@tscircuit/3d-viewer 0.0.459 → 0.0.461
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 +35 -30
- 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.460",
|
|
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);
|
|
@@ -34124,8 +34142,7 @@ function createSoldermaskTextureForLayer({
|
|
|
34124
34142
|
rawRadius
|
|
34125
34143
|
) * traceTextureResolution;
|
|
34126
34144
|
const ccwRotation = pad2.ccw_rotation || 0;
|
|
34127
|
-
const
|
|
34128
|
-
const rotation2 = layer === "bottom" ? -rotationRadians : rotationRadians;
|
|
34145
|
+
const rotation2 = -ccwRotation * (Math.PI / 180);
|
|
34129
34146
|
ctx.save();
|
|
34130
34147
|
ctx.translate(canvasX, canvasY);
|
|
34131
34148
|
ctx.rotate(rotation2);
|
|
@@ -34161,10 +34178,8 @@ function createSoldermaskTextureForLayer({
|
|
|
34161
34178
|
const width10 = (hole.outer_width ?? hole.outer_diameter ?? hole.hole_width) * traceTextureResolution;
|
|
34162
34179
|
const height10 = (hole.outer_height ?? hole.outer_diameter ?? hole.hole_height) * traceTextureResolution;
|
|
34163
34180
|
const radius = Math.min(width10, height10) / 2;
|
|
34164
|
-
|
|
34165
|
-
|
|
34166
|
-
rotation2 = -rotation2;
|
|
34167
|
-
}
|
|
34181
|
+
const ccwRotationDeg = hole.ccw_rotation || 0;
|
|
34182
|
+
const rotation2 = -ccwRotationDeg;
|
|
34168
34183
|
if (rotation2) {
|
|
34169
34184
|
ctx.save();
|
|
34170
34185
|
ctx.translate(canvasX, canvasY);
|
|
@@ -34189,10 +34204,8 @@ function createSoldermaskTextureForLayer({
|
|
|
34189
34204
|
const height10 = (hole.outer_height ?? hole.outer_diameter ?? hole.hole_height) * traceTextureResolution;
|
|
34190
34205
|
const radiusX = width10 / 2;
|
|
34191
34206
|
const radiusY = height10 / 2;
|
|
34192
|
-
|
|
34193
|
-
|
|
34194
|
-
rotation2 = -rotation2;
|
|
34195
|
-
}
|
|
34207
|
+
const ccwRotationDeg = hole.ccw_rotation || 0;
|
|
34208
|
+
const rotation2 = -ccwRotationDeg;
|
|
34196
34209
|
if (rotation2) {
|
|
34197
34210
|
ctx.save();
|
|
34198
34211
|
ctx.translate(canvasX, canvasY);
|
|
@@ -34216,10 +34229,8 @@ function createSoldermaskTextureForLayer({
|
|
|
34216
34229
|
const width10 = (hole.outer_width ?? hole.outer_diameter ?? hole.hole_width) * traceTextureResolution;
|
|
34217
34230
|
const height10 = (hole.outer_height ?? hole.outer_diameter ?? hole.hole_height) * traceTextureResolution;
|
|
34218
34231
|
const radius = Math.min(width10, height10) / 2;
|
|
34219
|
-
|
|
34220
|
-
|
|
34221
|
-
rotation2 = -rotation2;
|
|
34222
|
-
}
|
|
34232
|
+
const ccwRotationDeg = hole.ccw_rotation || 0;
|
|
34233
|
+
const rotation2 = -ccwRotationDeg;
|
|
34223
34234
|
if (rotation2) {
|
|
34224
34235
|
ctx.save();
|
|
34225
34236
|
ctx.translate(adjustedCanvasX, adjustedCanvasY);
|
|
@@ -34244,10 +34255,8 @@ function createSoldermaskTextureForLayer({
|
|
|
34244
34255
|
const height10 = (hole.outer_height ?? hole.outer_diameter ?? hole.hole_height) * traceTextureResolution;
|
|
34245
34256
|
const radiusX = width10 / 2;
|
|
34246
34257
|
const radiusY = height10 / 2;
|
|
34247
|
-
|
|
34248
|
-
|
|
34249
|
-
rotation2 = -rotation2;
|
|
34250
|
-
}
|
|
34258
|
+
const ccwRotationDeg = hole.ccw_rotation || 0;
|
|
34259
|
+
const rotation2 = -ccwRotationDeg;
|
|
34251
34260
|
if (rotation2) {
|
|
34252
34261
|
ctx.save();
|
|
34253
34262
|
ctx.translate(adjustedCanvasX, adjustedCanvasY);
|
|
@@ -34312,10 +34321,8 @@ function createSoldermaskTextureForLayer({
|
|
|
34312
34321
|
hole.rect_pad_height ?? hole.hole_height ?? 0,
|
|
34313
34322
|
rawRadius
|
|
34314
34323
|
) * traceTextureResolution;
|
|
34315
|
-
|
|
34316
|
-
|
|
34317
|
-
rotation2 = -rotation2;
|
|
34318
|
-
}
|
|
34324
|
+
const ccwRotationDeg = hole.ccw_rotation || 0;
|
|
34325
|
+
const rotation2 = -ccwRotationDeg;
|
|
34319
34326
|
if (rotation2) {
|
|
34320
34327
|
ctx.save();
|
|
34321
34328
|
ctx.translate(canvasX, canvasY);
|
|
@@ -34359,10 +34366,8 @@ function createSoldermaskTextureForLayer({
|
|
|
34359
34366
|
const width10 = hole.hole_width * traceTextureResolution;
|
|
34360
34367
|
const height10 = hole.hole_height * traceTextureResolution;
|
|
34361
34368
|
const radius = Math.min(width10, height10) / 2;
|
|
34362
|
-
|
|
34363
|
-
|
|
34364
|
-
rotation2 = -rotation2;
|
|
34365
|
-
}
|
|
34369
|
+
const ccwRotationDeg = hole.ccw_rotation || 0;
|
|
34370
|
+
const rotation2 = -ccwRotationDeg * (Math.PI / 180);
|
|
34366
34371
|
if (rotation2) {
|
|
34367
34372
|
ctx.save();
|
|
34368
34373
|
ctx.translate(canvasX, canvasY);
|
|
@@ -34426,7 +34431,7 @@ function createSoldermaskTextureForLayer({
|
|
|
34426
34431
|
if (cutout.rotation) {
|
|
34427
34432
|
ctx.save();
|
|
34428
34433
|
ctx.translate(canvasX, canvasY);
|
|
34429
|
-
const rotation2 =
|
|
34434
|
+
const rotation2 = -cutout.rotation * (Math.PI / 180);
|
|
34430
34435
|
ctx.rotate(rotation2);
|
|
34431
34436
|
if (borderRadius > 0) {
|
|
34432
34437
|
ctx.beginPath();
|