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 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "circuit-to-canvas",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.56",
4
+ "version": "0.0.57",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup-node ./lib/index.ts --format esm --dts",
@@ -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(100, 100)
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, 100, 100)
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: 50, y: 50 },
20
- width: 40,
21
- height: 20,
22
- stroke_width: 0.2,
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])