@tscircuit/3d-viewer 0.0.554 → 0.0.556

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 +18 -13
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -31985,7 +31985,7 @@ import * as THREE20 from "three";
31985
31985
  // package.json
31986
31986
  var package_default = {
31987
31987
  name: "@tscircuit/3d-viewer",
31988
- version: "0.0.553",
31988
+ version: "0.0.555",
31989
31989
  main: "./dist/index.js",
31990
31990
  module: "./dist/index.js",
31991
31991
  type: "module",
@@ -32015,7 +32015,7 @@ var package_default = {
32015
32015
  "@jscad/regl-renderer": "^2.6.12",
32016
32016
  "@jscad/stl-serializer": "^2.1.20",
32017
32017
  "circuit-json": "^0.0.407",
32018
- "circuit-to-canvas": "^0.0.97",
32018
+ "circuit-to-canvas": "^0.0.100",
32019
32019
  "react-hot-toast": "^2.6.0",
32020
32020
  three: "^0.165.0",
32021
32021
  "three-stdlib": "^2.36.0",
@@ -33975,7 +33975,6 @@ var BOARD_CLIP_Z_MARGIN = 1;
33975
33975
  var BOARD_CLIP_XY_OUTSET = 0.05;
33976
33976
  var buildStateOrder = [
33977
33977
  "initializing",
33978
- "processing_copper_pours",
33979
33978
  "processing_plated_holes",
33980
33979
  "processing_holes",
33981
33980
  "processing_cutouts",
@@ -33993,7 +33992,6 @@ var BoardGeomBuilder = class {
33993
33992
  platedHoleGeoms = [];
33994
33993
  viaGeoms = [];
33995
33994
  // Combined with platedHoleGeoms
33996
- copperPourGeoms = [];
33997
33995
  boardClipGeom = null;
33998
33996
  state = "initializing";
33999
33997
  currentIndex = 0;
@@ -34062,7 +34060,7 @@ var BoardGeomBuilder = class {
34062
34060
  center: [this.board.center.x, this.board.center.y, 0]
34063
34061
  });
34064
34062
  }
34065
- this.state = "processing_copper_pours";
34063
+ this.state = "processing_plated_holes";
34066
34064
  this.currentIndex = 0;
34067
34065
  }
34068
34066
  goToNextState() {
@@ -34093,9 +34091,6 @@ var BoardGeomBuilder = class {
34093
34091
  this.goToNextState();
34094
34092
  }
34095
34093
  break;
34096
- case "processing_copper_pours":
34097
- this.goToNextState();
34098
- break;
34099
34094
  case "processing_vias":
34100
34095
  if (this.currentIndex < this.pcb_vias.length) {
34101
34096
  this.processVia(this.pcb_vias[this.currentIndex]);
@@ -34490,8 +34485,7 @@ var BoardGeomBuilder = class {
34490
34485
  this.finalGeoms = [
34491
34486
  this.boardGeom,
34492
34487
  ...this.platedHoleGeoms,
34493
- ...this.viaGeoms,
34494
- ...this.copperPourGeoms
34488
+ ...this.viaGeoms
34495
34489
  ];
34496
34490
  if (this.onCompleteCallback) {
34497
34491
  this.onCompleteCallback(this.finalGeoms);
@@ -35292,8 +35286,8 @@ function createCopperTextTextureForLayer({
35292
35286
  }
35293
35287
 
35294
35288
  // src/textures/create-copper-pour-texture-for-layer.ts
35295
- import * as THREE27 from "three";
35296
35289
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer4 } from "circuit-to-canvas";
35290
+ import * as THREE27 from "three";
35297
35291
  var toRgb = (colorArr) => {
35298
35292
  const [r = 0, g = 0, b = 0] = colorArr;
35299
35293
  return `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(
@@ -35314,6 +35308,16 @@ function createCopperPourTextureForLayer({
35314
35308
  const pcbRenderLayer = layer === "top" ? "top_copper" : "bottom_copper";
35315
35309
  const poursOnLayer = copperPours.filter((p) => p.layer === layer);
35316
35310
  if (poursOnLayer.length === 0) return null;
35311
+ const holes = circuitJson.filter((e) => e.type === "pcb_hole");
35312
+ const platedHolesOnLayer = circuitJson.filter((e) => {
35313
+ if (e.type !== "pcb_plated_hole") return false;
35314
+ return !Array.isArray(e.layers) || e.layers.includes(layer);
35315
+ });
35316
+ const viasOnLayer = circuitJson.filter((e) => {
35317
+ if (e.type !== "pcb_via") return false;
35318
+ return !Array.isArray(e.layers) || e.layers.includes(layer);
35319
+ });
35320
+ const drillElements = [...holes, ...platedHolesOnLayer, ...viasOnLayer];
35317
35321
  const boardOutlineBounds = calculateOutlineBounds(boardData);
35318
35322
  const canvas = document.createElement("canvas");
35319
35323
  const canvasWidth = Math.floor(
@@ -35335,6 +35339,7 @@ function createCopperPourTextureForLayer({
35335
35339
  const uncoveredColor = copperColor;
35336
35340
  const setColorAndDraw = (pours, copperPourColor) => {
35337
35341
  if (pours.length === 0) return;
35342
+ const elementsToDraw = [...pours, ...drillElements];
35338
35343
  const drawer = new CircuitToCanvasDrawer4(ctx);
35339
35344
  drawer.configure({
35340
35345
  colorOverrides: {
@@ -35376,14 +35381,14 @@ function createCopperPourTextureForLayer({
35376
35381
  minY: boardOutlineBounds.minY,
35377
35382
  maxY: boardOutlineBounds.maxY
35378
35383
  });
35379
- drawer.drawElements(pours, {
35384
+ drawer.drawElements(elementsToDraw, {
35380
35385
  layers: [pcbRenderLayer],
35381
35386
  drawSoldermask: false,
35382
35387
  drawSoldermaskTop: false,
35383
35388
  drawSoldermaskBottom: false
35384
35389
  });
35385
35390
  for (let i = 1; i < COPPER_POUR_OPACITY_COMPENSATION_PASSES; i += 1) {
35386
- drawer.drawElements(pours, {
35391
+ drawer.drawElements(elementsToDraw, {
35387
35392
  layers: [pcbRenderLayer],
35388
35393
  drawSoldermask: false,
35389
35394
  drawSoldermaskTop: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.554",
3
+ "version": "0.0.556",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "@jscad/regl-renderer": "^2.6.12",
31
31
  "@jscad/stl-serializer": "^2.1.20",
32
32
  "circuit-json": "^0.0.407",
33
- "circuit-to-canvas": "^0.0.97",
33
+ "circuit-to-canvas": "^0.0.100",
34
34
  "react-hot-toast": "^2.6.0",
35
35
  "three": "^0.165.0",
36
36
  "three-stdlib": "^2.36.0",