@tscircuit/3d-viewer 0.0.452 → 0.0.453
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 +44 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28509,7 +28509,7 @@ import * as THREE15 from "three";
|
|
|
28509
28509
|
// package.json
|
|
28510
28510
|
var package_default = {
|
|
28511
28511
|
name: "@tscircuit/3d-viewer",
|
|
28512
|
-
version: "0.0.
|
|
28512
|
+
version: "0.0.452",
|
|
28513
28513
|
main: "./dist/index.js",
|
|
28514
28514
|
module: "./dist/index.js",
|
|
28515
28515
|
type: "module",
|
|
@@ -34027,6 +34027,49 @@ function createSoldermaskTextureForLayer({
|
|
|
34027
34027
|
ctx.fill();
|
|
34028
34028
|
}
|
|
34029
34029
|
});
|
|
34030
|
+
const pcbHoles = su13(circuitJson).pcb_hole.list();
|
|
34031
|
+
pcbHoles.forEach((hole) => {
|
|
34032
|
+
const x = hole.x;
|
|
34033
|
+
const y = hole.y;
|
|
34034
|
+
const canvasX = canvasXFromPcb(x);
|
|
34035
|
+
const canvasY = canvasYFromPcb(y);
|
|
34036
|
+
const holeShape = hole.hole_shape || hole.shape;
|
|
34037
|
+
if (holeShape === "circle" && typeof hole.hole_diameter === "number") {
|
|
34038
|
+
const canvasRadius = hole.hole_diameter / 2 * traceTextureResolution;
|
|
34039
|
+
ctx.beginPath();
|
|
34040
|
+
ctx.arc(canvasX, canvasY, canvasRadius, 0, 2 * Math.PI);
|
|
34041
|
+
ctx.fill();
|
|
34042
|
+
} else if (holeShape === "pill" && typeof hole.hole_width === "number" && typeof hole.hole_height === "number") {
|
|
34043
|
+
const width10 = hole.hole_width * traceTextureResolution;
|
|
34044
|
+
const height10 = hole.hole_height * traceTextureResolution;
|
|
34045
|
+
const radius = Math.min(width10, height10) / 2;
|
|
34046
|
+
ctx.beginPath();
|
|
34047
|
+
ctx.roundRect(
|
|
34048
|
+
canvasX - width10 / 2,
|
|
34049
|
+
canvasY - height10 / 2,
|
|
34050
|
+
width10,
|
|
34051
|
+
height10,
|
|
34052
|
+
radius
|
|
34053
|
+
);
|
|
34054
|
+
ctx.fill();
|
|
34055
|
+
} else if (holeShape === "rotated_pill" && typeof hole.hole_width === "number" && typeof hole.hole_height === "number") {
|
|
34056
|
+
const width10 = hole.hole_width * traceTextureResolution;
|
|
34057
|
+
const height10 = hole.hole_height * traceTextureResolution;
|
|
34058
|
+
const radius = Math.min(width10, height10) / 2;
|
|
34059
|
+
const rotation2 = (hole.ccw_rotation || 0) * (Math.PI / 180);
|
|
34060
|
+
ctx.save();
|
|
34061
|
+
ctx.translate(canvasX, canvasY);
|
|
34062
|
+
if (layer === "bottom") {
|
|
34063
|
+
ctx.rotate(-rotation2);
|
|
34064
|
+
} else {
|
|
34065
|
+
ctx.rotate(rotation2);
|
|
34066
|
+
}
|
|
34067
|
+
ctx.beginPath();
|
|
34068
|
+
ctx.roundRect(-width10 / 2, -height10 / 2, width10, height10, radius);
|
|
34069
|
+
ctx.fill();
|
|
34070
|
+
ctx.restore();
|
|
34071
|
+
}
|
|
34072
|
+
});
|
|
34030
34073
|
const pcbCopperPours = su13(circuitJson).pcb_copper_pour.list();
|
|
34031
34074
|
pcbCopperPours.forEach((pour) => {
|
|
34032
34075
|
if (pour.layer !== layer) return;
|