@tscircuit/pcb-viewer 1.11.306 → 1.11.307
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 +408 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7546,6 +7546,333 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
7546
7546
|
});
|
|
7547
7547
|
return primitives;
|
|
7548
7548
|
}
|
|
7549
|
+
case "pcb_plated_hole": {
|
|
7550
|
+
if (element.shape === "circle") {
|
|
7551
|
+
const { x, y, hole_diameter, outer_diameter } = element;
|
|
7552
|
+
return [
|
|
7553
|
+
{
|
|
7554
|
+
_pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
|
|
7555
|
+
pcb_drawing_type: "circle",
|
|
7556
|
+
x,
|
|
7557
|
+
y,
|
|
7558
|
+
r: outer_diameter / 2,
|
|
7559
|
+
// TODO support layer on pcb_plated_hole
|
|
7560
|
+
layer: "top",
|
|
7561
|
+
_element: element,
|
|
7562
|
+
_parent_pcb_component,
|
|
7563
|
+
_parent_source_component,
|
|
7564
|
+
_source_port
|
|
7565
|
+
},
|
|
7566
|
+
{
|
|
7567
|
+
_pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
|
|
7568
|
+
pcb_drawing_type: "circle",
|
|
7569
|
+
x,
|
|
7570
|
+
y,
|
|
7571
|
+
r: hole_diameter / 2,
|
|
7572
|
+
// TODO support layer on pcb_plated_hole
|
|
7573
|
+
layer: "drill",
|
|
7574
|
+
_element: element
|
|
7575
|
+
// double highlights are annoying
|
|
7576
|
+
// _element: element,
|
|
7577
|
+
}
|
|
7578
|
+
];
|
|
7579
|
+
} else if (element.shape === "oval") {
|
|
7580
|
+
const { x, y, outer_height, outer_width, hole_height, hole_width } = element;
|
|
7581
|
+
return [
|
|
7582
|
+
{
|
|
7583
|
+
_pcb_drawing_object_id: `oval_${globalPcbDrawingObjectCount++}`,
|
|
7584
|
+
pcb_drawing_type: "oval",
|
|
7585
|
+
x,
|
|
7586
|
+
y,
|
|
7587
|
+
rX: outer_width / 2,
|
|
7588
|
+
rY: outer_height / 2,
|
|
7589
|
+
layer: "top",
|
|
7590
|
+
_element: element,
|
|
7591
|
+
_parent_pcb_component,
|
|
7592
|
+
_parent_source_component,
|
|
7593
|
+
_source_port
|
|
7594
|
+
},
|
|
7595
|
+
{
|
|
7596
|
+
_pcb_drawing_object_id: `oval_${globalPcbDrawingObjectCount++}`,
|
|
7597
|
+
_element: element,
|
|
7598
|
+
pcb_drawing_type: "oval",
|
|
7599
|
+
x,
|
|
7600
|
+
y,
|
|
7601
|
+
rX: hole_width / 2,
|
|
7602
|
+
rY: hole_height / 2,
|
|
7603
|
+
layer: "drill"
|
|
7604
|
+
}
|
|
7605
|
+
];
|
|
7606
|
+
} else if (element.shape === "pill") {
|
|
7607
|
+
const { x, y, outer_height, outer_width, hole_height, hole_width } = element;
|
|
7608
|
+
return [
|
|
7609
|
+
{
|
|
7610
|
+
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
7611
|
+
pcb_drawing_type: "pill",
|
|
7612
|
+
x,
|
|
7613
|
+
y,
|
|
7614
|
+
w: outer_width,
|
|
7615
|
+
h: outer_height,
|
|
7616
|
+
layer: "top",
|
|
7617
|
+
_element: element,
|
|
7618
|
+
_parent_pcb_component,
|
|
7619
|
+
_parent_source_component,
|
|
7620
|
+
_source_port,
|
|
7621
|
+
ccw_rotation: element.ccw_rotation
|
|
7622
|
+
},
|
|
7623
|
+
{
|
|
7624
|
+
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
7625
|
+
_element: element,
|
|
7626
|
+
pcb_drawing_type: "pill",
|
|
7627
|
+
x,
|
|
7628
|
+
y,
|
|
7629
|
+
w: hole_width,
|
|
7630
|
+
h: hole_height,
|
|
7631
|
+
layer: "drill",
|
|
7632
|
+
ccw_rotation: element.ccw_rotation
|
|
7633
|
+
}
|
|
7634
|
+
];
|
|
7635
|
+
} else if (element.shape === "circular_hole_with_rect_pad") {
|
|
7636
|
+
const {
|
|
7637
|
+
x,
|
|
7638
|
+
y,
|
|
7639
|
+
hole_diameter,
|
|
7640
|
+
rect_pad_width,
|
|
7641
|
+
rect_pad_height,
|
|
7642
|
+
rect_border_radius,
|
|
7643
|
+
hole_offset_x,
|
|
7644
|
+
hole_offset_y
|
|
7645
|
+
} = element;
|
|
7646
|
+
const parsed_hole_offset_x = distance2.parse(hole_offset_x ?? 0);
|
|
7647
|
+
const parsed_hole_offset_y = distance2.parse(hole_offset_y ?? 0);
|
|
7648
|
+
return [
|
|
7649
|
+
{
|
|
7650
|
+
_pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
|
|
7651
|
+
pcb_drawing_type: "rect",
|
|
7652
|
+
x,
|
|
7653
|
+
y,
|
|
7654
|
+
w: rect_pad_width,
|
|
7655
|
+
h: rect_pad_height,
|
|
7656
|
+
layer: "top",
|
|
7657
|
+
_element: element,
|
|
7658
|
+
_parent_pcb_component,
|
|
7659
|
+
_parent_source_component,
|
|
7660
|
+
_source_port,
|
|
7661
|
+
roundness: rect_border_radius
|
|
7662
|
+
},
|
|
7663
|
+
{
|
|
7664
|
+
_pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
|
|
7665
|
+
pcb_drawing_type: "rect",
|
|
7666
|
+
x,
|
|
7667
|
+
y,
|
|
7668
|
+
w: rect_pad_width,
|
|
7669
|
+
h: rect_pad_height,
|
|
7670
|
+
layer: "bottom",
|
|
7671
|
+
_element: element,
|
|
7672
|
+
_parent_pcb_component,
|
|
7673
|
+
_parent_source_component,
|
|
7674
|
+
_source_port,
|
|
7675
|
+
roundness: rect_border_radius
|
|
7676
|
+
},
|
|
7677
|
+
{
|
|
7678
|
+
_pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
|
|
7679
|
+
_element: element,
|
|
7680
|
+
pcb_drawing_type: "circle",
|
|
7681
|
+
x: x + parsed_hole_offset_x,
|
|
7682
|
+
y: y + parsed_hole_offset_y,
|
|
7683
|
+
r: hole_diameter / 2,
|
|
7684
|
+
layer: "drill"
|
|
7685
|
+
}
|
|
7686
|
+
];
|
|
7687
|
+
} else if (element.shape === "pill_hole_with_rect_pad") {
|
|
7688
|
+
const {
|
|
7689
|
+
x,
|
|
7690
|
+
y,
|
|
7691
|
+
hole_width,
|
|
7692
|
+
hole_height,
|
|
7693
|
+
rect_pad_width,
|
|
7694
|
+
rect_pad_height,
|
|
7695
|
+
rect_border_radius
|
|
7696
|
+
} = element;
|
|
7697
|
+
return [
|
|
7698
|
+
{
|
|
7699
|
+
_pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
|
|
7700
|
+
pcb_drawing_type: "rect",
|
|
7701
|
+
x,
|
|
7702
|
+
y,
|
|
7703
|
+
w: rect_pad_width,
|
|
7704
|
+
h: rect_pad_height,
|
|
7705
|
+
layer: "top",
|
|
7706
|
+
_element: element,
|
|
7707
|
+
_parent_pcb_component,
|
|
7708
|
+
_parent_source_component,
|
|
7709
|
+
_source_port,
|
|
7710
|
+
roundness: rect_border_radius
|
|
7711
|
+
},
|
|
7712
|
+
{
|
|
7713
|
+
_pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
|
|
7714
|
+
pcb_drawing_type: "rect",
|
|
7715
|
+
x,
|
|
7716
|
+
y,
|
|
7717
|
+
w: rect_pad_width,
|
|
7718
|
+
h: rect_pad_height,
|
|
7719
|
+
layer: "bottom",
|
|
7720
|
+
_element: element,
|
|
7721
|
+
_parent_pcb_component,
|
|
7722
|
+
_parent_source_component,
|
|
7723
|
+
_source_port,
|
|
7724
|
+
roundness: rect_border_radius
|
|
7725
|
+
},
|
|
7726
|
+
{
|
|
7727
|
+
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
7728
|
+
_element: element,
|
|
7729
|
+
pcb_drawing_type: "pill",
|
|
7730
|
+
x,
|
|
7731
|
+
y,
|
|
7732
|
+
w: hole_width,
|
|
7733
|
+
h: hole_height,
|
|
7734
|
+
layer: "drill"
|
|
7735
|
+
}
|
|
7736
|
+
];
|
|
7737
|
+
} else if (element.shape === "rotated_pill_hole_with_rect_pad") {
|
|
7738
|
+
const {
|
|
7739
|
+
x,
|
|
7740
|
+
y,
|
|
7741
|
+
hole_width,
|
|
7742
|
+
hole_height,
|
|
7743
|
+
hole_ccw_rotation,
|
|
7744
|
+
rect_pad_width,
|
|
7745
|
+
rect_pad_height,
|
|
7746
|
+
rect_ccw_rotation,
|
|
7747
|
+
rect_border_radius
|
|
7748
|
+
} = element;
|
|
7749
|
+
return [
|
|
7750
|
+
{
|
|
7751
|
+
_pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
|
|
7752
|
+
pcb_drawing_type: "rect",
|
|
7753
|
+
x,
|
|
7754
|
+
y,
|
|
7755
|
+
w: rect_pad_width,
|
|
7756
|
+
h: rect_pad_height,
|
|
7757
|
+
layer: "top",
|
|
7758
|
+
_element: element,
|
|
7759
|
+
_parent_pcb_component,
|
|
7760
|
+
_parent_source_component,
|
|
7761
|
+
_source_port,
|
|
7762
|
+
ccw_rotation: rect_ccw_rotation,
|
|
7763
|
+
roundness: rect_border_radius
|
|
7764
|
+
},
|
|
7765
|
+
{
|
|
7766
|
+
_pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
|
|
7767
|
+
pcb_drawing_type: "rect",
|
|
7768
|
+
x,
|
|
7769
|
+
y,
|
|
7770
|
+
w: rect_pad_width,
|
|
7771
|
+
h: rect_pad_height,
|
|
7772
|
+
layer: "bottom",
|
|
7773
|
+
_element: element,
|
|
7774
|
+
_parent_pcb_component,
|
|
7775
|
+
_parent_source_component,
|
|
7776
|
+
_source_port,
|
|
7777
|
+
ccw_rotation: rect_ccw_rotation,
|
|
7778
|
+
roundness: rect_border_radius
|
|
7779
|
+
},
|
|
7780
|
+
{
|
|
7781
|
+
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
7782
|
+
_element: element,
|
|
7783
|
+
pcb_drawing_type: "pill",
|
|
7784
|
+
x,
|
|
7785
|
+
y,
|
|
7786
|
+
w: hole_width,
|
|
7787
|
+
h: hole_height,
|
|
7788
|
+
layer: "drill",
|
|
7789
|
+
ccw_rotation: hole_ccw_rotation
|
|
7790
|
+
}
|
|
7791
|
+
];
|
|
7792
|
+
} else if (element.shape === "hole_with_polygon_pad") {
|
|
7793
|
+
const {
|
|
7794
|
+
x,
|
|
7795
|
+
y,
|
|
7796
|
+
pad_outline,
|
|
7797
|
+
hole_shape,
|
|
7798
|
+
hole_diameter,
|
|
7799
|
+
hole_width,
|
|
7800
|
+
hole_height,
|
|
7801
|
+
layers,
|
|
7802
|
+
hole_offset_x,
|
|
7803
|
+
hole_offset_y
|
|
7804
|
+
} = element;
|
|
7805
|
+
const parsed_hole_offset_x = distance2.parse(hole_offset_x ?? 0);
|
|
7806
|
+
const parsed_hole_offset_y = distance2.parse(hole_offset_y ?? 0);
|
|
7807
|
+
const pcb_outline = pad_outline;
|
|
7808
|
+
const padPrimitives = [];
|
|
7809
|
+
if (pcb_outline && Array.isArray(pcb_outline)) {
|
|
7810
|
+
const translatedPoints = normalizePolygonPoints(pcb_outline).map(
|
|
7811
|
+
(p) => ({ x: p.x + x, y: p.y + y })
|
|
7812
|
+
);
|
|
7813
|
+
for (const layer of layers || ["top", "bottom"]) {
|
|
7814
|
+
padPrimitives.push({
|
|
7815
|
+
_pcb_drawing_object_id: `polygon_${globalPcbDrawingObjectCount++}`,
|
|
7816
|
+
pcb_drawing_type: "polygon",
|
|
7817
|
+
points: translatedPoints,
|
|
7818
|
+
layer,
|
|
7819
|
+
_element: element,
|
|
7820
|
+
_parent_pcb_component,
|
|
7821
|
+
_parent_source_component,
|
|
7822
|
+
_source_port
|
|
7823
|
+
});
|
|
7824
|
+
}
|
|
7825
|
+
}
|
|
7826
|
+
const holeCenter = {
|
|
7827
|
+
x: x + parsed_hole_offset_x,
|
|
7828
|
+
y: y + parsed_hole_offset_y
|
|
7829
|
+
};
|
|
7830
|
+
const holePrimitives = [];
|
|
7831
|
+
if (hole_shape === "circle") {
|
|
7832
|
+
holePrimitives.push({
|
|
7833
|
+
_pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
|
|
7834
|
+
pcb_drawing_type: "circle",
|
|
7835
|
+
x: holeCenter.x,
|
|
7836
|
+
y: holeCenter.y,
|
|
7837
|
+
r: (hole_diameter ?? 0) / 2,
|
|
7838
|
+
layer: "drill",
|
|
7839
|
+
_element: element,
|
|
7840
|
+
_parent_pcb_component,
|
|
7841
|
+
_parent_source_component
|
|
7842
|
+
});
|
|
7843
|
+
} else if (hole_shape === "oval") {
|
|
7844
|
+
holePrimitives.push({
|
|
7845
|
+
_pcb_drawing_object_id: `oval_${globalPcbDrawingObjectCount++}`,
|
|
7846
|
+
pcb_drawing_type: "oval",
|
|
7847
|
+
x: holeCenter.x,
|
|
7848
|
+
y: holeCenter.y,
|
|
7849
|
+
rX: (hole_width ?? 0) / 2,
|
|
7850
|
+
rY: (hole_height ?? 0) / 2,
|
|
7851
|
+
layer: "drill",
|
|
7852
|
+
_element: element,
|
|
7853
|
+
_parent_pcb_component,
|
|
7854
|
+
_parent_source_component
|
|
7855
|
+
});
|
|
7856
|
+
} else if (hole_shape === "pill" || hole_shape === "rotated_pill") {
|
|
7857
|
+
holePrimitives.push({
|
|
7858
|
+
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
7859
|
+
pcb_drawing_type: "pill",
|
|
7860
|
+
x: holeCenter.x,
|
|
7861
|
+
y: holeCenter.y,
|
|
7862
|
+
w: hole_width ?? 0,
|
|
7863
|
+
h: hole_height ?? 0,
|
|
7864
|
+
layer: "drill",
|
|
7865
|
+
_element: element,
|
|
7866
|
+
_parent_pcb_component,
|
|
7867
|
+
_parent_source_component,
|
|
7868
|
+
ccw_rotation: element.ccw_rotation
|
|
7869
|
+
});
|
|
7870
|
+
}
|
|
7871
|
+
return [...padPrimitives, ...holePrimitives];
|
|
7872
|
+
} else {
|
|
7873
|
+
return [];
|
|
7874
|
+
}
|
|
7875
|
+
}
|
|
7549
7876
|
case "pcb_copper_text": {
|
|
7550
7877
|
return convertPcbCopperTextToPrimitive(element, {
|
|
7551
7878
|
_parent_pcb_component,
|
|
@@ -8259,23 +8586,23 @@ var Drawer = class {
|
|
|
8259
8586
|
}
|
|
8260
8587
|
applyAperture() {
|
|
8261
8588
|
const { transform, aperture } = this;
|
|
8262
|
-
let { size, mode, color:
|
|
8589
|
+
let { size, mode, color: color4, fontSize, layer } = aperture;
|
|
8263
8590
|
if (!(layer in this.ctxLayerMap)) this.aperture.layer = "other";
|
|
8264
8591
|
const ctx = this.getLayerCtx();
|
|
8265
8592
|
if (!ctx) {
|
|
8266
8593
|
throw new Error(`No context for layer "${this.foregroundLayer}"`);
|
|
8267
8594
|
}
|
|
8268
|
-
if (!
|
|
8595
|
+
if (!color4) color4 = "undefined";
|
|
8269
8596
|
ctx.lineWidth = scaleOnly(transform, size);
|
|
8270
8597
|
ctx.lineCap = "round";
|
|
8271
8598
|
if (mode === "add") {
|
|
8272
8599
|
ctx.globalCompositeOperation = "source-over";
|
|
8273
|
-
let colorString = LAYER_NAME_TO_COLOR[
|
|
8600
|
+
let colorString = LAYER_NAME_TO_COLOR[color4.toLowerCase()];
|
|
8274
8601
|
if (!colorString)
|
|
8275
8602
|
try {
|
|
8276
|
-
colorString = colorParser(
|
|
8603
|
+
colorString = colorParser(color4).rgb().toString();
|
|
8277
8604
|
} catch (error) {
|
|
8278
|
-
console.warn(`Invalid color format: '${
|
|
8605
|
+
console.warn(`Invalid color format: '${color4}'`);
|
|
8279
8606
|
colorString = "white";
|
|
8280
8607
|
}
|
|
8281
8608
|
ctx.fillStyle = colorString;
|
|
@@ -8804,24 +9131,65 @@ function drawSilkscreenElementsForLayer(canvas, elements, layers, realToCanvasMa
|
|
|
8804
9131
|
}
|
|
8805
9132
|
|
|
8806
9133
|
// src/lib/draw-plated-hole.ts
|
|
8807
|
-
import {
|
|
9134
|
+
import {
|
|
9135
|
+
DEFAULT_PCB_COLOR_MAP as DEFAULT_PCB_COLOR_MAP2,
|
|
9136
|
+
CircuitToCanvasDrawer as CircuitToCanvasDrawer2
|
|
9137
|
+
} from "circuit-to-canvas";
|
|
9138
|
+
import color2 from "color";
|
|
9139
|
+
var HOVER_COLOR_MAP = {
|
|
9140
|
+
...DEFAULT_PCB_COLOR_MAP2,
|
|
9141
|
+
copper: {
|
|
9142
|
+
...DEFAULT_PCB_COLOR_MAP2.copper,
|
|
9143
|
+
top: color2(colors_default.board.pad_front).lighten(0.5).toString(),
|
|
9144
|
+
bottom: color2(colors_default.board.pad_back).lighten(0.5).toString()
|
|
9145
|
+
}
|
|
9146
|
+
};
|
|
8808
9147
|
function isPlatedHole(element) {
|
|
8809
9148
|
return element.type === "pcb_plated_hole";
|
|
8810
9149
|
}
|
|
8811
|
-
function drawPlatedHolePads(
|
|
8812
|
-
|
|
8813
|
-
|
|
9150
|
+
function drawPlatedHolePads({
|
|
9151
|
+
canvas,
|
|
9152
|
+
elements,
|
|
9153
|
+
layers,
|
|
9154
|
+
realToCanvasMat,
|
|
9155
|
+
primitives
|
|
9156
|
+
}) {
|
|
8814
9157
|
const platedHoleElements = elements.filter(isPlatedHole);
|
|
8815
|
-
|
|
9158
|
+
if (platedHoleElements.length === 0) return;
|
|
9159
|
+
const highlightedElementIds = /* @__PURE__ */ new Set();
|
|
9160
|
+
if (primitives) {
|
|
9161
|
+
for (const primitive of primitives) {
|
|
9162
|
+
if ((primitive.is_mouse_over || primitive.is_in_highlighted_net) && primitive._element?.type === "pcb_plated_hole") {
|
|
9163
|
+
highlightedElementIds.add(primitive._element.pcb_plated_hole_id);
|
|
9164
|
+
}
|
|
9165
|
+
}
|
|
9166
|
+
}
|
|
9167
|
+
const highlightedElements = platedHoleElements.filter(
|
|
9168
|
+
(element) => highlightedElementIds.has(element.pcb_plated_hole_id)
|
|
9169
|
+
);
|
|
9170
|
+
const nonHighlightedElements = platedHoleElements.filter(
|
|
9171
|
+
(element) => !highlightedElementIds.has(element.pcb_plated_hole_id)
|
|
9172
|
+
);
|
|
9173
|
+
if (nonHighlightedElements.length > 0) {
|
|
9174
|
+
const drawer = new CircuitToCanvasDrawer2(canvas);
|
|
9175
|
+
drawer.realToCanvasMat = realToCanvasMat;
|
|
9176
|
+
drawer.drawElements(nonHighlightedElements, { layers });
|
|
9177
|
+
}
|
|
9178
|
+
if (highlightedElements.length > 0) {
|
|
9179
|
+
const highlightDrawer = new CircuitToCanvasDrawer2(canvas);
|
|
9180
|
+
highlightDrawer.configure({ colorOverrides: HOVER_COLOR_MAP });
|
|
9181
|
+
highlightDrawer.realToCanvasMat = realToCanvasMat;
|
|
9182
|
+
highlightDrawer.drawElements(highlightedElements, { layers });
|
|
9183
|
+
}
|
|
8816
9184
|
}
|
|
8817
9185
|
|
|
8818
9186
|
// src/lib/draw-fabrication-note.ts
|
|
8819
9187
|
import {
|
|
8820
|
-
DEFAULT_PCB_COLOR_MAP as
|
|
9188
|
+
DEFAULT_PCB_COLOR_MAP as DEFAULT_PCB_COLOR_MAP3,
|
|
8821
9189
|
CircuitToCanvasDrawer as CircuitToCanvasDrawer3
|
|
8822
9190
|
} from "circuit-to-canvas";
|
|
8823
9191
|
var PCB_VIEWER_COLOR_MAP2 = {
|
|
8824
|
-
...
|
|
9192
|
+
...DEFAULT_PCB_COLOR_MAP3,
|
|
8825
9193
|
silkscreen: {
|
|
8826
9194
|
top: colors_default.board.f_fab,
|
|
8827
9195
|
bottom: colors_default.board.b_fab
|
|
@@ -8892,16 +9260,16 @@ function drawPcbCutoutElementsForLayer(canvas, elements, layers, realToCanvasMat
|
|
|
8892
9260
|
|
|
8893
9261
|
// src/lib/draw-pcb-smtpad.ts
|
|
8894
9262
|
import {
|
|
8895
|
-
DEFAULT_PCB_COLOR_MAP as
|
|
9263
|
+
DEFAULT_PCB_COLOR_MAP as DEFAULT_PCB_COLOR_MAP5,
|
|
8896
9264
|
CircuitToCanvasDrawer as CircuitToCanvasDrawer8
|
|
8897
9265
|
} from "circuit-to-canvas";
|
|
8898
|
-
import
|
|
8899
|
-
var
|
|
8900
|
-
...
|
|
9266
|
+
import color3 from "color";
|
|
9267
|
+
var HOVER_COLOR_MAP2 = {
|
|
9268
|
+
...DEFAULT_PCB_COLOR_MAP5,
|
|
8901
9269
|
copper: {
|
|
8902
|
-
...
|
|
8903
|
-
top:
|
|
8904
|
-
bottom:
|
|
9270
|
+
...DEFAULT_PCB_COLOR_MAP5.copper,
|
|
9271
|
+
top: color3(colors_default.board.pad_front).lighten(0.5).toString(),
|
|
9272
|
+
bottom: color3(colors_default.board.pad_back).lighten(0.5).toString()
|
|
8905
9273
|
}
|
|
8906
9274
|
};
|
|
8907
9275
|
function isPcbSmtPad(element) {
|
|
@@ -8944,7 +9312,7 @@ function drawPcbSmtPadElementsForLayer({
|
|
|
8944
9312
|
}
|
|
8945
9313
|
if (highlightedElements.length > 0) {
|
|
8946
9314
|
const highlightDrawer = new CircuitToCanvasDrawer8(canvas);
|
|
8947
|
-
highlightDrawer.configure({ colorOverrides:
|
|
9315
|
+
highlightDrawer.configure({ colorOverrides: HOVER_COLOR_MAP2 });
|
|
8948
9316
|
highlightDrawer.realToCanvasMat = realToCanvasMat;
|
|
8949
9317
|
highlightDrawer.drawElements(highlightedElements, { layers: [] });
|
|
8950
9318
|
}
|
|
@@ -9004,16 +9372,28 @@ var CanvasPrimitiveRenderer = ({
|
|
|
9004
9372
|
if (transform) drawer.transform = transform;
|
|
9005
9373
|
drawer.clear();
|
|
9006
9374
|
drawer.foregroundLayer = selectedLayer;
|
|
9007
|
-
const filteredPrimitives = primitives.filter((p) => isShowingSolderMask || !p.layer?.includes("soldermask")).filter((p) => p.layer !== "board").filter((p) => p._element?.type !== "pcb_smtpad");
|
|
9375
|
+
const filteredPrimitives = primitives.filter((p) => isShowingSolderMask || !p.layer?.includes("soldermask")).filter((p) => p.layer !== "board").filter((p) => p._element?.type !== "pcb_smtpad").filter((p) => p._element?.type !== "pcb_plated_hole");
|
|
9008
9376
|
drawPrimitives(drawer, filteredPrimitives);
|
|
9009
9377
|
if (transform) {
|
|
9010
9378
|
const topCanvas = canvasRefs.current.top;
|
|
9011
9379
|
if (topCanvas) {
|
|
9012
|
-
drawPlatedHolePads(
|
|
9380
|
+
drawPlatedHolePads({
|
|
9381
|
+
canvas: topCanvas,
|
|
9382
|
+
elements,
|
|
9383
|
+
layers: ["top_copper"],
|
|
9384
|
+
realToCanvasMat: transform,
|
|
9385
|
+
primitives
|
|
9386
|
+
});
|
|
9013
9387
|
}
|
|
9014
9388
|
const bottomCanvas = canvasRefs.current.bottom;
|
|
9015
9389
|
if (bottomCanvas) {
|
|
9016
|
-
drawPlatedHolePads(
|
|
9390
|
+
drawPlatedHolePads({
|
|
9391
|
+
canvas: bottomCanvas,
|
|
9392
|
+
elements,
|
|
9393
|
+
layers: ["bottom_copper"],
|
|
9394
|
+
realToCanvasMat: transform,
|
|
9395
|
+
primitives
|
|
9396
|
+
});
|
|
9017
9397
|
}
|
|
9018
9398
|
if (topCanvas) {
|
|
9019
9399
|
drawPcbSmtPadElementsForLayer({
|
|
@@ -11704,7 +12084,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
11704
12084
|
];
|
|
11705
12085
|
const si = primitive.same_space_index ?? 0;
|
|
11706
12086
|
const sip = 26;
|
|
11707
|
-
const
|
|
12087
|
+
const color4 = layerColorHightlightMap[primitive?._element?.layer] ?? "red";
|
|
11708
12088
|
let rotation = 0;
|
|
11709
12089
|
if (primitiveElement.type === "pcb_smtpad" && primitiveElement?.shape === "rotated_rect") {
|
|
11710
12090
|
rotation = primitiveElement?.ccw_rotation ?? 0;
|
|
@@ -11726,7 +12106,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
11726
12106
|
position: "absolute",
|
|
11727
12107
|
left: mousePos.x,
|
|
11728
12108
|
top: yOffset,
|
|
11729
|
-
color:
|
|
12109
|
+
color: color4,
|
|
11730
12110
|
pointerEvents: "none",
|
|
11731
12111
|
transform: "translateX(-50%)"
|
|
11732
12112
|
},
|
|
@@ -11766,7 +12146,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
11766
12146
|
top: y - h / 2 - 8,
|
|
11767
12147
|
width: w + 16,
|
|
11768
12148
|
height: h + 16,
|
|
11769
|
-
color:
|
|
12149
|
+
color: color4,
|
|
11770
12150
|
transform: `rotate(${-rotation}deg)`,
|
|
11771
12151
|
transformOrigin: "center center"
|
|
11772
12152
|
},
|
|
@@ -11782,7 +12162,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
11782
12162
|
height: finalState ? `calc(100% + ${sip * 2 * si}px)` : "100%",
|
|
11783
12163
|
marginLeft: finalState ? `${-sip * si}px` : 0,
|
|
11784
12164
|
marginTop: finalState ? `${-sip * si}px` : 0,
|
|
11785
|
-
border: `1px solid ${
|
|
12165
|
+
border: `1px solid ${color4}`,
|
|
11786
12166
|
opacity: finalState ? 1 : si === 0 ? 1 : 0,
|
|
11787
12167
|
transition: "width 0.2s, height 0.2s, margin-left 0.2s, margin-top 0.2s, opacity 0.2s"
|
|
11788
12168
|
},
|
|
@@ -13141,7 +13521,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
13141
13521
|
// package.json
|
|
13142
13522
|
var package_default = {
|
|
13143
13523
|
name: "@tscircuit/pcb-viewer",
|
|
13144
|
-
version: "1.11.
|
|
13524
|
+
version: "1.11.306",
|
|
13145
13525
|
main: "dist/index.js",
|
|
13146
13526
|
type: "module",
|
|
13147
13527
|
repository: "tscircuit/pcb-viewer",
|