@tscircuit/3d-viewer 0.0.459 → 0.0.460
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 +21 -3
- 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.459",
|
|
28513
28513
|
main: "./dist/index.js",
|
|
28514
28514
|
module: "./dist/index.js",
|
|
28515
28515
|
type: "module",
|
|
@@ -34040,10 +34040,22 @@ function createSoldermaskTextureForLayer({
|
|
|
34040
34040
|
ctx.translate(0, canvasHeight);
|
|
34041
34041
|
ctx.scale(1, -1);
|
|
34042
34042
|
}
|
|
34043
|
-
ctx.fillStyle = soldermaskColor;
|
|
34044
|
-
ctx.fillRect(0, 0, canvasWidth, canvasHeight);
|
|
34045
34043
|
const canvasXFromPcb = (pcbX) => (pcbX - boardData.center.x + boardData.width / 2) * traceTextureResolution;
|
|
34046
34044
|
const canvasYFromPcb = (pcbY) => (-(pcbY - boardData.center.y) + boardData.height / 2) * traceTextureResolution;
|
|
34045
|
+
ctx.fillStyle = soldermaskColor;
|
|
34046
|
+
if (boardData.outline && boardData.outline.length >= 3) {
|
|
34047
|
+
ctx.beginPath();
|
|
34048
|
+
const firstPoint = boardData.outline[0];
|
|
34049
|
+
ctx.moveTo(canvasXFromPcb(firstPoint.x), canvasYFromPcb(firstPoint.y));
|
|
34050
|
+
for (let i = 1; i < boardData.outline.length; i++) {
|
|
34051
|
+
const point2 = boardData.outline[i];
|
|
34052
|
+
ctx.lineTo(canvasXFromPcb(point2.x), canvasYFromPcb(point2.y));
|
|
34053
|
+
}
|
|
34054
|
+
ctx.closePath();
|
|
34055
|
+
ctx.fill();
|
|
34056
|
+
} else {
|
|
34057
|
+
ctx.fillRect(0, 0, canvasWidth, canvasHeight);
|
|
34058
|
+
}
|
|
34047
34059
|
ctx.globalCompositeOperation = "destination-out";
|
|
34048
34060
|
ctx.fillStyle = "black";
|
|
34049
34061
|
const pcbSmtPads = su13(circuitJson).pcb_smtpad.list();
|
|
@@ -34065,6 +34077,12 @@ function createSoldermaskTextureForLayer({
|
|
|
34065
34077
|
return;
|
|
34066
34078
|
}
|
|
34067
34079
|
if (pad2.x === void 0 || pad2.y === void 0) return;
|
|
34080
|
+
if (Number.isNaN(pad2.x) || Number.isNaN(pad2.y)) {
|
|
34081
|
+
console.warn(
|
|
34082
|
+
`[soldermask-texture] Skipping pad ${pad2.pcb_smtpad_id} with NaN coordinates`
|
|
34083
|
+
);
|
|
34084
|
+
return;
|
|
34085
|
+
}
|
|
34068
34086
|
const x = pad2.x;
|
|
34069
34087
|
const y = pad2.y;
|
|
34070
34088
|
const canvasX = canvasXFromPcb(x);
|