@tscircuit/3d-viewer 0.0.455 → 0.0.457
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 +95 -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.456",
|
|
28513
28513
|
main: "./dist/index.js",
|
|
28514
28514
|
module: "./dist/index.js",
|
|
28515
28515
|
type: "module",
|
|
@@ -34115,12 +34115,12 @@ function createSoldermaskTextureForLayer({
|
|
|
34115
34115
|
ctx.beginPath();
|
|
34116
34116
|
ctx.arc(canvasX, canvasY, canvasRadius, 0, 2 * Math.PI);
|
|
34117
34117
|
ctx.fill();
|
|
34118
|
-
} else if (hole.shape === "pill"
|
|
34118
|
+
} else if (hole.shape === "pill") {
|
|
34119
34119
|
const width10 = (hole.outer_width ?? hole.outer_diameter ?? hole.hole_width) * traceTextureResolution;
|
|
34120
34120
|
const height10 = (hole.outer_height ?? hole.outer_diameter ?? hole.hole_height) * traceTextureResolution;
|
|
34121
34121
|
const radius = Math.min(width10, height10) / 2;
|
|
34122
34122
|
let rotation2 = hole.ccw_rotation || 0;
|
|
34123
|
-
if (
|
|
34123
|
+
if (layer === "bottom") {
|
|
34124
34124
|
rotation2 = -rotation2;
|
|
34125
34125
|
}
|
|
34126
34126
|
if (rotation2) {
|
|
@@ -34142,6 +34142,98 @@ function createSoldermaskTextureForLayer({
|
|
|
34142
34142
|
);
|
|
34143
34143
|
ctx.fill();
|
|
34144
34144
|
}
|
|
34145
|
+
} else if (hole.shape === "oval") {
|
|
34146
|
+
const width10 = (hole.outer_width ?? hole.outer_diameter ?? hole.hole_width) * traceTextureResolution;
|
|
34147
|
+
const height10 = (hole.outer_height ?? hole.outer_diameter ?? hole.hole_height) * traceTextureResolution;
|
|
34148
|
+
const radiusX = width10 / 2;
|
|
34149
|
+
const radiusY = height10 / 2;
|
|
34150
|
+
let rotation2 = hole.ccw_rotation || 0;
|
|
34151
|
+
if (layer === "bottom") {
|
|
34152
|
+
rotation2 = -rotation2;
|
|
34153
|
+
}
|
|
34154
|
+
if (rotation2) {
|
|
34155
|
+
ctx.save();
|
|
34156
|
+
ctx.translate(canvasX, canvasY);
|
|
34157
|
+
ctx.rotate(rotation2 * Math.PI / 180);
|
|
34158
|
+
ctx.beginPath();
|
|
34159
|
+
ctx.ellipse(0, 0, radiusX, radiusY, 0, 0, 2 * Math.PI);
|
|
34160
|
+
ctx.fill();
|
|
34161
|
+
ctx.restore();
|
|
34162
|
+
} else {
|
|
34163
|
+
ctx.beginPath();
|
|
34164
|
+
ctx.ellipse(canvasX, canvasY, radiusX, radiusY, 0, 0, 2 * Math.PI);
|
|
34165
|
+
ctx.fill();
|
|
34166
|
+
}
|
|
34167
|
+
} else if (hole.shape === "hole_with_polygon_pad") {
|
|
34168
|
+
const holeShape = hole.hole_shape || "circle";
|
|
34169
|
+
const holeOffsetX = hole.hole_offset_x || 0;
|
|
34170
|
+
const holeOffsetY = hole.hole_offset_y || 0;
|
|
34171
|
+
const adjustedCanvasX = canvasXFromPcb(hole.x + holeOffsetX);
|
|
34172
|
+
const adjustedCanvasY = canvasYFromPcb(hole.y + holeOffsetY);
|
|
34173
|
+
if (holeShape === "pill" || holeShape === "rotated_pill") {
|
|
34174
|
+
const width10 = (hole.outer_width ?? hole.outer_diameter ?? hole.hole_width) * traceTextureResolution;
|
|
34175
|
+
const height10 = (hole.outer_height ?? hole.outer_diameter ?? hole.hole_height) * traceTextureResolution;
|
|
34176
|
+
const radius = Math.min(width10, height10) / 2;
|
|
34177
|
+
let rotation2 = hole.ccw_rotation || 0;
|
|
34178
|
+
if (layer === "bottom") {
|
|
34179
|
+
rotation2 = -rotation2;
|
|
34180
|
+
}
|
|
34181
|
+
if (rotation2) {
|
|
34182
|
+
ctx.save();
|
|
34183
|
+
ctx.translate(adjustedCanvasX, adjustedCanvasY);
|
|
34184
|
+
ctx.rotate(rotation2 * Math.PI / 180);
|
|
34185
|
+
ctx.beginPath();
|
|
34186
|
+
ctx.roundRect(-width10 / 2, -height10 / 2, width10, height10, radius);
|
|
34187
|
+
ctx.fill();
|
|
34188
|
+
ctx.restore();
|
|
34189
|
+
} else {
|
|
34190
|
+
ctx.beginPath();
|
|
34191
|
+
ctx.roundRect(
|
|
34192
|
+
adjustedCanvasX - width10 / 2,
|
|
34193
|
+
adjustedCanvasY - height10 / 2,
|
|
34194
|
+
width10,
|
|
34195
|
+
height10,
|
|
34196
|
+
radius
|
|
34197
|
+
);
|
|
34198
|
+
ctx.fill();
|
|
34199
|
+
}
|
|
34200
|
+
} else if (holeShape === "oval") {
|
|
34201
|
+
const width10 = (hole.outer_width ?? hole.outer_diameter ?? hole.hole_width) * traceTextureResolution;
|
|
34202
|
+
const height10 = (hole.outer_height ?? hole.outer_diameter ?? hole.hole_height) * traceTextureResolution;
|
|
34203
|
+
const radiusX = width10 / 2;
|
|
34204
|
+
const radiusY = height10 / 2;
|
|
34205
|
+
let rotation2 = hole.ccw_rotation || 0;
|
|
34206
|
+
if (rotation2) {
|
|
34207
|
+
rotation2 = -rotation2;
|
|
34208
|
+
}
|
|
34209
|
+
if (rotation2) {
|
|
34210
|
+
ctx.save();
|
|
34211
|
+
ctx.translate(adjustedCanvasX, adjustedCanvasY);
|
|
34212
|
+
ctx.rotate(rotation2 * Math.PI / 180);
|
|
34213
|
+
ctx.beginPath();
|
|
34214
|
+
ctx.ellipse(0, 0, radiusX, radiusY, 0, 0, 2 * Math.PI);
|
|
34215
|
+
ctx.fill();
|
|
34216
|
+
ctx.restore();
|
|
34217
|
+
} else {
|
|
34218
|
+
ctx.beginPath();
|
|
34219
|
+
ctx.ellipse(
|
|
34220
|
+
adjustedCanvasX,
|
|
34221
|
+
adjustedCanvasY,
|
|
34222
|
+
radiusX,
|
|
34223
|
+
radiusY,
|
|
34224
|
+
0,
|
|
34225
|
+
0,
|
|
34226
|
+
2 * Math.PI
|
|
34227
|
+
);
|
|
34228
|
+
ctx.fill();
|
|
34229
|
+
}
|
|
34230
|
+
} else if (holeShape === "circle") {
|
|
34231
|
+
const outerDiameter = (hole.outer_diameter ?? hole.hole_diameter ?? 0) * traceTextureResolution;
|
|
34232
|
+
const canvasRadius = outerDiameter / 2;
|
|
34233
|
+
ctx.beginPath();
|
|
34234
|
+
ctx.arc(adjustedCanvasX, adjustedCanvasY, canvasRadius, 0, 2 * Math.PI);
|
|
34235
|
+
ctx.fill();
|
|
34236
|
+
}
|
|
34145
34237
|
}
|
|
34146
34238
|
});
|
|
34147
34239
|
const pcbHoles = su13(circuitJson).pcb_hole.list();
|