circuit-to-canvas 0.0.30 → 0.0.32
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.d.ts +41 -5
- package/dist/index.js +456 -41
- package/lib/drawer/CircuitToCanvasDrawer.ts +116 -2
- package/lib/drawer/elements/index.ts +10 -0
- package/lib/drawer/elements/pcb-hole.ts +2 -2
- package/lib/drawer/elements/pcb-plated-hole.ts +6 -6
- package/lib/drawer/elements/pcb-silkscreen-oval.ts +35 -0
- package/lib/drawer/elements/pcb-smtpad.ts +174 -0
- package/lib/drawer/elements/soldermask-margin.ts +266 -0
- package/lib/drawer/shapes/oval.ts +25 -10
- package/package.json +3 -3
- package/tests/elements/__snapshots__/pcb-silkscreen-oval.snap.png +0 -0
- package/tests/elements/__snapshots__/pcb-smtpad-soldermask-margin.snap.png +0 -0
- package/tests/elements/pcb-silkscreen-oval.test.ts +37 -0
- package/tests/elements/pcb-smtpad-soldermask-margin.test.ts +163 -0
- package/tests/shapes/__snapshots__/oval.snap.png +0 -0
- package/tests/shapes/oval.test.ts +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyCircuitElement, PcbRenderLayer, NinePointAnchor, PcbPlatedHole, PCBVia, PCBHole, PcbSmtPad, PCBTrace, PcbBoard, PcbSilkscreenText, PcbSilkscreenRect, PcbSilkscreenCircle, PcbSilkscreenLine, PcbSilkscreenPath, PcbSilkscreenPill, PcbCutout, PcbCopperPour, PcbCopperText, PcbFabricationNoteText, PcbFabricationNoteRect, PcbNoteRect, PcbFabricationNotePath, PcbNotePath, PcbNoteText, PcbNoteDimension } from 'circuit-json';
|
|
1
|
+
import { AnyCircuitElement, PcbRenderLayer, NinePointAnchor, PcbPlatedHole, PCBVia, PCBHole, PcbSmtPad, PCBTrace, PcbBoard, PcbSilkscreenText, PcbSilkscreenRect, PcbSilkscreenCircle, PcbSilkscreenLine, PcbSilkscreenPath, PcbSilkscreenPill, PcbSilkscreenOval, PcbCutout, PcbCopperPour, PcbCopperText, PcbFabricationNoteText, PcbFabricationNoteRect, PcbNoteRect, PcbFabricationNotePath, PcbNotePath, PcbNoteText, PcbNoteDimension } from 'circuit-json';
|
|
2
2
|
import { Matrix } from 'transformation-matrix';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -99,6 +99,7 @@ declare class CircuitToCanvasDrawer {
|
|
|
99
99
|
configure(config: DrawerConfig): void;
|
|
100
100
|
setCameraBounds(bounds: CameraBounds): void;
|
|
101
101
|
drawElements(elements: AnyCircuitElement[], options?: DrawElementsOptions): void;
|
|
102
|
+
private drawBoardWithSoldermask;
|
|
102
103
|
private drawElement;
|
|
103
104
|
}
|
|
104
105
|
|
|
@@ -138,9 +139,11 @@ interface DrawOvalParams {
|
|
|
138
139
|
x: number;
|
|
139
140
|
y: number;
|
|
140
141
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
fill
|
|
142
|
+
radius_x: number;
|
|
143
|
+
radius_y: number;
|
|
144
|
+
fill?: string;
|
|
145
|
+
stroke?: string;
|
|
146
|
+
strokeWidth?: number;
|
|
144
147
|
realToCanvasMat: Matrix;
|
|
145
148
|
rotation?: number;
|
|
146
149
|
}
|
|
@@ -287,6 +290,31 @@ interface DrawPcbSmtPadParams {
|
|
|
287
290
|
}
|
|
288
291
|
declare function drawPcbSmtPad(params: DrawPcbSmtPadParams): void;
|
|
289
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Draws a soldermask ring for rectangular shapes with negative margin
|
|
295
|
+
* (soldermask appears inside the pad boundary)
|
|
296
|
+
*/
|
|
297
|
+
declare function drawSoldermaskRingForRect(ctx: CanvasContext, center: {
|
|
298
|
+
x: number;
|
|
299
|
+
y: number;
|
|
300
|
+
}, width: number, height: number, margin: number, borderRadius: number, rotation: number, realToCanvasMat: Matrix, soldermaskColor: string, padColor: string): void;
|
|
301
|
+
/**
|
|
302
|
+
* Draws a soldermask ring for circular shapes with negative margin
|
|
303
|
+
* (soldermask appears inside the pad boundary)
|
|
304
|
+
*/
|
|
305
|
+
declare function drawSoldermaskRingForCircle(ctx: CanvasContext, center: {
|
|
306
|
+
x: number;
|
|
307
|
+
y: number;
|
|
308
|
+
}, radius: number, margin: number, realToCanvasMat: Matrix, soldermaskColor: string, padColor: string): void;
|
|
309
|
+
/**
|
|
310
|
+
* Draws a soldermask ring for pill shapes with negative margin
|
|
311
|
+
* (soldermask appears inside the pad boundary)
|
|
312
|
+
*/
|
|
313
|
+
declare function drawSoldermaskRingForPill(ctx: CanvasContext, center: {
|
|
314
|
+
x: number;
|
|
315
|
+
y: number;
|
|
316
|
+
}, width: number, height: number, margin: number, rotation: number, realToCanvasMat: Matrix, soldermaskColor: string, padColor: string): void;
|
|
317
|
+
|
|
290
318
|
interface DrawPcbTraceParams {
|
|
291
319
|
ctx: CanvasContext;
|
|
292
320
|
trace: PCBTrace;
|
|
@@ -351,6 +379,14 @@ interface DrawPcbSilkscreenPillParams {
|
|
|
351
379
|
}
|
|
352
380
|
declare function drawPcbSilkscreenPill(params: DrawPcbSilkscreenPillParams): void;
|
|
353
381
|
|
|
382
|
+
interface DrawPcbSilkscreenOvalParams {
|
|
383
|
+
ctx: CanvasContext;
|
|
384
|
+
oval: PcbSilkscreenOval;
|
|
385
|
+
realToCanvasMat: Matrix;
|
|
386
|
+
colorMap: PcbColorMap;
|
|
387
|
+
}
|
|
388
|
+
declare function drawPcbSilkscreenOval(params: DrawPcbSilkscreenOvalParams): void;
|
|
389
|
+
|
|
354
390
|
interface DrawPcbCutoutParams {
|
|
355
391
|
ctx: CanvasContext;
|
|
356
392
|
cutout: PcbCutout;
|
|
@@ -431,4 +467,4 @@ interface DrawPcbNoteDimensionParams {
|
|
|
431
467
|
}
|
|
432
468
|
declare function drawPcbNoteDimension(params: DrawPcbNoteDimensionParams): void;
|
|
433
469
|
|
|
434
|
-
export { type AlphabetLayout, type AnchorAlignment, type CameraBounds, type CanvasContext, CircuitToCanvasDrawer, type CopperColorMap, type CopperLayerName, DEFAULT_PCB_COLOR_MAP, type DrawArrowParams, type DrawCircleParams, type DrawContext, type DrawElementsOptions, type DrawLineParams, type DrawOvalParams, type DrawPathParams, type DrawPcbBoardParams, type DrawPcbCopperPourParams, type DrawPcbCopperTextParams, type DrawPcbCutoutParams, type DrawPcbFabricationNotePathParams, type DrawPcbFabricationNoteRectParams, type DrawPcbFabricationNoteTextParams, type DrawPcbHoleParams, type DrawPcbNoteDimensionParams, type DrawPcbNotePathParams, type DrawPcbNoteRectParams, type DrawPcbNoteTextParams, type DrawPcbPlatedHoleParams, type DrawPcbSilkscreenCircleParams, type DrawPcbSilkscreenLineParams, type DrawPcbSilkscreenPathParams, type DrawPcbSilkscreenPillParams, type DrawPcbSilkscreenRectParams, type DrawPcbSilkscreenTextParams, type DrawPcbSmtPadParams, type DrawPcbTraceParams, type DrawPcbViaParams, type DrawPillParams, type DrawPolygonParams, type DrawRectParams, type DrawTextParams, type DrawerConfig, type PcbColorMap, drawArrow, drawCircle, drawLine, drawOval, drawPath, drawPcbBoard, drawPcbCopperPour, drawPcbCopperText, drawPcbCutout, drawPcbFabricationNotePath, drawPcbFabricationNoteRect, drawPcbFabricationNoteText, drawPcbHole, drawPcbNoteDimension, drawPcbNotePath, drawPcbNoteRect, drawPcbNoteText, drawPcbPlatedHole, drawPcbSilkscreenCircle, drawPcbSilkscreenLine, drawPcbSilkscreenPath, drawPcbSilkscreenPill, drawPcbSilkscreenRect, drawPcbSilkscreenText, drawPcbSmtPad, drawPcbTrace, drawPcbVia, drawPill, drawPolygon, drawRect, drawText, getAlphabetLayout, getTextStartPosition, strokeAlphabetText };
|
|
470
|
+
export { type AlphabetLayout, type AnchorAlignment, type CameraBounds, type CanvasContext, CircuitToCanvasDrawer, type CopperColorMap, type CopperLayerName, DEFAULT_PCB_COLOR_MAP, type DrawArrowParams, type DrawCircleParams, type DrawContext, type DrawElementsOptions, type DrawLineParams, type DrawOvalParams, type DrawPathParams, type DrawPcbBoardParams, type DrawPcbCopperPourParams, type DrawPcbCopperTextParams, type DrawPcbCutoutParams, type DrawPcbFabricationNotePathParams, type DrawPcbFabricationNoteRectParams, type DrawPcbFabricationNoteTextParams, type DrawPcbHoleParams, type DrawPcbNoteDimensionParams, type DrawPcbNotePathParams, type DrawPcbNoteRectParams, type DrawPcbNoteTextParams, type DrawPcbPlatedHoleParams, type DrawPcbSilkscreenCircleParams, type DrawPcbSilkscreenLineParams, type DrawPcbSilkscreenOvalParams, type DrawPcbSilkscreenPathParams, type DrawPcbSilkscreenPillParams, type DrawPcbSilkscreenRectParams, type DrawPcbSilkscreenTextParams, type DrawPcbSmtPadParams, type DrawPcbTraceParams, type DrawPcbViaParams, type DrawPillParams, type DrawPolygonParams, type DrawRectParams, type DrawTextParams, type DrawerConfig, type PcbColorMap, drawArrow, drawCircle, drawLine, drawOval, drawPath, drawPcbBoard, drawPcbCopperPour, drawPcbCopperText, drawPcbCutout, drawPcbFabricationNotePath, drawPcbFabricationNoteRect, drawPcbFabricationNoteText, drawPcbHole, drawPcbNoteDimension, drawPcbNotePath, drawPcbNoteRect, drawPcbNoteText, drawPcbPlatedHole, drawPcbSilkscreenCircle, drawPcbSilkscreenLine, drawPcbSilkscreenOval, drawPcbSilkscreenPath, drawPcbSilkscreenPill, drawPcbSilkscreenRect, drawPcbSilkscreenText, drawPcbSmtPad, drawPcbTrace, drawPcbVia, drawPill, drawPolygon, drawRect, drawSoldermaskRingForCircle, drawSoldermaskRingForPill, drawSoldermaskRingForRect, drawText, getAlphabetLayout, getTextStartPosition, strokeAlphabetText };
|