@tscircuit/3d-viewer 0.0.456 → 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.
Files changed (2) hide show
  1. package/dist/index.js +71 -1
  2. 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.455",
28512
+ version: "0.0.456",
28513
28513
  main: "./dist/index.js",
28514
28514
  module: "./dist/index.js",
28515
28515
  type: "module",
@@ -34164,6 +34164,76 @@ function createSoldermaskTextureForLayer({
34164
34164
  ctx.ellipse(canvasX, canvasY, radiusX, radiusY, 0, 0, 2 * Math.PI);
34165
34165
  ctx.fill();
34166
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
+ }
34167
34237
  }
34168
34238
  });
34169
34239
  const pcbHoles = su13(circuitJson).pcb_hole.list();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.456",
3
+ "version": "0.0.457",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",