@tscircuit/3d-viewer 0.0.488 → 0.0.490

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 +83 -11
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -7502,7 +7502,7 @@ var require_ellipse = __commonJS({
7502
7502
  var geom2 = require_geom2();
7503
7503
  var { sin: sin2, cos: cos2 } = require_trigonometry();
7504
7504
  var { isGTE, isNumberArray } = require_commonChecks();
7505
- var ellipse2 = (options) => {
7505
+ var ellipse3 = (options) => {
7506
7506
  const defaults = {
7507
7507
  center: [0, 0],
7508
7508
  radius: [1, 1],
@@ -7544,7 +7544,7 @@ var require_ellipse = __commonJS({
7544
7544
  if (rotation2 < TAU) points.push(centerv);
7545
7545
  return geom2.fromPoints(points);
7546
7546
  };
7547
- module.exports = ellipse2;
7547
+ module.exports = ellipse3;
7548
7548
  }
7549
7549
  });
7550
7550
 
@@ -7553,7 +7553,7 @@ var require_circle = __commonJS({
7553
7553
  "node_modules/@jscad/modeling/src/primitives/circle.js"(exports, module) {
7554
7554
  "use strict";
7555
7555
  var { TAU } = require_constants();
7556
- var ellipse2 = require_ellipse();
7556
+ var ellipse3 = require_ellipse();
7557
7557
  var { isGTE } = require_commonChecks();
7558
7558
  var circle = (options) => {
7559
7559
  const defaults = {
@@ -7566,7 +7566,7 @@ var require_circle = __commonJS({
7566
7566
  let { center, radius, startAngle, endAngle, segments } = Object.assign({}, defaults, options);
7567
7567
  if (!isGTE(radius, 0)) throw new Error("radius must be positive");
7568
7568
  radius = [radius, radius];
7569
- return ellipse2({ center, radius, startAngle, endAngle, segments });
7569
+ return ellipse3({ center, radius, startAngle, endAngle, segments });
7570
7570
  };
7571
7571
  module.exports = circle;
7572
7572
  }
@@ -30825,7 +30825,7 @@ import * as THREE16 from "three";
30825
30825
  // package.json
30826
30826
  var package_default = {
30827
30827
  name: "@tscircuit/3d-viewer",
30828
- version: "0.0.487",
30828
+ version: "0.0.489",
30829
30829
  main: "./dist/index.js",
30830
30830
  module: "./dist/index.js",
30831
30831
  type: "module",
@@ -30854,7 +30854,7 @@ var package_default = {
30854
30854
  dependencies: {
30855
30855
  "@jscad/regl-renderer": "^2.6.12",
30856
30856
  "@jscad/stl-serializer": "^2.1.20",
30857
- "circuit-to-canvas": "^0.0.26",
30857
+ "circuit-to-canvas": "^0.0.49",
30858
30858
  "react-hot-toast": "^2.6.0",
30859
30859
  three: "^0.165.0",
30860
30860
  "three-stdlib": "^2.36.0",
@@ -30891,7 +30891,7 @@ var package_default = {
30891
30891
  "react-use-gesture": "^9.1.3",
30892
30892
  semver: "^7.7.0",
30893
30893
  "strip-ansi": "^7.1.0",
30894
- tscircuit: "^0.0.1123",
30894
+ tscircuit: "^0.0.1141",
30895
30895
  tsup: "^8.3.6",
30896
30896
  typescript: "^5.7.3",
30897
30897
  vite: "^7.1.5",
@@ -33407,6 +33407,41 @@ var BoardGeomBuilder = class {
33407
33407
  this.platedHoleGeoms = this.platedHoleGeoms.map(
33408
33408
  (phg) => (0, import_colors3.colorize)(colors.copper, (0, import_booleans5.subtract)(phg, copperPill))
33409
33409
  );
33410
+ } else if (hole.hole_shape === "oval") {
33411
+ const holeWidth = hole.hole_width;
33412
+ const holeHeight = hole.hole_height;
33413
+ const ellipseGeom = (0, import_transforms6.translate)(
33414
+ [hole.x, hole.y, 0],
33415
+ (0, import_transforms6.translate)(
33416
+ [0, 0, -holeDepth / 2],
33417
+ (0, import_extrusions4.extrudeLinear)(
33418
+ { height: holeDepth },
33419
+ (0, import_primitives7.ellipse)({ radius: [holeWidth / 2, holeHeight / 2] })
33420
+ )
33421
+ )
33422
+ );
33423
+ this.boardGeom = (0, import_booleans5.subtract)(this.boardGeom, ellipseGeom);
33424
+ this.padGeoms = this.padGeoms.map(
33425
+ (pg) => (0, import_colors3.colorize)(colors.copper, (0, import_booleans5.subtract)(pg, ellipseGeom))
33426
+ );
33427
+ const copperEllipseGeom = (0, import_transforms6.translate)(
33428
+ [hole.x, hole.y, 0],
33429
+ (0, import_transforms6.translate)(
33430
+ [0, 0, -holeDepth / 2],
33431
+ (0, import_extrusions4.extrudeLinear)(
33432
+ { height: holeDepth },
33433
+ (0, import_primitives7.ellipse)({
33434
+ radius: [
33435
+ holeWidth / 2 - copperInset,
33436
+ holeHeight / 2 - copperInset
33437
+ ]
33438
+ })
33439
+ )
33440
+ )
33441
+ );
33442
+ this.platedHoleGeoms = this.platedHoleGeoms.map(
33443
+ (phg) => (0, import_colors3.colorize)(colors.copper, (0, import_booleans5.subtract)(phg, copperEllipseGeom))
33444
+ );
33410
33445
  }
33411
33446
  }
33412
33447
  processPad(pad2) {
@@ -34244,13 +34279,26 @@ function createSoldermaskTextureForLayer({
34244
34279
  const y = hole.y;
34245
34280
  const canvasX = canvasXFromPcb(x);
34246
34281
  const canvasY = canvasYFromPcb(y);
34247
- const holeShape = hole.hole_shape || hole.shape;
34282
+ const holeShape = hole.hole_shape;
34248
34283
  if (holeShape === "circle" && typeof hole.hole_diameter === "number") {
34249
34284
  const canvasRadius = hole.hole_diameter / 2 * traceTextureResolution;
34250
34285
  ctx.beginPath();
34251
34286
  ctx.arc(canvasX, canvasY, canvasRadius, 0, 2 * Math.PI);
34252
34287
  ctx.fill();
34253
- } else if ((holeShape === "pill" || holeShape === "rotated_pill") && typeof hole.hole_width === "number" && typeof hole.hole_height === "number") {
34288
+ } else if (holeShape === "pill" && typeof hole.hole_width === "number" && typeof hole.hole_height === "number") {
34289
+ const width10 = hole.hole_width * traceTextureResolution;
34290
+ const height10 = hole.hole_height * traceTextureResolution;
34291
+ const radius = Math.min(width10, height10) / 2;
34292
+ ctx.beginPath();
34293
+ ctx.roundRect(
34294
+ canvasX - width10 / 2,
34295
+ canvasY - height10 / 2,
34296
+ width10,
34297
+ height10,
34298
+ radius
34299
+ );
34300
+ ctx.fill();
34301
+ } else if (holeShape === "rotated_pill" && typeof hole.hole_width === "number" && typeof hole.hole_height === "number") {
34254
34302
  const width10 = hole.hole_width * traceTextureResolution;
34255
34303
  const height10 = hole.hole_height * traceTextureResolution;
34256
34304
  const radius = Math.min(width10, height10) / 2;
@@ -34275,6 +34323,14 @@ function createSoldermaskTextureForLayer({
34275
34323
  );
34276
34324
  ctx.fill();
34277
34325
  }
34326
+ } else if (holeShape === "oval" && typeof hole.hole_width === "number" && typeof hole.hole_height === "number") {
34327
+ const width10 = hole.hole_width * traceTextureResolution;
34328
+ const height10 = hole.hole_height * traceTextureResolution;
34329
+ const radiusX = width10 / 2;
34330
+ const radiusY = height10 / 2;
34331
+ ctx.beginPath();
34332
+ ctx.ellipse(canvasX, canvasY, radiusX, radiusY, 0, 0, 2 * Math.PI);
34333
+ ctx.fill();
34278
34334
  }
34279
34335
  });
34280
34336
  const pcbCopperPours = su5(circuitJson).pcb_copper_pour.list();
@@ -36342,6 +36398,21 @@ function processNonPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, m
36342
36398
  const translatedPillDrill = pillDrillOp.translate([hole.x, hole.y, 0]);
36343
36399
  manifoldInstancesForCleanup.push(translatedPillDrill);
36344
36400
  nonPlatedHoleBoardDrills.push(translatedPillDrill);
36401
+ } else if (hole.hole_shape === "oval") {
36402
+ const holeW = hole.hole_width;
36403
+ const holeH = hole.hole_height;
36404
+ const drillDepth = pcbThickness * 1.2;
36405
+ const ovalDrillOp = Manifold.cylinder(
36406
+ drillDepth,
36407
+ 1,
36408
+ 1,
36409
+ SMOOTH_CIRCLE_SEGMENTS,
36410
+ true
36411
+ ).scale([holeW / 2, holeH / 2, 1]);
36412
+ manifoldInstancesForCleanup.push(ovalDrillOp);
36413
+ const translatedOvalDrill = ovalDrillOp.translate([hole.x, hole.y, 0]);
36414
+ manifoldInstancesForCleanup.push(translatedOvalDrill);
36415
+ nonPlatedHoleBoardDrills.push(translatedOvalDrill);
36345
36416
  }
36346
36417
  });
36347
36418
  return { nonPlatedHoleBoardDrills };
@@ -37176,6 +37247,7 @@ function createCopperPourTextureForLayer({
37176
37247
  const copperPours = circuitJson.filter(
37177
37248
  (e) => e.type === "pcb_copper_pour"
37178
37249
  );
37250
+ const pcbRenderLayer2 = layer === "top" ? "top_copper" : "bottom_copper";
37179
37251
  const poursOnLayer = copperPours.filter((p) => p.layer === layer);
37180
37252
  if (poursOnLayer.length === 0) return null;
37181
37253
  const boardOutlineBounds = calculateOutlineBounds(boardData);
@@ -37231,7 +37303,7 @@ function createCopperPourTextureForLayer({
37231
37303
  }
37232
37304
  }
37233
37305
  });
37234
- drawer.drawElements(coveredPours, { layers: [layer] });
37306
+ drawer.drawElements(coveredPours, { layers: [pcbRenderLayer2] });
37235
37307
  }
37236
37308
  if (uncoveredPours.length > 0) {
37237
37309
  drawer.configure({
@@ -37248,7 +37320,7 @@ function createCopperPourTextureForLayer({
37248
37320
  }
37249
37321
  }
37250
37322
  });
37251
- drawer.drawElements(uncoveredPours, { layers: [layer] });
37323
+ drawer.drawElements(uncoveredPours, { layers: [pcbRenderLayer2] });
37252
37324
  }
37253
37325
  }
37254
37326
  for (const pour of brepPours) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.488",
3
+ "version": "0.0.490",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@jscad/regl-renderer": "^2.6.12",
31
31
  "@jscad/stl-serializer": "^2.1.20",
32
- "circuit-to-canvas": "^0.0.26",
32
+ "circuit-to-canvas": "^0.0.49",
33
33
  "react-hot-toast": "^2.6.0",
34
34
  "three": "^0.165.0",
35
35
  "three-stdlib": "^2.36.0",
@@ -66,7 +66,7 @@
66
66
  "react-use-gesture": "^9.1.3",
67
67
  "semver": "^7.7.0",
68
68
  "strip-ansi": "^7.1.0",
69
- "tscircuit": "^0.0.1123",
69
+ "tscircuit": "^0.0.1141",
70
70
  "tsup": "^8.3.6",
71
71
  "typescript": "^5.7.3",
72
72
  "vite": "^7.1.5",