circuit-to-canvas 0.0.56 → 0.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -1
- package/lib/drawer/elements/pcb-silkscreen-rect.ts +3 -1
- package/package.json +1 -1
- package/tests/elements/__snapshots__/pcb-silkscreen-on-component.snap.png +0 -0
- package/tests/elements/__snapshots__/pcb-silkscreen-rect.snap.png +0 -0
- package/tests/elements/pcb-silkscreen-rect.test.ts +6 -6
package/dist/index.js
CHANGED
|
@@ -1945,7 +1945,9 @@ function drawPcbSilkscreenRect(params) {
|
|
|
1945
1945
|
center: rect.center,
|
|
1946
1946
|
width: rect.width,
|
|
1947
1947
|
height: rect.height,
|
|
1948
|
-
fill: color,
|
|
1948
|
+
fill: rect.is_filled ? color : "transparent",
|
|
1949
|
+
stroke: color,
|
|
1950
|
+
strokeWidth: rect.stroke_width,
|
|
1949
1951
|
realToCanvasMat
|
|
1950
1952
|
});
|
|
1951
1953
|
}
|
|
@@ -28,7 +28,9 @@ export function drawPcbSilkscreenRect(
|
|
|
28
28
|
center: rect.center,
|
|
29
29
|
width: rect.width,
|
|
30
30
|
height: rect.height,
|
|
31
|
-
fill: color,
|
|
31
|
+
fill: rect.is_filled ? color : "transparent",
|
|
32
|
+
stroke: color,
|
|
33
|
+
strokeWidth: rect.stroke_width,
|
|
32
34
|
realToCanvasMat,
|
|
33
35
|
})
|
|
34
36
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -4,22 +4,22 @@ import type { PcbSilkscreenRect } from "circuit-json"
|
|
|
4
4
|
import { CircuitToCanvasDrawer } from "../../lib/drawer"
|
|
5
5
|
|
|
6
6
|
test("draw silkscreen rect", async () => {
|
|
7
|
-
const canvas = createCanvas(
|
|
7
|
+
const canvas = createCanvas(200, 200)
|
|
8
8
|
const ctx = canvas.getContext("2d")
|
|
9
9
|
const drawer = new CircuitToCanvasDrawer(ctx)
|
|
10
10
|
|
|
11
11
|
ctx.fillStyle = "#1a1a1a"
|
|
12
|
-
ctx.fillRect(0, 0,
|
|
12
|
+
ctx.fillRect(0, 0, 200, 200)
|
|
13
13
|
|
|
14
14
|
const rect: PcbSilkscreenRect = {
|
|
15
15
|
type: "pcb_silkscreen_rect",
|
|
16
16
|
pcb_silkscreen_rect_id: "rect1",
|
|
17
17
|
pcb_component_id: "component1",
|
|
18
18
|
layer: "top",
|
|
19
|
-
center: { x:
|
|
20
|
-
width:
|
|
21
|
-
height:
|
|
22
|
-
stroke_width: 0.
|
|
19
|
+
center: { x: 100, y: 100 },
|
|
20
|
+
width: 80,
|
|
21
|
+
height: 40,
|
|
22
|
+
stroke_width: 0.4,
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
drawer.drawElements([rect])
|