circuit-to-canvas 0.0.14 → 0.0.16
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/.github/workflows/bun-test.yml +8 -0
- package/dist/index.d.ts +29 -29
- package/dist/index.js +157 -138
- package/lib/drawer/CircuitToCanvasDrawer.ts +21 -21
- package/lib/drawer/elements/pcb-board.ts +5 -5
- package/lib/drawer/elements/pcb-copper-pour.ts +13 -10
- package/lib/drawer/elements/pcb-copper-text.ts +4 -4
- package/lib/drawer/elements/pcb-cutout.ts +5 -5
- package/lib/drawer/elements/pcb-fabrication-note-path.ts +3 -3
- package/lib/drawer/elements/pcb-fabrication-note-rect.ts +3 -3
- package/lib/drawer/elements/pcb-fabrication-note-text.ts +4 -4
- package/lib/drawer/elements/pcb-hole.ts +8 -8
- package/lib/drawer/elements/pcb-note-line.ts +5 -5
- package/lib/drawer/elements/pcb-note-path.ts +3 -3
- package/lib/drawer/elements/pcb-note-rect.ts +3 -3
- package/lib/drawer/elements/pcb-note-text.ts +4 -4
- package/lib/drawer/elements/pcb-plated-hole.ts +14 -14
- package/lib/drawer/elements/pcb-silkscreen.ts +16 -16
- package/lib/drawer/elements/pcb-smtpad.ts +8 -8
- package/lib/drawer/elements/pcb-trace.ts +3 -3
- package/lib/drawer/elements/pcb-via.ts +4 -4
- package/lib/drawer/shapes/circle.ts +4 -4
- package/lib/drawer/shapes/line.ts +5 -5
- package/lib/drawer/shapes/oval.ts +13 -5
- package/lib/drawer/shapes/path.ts +8 -8
- package/lib/drawer/shapes/pill.ts +13 -5
- package/lib/drawer/shapes/polygon.ts +7 -7
- package/lib/drawer/shapes/rect.ts +7 -7
- package/lib/drawer/shapes/text.ts +5 -5
- package/lib/drawer/types.ts +1 -1
- package/package.json +1 -1
- package/tests/shapes/circle.test.ts +1 -1
- package/tests/shapes/oval.test.ts +1 -1
- package/tests/shapes/pill.test.ts +2 -2
- package/tests/shapes/rect.test.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -38,9 +38,9 @@ var DEFAULT_PCB_COLOR_MAP = {
|
|
|
38
38
|
// lib/drawer/shapes/circle.ts
|
|
39
39
|
import { applyToPoint } from "transformation-matrix";
|
|
40
40
|
function drawCircle(params) {
|
|
41
|
-
const { ctx, center, radius, fill,
|
|
42
|
-
const [cx, cy] = applyToPoint(
|
|
43
|
-
const scaledRadius = radius * Math.abs(
|
|
41
|
+
const { ctx, center, radius, fill, realToCanvasMat } = params;
|
|
42
|
+
const [cx, cy] = applyToPoint(realToCanvasMat, [center.x, center.y]);
|
|
43
|
+
const scaledRadius = radius * Math.abs(realToCanvasMat.a);
|
|
44
44
|
ctx.beginPath();
|
|
45
45
|
ctx.arc(cx, cy, scaledRadius, 0, Math.PI * 2);
|
|
46
46
|
ctx.fillStyle = fill;
|
|
@@ -56,18 +56,18 @@ function drawRect(params) {
|
|
|
56
56
|
width,
|
|
57
57
|
height,
|
|
58
58
|
fill,
|
|
59
|
-
|
|
59
|
+
realToCanvasMat,
|
|
60
60
|
borderRadius = 0,
|
|
61
61
|
rotation = 0,
|
|
62
62
|
stroke,
|
|
63
63
|
strokeWidth,
|
|
64
64
|
isStrokeDashed = false
|
|
65
65
|
} = params;
|
|
66
|
-
const [cx, cy] = applyToPoint2(
|
|
67
|
-
const scaledWidth = width * Math.abs(
|
|
68
|
-
const scaledHeight = height * Math.abs(
|
|
69
|
-
const scaledRadius = borderRadius * Math.abs(
|
|
70
|
-
const scaledStrokeWidth = strokeWidth ? strokeWidth * Math.abs(
|
|
66
|
+
const [cx, cy] = applyToPoint2(realToCanvasMat, [center.x, center.y]);
|
|
67
|
+
const scaledWidth = width * Math.abs(realToCanvasMat.a);
|
|
68
|
+
const scaledHeight = height * Math.abs(realToCanvasMat.a);
|
|
69
|
+
const scaledRadius = borderRadius * Math.abs(realToCanvasMat.a);
|
|
70
|
+
const scaledStrokeWidth = strokeWidth ? strokeWidth * Math.abs(realToCanvasMat.a) : void 0;
|
|
71
71
|
ctx.save();
|
|
72
72
|
ctx.translate(cx, cy);
|
|
73
73
|
if (rotation !== 0) {
|
|
@@ -116,10 +116,18 @@ function drawRect(params) {
|
|
|
116
116
|
// lib/drawer/shapes/oval.ts
|
|
117
117
|
import { applyToPoint as applyToPoint3 } from "transformation-matrix";
|
|
118
118
|
function drawOval(params) {
|
|
119
|
-
const {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
const {
|
|
120
|
+
ctx,
|
|
121
|
+
center,
|
|
122
|
+
width,
|
|
123
|
+
height,
|
|
124
|
+
fill,
|
|
125
|
+
realToCanvasMat,
|
|
126
|
+
rotation = 0
|
|
127
|
+
} = params;
|
|
128
|
+
const [cx, cy] = applyToPoint3(realToCanvasMat, [center.x, center.y]);
|
|
129
|
+
const scaledWidth = width * Math.abs(realToCanvasMat.a);
|
|
130
|
+
const scaledHeight = height * Math.abs(realToCanvasMat.a);
|
|
123
131
|
ctx.save();
|
|
124
132
|
ctx.translate(cx, cy);
|
|
125
133
|
if (rotation !== 0) {
|
|
@@ -135,10 +143,18 @@ function drawOval(params) {
|
|
|
135
143
|
// lib/drawer/shapes/pill.ts
|
|
136
144
|
import { applyToPoint as applyToPoint4 } from "transformation-matrix";
|
|
137
145
|
function drawPill(params) {
|
|
138
|
-
const {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
const {
|
|
147
|
+
ctx,
|
|
148
|
+
center,
|
|
149
|
+
width,
|
|
150
|
+
height,
|
|
151
|
+
fill,
|
|
152
|
+
realToCanvasMat,
|
|
153
|
+
rotation = 0
|
|
154
|
+
} = params;
|
|
155
|
+
const [cx, cy] = applyToPoint4(realToCanvasMat, [center.x, center.y]);
|
|
156
|
+
const scaledWidth = width * Math.abs(realToCanvasMat.a);
|
|
157
|
+
const scaledHeight = height * Math.abs(realToCanvasMat.a);
|
|
142
158
|
ctx.save();
|
|
143
159
|
ctx.translate(cx, cy);
|
|
144
160
|
if (rotation !== 0) {
|
|
@@ -172,21 +188,21 @@ function drawPill(params) {
|
|
|
172
188
|
|
|
173
189
|
// lib/drawer/elements/pcb-plated-hole.ts
|
|
174
190
|
function drawPcbPlatedHole(params) {
|
|
175
|
-
const { ctx, hole,
|
|
191
|
+
const { ctx, hole, realToCanvasMat, colorMap } = params;
|
|
176
192
|
if (hole.shape === "circle") {
|
|
177
193
|
drawCircle({
|
|
178
194
|
ctx,
|
|
179
195
|
center: { x: hole.x, y: hole.y },
|
|
180
196
|
radius: hole.outer_diameter / 2,
|
|
181
197
|
fill: colorMap.copper.top,
|
|
182
|
-
|
|
198
|
+
realToCanvasMat
|
|
183
199
|
});
|
|
184
200
|
drawCircle({
|
|
185
201
|
ctx,
|
|
186
202
|
center: { x: hole.x, y: hole.y },
|
|
187
203
|
radius: hole.hole_diameter / 2,
|
|
188
204
|
fill: colorMap.drill,
|
|
189
|
-
|
|
205
|
+
realToCanvasMat
|
|
190
206
|
});
|
|
191
207
|
return;
|
|
192
208
|
}
|
|
@@ -197,7 +213,7 @@ function drawPcbPlatedHole(params) {
|
|
|
197
213
|
width: hole.outer_width,
|
|
198
214
|
height: hole.outer_height,
|
|
199
215
|
fill: colorMap.copper.top,
|
|
200
|
-
|
|
216
|
+
realToCanvasMat,
|
|
201
217
|
rotation: hole.ccw_rotation
|
|
202
218
|
});
|
|
203
219
|
drawOval({
|
|
@@ -206,7 +222,7 @@ function drawPcbPlatedHole(params) {
|
|
|
206
222
|
width: hole.hole_width,
|
|
207
223
|
height: hole.hole_height,
|
|
208
224
|
fill: colorMap.drill,
|
|
209
|
-
|
|
225
|
+
realToCanvasMat,
|
|
210
226
|
rotation: hole.ccw_rotation
|
|
211
227
|
});
|
|
212
228
|
return;
|
|
@@ -218,7 +234,7 @@ function drawPcbPlatedHole(params) {
|
|
|
218
234
|
width: hole.outer_width,
|
|
219
235
|
height: hole.outer_height,
|
|
220
236
|
fill: colorMap.copper.top,
|
|
221
|
-
|
|
237
|
+
realToCanvasMat,
|
|
222
238
|
rotation: hole.ccw_rotation
|
|
223
239
|
});
|
|
224
240
|
drawPill({
|
|
@@ -227,7 +243,7 @@ function drawPcbPlatedHole(params) {
|
|
|
227
243
|
width: hole.hole_width,
|
|
228
244
|
height: hole.hole_height,
|
|
229
245
|
fill: colorMap.drill,
|
|
230
|
-
|
|
246
|
+
realToCanvasMat,
|
|
231
247
|
rotation: hole.ccw_rotation
|
|
232
248
|
});
|
|
233
249
|
return;
|
|
@@ -239,7 +255,7 @@ function drawPcbPlatedHole(params) {
|
|
|
239
255
|
width: hole.rect_pad_width,
|
|
240
256
|
height: hole.rect_pad_height,
|
|
241
257
|
fill: colorMap.copper.top,
|
|
242
|
-
|
|
258
|
+
realToCanvasMat,
|
|
243
259
|
borderRadius: hole.rect_border_radius ?? 0
|
|
244
260
|
});
|
|
245
261
|
const holeX = hole.x + (hole.hole_offset_x ?? 0);
|
|
@@ -249,7 +265,7 @@ function drawPcbPlatedHole(params) {
|
|
|
249
265
|
center: { x: holeX, y: holeY },
|
|
250
266
|
radius: hole.hole_diameter / 2,
|
|
251
267
|
fill: colorMap.drill,
|
|
252
|
-
|
|
268
|
+
realToCanvasMat
|
|
253
269
|
});
|
|
254
270
|
return;
|
|
255
271
|
}
|
|
@@ -260,7 +276,7 @@ function drawPcbPlatedHole(params) {
|
|
|
260
276
|
width: hole.rect_pad_width,
|
|
261
277
|
height: hole.rect_pad_height,
|
|
262
278
|
fill: colorMap.copper.top,
|
|
263
|
-
|
|
279
|
+
realToCanvasMat,
|
|
264
280
|
borderRadius: hole.rect_border_radius ?? 0
|
|
265
281
|
});
|
|
266
282
|
const holeX = hole.x + (hole.hole_offset_x ?? 0);
|
|
@@ -271,7 +287,7 @@ function drawPcbPlatedHole(params) {
|
|
|
271
287
|
width: hole.hole_width,
|
|
272
288
|
height: hole.hole_height,
|
|
273
289
|
fill: colorMap.drill,
|
|
274
|
-
|
|
290
|
+
realToCanvasMat
|
|
275
291
|
});
|
|
276
292
|
return;
|
|
277
293
|
}
|
|
@@ -282,7 +298,7 @@ function drawPcbPlatedHole(params) {
|
|
|
282
298
|
width: hole.rect_pad_width,
|
|
283
299
|
height: hole.rect_pad_height,
|
|
284
300
|
fill: colorMap.copper.top,
|
|
285
|
-
|
|
301
|
+
realToCanvasMat,
|
|
286
302
|
borderRadius: hole.rect_border_radius ?? 0,
|
|
287
303
|
rotation: hole.rect_ccw_rotation
|
|
288
304
|
});
|
|
@@ -294,7 +310,7 @@ function drawPcbPlatedHole(params) {
|
|
|
294
310
|
width: hole.hole_width,
|
|
295
311
|
height: hole.hole_height,
|
|
296
312
|
fill: colorMap.drill,
|
|
297
|
-
|
|
313
|
+
realToCanvasMat,
|
|
298
314
|
rotation: hole.hole_ccw_rotation
|
|
299
315
|
});
|
|
300
316
|
return;
|
|
@@ -303,33 +319,33 @@ function drawPcbPlatedHole(params) {
|
|
|
303
319
|
|
|
304
320
|
// lib/drawer/elements/pcb-via.ts
|
|
305
321
|
function drawPcbVia(params) {
|
|
306
|
-
const { ctx, via,
|
|
322
|
+
const { ctx, via, realToCanvasMat, colorMap } = params;
|
|
307
323
|
drawCircle({
|
|
308
324
|
ctx,
|
|
309
325
|
center: { x: via.x, y: via.y },
|
|
310
326
|
radius: via.outer_diameter / 2,
|
|
311
327
|
fill: colorMap.copper.top,
|
|
312
|
-
|
|
328
|
+
realToCanvasMat
|
|
313
329
|
});
|
|
314
330
|
drawCircle({
|
|
315
331
|
ctx,
|
|
316
332
|
center: { x: via.x, y: via.y },
|
|
317
333
|
radius: via.hole_diameter / 2,
|
|
318
334
|
fill: colorMap.drill,
|
|
319
|
-
|
|
335
|
+
realToCanvasMat
|
|
320
336
|
});
|
|
321
337
|
}
|
|
322
338
|
|
|
323
339
|
// lib/drawer/elements/pcb-hole.ts
|
|
324
340
|
function drawPcbHole(params) {
|
|
325
|
-
const { ctx, hole,
|
|
341
|
+
const { ctx, hole, realToCanvasMat, colorMap } = params;
|
|
326
342
|
if (hole.hole_shape === "circle") {
|
|
327
343
|
drawCircle({
|
|
328
344
|
ctx,
|
|
329
345
|
center: { x: hole.x, y: hole.y },
|
|
330
346
|
radius: hole.hole_diameter / 2,
|
|
331
347
|
fill: colorMap.drill,
|
|
332
|
-
|
|
348
|
+
realToCanvasMat
|
|
333
349
|
});
|
|
334
350
|
return;
|
|
335
351
|
}
|
|
@@ -340,7 +356,7 @@ function drawPcbHole(params) {
|
|
|
340
356
|
width: hole.hole_diameter,
|
|
341
357
|
height: hole.hole_diameter,
|
|
342
358
|
fill: colorMap.drill,
|
|
343
|
-
|
|
359
|
+
realToCanvasMat
|
|
344
360
|
});
|
|
345
361
|
return;
|
|
346
362
|
}
|
|
@@ -351,7 +367,7 @@ function drawPcbHole(params) {
|
|
|
351
367
|
width: hole.hole_width,
|
|
352
368
|
height: hole.hole_height,
|
|
353
369
|
fill: colorMap.drill,
|
|
354
|
-
|
|
370
|
+
realToCanvasMat
|
|
355
371
|
});
|
|
356
372
|
return;
|
|
357
373
|
}
|
|
@@ -362,7 +378,7 @@ function drawPcbHole(params) {
|
|
|
362
378
|
width: hole.hole_width,
|
|
363
379
|
height: hole.hole_height,
|
|
364
380
|
fill: colorMap.drill,
|
|
365
|
-
|
|
381
|
+
realToCanvasMat
|
|
366
382
|
});
|
|
367
383
|
return;
|
|
368
384
|
}
|
|
@@ -373,7 +389,7 @@ function drawPcbHole(params) {
|
|
|
373
389
|
width: hole.hole_width,
|
|
374
390
|
height: hole.hole_height,
|
|
375
391
|
fill: colorMap.drill,
|
|
376
|
-
|
|
392
|
+
realToCanvasMat
|
|
377
393
|
});
|
|
378
394
|
return;
|
|
379
395
|
}
|
|
@@ -384,7 +400,7 @@ function drawPcbHole(params) {
|
|
|
384
400
|
width: hole.hole_width,
|
|
385
401
|
height: hole.hole_height,
|
|
386
402
|
fill: colorMap.drill,
|
|
387
|
-
|
|
403
|
+
realToCanvasMat,
|
|
388
404
|
rotation: hole.ccw_rotation ?? 0
|
|
389
405
|
});
|
|
390
406
|
return;
|
|
@@ -394,18 +410,18 @@ function drawPcbHole(params) {
|
|
|
394
410
|
// lib/drawer/shapes/polygon.ts
|
|
395
411
|
import { applyToPoint as applyToPoint5 } from "transformation-matrix";
|
|
396
412
|
function drawPolygon(params) {
|
|
397
|
-
const { ctx, points, fill,
|
|
413
|
+
const { ctx, points, fill, realToCanvasMat } = params;
|
|
398
414
|
if (points.length < 3) return;
|
|
399
415
|
ctx.beginPath();
|
|
400
|
-
const
|
|
401
|
-
(p) => applyToPoint5(
|
|
416
|
+
const canvasPoints = points.map(
|
|
417
|
+
(p) => applyToPoint5(realToCanvasMat, [p.x, p.y])
|
|
402
418
|
);
|
|
403
|
-
const firstPoint =
|
|
419
|
+
const firstPoint = canvasPoints[0];
|
|
404
420
|
if (!firstPoint) return;
|
|
405
421
|
const [firstX, firstY] = firstPoint;
|
|
406
422
|
ctx.moveTo(firstX, firstY);
|
|
407
|
-
for (let i = 1; i <
|
|
408
|
-
const point =
|
|
423
|
+
for (let i = 1; i < canvasPoints.length; i++) {
|
|
424
|
+
const point = canvasPoints[i];
|
|
409
425
|
if (!point) continue;
|
|
410
426
|
const [x, y] = point;
|
|
411
427
|
ctx.lineTo(x, y);
|
|
@@ -420,7 +436,7 @@ function layerToColor(layer, colorMap) {
|
|
|
420
436
|
return colorMap.copper[layer] ?? colorMap.copper.top;
|
|
421
437
|
}
|
|
422
438
|
function drawPcbSmtPad(params) {
|
|
423
|
-
const { ctx, pad,
|
|
439
|
+
const { ctx, pad, realToCanvasMat, colorMap } = params;
|
|
424
440
|
const color = layerToColor(pad.layer, colorMap);
|
|
425
441
|
if (pad.shape === "rect") {
|
|
426
442
|
drawRect({
|
|
@@ -429,7 +445,7 @@ function drawPcbSmtPad(params) {
|
|
|
429
445
|
width: pad.width,
|
|
430
446
|
height: pad.height,
|
|
431
447
|
fill: color,
|
|
432
|
-
|
|
448
|
+
realToCanvasMat,
|
|
433
449
|
borderRadius: pad.corner_radius ?? pad.rect_border_radius ?? 0
|
|
434
450
|
});
|
|
435
451
|
return;
|
|
@@ -441,7 +457,7 @@ function drawPcbSmtPad(params) {
|
|
|
441
457
|
width: pad.width,
|
|
442
458
|
height: pad.height,
|
|
443
459
|
fill: color,
|
|
444
|
-
|
|
460
|
+
realToCanvasMat,
|
|
445
461
|
borderRadius: pad.corner_radius ?? pad.rect_border_radius ?? 0,
|
|
446
462
|
rotation: pad.ccw_rotation ?? 0
|
|
447
463
|
});
|
|
@@ -453,7 +469,7 @@ function drawPcbSmtPad(params) {
|
|
|
453
469
|
center: { x: pad.x, y: pad.y },
|
|
454
470
|
radius: pad.radius,
|
|
455
471
|
fill: color,
|
|
456
|
-
|
|
472
|
+
realToCanvasMat
|
|
457
473
|
});
|
|
458
474
|
return;
|
|
459
475
|
}
|
|
@@ -464,7 +480,7 @@ function drawPcbSmtPad(params) {
|
|
|
464
480
|
width: pad.width,
|
|
465
481
|
height: pad.height,
|
|
466
482
|
fill: color,
|
|
467
|
-
|
|
483
|
+
realToCanvasMat
|
|
468
484
|
});
|
|
469
485
|
return;
|
|
470
486
|
}
|
|
@@ -475,7 +491,7 @@ function drawPcbSmtPad(params) {
|
|
|
475
491
|
width: pad.width,
|
|
476
492
|
height: pad.height,
|
|
477
493
|
fill: color,
|
|
478
|
-
|
|
494
|
+
realToCanvasMat,
|
|
479
495
|
rotation: pad.ccw_rotation ?? 0
|
|
480
496
|
});
|
|
481
497
|
return;
|
|
@@ -486,7 +502,7 @@ function drawPcbSmtPad(params) {
|
|
|
486
502
|
ctx,
|
|
487
503
|
points: pad.points,
|
|
488
504
|
fill: color,
|
|
489
|
-
|
|
505
|
+
realToCanvasMat
|
|
490
506
|
});
|
|
491
507
|
}
|
|
492
508
|
return;
|
|
@@ -502,12 +518,12 @@ function drawLine(params) {
|
|
|
502
518
|
end,
|
|
503
519
|
strokeWidth,
|
|
504
520
|
stroke,
|
|
505
|
-
|
|
521
|
+
realToCanvasMat,
|
|
506
522
|
lineCap = "round"
|
|
507
523
|
} = params;
|
|
508
|
-
const [x1, y1] = applyToPoint6(
|
|
509
|
-
const [x2, y2] = applyToPoint6(
|
|
510
|
-
const scaledStrokeWidth = strokeWidth * Math.abs(
|
|
524
|
+
const [x1, y1] = applyToPoint6(realToCanvasMat, [start.x, start.y]);
|
|
525
|
+
const [x2, y2] = applyToPoint6(realToCanvasMat, [end.x, end.y]);
|
|
526
|
+
const scaledStrokeWidth = strokeWidth * Math.abs(realToCanvasMat.a);
|
|
511
527
|
ctx.beginPath();
|
|
512
528
|
ctx.moveTo(x1, y1);
|
|
513
529
|
ctx.lineTo(x2, y2);
|
|
@@ -522,7 +538,7 @@ function layerToColor2(layer, colorMap) {
|
|
|
522
538
|
return colorMap.copper[layer] ?? colorMap.copper.top;
|
|
523
539
|
}
|
|
524
540
|
function drawPcbTrace(params) {
|
|
525
|
-
const { ctx, trace,
|
|
541
|
+
const { ctx, trace, realToCanvasMat, colorMap } = params;
|
|
526
542
|
if (!trace.route || !Array.isArray(trace.route) || trace.route.length < 2) {
|
|
527
543
|
return;
|
|
528
544
|
}
|
|
@@ -540,7 +556,7 @@ function drawPcbTrace(params) {
|
|
|
540
556
|
end: { x: end.x, y: end.y },
|
|
541
557
|
strokeWidth: traceWidth,
|
|
542
558
|
stroke: color,
|
|
543
|
-
|
|
559
|
+
realToCanvasMat,
|
|
544
560
|
lineCap: "round"
|
|
545
561
|
});
|
|
546
562
|
}
|
|
@@ -555,20 +571,20 @@ function drawPath(params) {
|
|
|
555
571
|
fill,
|
|
556
572
|
stroke,
|
|
557
573
|
strokeWidth = 1,
|
|
558
|
-
|
|
574
|
+
realToCanvasMat,
|
|
559
575
|
closePath = false
|
|
560
576
|
} = params;
|
|
561
577
|
if (points.length < 2) return;
|
|
562
578
|
ctx.beginPath();
|
|
563
|
-
const
|
|
564
|
-
(p) => applyToPoint7(
|
|
579
|
+
const canvasPoints = points.map(
|
|
580
|
+
(p) => applyToPoint7(realToCanvasMat, [p.x, p.y])
|
|
565
581
|
);
|
|
566
|
-
const firstPoint =
|
|
582
|
+
const firstPoint = canvasPoints[0];
|
|
567
583
|
if (!firstPoint) return;
|
|
568
584
|
const [firstX, firstY] = firstPoint;
|
|
569
585
|
ctx.moveTo(firstX, firstY);
|
|
570
|
-
for (let i = 1; i <
|
|
571
|
-
const point =
|
|
586
|
+
for (let i = 1; i < canvasPoints.length; i++) {
|
|
587
|
+
const point = canvasPoints[i];
|
|
572
588
|
if (!point) continue;
|
|
573
589
|
const [x, y] = point;
|
|
574
590
|
ctx.lineTo(x, y);
|
|
@@ -581,7 +597,7 @@ function drawPath(params) {
|
|
|
581
597
|
ctx.fill();
|
|
582
598
|
}
|
|
583
599
|
if (stroke) {
|
|
584
|
-
const scaledStrokeWidth = strokeWidth * Math.abs(
|
|
600
|
+
const scaledStrokeWidth = strokeWidth * Math.abs(realToCanvasMat.a);
|
|
585
601
|
ctx.strokeStyle = stroke;
|
|
586
602
|
ctx.lineWidth = scaledStrokeWidth;
|
|
587
603
|
ctx.stroke();
|
|
@@ -590,7 +606,7 @@ function drawPath(params) {
|
|
|
590
606
|
|
|
591
607
|
// lib/drawer/elements/pcb-board.ts
|
|
592
608
|
function drawPcbBoard(params) {
|
|
593
|
-
const { ctx, board,
|
|
609
|
+
const { ctx, board, realToCanvasMat, colorMap } = params;
|
|
594
610
|
const { width, height, center, outline } = board;
|
|
595
611
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
596
612
|
drawPath({
|
|
@@ -598,7 +614,7 @@ function drawPcbBoard(params) {
|
|
|
598
614
|
points: outline.map((p) => ({ x: p.x, y: p.y })),
|
|
599
615
|
stroke: colorMap.boardOutline,
|
|
600
616
|
strokeWidth: 0.1,
|
|
601
|
-
|
|
617
|
+
realToCanvasMat,
|
|
602
618
|
closePath: true
|
|
603
619
|
});
|
|
604
620
|
return;
|
|
@@ -610,7 +626,7 @@ function drawPcbBoard(params) {
|
|
|
610
626
|
width,
|
|
611
627
|
height,
|
|
612
628
|
fill: "transparent",
|
|
613
|
-
|
|
629
|
+
realToCanvasMat
|
|
614
630
|
});
|
|
615
631
|
const halfWidth = width / 2;
|
|
616
632
|
const halfHeight = height / 2;
|
|
@@ -625,7 +641,7 @@ function drawPcbBoard(params) {
|
|
|
625
641
|
points: corners,
|
|
626
642
|
stroke: colorMap.boardOutline,
|
|
627
643
|
strokeWidth: 0.1,
|
|
628
|
-
|
|
644
|
+
realToCanvasMat,
|
|
629
645
|
closePath: true
|
|
630
646
|
});
|
|
631
647
|
}
|
|
@@ -643,13 +659,13 @@ function mapAnchorAlignment(alignment) {
|
|
|
643
659
|
return "center";
|
|
644
660
|
}
|
|
645
661
|
function drawPcbSilkscreenText(params) {
|
|
646
|
-
const { ctx, text,
|
|
662
|
+
const { ctx, text, realToCanvasMat, colorMap } = params;
|
|
647
663
|
const color = layerToSilkscreenColor(text.layer, colorMap);
|
|
648
|
-
const [x, y] = applyToPoint8(
|
|
664
|
+
const [x, y] = applyToPoint8(realToCanvasMat, [
|
|
649
665
|
text.anchor_position.x,
|
|
650
666
|
text.anchor_position.y
|
|
651
667
|
]);
|
|
652
|
-
const fontSize = (text.font_size ?? 1) * Math.abs(
|
|
668
|
+
const fontSize = (text.font_size ?? 1) * Math.abs(realToCanvasMat.a);
|
|
653
669
|
const rotation = text.ccw_rotation ?? 0;
|
|
654
670
|
ctx.save();
|
|
655
671
|
ctx.translate(x, y);
|
|
@@ -663,7 +679,7 @@ function drawPcbSilkscreenText(params) {
|
|
|
663
679
|
ctx.restore();
|
|
664
680
|
}
|
|
665
681
|
function drawPcbSilkscreenRect(params) {
|
|
666
|
-
const { ctx, rect,
|
|
682
|
+
const { ctx, rect, realToCanvasMat, colorMap } = params;
|
|
667
683
|
const color = layerToSilkscreenColor(rect.layer, colorMap);
|
|
668
684
|
drawRect({
|
|
669
685
|
ctx,
|
|
@@ -671,22 +687,22 @@ function drawPcbSilkscreenRect(params) {
|
|
|
671
687
|
width: rect.width,
|
|
672
688
|
height: rect.height,
|
|
673
689
|
fill: color,
|
|
674
|
-
|
|
690
|
+
realToCanvasMat
|
|
675
691
|
});
|
|
676
692
|
}
|
|
677
693
|
function drawPcbSilkscreenCircle(params) {
|
|
678
|
-
const { ctx, circle,
|
|
694
|
+
const { ctx, circle, realToCanvasMat, colorMap } = params;
|
|
679
695
|
const color = layerToSilkscreenColor(circle.layer, colorMap);
|
|
680
696
|
drawCircle({
|
|
681
697
|
ctx,
|
|
682
698
|
center: circle.center,
|
|
683
699
|
radius: circle.radius,
|
|
684
700
|
fill: color,
|
|
685
|
-
|
|
701
|
+
realToCanvasMat
|
|
686
702
|
});
|
|
687
703
|
}
|
|
688
704
|
function drawPcbSilkscreenLine(params) {
|
|
689
|
-
const { ctx, line,
|
|
705
|
+
const { ctx, line, realToCanvasMat, colorMap } = params;
|
|
690
706
|
const color = layerToSilkscreenColor(line.layer, colorMap);
|
|
691
707
|
drawLine({
|
|
692
708
|
ctx,
|
|
@@ -694,11 +710,11 @@ function drawPcbSilkscreenLine(params) {
|
|
|
694
710
|
end: { x: line.x2, y: line.y2 },
|
|
695
711
|
strokeWidth: line.stroke_width ?? 0.1,
|
|
696
712
|
stroke: color,
|
|
697
|
-
|
|
713
|
+
realToCanvasMat
|
|
698
714
|
});
|
|
699
715
|
}
|
|
700
716
|
function drawPcbSilkscreenPath(params) {
|
|
701
|
-
const { ctx, path,
|
|
717
|
+
const { ctx, path, realToCanvasMat, colorMap } = params;
|
|
702
718
|
const color = layerToSilkscreenColor(path.layer, colorMap);
|
|
703
719
|
if (!path.route || path.route.length < 2) return;
|
|
704
720
|
for (let i = 0; i < path.route.length - 1; i++) {
|
|
@@ -711,14 +727,14 @@ function drawPcbSilkscreenPath(params) {
|
|
|
711
727
|
end: { x: end.x, y: end.y },
|
|
712
728
|
strokeWidth: path.stroke_width ?? 0.1,
|
|
713
729
|
stroke: color,
|
|
714
|
-
|
|
730
|
+
realToCanvasMat
|
|
715
731
|
});
|
|
716
732
|
}
|
|
717
733
|
}
|
|
718
734
|
|
|
719
735
|
// lib/drawer/elements/pcb-cutout.ts
|
|
720
736
|
function drawPcbCutout(params) {
|
|
721
|
-
const { ctx, cutout,
|
|
737
|
+
const { ctx, cutout, realToCanvasMat, colorMap } = params;
|
|
722
738
|
if (cutout.shape === "rect") {
|
|
723
739
|
drawRect({
|
|
724
740
|
ctx,
|
|
@@ -726,7 +742,7 @@ function drawPcbCutout(params) {
|
|
|
726
742
|
width: cutout.width,
|
|
727
743
|
height: cutout.height,
|
|
728
744
|
fill: colorMap.drill,
|
|
729
|
-
|
|
745
|
+
realToCanvasMat,
|
|
730
746
|
rotation: cutout.rotation ?? 0
|
|
731
747
|
});
|
|
732
748
|
return;
|
|
@@ -737,7 +753,7 @@ function drawPcbCutout(params) {
|
|
|
737
753
|
center: cutout.center,
|
|
738
754
|
radius: cutout.radius,
|
|
739
755
|
fill: colorMap.drill,
|
|
740
|
-
|
|
756
|
+
realToCanvasMat
|
|
741
757
|
});
|
|
742
758
|
return;
|
|
743
759
|
}
|
|
@@ -747,7 +763,7 @@ function drawPcbCutout(params) {
|
|
|
747
763
|
ctx,
|
|
748
764
|
points: cutout.points,
|
|
749
765
|
fill: colorMap.drill,
|
|
750
|
-
|
|
766
|
+
realToCanvasMat
|
|
751
767
|
});
|
|
752
768
|
}
|
|
753
769
|
return;
|
|
@@ -760,13 +776,16 @@ function layerToColor3(layer, colorMap) {
|
|
|
760
776
|
return colorMap.copper[layer] ?? colorMap.copper.top;
|
|
761
777
|
}
|
|
762
778
|
function drawPcbCopperPour(params) {
|
|
763
|
-
const { ctx, pour,
|
|
779
|
+
const { ctx, pour, realToCanvasMat, colorMap } = params;
|
|
764
780
|
const color = layerToColor3(pour.layer, colorMap);
|
|
765
781
|
ctx.save();
|
|
766
782
|
if (pour.shape === "rect") {
|
|
767
|
-
const [cx, cy] = applyToPoint9(
|
|
768
|
-
|
|
769
|
-
|
|
783
|
+
const [cx, cy] = applyToPoint9(realToCanvasMat, [
|
|
784
|
+
pour.center.x,
|
|
785
|
+
pour.center.y
|
|
786
|
+
]);
|
|
787
|
+
const scaledWidth = pour.width * Math.abs(realToCanvasMat.a);
|
|
788
|
+
const scaledHeight = pour.height * Math.abs(realToCanvasMat.a);
|
|
770
789
|
ctx.translate(cx, cy);
|
|
771
790
|
if (pour.rotation) {
|
|
772
791
|
ctx.rotate(-pour.rotation * (Math.PI / 180));
|
|
@@ -781,10 +800,10 @@ function drawPcbCopperPour(params) {
|
|
|
781
800
|
}
|
|
782
801
|
if (pour.shape === "polygon") {
|
|
783
802
|
if (pour.points && pour.points.length >= 3) {
|
|
784
|
-
const
|
|
785
|
-
(p) => applyToPoint9(
|
|
803
|
+
const canvasPoints = pour.points.map(
|
|
804
|
+
(p) => applyToPoint9(realToCanvasMat, [p.x, p.y])
|
|
786
805
|
);
|
|
787
|
-
const firstPoint =
|
|
806
|
+
const firstPoint = canvasPoints[0];
|
|
788
807
|
if (!firstPoint) {
|
|
789
808
|
ctx.restore();
|
|
790
809
|
return;
|
|
@@ -792,8 +811,8 @@ function drawPcbCopperPour(params) {
|
|
|
792
811
|
ctx.beginPath();
|
|
793
812
|
const [firstX, firstY] = firstPoint;
|
|
794
813
|
ctx.moveTo(firstX, firstY);
|
|
795
|
-
for (let i = 1; i <
|
|
796
|
-
const point =
|
|
814
|
+
for (let i = 1; i < canvasPoints.length; i++) {
|
|
815
|
+
const point = canvasPoints[i];
|
|
797
816
|
if (!point) continue;
|
|
798
817
|
const [x, y] = point;
|
|
799
818
|
ctx.lineTo(x, y);
|
|
@@ -898,18 +917,18 @@ function drawText(params) {
|
|
|
898
917
|
y,
|
|
899
918
|
fontSize,
|
|
900
919
|
color,
|
|
901
|
-
|
|
920
|
+
realToCanvasMat,
|
|
902
921
|
anchorAlignment,
|
|
903
922
|
rotation = 0
|
|
904
923
|
} = params;
|
|
905
924
|
if (!text) return;
|
|
906
|
-
const [
|
|
907
|
-
const scale2 = Math.abs(
|
|
925
|
+
const [canvasX, canvasY] = applyToPoint10(realToCanvasMat, [x, y]);
|
|
926
|
+
const scale2 = Math.abs(realToCanvasMat.a);
|
|
908
927
|
const scaledFontSize = fontSize * scale2;
|
|
909
928
|
const layout = getAlphabetLayout(text, scaledFontSize);
|
|
910
929
|
const startPos = getTextStartPosition(anchorAlignment, layout);
|
|
911
930
|
ctx.save();
|
|
912
|
-
ctx.translate(
|
|
931
|
+
ctx.translate(canvasX, canvasY);
|
|
913
932
|
if (rotation !== 0) {
|
|
914
933
|
ctx.rotate(-rotation * (Math.PI / 180));
|
|
915
934
|
}
|
|
@@ -933,14 +952,14 @@ function mapAnchorAlignment2(alignment) {
|
|
|
933
952
|
return "center";
|
|
934
953
|
}
|
|
935
954
|
function drawPcbCopperText(params) {
|
|
936
|
-
const { ctx, text,
|
|
955
|
+
const { ctx, text, realToCanvasMat, colorMap } = params;
|
|
937
956
|
const content = text.text ?? "";
|
|
938
957
|
if (!content) return;
|
|
939
|
-
const [x, y] = applyToPoint11(
|
|
958
|
+
const [x, y] = applyToPoint11(realToCanvasMat, [
|
|
940
959
|
text.anchor_position.x,
|
|
941
960
|
text.anchor_position.y
|
|
942
961
|
]);
|
|
943
|
-
const scale2 = Math.abs(
|
|
962
|
+
const scale2 = Math.abs(realToCanvasMat.a);
|
|
944
963
|
const fontSize = (text.font_size ?? 1) * scale2;
|
|
945
964
|
const rotation = text.ccw_rotation ?? 0;
|
|
946
965
|
const padding = {
|
|
@@ -998,7 +1017,7 @@ function layerToColor4(layer, colorMap) {
|
|
|
998
1017
|
return DEFAULT_FABRICATION_NOTE_COLOR;
|
|
999
1018
|
}
|
|
1000
1019
|
function drawPcbFabricationNoteText(params) {
|
|
1001
|
-
const { ctx, text,
|
|
1020
|
+
const { ctx, text, realToCanvasMat, colorMap } = params;
|
|
1002
1021
|
const defaultColor = layerToColor4(text.layer, colorMap);
|
|
1003
1022
|
const color = text.color ?? defaultColor;
|
|
1004
1023
|
const fontSize = text.font_size;
|
|
@@ -1009,14 +1028,14 @@ function drawPcbFabricationNoteText(params) {
|
|
|
1009
1028
|
y: text.anchor_position.y,
|
|
1010
1029
|
fontSize,
|
|
1011
1030
|
color,
|
|
1012
|
-
|
|
1031
|
+
realToCanvasMat,
|
|
1013
1032
|
anchorAlignment: text.anchor_alignment
|
|
1014
1033
|
});
|
|
1015
1034
|
}
|
|
1016
1035
|
|
|
1017
1036
|
// lib/drawer/elements/pcb-fabrication-note-rect.ts
|
|
1018
1037
|
function drawPcbFabricationNoteRect(params) {
|
|
1019
|
-
const { ctx, rect,
|
|
1038
|
+
const { ctx, rect, realToCanvasMat, colorMap } = params;
|
|
1020
1039
|
const defaultColor = "rgba(255,255,255,0.5)";
|
|
1021
1040
|
const color = rect.color ?? defaultColor;
|
|
1022
1041
|
const isFilled = rect.is_filled ?? false;
|
|
@@ -1031,14 +1050,14 @@ function drawPcbFabricationNoteRect(params) {
|
|
|
1031
1050
|
stroke: hasStroke ? color : void 0,
|
|
1032
1051
|
strokeWidth: hasStroke ? rect.stroke_width : void 0,
|
|
1033
1052
|
borderRadius: rect.corner_radius,
|
|
1034
|
-
|
|
1053
|
+
realToCanvasMat,
|
|
1035
1054
|
isStrokeDashed
|
|
1036
1055
|
});
|
|
1037
1056
|
}
|
|
1038
1057
|
|
|
1039
1058
|
// lib/drawer/elements/pcb-note-rect.ts
|
|
1040
1059
|
function drawPcbNoteRect(params) {
|
|
1041
|
-
const { ctx, rect,
|
|
1060
|
+
const { ctx, rect, realToCanvasMat, colorMap } = params;
|
|
1042
1061
|
const defaultColor = "rgb(89, 148, 220)";
|
|
1043
1062
|
const color = rect.color ?? defaultColor;
|
|
1044
1063
|
const isFilled = rect.is_filled ?? false;
|
|
@@ -1053,14 +1072,14 @@ function drawPcbNoteRect(params) {
|
|
|
1053
1072
|
stroke: hasStroke ? color : void 0,
|
|
1054
1073
|
strokeWidth: hasStroke ? rect.stroke_width : void 0,
|
|
1055
1074
|
borderRadius: rect.corner_radius,
|
|
1056
|
-
|
|
1075
|
+
realToCanvasMat,
|
|
1057
1076
|
isStrokeDashed
|
|
1058
1077
|
});
|
|
1059
1078
|
}
|
|
1060
1079
|
|
|
1061
1080
|
// lib/drawer/elements/pcb-fabrication-note-path.ts
|
|
1062
1081
|
function drawPcbFabricationNotePath(params) {
|
|
1063
|
-
const { ctx, path,
|
|
1082
|
+
const { ctx, path, realToCanvasMat, colorMap } = params;
|
|
1064
1083
|
const defaultColor = "rgba(255,255,255,0.5)";
|
|
1065
1084
|
const color = path.color ?? defaultColor;
|
|
1066
1085
|
if (!path.route || path.route.length < 2) return;
|
|
@@ -1074,14 +1093,14 @@ function drawPcbFabricationNotePath(params) {
|
|
|
1074
1093
|
end: { x: end.x, y: end.y },
|
|
1075
1094
|
strokeWidth: path.stroke_width ?? 0.1,
|
|
1076
1095
|
stroke: color,
|
|
1077
|
-
|
|
1096
|
+
realToCanvasMat
|
|
1078
1097
|
});
|
|
1079
1098
|
}
|
|
1080
1099
|
}
|
|
1081
1100
|
|
|
1082
1101
|
// lib/drawer/elements/pcb-note-path.ts
|
|
1083
1102
|
function drawPcbNotePath(params) {
|
|
1084
|
-
const { ctx, path,
|
|
1103
|
+
const { ctx, path, realToCanvasMat, colorMap } = params;
|
|
1085
1104
|
const defaultColor = "rgb(89, 148, 220)";
|
|
1086
1105
|
const color = path.color ?? defaultColor;
|
|
1087
1106
|
if (!path.route || path.route.length < 2) return;
|
|
@@ -1095,7 +1114,7 @@ function drawPcbNotePath(params) {
|
|
|
1095
1114
|
end: { x: end.x, y: end.y },
|
|
1096
1115
|
strokeWidth: path.stroke_width ?? 0.1,
|
|
1097
1116
|
stroke: color,
|
|
1098
|
-
|
|
1117
|
+
realToCanvasMat
|
|
1099
1118
|
});
|
|
1100
1119
|
}
|
|
1101
1120
|
}
|
|
@@ -1103,7 +1122,7 @@ function drawPcbNotePath(params) {
|
|
|
1103
1122
|
// lib/drawer/elements/pcb-note-text.ts
|
|
1104
1123
|
var DEFAULT_NOTE_TEXT_COLOR = "rgb(89, 148, 220)";
|
|
1105
1124
|
function drawPcbNoteText(params) {
|
|
1106
|
-
const { ctx, text,
|
|
1125
|
+
const { ctx, text, realToCanvasMat, colorMap } = params;
|
|
1107
1126
|
const defaultColor = DEFAULT_NOTE_TEXT_COLOR;
|
|
1108
1127
|
const color = text.color ?? defaultColor;
|
|
1109
1128
|
const fontSize = text.font_size ?? 1;
|
|
@@ -1114,7 +1133,7 @@ function drawPcbNoteText(params) {
|
|
|
1114
1133
|
y: text.anchor_position.y,
|
|
1115
1134
|
fontSize,
|
|
1116
1135
|
color,
|
|
1117
|
-
|
|
1136
|
+
realToCanvasMat,
|
|
1118
1137
|
anchorAlignment: text.anchor_alignment ?? "center"
|
|
1119
1138
|
});
|
|
1120
1139
|
}
|
|
@@ -1122,14 +1141,14 @@ function drawPcbNoteText(params) {
|
|
|
1122
1141
|
// lib/drawer/elements/pcb-note-line.ts
|
|
1123
1142
|
import { applyToPoint as applyToPoint12 } from "transformation-matrix";
|
|
1124
1143
|
function drawPcbNoteLine(params) {
|
|
1125
|
-
const { ctx, line,
|
|
1144
|
+
const { ctx, line, realToCanvasMat, colorMap } = params;
|
|
1126
1145
|
const defaultColor = "rgb(89, 148, 220)";
|
|
1127
1146
|
const color = line.color ?? defaultColor;
|
|
1128
1147
|
const strokeWidth = line.stroke_width ?? 0.1;
|
|
1129
1148
|
const isDashed = line.is_dashed ?? false;
|
|
1130
|
-
const [x1, y1] = applyToPoint12(
|
|
1131
|
-
const [x2, y2] = applyToPoint12(
|
|
1132
|
-
const scaledStrokeWidth = strokeWidth * Math.abs(
|
|
1149
|
+
const [x1, y1] = applyToPoint12(realToCanvasMat, [line.x1, line.y1]);
|
|
1150
|
+
const [x2, y2] = applyToPoint12(realToCanvasMat, [line.x2, line.y2]);
|
|
1151
|
+
const scaledStrokeWidth = strokeWidth * Math.abs(realToCanvasMat.a);
|
|
1133
1152
|
ctx.save();
|
|
1134
1153
|
if (isDashed) {
|
|
1135
1154
|
ctx.setLineDash([scaledStrokeWidth * 2, scaledStrokeWidth * 2]);
|
|
@@ -1219,7 +1238,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1219
1238
|
drawPcbPlatedHole({
|
|
1220
1239
|
ctx: this.ctx,
|
|
1221
1240
|
hole: element,
|
|
1222
|
-
|
|
1241
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1223
1242
|
colorMap: this.colorMap
|
|
1224
1243
|
});
|
|
1225
1244
|
}
|
|
@@ -1227,7 +1246,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1227
1246
|
drawPcbVia({
|
|
1228
1247
|
ctx: this.ctx,
|
|
1229
1248
|
via: element,
|
|
1230
|
-
|
|
1249
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1231
1250
|
colorMap: this.colorMap
|
|
1232
1251
|
});
|
|
1233
1252
|
}
|
|
@@ -1235,7 +1254,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1235
1254
|
drawPcbHole({
|
|
1236
1255
|
ctx: this.ctx,
|
|
1237
1256
|
hole: element,
|
|
1238
|
-
|
|
1257
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1239
1258
|
colorMap: this.colorMap
|
|
1240
1259
|
});
|
|
1241
1260
|
}
|
|
@@ -1243,7 +1262,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1243
1262
|
drawPcbSmtPad({
|
|
1244
1263
|
ctx: this.ctx,
|
|
1245
1264
|
pad: element,
|
|
1246
|
-
|
|
1265
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1247
1266
|
colorMap: this.colorMap
|
|
1248
1267
|
});
|
|
1249
1268
|
}
|
|
@@ -1251,7 +1270,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1251
1270
|
drawPcbTrace({
|
|
1252
1271
|
ctx: this.ctx,
|
|
1253
1272
|
trace: element,
|
|
1254
|
-
|
|
1273
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1255
1274
|
colorMap: this.colorMap
|
|
1256
1275
|
});
|
|
1257
1276
|
}
|
|
@@ -1259,7 +1278,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1259
1278
|
drawPcbBoard({
|
|
1260
1279
|
ctx: this.ctx,
|
|
1261
1280
|
board: element,
|
|
1262
|
-
|
|
1281
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1263
1282
|
colorMap: this.colorMap
|
|
1264
1283
|
});
|
|
1265
1284
|
}
|
|
@@ -1267,7 +1286,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1267
1286
|
drawPcbSilkscreenText({
|
|
1268
1287
|
ctx: this.ctx,
|
|
1269
1288
|
text: element,
|
|
1270
|
-
|
|
1289
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1271
1290
|
colorMap: this.colorMap
|
|
1272
1291
|
});
|
|
1273
1292
|
}
|
|
@@ -1275,7 +1294,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1275
1294
|
drawPcbSilkscreenRect({
|
|
1276
1295
|
ctx: this.ctx,
|
|
1277
1296
|
rect: element,
|
|
1278
|
-
|
|
1297
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1279
1298
|
colorMap: this.colorMap
|
|
1280
1299
|
});
|
|
1281
1300
|
}
|
|
@@ -1283,7 +1302,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1283
1302
|
drawPcbSilkscreenCircle({
|
|
1284
1303
|
ctx: this.ctx,
|
|
1285
1304
|
circle: element,
|
|
1286
|
-
|
|
1305
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1287
1306
|
colorMap: this.colorMap
|
|
1288
1307
|
});
|
|
1289
1308
|
}
|
|
@@ -1291,7 +1310,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1291
1310
|
drawPcbSilkscreenLine({
|
|
1292
1311
|
ctx: this.ctx,
|
|
1293
1312
|
line: element,
|
|
1294
|
-
|
|
1313
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1295
1314
|
colorMap: this.colorMap
|
|
1296
1315
|
});
|
|
1297
1316
|
}
|
|
@@ -1299,7 +1318,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1299
1318
|
drawPcbSilkscreenPath({
|
|
1300
1319
|
ctx: this.ctx,
|
|
1301
1320
|
path: element,
|
|
1302
|
-
|
|
1321
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1303
1322
|
colorMap: this.colorMap
|
|
1304
1323
|
});
|
|
1305
1324
|
}
|
|
@@ -1307,7 +1326,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1307
1326
|
drawPcbCutout({
|
|
1308
1327
|
ctx: this.ctx,
|
|
1309
1328
|
cutout: element,
|
|
1310
|
-
|
|
1329
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1311
1330
|
colorMap: this.colorMap
|
|
1312
1331
|
});
|
|
1313
1332
|
}
|
|
@@ -1315,7 +1334,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1315
1334
|
drawPcbCopperPour({
|
|
1316
1335
|
ctx: this.ctx,
|
|
1317
1336
|
pour: element,
|
|
1318
|
-
|
|
1337
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1319
1338
|
colorMap: this.colorMap
|
|
1320
1339
|
});
|
|
1321
1340
|
}
|
|
@@ -1323,7 +1342,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1323
1342
|
drawPcbCopperText({
|
|
1324
1343
|
ctx: this.ctx,
|
|
1325
1344
|
text: element,
|
|
1326
|
-
|
|
1345
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1327
1346
|
colorMap: this.colorMap
|
|
1328
1347
|
});
|
|
1329
1348
|
}
|
|
@@ -1331,7 +1350,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1331
1350
|
drawPcbFabricationNoteText({
|
|
1332
1351
|
ctx: this.ctx,
|
|
1333
1352
|
text: element,
|
|
1334
|
-
|
|
1353
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1335
1354
|
colorMap: this.colorMap
|
|
1336
1355
|
});
|
|
1337
1356
|
}
|
|
@@ -1339,13 +1358,13 @@ var CircuitToCanvasDrawer = class {
|
|
|
1339
1358
|
drawPcbFabricationNoteRect({
|
|
1340
1359
|
ctx: this.ctx,
|
|
1341
1360
|
rect: element,
|
|
1342
|
-
|
|
1361
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1343
1362
|
colorMap: this.colorMap
|
|
1344
1363
|
});
|
|
1345
1364
|
}
|
|
1346
1365
|
if (element.type === "pcb_note_rect") {
|
|
1347
1366
|
drawPcbNoteRect({
|
|
1348
|
-
|
|
1367
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1349
1368
|
colorMap: this.colorMap,
|
|
1350
1369
|
ctx: this.ctx,
|
|
1351
1370
|
rect: element
|
|
@@ -1355,7 +1374,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1355
1374
|
drawPcbFabricationNotePath({
|
|
1356
1375
|
ctx: this.ctx,
|
|
1357
1376
|
path: element,
|
|
1358
|
-
|
|
1377
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1359
1378
|
colorMap: this.colorMap
|
|
1360
1379
|
});
|
|
1361
1380
|
}
|
|
@@ -1363,7 +1382,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1363
1382
|
drawPcbNotePath({
|
|
1364
1383
|
ctx: this.ctx,
|
|
1365
1384
|
path: element,
|
|
1366
|
-
|
|
1385
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1367
1386
|
colorMap: this.colorMap
|
|
1368
1387
|
});
|
|
1369
1388
|
}
|
|
@@ -1371,7 +1390,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1371
1390
|
drawPcbNoteText({
|
|
1372
1391
|
ctx: this.ctx,
|
|
1373
1392
|
text: element,
|
|
1374
|
-
|
|
1393
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1375
1394
|
colorMap: this.colorMap
|
|
1376
1395
|
});
|
|
1377
1396
|
}
|
|
@@ -1379,7 +1398,7 @@ var CircuitToCanvasDrawer = class {
|
|
|
1379
1398
|
drawPcbNoteLine({
|
|
1380
1399
|
ctx: this.ctx,
|
|
1381
1400
|
line: element,
|
|
1382
|
-
|
|
1401
|
+
realToCanvasMat: this.realToCanvasMat,
|
|
1383
1402
|
colorMap: this.colorMap
|
|
1384
1403
|
});
|
|
1385
1404
|
}
|