@@ -2,16 +2,24 @@ import { css, html, LitElement } from 'lit';
22import { customElement } from 'lit/decorators.js' ;
33import { classMap } from 'lit/directives/class-map.js' ;
44import { styleMap } from 'lit/directives/style-map.js' ;
5+ import { ElementPin , GND } from './pin' ;
56
67type InitialValue = '' ;
78type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ;
89
910@customElement ( 'wokwi-rotary-dialer' )
1011export class RotaryDialerElement extends LitElement {
12+ readonly pinInfo : ElementPin [ ] = [
13+ { name : 'GND' , x : 122 , y : 286 , signals : [ GND ( ) ] } ,
14+ { name : 'DIAL' , x : 131.6 , y : 286 , signals : [ ] } ,
15+ { name : 'PULSE' , x : 141.2 , y : 286 , signals : [ ] } ,
16+ ] ;
17+
1118 private digit : Digit | InitialValue = '' ;
1219 private stylesMapping = { } ;
1320 private classes : Record < string , boolean > = { 'rotate-path' : true } ;
1421 private degrees = [ 320 , 56 , 87 , 115 , 143 , 173 , 204 , 232 , 260 , 290 ] ;
22+
1523 static get styles ( ) {
1624 return css `
1725 .text {
@@ -30,7 +38,7 @@ export class RotaryDialerElement extends LitElement {
3038 margin: -1px;
3139 }
3240 .rotate-path {
33- transform-origin: center ;
41+ transform-origin: 133px 133px ;
3442 transition: transform 1000ms ease-in;
3543 }
3644 .dialer-anim {
@@ -87,7 +95,19 @@ export class RotaryDialerElement extends LitElement {
8795 value ="${ this . digit } "
8896 @input ="${ this . onValueChange } "
8997 />
90- < svg width ="266 " height ="266 " @click ="${ this . focusInput } " xmlns ="http://www.w3.org/2000/svg ">
98+ < svg width ="266 " height ="286 " @click ="${ this . focusInput } " xmlns ="http://www.w3.org/2000/svg ">
99+ <!-- Pins -->
100+ < g fill ="#9f9f9f " stroke-width =".987 ">
101+ < path
102+ d ="m123.4 266c0-0.377-0.149-0.739-0.416-1.01-0.268-0.267-0.629-0.417-1.01-0.417-0.377 0-0.739 0.15-1.01 0.417s-0.417 0.629-0.417 1.01v25.8c0 0.231 0.188 0.419 0.418 0.419h2.01c0.231 0 0.418-0.188 0.418-0.419v-25.8z "
103+ />
104+ < path
105+ d ="m133 266c0-0.377-0.149-0.739-0.416-1.01-0.268-0.267-0.629-0.417-1.01-0.417-0.377 0-0.739 0.15-1.01 0.417s-0.417 0.629-0.417 1.01v25.8c0 0.231 0.188 0.419 0.418 0.419h2.01c0.231 0 0.418-0.188 0.418-0.419v-25.8z "
106+ />
107+ < path
108+ d ="m142.6 266c0-0.377-0.15-0.739-0.417-1.01s-0.629-0.417-1.01-0.417c-0.377 0-0.739 0.15-1.01 0.417s-0.417 0.629-0.417 1.01v25.8c0 0.231 0.188 0.419 0.419 0.419h2.01c0.231 0 0.419-0.188 0.419-0.419v-25.8z "
109+ />
110+ </ g >
91111 < g transform ="translate(1 1) ">
92112 < circle stroke ="#979797 " stroke-width ="3 " fill ="#1F1F1F " cx ="133 " cy ="133 " r ="131 " />
93113 < circle stroke ="#fff " stroke-width ="2 " fill ="#D8D8D8 " cx ="133 " cy ="133 " r ="72 " />
0 commit comments