Skip to content

Commit f73c8f8

Browse files
committed
fix: align pins position to grid
1 parent 6f5b7fe commit f73c8f8

File tree

5 files changed

+24
-32
lines changed

5 files changed

+24
-32
lines changed

src/7segment-element.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class SevenSegmentElement extends LitElement {
134134
const cols = Math.ceil(numPins / 2);
135135
return {
136136
startX: (12.55 * digits - cols * 2.54) / 2,
137-
bottomY: this.pins === 'extend' ? 21 : 17,
137+
bottomY: this.pins === 'extend' ? 21 : 18,
138138
cols,
139139
};
140140
}
@@ -191,7 +191,7 @@ export class SevenSegmentElement extends LitElement {
191191
render() {
192192
const { digits, colon, pins, yOffset } = this;
193193
const width = 12.55 * digits;
194-
const height = pins === 'extend' ? 23 : 19;
194+
const height = pins === 'extend' ? 23 : 22;
195195
const digitShapes = [];
196196
for (let i = 0; i < digits; i++) {
197197
digitShapes.push(this.renderDigit(3.5 + i * 12.7, i * 8));
@@ -211,7 +211,7 @@ export class SevenSegmentElement extends LitElement {
211211
: svg`<circle cx="1.27" cy="1" r=0.5 fill="#aaa" />`}
212212
</pattern>
213213
</defs>
214-
<rect x="0" y="${yOffset}" width="${width}" height="19" />
214+
<rect x="0" y="${yOffset}" width="${width}" height="20.5" />
215215
${digitShapes}<!-- -->
216216
${colon ? this.renderColon() : null}<!-- -->
217217
${pins !== 'none' ? this.renderPins() : null}

src/buzzer-element.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export class BuzzerElement extends LitElement {
1414
@property() hasSignal = false;
1515

1616
readonly pinInfo: ElementPin[] = [
17-
{ name: '1', x: 30, y: 82, signals: [] },
18-
{ name: '2', x: 34, y: 82, signals: [] },
17+
{ name: '1', x: 27, y: 84, signals: [] },
18+
{ name: '2', x: 37, y: 84, signals: [] },
1919
];
2020

2121
static get styles() {
@@ -90,8 +90,8 @@ export class BuzzerElement extends LitElement {
9090
viewBox="0 0 17 20"
9191
xmlns="http://www.w3.org/2000/svg"
9292
>
93-
<path d="m8 16.5v3.5" fill="none" stroke="#000" stroke-width=".5" />
94-
<path d="m9 16.5v3.5" fill="#f00" stroke="#f00" stroke-width=".5" />
93+
<path d="m7.23 16.5v3.5" fill="none" stroke="#000" stroke-width=".5" />
94+
<path d="m9.77 16.5v3.5" fill="#f00" stroke="#f00" stroke-width=".5" />
9595
<g stroke="#000">
9696
<g>
9797
<ellipse cx="8.5" cy="8.5" rx="8.15" ry="8.15" fill="#1a1a1a" stroke-width=".7" />

src/neopixel-element.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ export class NeoPixelElement extends LitElement {
99
@property() b = 0;
1010

1111
readonly pinInfo: ElementPin[] = [
12-
{ name: 'VDD', y: 3.5, x: 0, number: 1, signals: [VCC()] },
13-
{ name: 'DOUT', y: 15.5, x: 0, number: 2, signals: [] },
14-
{ name: 'VSS', y: 15.5, x: 22, number: 3, signals: [{ type: 'power', signal: 'GND' }] },
15-
{ name: 'DIN', y: 3.5, x: 22, number: 4, signals: [GND()] },
12+
{ name: 'VDD', y: 3.5, x: 1, number: 1, signals: [VCC()] },
13+
{ name: 'DOUT', y: 14, x: 1, number: 2, signals: [] },
14+
{ name: 'VSS', y: 14, x: 21, number: 3, signals: [{ type: 'power', signal: 'GND' }] },
15+
{ name: 'DIN', y: 3.5, x: 21, number: 4, signals: [GND()] },
1616
];
1717

1818
render() {
@@ -49,10 +49,10 @@ export class NeoPixelElement extends LitElement {
4949
<feGaussianBlur stdDeviation="0.5" />
5050
</filter>
5151
<rect x=".33308" y="0" width="5" height="5" fill="${background}" />
52-
<rect x=".016709" y=".4279" width=".35114" height=".9" fill="#eaeaea" />
53-
<rect x="0" y="3.6518" width=".35114" height=".9" fill="#eaeaea" />
54-
<rect x="5.312" y="3.6351" width=".35114" height=".9" fill="#eaeaea" />
55-
<rect x="5.312" y=".3945" width=".35114" height=".9" fill="#eaeaea" />
52+
<rect x="0" y=".5" width=".35" height=".9" fill="#c3c2c3" />
53+
<rect x="0" y="3.1" width=".35" height=".9" fill="#c3c2c3" />
54+
<rect x="5.3" y="3.1" width=".35" height=".9" fill="#c3c2c3" />
55+
<rect x="5.3" y=".5" width=".35" height=".9" fill="#c3c2c3" />
5656
<circle cx="2.8331" cy="2.5" r="2.1" fill="#ddd" />
5757
<circle cx="2.8331" cy="2.5" r="1.7325" fill="#e6e6e6" />
5858
<g fill="#bfbfbf">

src/potentiometer-element.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export class PotentiometerElement extends LitElement {
2626

2727
readonly pinInfo: ElementPin[] = [
2828
{ name: 'GND', x: 29, y: 68.5, number: 1, signals: [{ type: 'power', signal: 'GND' }] },
29-
{ name: 'SIG', x: 37, y: 68.5, number: 2, signals: [analog(0)] },
30-
{ name: 'VCC', x: 44.75, y: 68.5, number: 3, signals: [{ type: 'power', signal: 'VCC' }] },
29+
{ name: 'SIG', x: 39, y: 68.5, number: 2, signals: [analog(0)] },
30+
{ name: 'VCC', x: 49, y: 68.5, number: 3, signals: [{ type: 'power', signal: 'VCC' }] },
3131
];
3232

3333
static get styles() {
@@ -126,19 +126,11 @@ export class PotentiometerElement extends LitElement {
126126
fill="#e4e8eb"
127127
stroke-width=".15"
128128
/>
129-
<rect
130-
x="6.6"
131-
y="17"
132-
width="6.5"
133-
height="2"
134-
fill-opacity="0"
135-
stroke="#fff"
136-
stroke-width=".30"
137-
/>
129+
<rect x="6" y="17" width="8" height="2" fill-opacity="0" stroke="#fff" stroke-width=".30" />
138130
<g stroke-width=".15">
139131
<text x="6.21" y="16.6">GND</text>
140-
<text x="8.75" y="16.63">SIG</text>
141-
<text x="11.25" y="16.59">VCC</text>
132+
<text x="9.2" y="16.63">SIG</text>
133+
<text x="11.5" y="16.59">VCC</text>
142134
</g>
143135
<g fill="#fff" stroke-width=".15">
144136
<ellipse cx="1.68" cy="1.81" rx=".99" ry=".96" />
@@ -148,8 +140,8 @@ export class PotentiometerElement extends LitElement {
148140
</g>
149141
<g fill="#b3b1b0" stroke-width=".15">
150142
<ellipse cx="7.68" cy="18" rx=".61" ry=".63" />
151-
<ellipse cx="9.75" cy="18" rx=".61" ry=".63" />
152-
<ellipse cx="11.87" cy="18" rx=".61" ry=".63" />
143+
<ellipse cx="10.22" cy="18" rx=".61" ry=".63" />
144+
<ellipse cx="12.76" cy="18" rx=".61" ry=".63" />
153145
</g>
154146
<ellipse cx="9.95" cy="8.06" rx="6.60" ry="6.58" fill="#c3c2c3" stroke-width=".15" />
155147
<rect id="rotating" x="10" y="2" width=".42" height="3.1" stroke-width=".15" />

src/slide-potentiometer-element.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class SlidePotentiometerElement extends LitElement {
1616
get pinInfo(): ElementPin[] {
1717
return [
1818
{ name: 'VCC', x: 1, y: 43, number: 1, signals: [{ type: 'power', signal: 'VCC' }] },
19-
{ name: 'SIG', x: 1, y: 66.5, number: 2, signals: [analog(0)] },
19+
{ name: 'SIG', x: 1, y: 63, number: 2, signals: [analog(0)] },
2020
{
2121
name: 'GND',
2222
x: 93.6 + this.travelLength * mmToPix,
@@ -121,7 +121,7 @@ export class SlidePotentiometerElement extends LitElement {
121121
<g fill="#ccc">
122122
<rect x="0" y="11" width="5" height="0.75" />
123123
<rect x="${travelLength + 20}" y="11" width="5" height="0.75" />
124-
<rect x="0" y="17.25" width="5" height="0.75" />
124+
<rect x="0" y="16.25" width="5" height="0.75" />
125125
</g>
126126
<g transform="translate(5 5)">
127127
<!-- Body -->

0 commit comments

Comments
 (0)