@@ -2,16 +2,24 @@ import { css, html, LitElement } from 'lit';
2
2
import { customElement } from 'lit/decorators.js' ;
3
3
import { classMap } from 'lit/directives/class-map.js' ;
4
4
import { styleMap } from 'lit/directives/style-map.js' ;
5
+ import { ElementPin , GND } from './pin' ;
5
6
6
7
type InitialValue = '' ;
7
8
type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ;
8
9
9
10
@customElement ( 'wokwi-rotary-dialer' )
10
11
export 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
+
11
18
private digit : Digit | InitialValue = '' ;
12
19
private stylesMapping = { } ;
13
20
private classes : Record < string , boolean > = { 'rotate-path' : true } ;
14
21
private degrees = [ 320 , 56 , 87 , 115 , 143 , 173 , 204 , 232 , 260 , 290 ] ;
22
+
15
23
static get styles ( ) {
16
24
return css `
17
25
.text {
@@ -30,7 +38,7 @@ export class RotaryDialerElement extends LitElement {
30
38
margin: -1px;
31
39
}
32
40
.rotate-path {
33
- transform-origin: center ;
41
+ transform-origin: 133px 133px ;
34
42
transition: transform 1000ms ease-in;
35
43
}
36
44
.dialer-anim {
@@ -87,7 +95,19 @@ export class RotaryDialerElement extends LitElement {
87
95
value ="${ this . digit } "
88
96
@input ="${ this . onValueChange } "
89
97
/>
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 >
91
111
< g transform ="translate(1 1) ">
92
112
< circle stroke ="#979797 " stroke-width ="3 " fill ="#1F1F1F " cx ="133 " cy ="133 " r ="131 " />
93
113
< circle stroke ="#fff " stroke-width ="2 " fill ="#D8D8D8 " cx ="133 " cy ="133 " r ="72 " />
0 commit comments