@@ -40,10 +40,10 @@ export class SevenSegmentElement extends LitElement {
40
40
const pinXY = ( n : number ) => {
41
41
const { startX, cols, bottomY } = this . pinPositions ;
42
42
const col = ( n - 1 ) % cols ;
43
- const row = Math . floor ( ( n - 1 ) / cols ) ;
43
+ const row = 1 - Math . floor ( ( n - 1 ) / cols ) ;
44
44
const xOffset = 1.27 ;
45
45
const mmToPix = 3.78 ;
46
- const x = startX + xOffset + col * 2.54 ;
46
+ const x = startX + xOffset + ( row ? col : cols - col - 1 ) * 2.54 ;
47
47
const y = this . pins === 'top' ? ( row ? bottomY + 1 : 1 ) : row ? bottomY + 2 : 0 ;
48
48
return { number : n , x : x * mmToPix , y : y * mmToPix } ;
49
49
} ;
@@ -173,27 +173,25 @@ export class SevenSegmentElement extends LitElement {
173
173
digitShapes . push ( this . renderDigit ( 3.5 + i * 12.7 , i * 8 ) ) ;
174
174
}
175
175
return html `
176
- < div style ="position:relative ">
177
- < svg
178
- width ="${ width } mm "
179
- height ="${ height } mm "
180
- version ="1.1 "
181
- viewBox ="0 0 ${ width } ${ height } "
182
- xmlns ="http://www.w3.org/2000/svg "
183
- >
184
- < defs >
185
- < pattern id ="pin-pattern " height ="2 " width ="2.54 " patternUnits ="userSpaceOnUse ">
186
- ${ pins === 'extend'
187
- ? svg `< rect x ="1.02 " y ="0 " height ="2 " width ="0.5 " fill ="#aaa " /> `
188
- : svg `< circle cx ="1.27 " cy ="1 " r =0.5 fill ="#aaa " /> ` }
189
- </ pattern >
190
- </ defs >
191
- < rect x ="0 " y ="${ yOffset } " width ="${ width } " height ="19 " />
192
- ${ digitShapes } <!-- -->
193
- ${ colon ? this . renderColon ( ) : null } <!-- -->
194
- ${ pins !== 'none' ? this . renderPins ( ) : null }
195
- </ svg >
196
- </ div >
176
+ < svg
177
+ width ="${ width } mm "
178
+ height ="${ height } mm "
179
+ version ="1.1 "
180
+ viewBox ="0 0 ${ width } ${ height } "
181
+ xmlns ="http://www.w3.org/2000/svg "
182
+ >
183
+ < defs >
184
+ < pattern id ="pin-pattern " height ="2 " width ="2.54 " patternUnits ="userSpaceOnUse ">
185
+ ${ pins === 'extend'
186
+ ? svg `< rect x ="1.02 " y ="0 " height ="2 " width ="0.5 " fill ="#aaa " /> `
187
+ : svg `< circle cx ="1.27 " cy ="1 " r =0.5 fill ="#aaa " /> ` }
188
+ </ pattern >
189
+ </ defs >
190
+ < rect x ="0 " y ="${ yOffset } " width ="${ width } " height ="19 " />
191
+ ${ digitShapes } <!-- -->
192
+ ${ colon ? this . renderColon ( ) : null } <!-- -->
193
+ ${ pins !== 'none' ? this . renderPins ( ) : null }
194
+ </ svg >
197
195
` ;
198
196
}
199
197
}
0 commit comments