@@ -18,11 +18,17 @@ export class LEDElement extends LitElement {
1818 @property ( ) color = 'red' ;
1919 @property ( ) lightColor : string | null = null ;
2020 @property ( ) label = '' ;
21+ @property ( { type : Boolean } ) flip = false ;
2122
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+ }
2632
2733 static get styles ( ) {
2834 return css `
@@ -48,15 +54,18 @@ export class LEDElement extends LitElement {
4854 }
4955
5056 render ( ) {
51- const { color, lightColor } = this ;
57+ const { color, lightColor, flip } = this ;
5258 const lightColorActual = lightColor || lightColors [ color ] || '#ff8080' ;
5359 const opacity = this . brightness ? 0.3 + this . brightness * 0.7 : 0 ;
5460 const lightOn = this . value && this . brightness > Number . EPSILON ;
61+ const xScale = flip ? - 1 : 1 ;
62+
5563 return html `
5664 < div class ="led-container ">
5765 < svg
5866 width ="40 "
5967 height ="50 "
68+ transform ="scale(${ xScale } 1) "
6069 version ="1.2 "
6170 viewBox ="-10 -5 35.456 39.618 "
6271 xmlns ="http://www.w3.org/2000/svg "
0 commit comments