circuit-to-canvas 0.0.60 → 0.0.61

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
@@ -1108,9 +1108,6 @@ function getRotation(hole) {
1108
1108
  }
1109
1109
  function drawPcbHole(params) {
1110
1110
  const { ctx, hole, realToCanvasMat, colorMap, soldermaskMargin = 0 } = params;
1111
- if (hole.is_covered_with_solder_mask === true) {
1112
- return;
1113
- }
1114
1111
  const holeInset = soldermaskMargin < 0 ? Math.abs(soldermaskMargin) : 0;
1115
1112
  if (hole.hole_shape === "circle") {
1116
1113
  drawCircle({
@@ -3435,6 +3432,18 @@ var CircuitToCanvasDrawer = class {
3435
3432
  }
3436
3433
  }
3437
3434
  const drawSoldermask = options.drawSoldermask ?? false;
3435
+ for (const element of elements) {
3436
+ if (!shouldDrawElement(element, options)) continue;
3437
+ if (element.type === "pcb_hole") {
3438
+ drawPcbHole({
3439
+ ctx: this.ctx,
3440
+ hole: element,
3441
+ realToCanvasMat: this.realToCanvasMat,
3442
+ colorMap: this.colorMap,
3443
+ soldermaskMargin: drawSoldermask ? element.soldermask_margin : void 0
3444
+ });
3445
+ }
3446
+ }
3438
3447
  if (board) {
3439
3448
  drawPcbSoldermask({
3440
3449
  ctx: this.ctx,
@@ -3547,15 +3556,6 @@ var CircuitToCanvasDrawer = class {
3547
3556
  }
3548
3557
  for (const element of elements) {
3549
3558
  if (!shouldDrawElement(element, options)) continue;
3550
- if (element.type === "pcb_hole") {
3551
- drawPcbHole({
3552
- ctx: this.ctx,
3553
- hole: element,
3554
- realToCanvasMat: this.realToCanvasMat,
3555
- colorMap: this.colorMap,
3556
- soldermaskMargin: drawSoldermask ? element.soldermask_margin : void 0
3557
- });
3558
- }
3559
3559
  if (element.type === "pcb_cutout") {
3560
3560
  drawPcbCutout({
3561
3561
  ctx: this.ctx,
@@ -179,12 +179,13 @@ export class CircuitToCanvasDrawer {
179
179
  // 1. Panel outline (outer boundary)
180
180
  // 2. Board outline (inner board)
181
181
  // 3. Copper elements underneath soldermask (pads, copper text)
182
- // 3. Soldermask (covers everything except openings)
183
- // 4. Silkscreen (on soldermask, under top copper layers)
184
- // 5. Copper pour and traces (drawn on top of soldermask and silkscreen)
185
- // 6. Plated holes, vias (copper ring + drill hole on top of soldermask)
186
- // 7. Holes and cutouts (punch through everything)
187
- // 8. Other annotations
182
+ // 4. Holes (under soldermask so mask can cover them)
183
+ // 5. Soldermask (covers everything except openings)
184
+ // 6. Silkscreen (on soldermask, under top copper layers)
185
+ // 7. Copper pour and traces (drawn on top of soldermask and silkscreen)
186
+ // 8. Plated holes, vias (copper ring + drill hole on top of soldermask)
187
+ // 9. Cutouts (punch through everything)
188
+ // 10. Other annotations
188
189
 
189
190
  // Step 1: Draw panel outline (outer boundary)
190
191
  if (panel) {
@@ -231,8 +232,26 @@ export class CircuitToCanvasDrawer {
231
232
  }
232
233
  }
233
234
 
234
- // Step 3: Draw soldermask layer (only if showSoldermask is true)
235
235
  const drawSoldermask = options.drawSoldermask ?? false
236
+
237
+ // Step 3: Draw holes under soldermask
238
+ for (const element of elements) {
239
+ if (!shouldDrawElement(element, options)) continue
240
+
241
+ if (element.type === "pcb_hole") {
242
+ drawPcbHole({
243
+ ctx: this.ctx,
244
+ hole: element as PcbHole,
245
+ realToCanvasMat: this.realToCanvasMat,
246
+ colorMap: this.colorMap,
247
+ soldermaskMargin: drawSoldermask
248
+ ? element.soldermask_margin
249
+ : undefined,
250
+ })
251
+ }
252
+ }
253
+
254
+ // Step 4: Draw soldermask layer (only if showSoldermask is true)
236
255
  if (board) {
237
256
  drawPcbSoldermask({
238
257
  ctx: this.ctx,
@@ -245,7 +264,7 @@ export class CircuitToCanvasDrawer {
245
264
  })
246
265
  }
247
266
 
248
- // Step 4: Draw silkscreen (on soldermask, under top copper layers)
267
+ // Step 5: Draw silkscreen (on soldermask, under top copper layers)
249
268
  for (const element of elements) {
250
269
  if (!shouldDrawElement(element, options)) continue
251
270
 
@@ -313,7 +332,7 @@ export class CircuitToCanvasDrawer {
313
332
  }
314
333
  }
315
334
 
316
- // Step 5: Draw copper pour and traces (on top of soldermask and silkscreen)
335
+ // Step 6: Draw copper pour and traces (on top of soldermask and silkscreen)
317
336
  for (const element of elements) {
318
337
  if (!shouldDrawElement(element, options)) continue
319
338
 
@@ -336,7 +355,7 @@ export class CircuitToCanvasDrawer {
336
355
  }
337
356
  }
338
357
 
339
- // Step 6: Draw plated holes, vias (copper ring + drill hole on top of soldermask)
358
+ // Step 7: Draw plated holes, vias (copper ring + drill hole on top of soldermask)
340
359
  for (const element of elements) {
341
360
  if (!shouldDrawElement(element, options)) continue
342
361
 
@@ -363,22 +382,10 @@ export class CircuitToCanvasDrawer {
363
382
  }
364
383
  }
365
384
 
366
- // Step 7: Draw holes and cutouts (these punch through everything)
385
+ // Step 8: Draw cutouts (these punch through everything)
367
386
  for (const element of elements) {
368
387
  if (!shouldDrawElement(element, options)) continue
369
388
 
370
- if (element.type === "pcb_hole") {
371
- drawPcbHole({
372
- ctx: this.ctx,
373
- hole: element as PcbHole,
374
- realToCanvasMat: this.realToCanvasMat,
375
- colorMap: this.colorMap,
376
- soldermaskMargin: drawSoldermask
377
- ? element.soldermask_margin
378
- : undefined,
379
- })
380
- }
381
-
382
389
  if (element.type === "pcb_cutout") {
383
390
  drawPcbCutout({
384
391
  ctx: this.ctx,
@@ -25,11 +25,6 @@ function getRotation(hole: PcbHole): number {
25
25
  export function drawPcbHole(params: DrawPcbHoleParams): void {
26
26
  const { ctx, hole, realToCanvasMat, colorMap, soldermaskMargin = 0 } = params
27
27
 
28
- // Skip drawing if the hole is fully covered with soldermask
29
- if (hole.is_covered_with_solder_mask === true) {
30
- return
31
- }
32
-
33
28
  // For negative margins, draw smaller hole (inset by margin amount)
34
29
  const holeInset = soldermaskMargin < 0 ? Math.abs(soldermaskMargin) : 0
35
30
 
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.60",
4
+ "version": "0.0.61",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup-node ./lib/index.ts --format esm --dts",