@tscircuit/3d-viewer 0.0.452 → 0.0.454
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 +58 -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.453",
|
|
28513
28513
|
main: "./dist/index.js",
|
|
28514
28514
|
module: "./dist/index.js",
|
|
28515
28515
|
type: "module",
|
|
@@ -34016,6 +34016,47 @@ function createSoldermaskTextureForLayer({
|
|
|
34016
34016
|
const width10 = (hole.outer_width ?? hole.outer_diameter ?? hole.hole_width) * traceTextureResolution;
|
|
34017
34017
|
const height10 = (hole.outer_height ?? hole.outer_diameter ?? hole.hole_height) * traceTextureResolution;
|
|
34018
34018
|
const radius = Math.min(width10, height10) / 2;
|
|
34019
|
+
let rotation2 = hole.ccw_rotation || 0;
|
|
34020
|
+
if (rotation2) {
|
|
34021
|
+
rotation2 = -rotation2;
|
|
34022
|
+
}
|
|
34023
|
+
if (rotation2) {
|
|
34024
|
+
ctx.save();
|
|
34025
|
+
ctx.translate(canvasX, canvasY);
|
|
34026
|
+
ctx.rotate(rotation2 * Math.PI / 180);
|
|
34027
|
+
ctx.beginPath();
|
|
34028
|
+
ctx.roundRect(-width10 / 2, -height10 / 2, width10, height10, radius);
|
|
34029
|
+
ctx.fill();
|
|
34030
|
+
ctx.restore();
|
|
34031
|
+
} else {
|
|
34032
|
+
ctx.beginPath();
|
|
34033
|
+
ctx.roundRect(
|
|
34034
|
+
canvasX - width10 / 2,
|
|
34035
|
+
canvasY - height10 / 2,
|
|
34036
|
+
width10,
|
|
34037
|
+
height10,
|
|
34038
|
+
radius
|
|
34039
|
+
);
|
|
34040
|
+
ctx.fill();
|
|
34041
|
+
}
|
|
34042
|
+
}
|
|
34043
|
+
});
|
|
34044
|
+
const pcbHoles = su13(circuitJson).pcb_hole.list();
|
|
34045
|
+
pcbHoles.forEach((hole) => {
|
|
34046
|
+
const x = hole.x;
|
|
34047
|
+
const y = hole.y;
|
|
34048
|
+
const canvasX = canvasXFromPcb(x);
|
|
34049
|
+
const canvasY = canvasYFromPcb(y);
|
|
34050
|
+
const holeShape = hole.hole_shape || hole.shape;
|
|
34051
|
+
if (holeShape === "circle" && typeof hole.hole_diameter === "number") {
|
|
34052
|
+
const canvasRadius = hole.hole_diameter / 2 * traceTextureResolution;
|
|
34053
|
+
ctx.beginPath();
|
|
34054
|
+
ctx.arc(canvasX, canvasY, canvasRadius, 0, 2 * Math.PI);
|
|
34055
|
+
ctx.fill();
|
|
34056
|
+
} else if (holeShape === "pill" && typeof hole.hole_width === "number" && typeof hole.hole_height === "number") {
|
|
34057
|
+
const width10 = hole.hole_width * traceTextureResolution;
|
|
34058
|
+
const height10 = hole.hole_height * traceTextureResolution;
|
|
34059
|
+
const radius = Math.min(width10, height10) / 2;
|
|
34019
34060
|
ctx.beginPath();
|
|
34020
34061
|
ctx.roundRect(
|
|
34021
34062
|
canvasX - width10 / 2,
|
|
@@ -34025,6 +34066,22 @@ function createSoldermaskTextureForLayer({
|
|
|
34025
34066
|
radius
|
|
34026
34067
|
);
|
|
34027
34068
|
ctx.fill();
|
|
34069
|
+
} else if (holeShape === "rotated_pill" && typeof hole.hole_width === "number" && typeof hole.hole_height === "number") {
|
|
34070
|
+
const width10 = hole.hole_width * traceTextureResolution;
|
|
34071
|
+
const height10 = hole.hole_height * traceTextureResolution;
|
|
34072
|
+
const radius = Math.min(width10, height10) / 2;
|
|
34073
|
+
const rotation2 = (hole.ccw_rotation || 0) * (Math.PI / 180);
|
|
34074
|
+
ctx.save();
|
|
34075
|
+
ctx.translate(canvasX, canvasY);
|
|
34076
|
+
if (layer === "bottom") {
|
|
34077
|
+
ctx.rotate(-rotation2);
|
|
34078
|
+
} else {
|
|
34079
|
+
ctx.rotate(rotation2);
|
|
34080
|
+
}
|
|
34081
|
+
ctx.beginPath();
|
|
34082
|
+
ctx.roundRect(-width10 / 2, -height10 / 2, width10, height10, radius);
|
|
34083
|
+
ctx.fill();
|
|
34084
|
+
ctx.restore();
|
|
34028
34085
|
}
|
|
34029
34086
|
});
|
|
34030
34087
|
const pcbCopperPours = su13(circuitJson).pcb_copper_pour.list();
|