@@ -18,11 +18,17 @@ export class LEDElement extends LitElement {
18
18
@property ( ) color = 'red' ;
19
19
@property ( ) lightColor : string | null = null ;
20
20
@property ( ) label = '' ;
21
+ @property ( { type : Boolean } ) flip = false ;
21
22
22
- readonly pinInfo : ElementPin [ ] = [
23
- { name : 'A' , x : 24 , y : 42 , signals : [ ] , description : 'Anode' } ,
24
- { name : 'C' , x : 16 , y : 42 , signals : [ ] , description : 'Cathode' } ,
25
- ] ;
23
+ get pinInfo ( ) : ElementPin [ ] {
24
+ const anodeX = this . flip ? 16 : 24 ;
25
+ const cathodeX = this . flip ? 24 : 16 ;
26
+
27
+ return [
28
+ { name : 'A' , x : anodeX , y : 42 , signals : [ ] , description : 'Anode' } ,
29
+ { name : 'C' , x : cathodeX , y : 42 , signals : [ ] , description : 'Cathode' } ,
30
+ ] ;
31
+ }
26
32
27
33
static get styles ( ) {
28
34
return css `
@@ -48,15 +54,18 @@ export class LEDElement extends LitElement {
48
54
}
49
55
50
56
render ( ) {
51
- const { color, lightColor } = this ;
57
+ const { color, lightColor, flip } = this ;
52
58
const lightColorActual = lightColor || lightColors [ color ] || '#ff8080' ;
53
59
const opacity = this . brightness ? 0.3 + this . brightness * 0.7 : 0 ;
54
60
const lightOn = this . value && this . brightness > Number . EPSILON ;
61
+ const xScale = flip ? - 1 : 1 ;
62
+
55
63
return html `
56
64
< div class ="led-container ">
57
65
< svg
58
66
width ="40 "
59
67
height ="50 "
68
+ transform ="scale(${ xScale } 1) "
60
69
version ="1.2 "
61
70
viewBox ="-10 -5 35.456 39.618 "
62
71
xmlns ="http://www.w3.org/2000/svg "
0 commit comments