@tscircuit/3d-viewer 0.0.522 → 0.0.523

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 +334 -132
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14245,7 +14245,7 @@ var require_browser = __commonJS({
14245
14245
 
14246
14246
  // src/CadViewer.tsx
14247
14247
  import { useState as useState36, useCallback as useCallback21, useRef as useRef26, useEffect as useEffect44 } from "react";
14248
- import * as THREE36 from "three";
14248
+ import * as THREE37 from "three";
14249
14249
 
14250
14250
  // src/CadViewerJscad.tsx
14251
14251
  import { su as su11 } from "@tscircuit/circuit-json-util";
@@ -28483,7 +28483,7 @@ import * as THREE16 from "three";
28483
28483
  // package.json
28484
28484
  var package_default = {
28485
28485
  name: "@tscircuit/3d-viewer",
28486
- version: "0.0.521",
28486
+ version: "0.0.522",
28487
28487
  main: "./dist/index.js",
28488
28488
  module: "./dist/index.js",
28489
28489
  type: "module",
@@ -31452,7 +31452,7 @@ import { su as su8 } from "@tscircuit/circuit-json-util";
31452
31452
  import { useEffect as useEffect23, useMemo as useMemo19 } from "react";
31453
31453
 
31454
31454
  // src/textures/create-combined-board-textures.ts
31455
- import * as THREE26 from "three";
31455
+ import * as THREE27 from "three";
31456
31456
 
31457
31457
  // node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
31458
31458
  var getBoundsFromPoints = (points) => {
@@ -32164,9 +32164,158 @@ function createCopperPourTextureForLayer({
32164
32164
  return texture;
32165
32165
  }
32166
32166
 
32167
- // src/textures/create-silkscreen-texture-for-layer.ts
32167
+ // src/textures/create-fabrication-note-texture-for-layer.ts
32168
32168
  import * as THREE24 from "three";
32169
32169
 
32170
+ // src/textures/fabrication-note/fabrication-note-drawing.ts
32171
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer3 } from "circuit-to-canvas";
32172
+
32173
+ // src/utils/units.ts
32174
+ var MM_PER_INCH = 25.4;
32175
+ var MM_PER_MIL = MM_PER_INCH / 1e3;
32176
+ var dimensionRegex = /^\s*(-?\d*(?:\.\d+)?)(?:\s*(mm|mil|inch|in|"))?\s*$/i;
32177
+ function normalizeUnit(unit) {
32178
+ if (!unit) return void 0;
32179
+ const normalized = unit.trim().toLowerCase();
32180
+ if (normalized === '"') return "in";
32181
+ if (normalized === "inch") return "in";
32182
+ return normalized;
32183
+ }
32184
+ function parseDimensionToMm(value) {
32185
+ if (value === null || value === void 0) return void 0;
32186
+ if (typeof value === "number") {
32187
+ return Number.isFinite(value) ? value : void 0;
32188
+ }
32189
+ if (typeof value !== "string") return void 0;
32190
+ const trimmed = value.trim();
32191
+ if (trimmed.length === 0) return void 0;
32192
+ const match = trimmed.match(dimensionRegex);
32193
+ if (!match) {
32194
+ const numeric = Number.parseFloat(trimmed);
32195
+ return Number.isFinite(numeric) ? numeric : void 0;
32196
+ }
32197
+ const [, magnitudeRaw, unitRaw] = match;
32198
+ const magnitude = Number.parseFloat(magnitudeRaw || "0");
32199
+ if (!Number.isFinite(magnitude)) return void 0;
32200
+ const unit = normalizeUnit(unitRaw);
32201
+ switch (unit) {
32202
+ case "mil":
32203
+ return magnitude * MM_PER_MIL;
32204
+ case "in":
32205
+ return magnitude * MM_PER_INCH;
32206
+ case "mm":
32207
+ case void 0:
32208
+ return magnitude;
32209
+ default:
32210
+ return magnitude;
32211
+ }
32212
+ }
32213
+ function coerceDimensionToMm(value, fallback) {
32214
+ const parsed = parseDimensionToMm(value);
32215
+ return parsed === void 0 ? fallback : parsed;
32216
+ }
32217
+
32218
+ // src/textures/fabrication-note/fabrication-note-drawing.ts
32219
+ var FABRICATION_NOTE_COLOR = "rgb(255,243,204)";
32220
+ var TRANSPARENT = "rgba(0,0,0,0)";
32221
+ var setDrawerBounds2 = (drawer, bounds) => {
32222
+ drawer.setCameraBounds({
32223
+ minX: bounds.minX,
32224
+ maxX: bounds.maxX,
32225
+ minY: bounds.minY,
32226
+ maxY: bounds.maxY
32227
+ });
32228
+ };
32229
+ var normalizeFabricationElement = (element) => {
32230
+ if (element.type === "pcb_fabrication_note_rect") {
32231
+ return {
32232
+ ...element,
32233
+ width: parseDimensionToMm(element.width) ?? 0,
32234
+ height: parseDimensionToMm(element.height) ?? 0,
32235
+ stroke_width: coerceDimensionToMm(element.stroke_width, 0.1),
32236
+ corner_radius: parseDimensionToMm(element.corner_radius)
32237
+ };
32238
+ }
32239
+ if (element.type === "pcb_fabrication_note_path") {
32240
+ return {
32241
+ ...element,
32242
+ stroke_width: coerceDimensionToMm(element.stroke_width, 0.1)
32243
+ };
32244
+ }
32245
+ if (element.type === "pcb_fabrication_note_text") {
32246
+ return {
32247
+ ...element,
32248
+ font_size: coerceDimensionToMm(element.font_size, 1)
32249
+ };
32250
+ }
32251
+ if (element.type === "pcb_fabrication_note_dimension") {
32252
+ return {
32253
+ ...element,
32254
+ font_size: coerceDimensionToMm(element.font_size, 1),
32255
+ arrow_size: coerceDimensionToMm(element.arrow_size, 1),
32256
+ offset_distance: coerceDimensionToMm(element.offset_distance, 0)
32257
+ };
32258
+ }
32259
+ return element;
32260
+ };
32261
+ var drawFabricationNoteLayer = ({
32262
+ ctx,
32263
+ layer,
32264
+ bounds,
32265
+ elements
32266
+ }) => {
32267
+ const renderLayer = `${layer}_fabrication_note`;
32268
+ const normalizedElements = elements.map(normalizeFabricationElement);
32269
+ const drawer = new CircuitToCanvasDrawer3(ctx);
32270
+ drawer.configure({
32271
+ colorOverrides: {
32272
+ copper: {
32273
+ top: TRANSPARENT,
32274
+ bottom: TRANSPARENT,
32275
+ inner1: TRANSPARENT,
32276
+ inner2: TRANSPARENT,
32277
+ inner3: TRANSPARENT,
32278
+ inner4: TRANSPARENT,
32279
+ inner5: TRANSPARENT,
32280
+ inner6: TRANSPARENT
32281
+ },
32282
+ copperPour: {
32283
+ top: TRANSPARENT,
32284
+ bottom: TRANSPARENT
32285
+ },
32286
+ drill: TRANSPARENT,
32287
+ boardOutline: TRANSPARENT,
32288
+ substrate: TRANSPARENT,
32289
+ keepout: TRANSPARENT,
32290
+ courtyard: {
32291
+ top: TRANSPARENT,
32292
+ bottom: TRANSPARENT
32293
+ },
32294
+ soldermask: {
32295
+ top: TRANSPARENT,
32296
+ bottom: TRANSPARENT
32297
+ },
32298
+ soldermaskWithCopperUnderneath: {
32299
+ top: TRANSPARENT,
32300
+ bottom: TRANSPARENT
32301
+ },
32302
+ soldermaskOverCopper: {
32303
+ top: TRANSPARENT,
32304
+ bottom: TRANSPARENT
32305
+ },
32306
+ silkscreen: {
32307
+ top: TRANSPARENT,
32308
+ bottom: TRANSPARENT
32309
+ },
32310
+ fabricationNote: FABRICATION_NOTE_COLOR
32311
+ }
32312
+ });
32313
+ setDrawerBounds2(drawer, bounds);
32314
+ drawer.drawElements(normalizedElements, {
32315
+ layers: [renderLayer]
32316
+ });
32317
+ };
32318
+
32170
32319
  // src/textures/soldermask/soldermask-bounds.ts
32171
32320
  var boundsFromPanel = (panel) => ({
32172
32321
  minX: panel.center.x - panel.width / 2,
@@ -32209,11 +32358,57 @@ var getSoldermaskRenderBounds = (circuitJson, boardData) => {
32209
32358
  return boardsForBounds.map((board) => calculateOutlineBounds(board)).reduce((acc, bounds) => mergeBounds(acc, bounds));
32210
32359
  };
32211
32360
 
32361
+ // src/textures/create-fabrication-note-texture-for-layer.ts
32362
+ var isFabricationNoteElement = (element, layer) => {
32363
+ if (!("layer" in element) || element.layer !== layer) return false;
32364
+ return element.type.startsWith("pcb_fabrication_note_");
32365
+ };
32366
+ function createFabricationNoteTextureForLayer({
32367
+ layer,
32368
+ circuitJson,
32369
+ boardData,
32370
+ traceTextureResolution = TRACE_TEXTURE_RESOLUTION
32371
+ }) {
32372
+ const elements = circuitJson.filter(
32373
+ (element) => isFabricationNoteElement(element, layer)
32374
+ );
32375
+ if (elements.length === 0) return null;
32376
+ const bounds = getSoldermaskRenderBounds(circuitJson, boardData);
32377
+ const canvasWidth = Math.floor(bounds.width * traceTextureResolution);
32378
+ const canvasHeight = Math.floor(bounds.height * traceTextureResolution);
32379
+ if (canvasWidth <= 0 || canvasHeight <= 0) return null;
32380
+ const canvas = document.createElement("canvas");
32381
+ canvas.width = canvasWidth;
32382
+ canvas.height = canvasHeight;
32383
+ const ctx = canvas.getContext("2d");
32384
+ if (!ctx) return null;
32385
+ if (layer === "bottom") {
32386
+ ctx.translate(0, canvasHeight);
32387
+ ctx.scale(1, -1);
32388
+ }
32389
+ drawFabricationNoteLayer({
32390
+ ctx,
32391
+ layer,
32392
+ bounds,
32393
+ elements
32394
+ });
32395
+ const texture = new THREE24.CanvasTexture(canvas);
32396
+ texture.generateMipmaps = true;
32397
+ texture.minFilter = THREE24.LinearMipmapLinearFilter;
32398
+ texture.magFilter = THREE24.LinearFilter;
32399
+ texture.anisotropy = 16;
32400
+ texture.needsUpdate = true;
32401
+ return texture;
32402
+ }
32403
+
32404
+ // src/textures/create-silkscreen-texture-for-layer.ts
32405
+ import * as THREE25 from "three";
32406
+
32212
32407
  // src/textures/silkscreen/silkscreen-drawing.ts
32213
- import { CircuitToCanvasDrawer as CircuitToCanvasDrawer3 } from "circuit-to-canvas";
32214
- var FABRICATION_NOTE_COLOR = "rgb(255,243,204)";
32215
- var TRANSPARENT = "rgba(0,0,0,0)";
32216
- var setDrawerBounds2 = (drawer, bounds) => {
32408
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer4 } from "circuit-to-canvas";
32409
+ var FABRICATION_NOTE_COLOR2 = "rgb(255,243,204)";
32410
+ var TRANSPARENT2 = "rgba(0,0,0,0)";
32411
+ var setDrawerBounds3 = (drawer, bounds) => {
32217
32412
  drawer.setCameraBounds({
32218
32413
  minX: bounds.minX,
32219
32414
  maxX: bounds.maxX,
@@ -32229,51 +32424,51 @@ var drawSilkscreenLayer = ({
32229
32424
  silkscreenColor
32230
32425
  }) => {
32231
32426
  const renderLayer = layer === "top" ? "top_silkscreen" : "bottom_silkscreen";
32232
- const drawer = new CircuitToCanvasDrawer3(ctx);
32427
+ const drawer = new CircuitToCanvasDrawer4(ctx);
32233
32428
  drawer.configure({
32234
32429
  colorOverrides: {
32235
32430
  copper: {
32236
- top: TRANSPARENT,
32237
- bottom: TRANSPARENT,
32238
- inner1: TRANSPARENT,
32239
- inner2: TRANSPARENT,
32240
- inner3: TRANSPARENT,
32241
- inner4: TRANSPARENT,
32242
- inner5: TRANSPARENT,
32243
- inner6: TRANSPARENT
32431
+ top: TRANSPARENT2,
32432
+ bottom: TRANSPARENT2,
32433
+ inner1: TRANSPARENT2,
32434
+ inner2: TRANSPARENT2,
32435
+ inner3: TRANSPARENT2,
32436
+ inner4: TRANSPARENT2,
32437
+ inner5: TRANSPARENT2,
32438
+ inner6: TRANSPARENT2
32244
32439
  },
32245
32440
  copperPour: {
32246
- top: TRANSPARENT,
32247
- bottom: TRANSPARENT
32441
+ top: TRANSPARENT2,
32442
+ bottom: TRANSPARENT2
32248
32443
  },
32249
- drill: TRANSPARENT,
32250
- boardOutline: TRANSPARENT,
32251
- substrate: TRANSPARENT,
32252
- keepout: TRANSPARENT,
32444
+ drill: TRANSPARENT2,
32445
+ boardOutline: TRANSPARENT2,
32446
+ substrate: TRANSPARENT2,
32447
+ keepout: TRANSPARENT2,
32253
32448
  courtyard: {
32254
- top: TRANSPARENT,
32255
- bottom: TRANSPARENT
32449
+ top: TRANSPARENT2,
32450
+ bottom: TRANSPARENT2
32256
32451
  },
32257
32452
  soldermask: {
32258
- top: TRANSPARENT,
32259
- bottom: TRANSPARENT
32453
+ top: TRANSPARENT2,
32454
+ bottom: TRANSPARENT2
32260
32455
  },
32261
32456
  soldermaskWithCopperUnderneath: {
32262
- top: TRANSPARENT,
32263
- bottom: TRANSPARENT
32457
+ top: TRANSPARENT2,
32458
+ bottom: TRANSPARENT2
32264
32459
  },
32265
32460
  soldermaskOverCopper: {
32266
- top: TRANSPARENT,
32267
- bottom: TRANSPARENT
32461
+ top: TRANSPARENT2,
32462
+ bottom: TRANSPARENT2
32268
32463
  },
32269
32464
  silkscreen: {
32270
32465
  top: silkscreenColor,
32271
32466
  bottom: silkscreenColor
32272
32467
  },
32273
- fabricationNote: FABRICATION_NOTE_COLOR
32468
+ fabricationNote: FABRICATION_NOTE_COLOR2
32274
32469
  }
32275
32470
  });
32276
- setDrawerBounds2(drawer, bounds);
32471
+ setDrawerBounds3(drawer, bounds);
32277
32472
  drawer.drawElements(elements, {
32278
32473
  layers: [renderLayer]
32279
32474
  });
@@ -32283,7 +32478,7 @@ var drawSilkscreenLayer = ({
32283
32478
  var isSilkscreenElement = (element, layer) => {
32284
32479
  if (!("layer" in element) || element.layer !== layer) return false;
32285
32480
  const elementType = element.type;
32286
- return elementType.startsWith("pcb_silkscreen_") || elementType === "pcb_fabrication_note_rect" || elementType === "pcb_note_line";
32481
+ return elementType.startsWith("pcb_silkscreen_") || elementType === "pcb_note_line";
32287
32482
  };
32288
32483
  function createSilkscreenTextureForLayer({
32289
32484
  layer,
@@ -32316,20 +32511,20 @@ function createSilkscreenTextureForLayer({
32316
32511
  elements,
32317
32512
  silkscreenColor
32318
32513
  });
32319
- const texture = new THREE24.CanvasTexture(canvas);
32514
+ const texture = new THREE25.CanvasTexture(canvas);
32320
32515
  texture.generateMipmaps = true;
32321
- texture.minFilter = THREE24.LinearMipmapLinearFilter;
32322
- texture.magFilter = THREE24.LinearFilter;
32516
+ texture.minFilter = THREE25.LinearMipmapLinearFilter;
32517
+ texture.magFilter = THREE25.LinearFilter;
32323
32518
  texture.anisotropy = 16;
32324
32519
  texture.needsUpdate = true;
32325
32520
  return texture;
32326
32521
  }
32327
32522
 
32328
32523
  // src/textures/create-soldermask-texture-for-layer.ts
32329
- import * as THREE25 from "three";
32524
+ import * as THREE26 from "three";
32330
32525
 
32331
32526
  // src/textures/soldermask/soldermask-drawing.ts
32332
- import { CircuitToCanvasDrawer as CircuitToCanvasDrawer4 } from "circuit-to-canvas";
32527
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer5 } from "circuit-to-canvas";
32333
32528
  var toRgb = (colorArr) => {
32334
32529
  const [r = 0, g = 0, b = 0] = colorArr;
32335
32530
  return `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(
@@ -32348,7 +32543,7 @@ var getSoldermaskPalette = (material) => {
32348
32543
  transparent: "rgba(0,0,0,0)"
32349
32544
  };
32350
32545
  };
32351
- var setDrawerBounds3 = (drawer, bounds) => {
32546
+ var setDrawerBounds4 = (drawer, bounds) => {
32352
32547
  drawer.setCameraBounds({
32353
32548
  minX: bounds.minX,
32354
32549
  maxX: bounds.maxX,
@@ -32365,7 +32560,7 @@ var drawSoldermaskLayer = ({
32365
32560
  }) => {
32366
32561
  const palette = getSoldermaskPalette(boardMaterial);
32367
32562
  const copperRenderLayer = layer === "top" ? "top_copper" : "bottom_copper";
32368
- const drawer = new CircuitToCanvasDrawer4(ctx);
32563
+ const drawer = new CircuitToCanvasDrawer5(ctx);
32369
32564
  drawer.configure({
32370
32565
  colorOverrides: {
32371
32566
  copper: {
@@ -32396,7 +32591,7 @@ var drawSoldermaskLayer = ({
32396
32591
  }
32397
32592
  }
32398
32593
  });
32399
- setDrawerBounds3(drawer, bounds);
32594
+ setDrawerBounds4(drawer, bounds);
32400
32595
  drawer.drawElements(elements, {
32401
32596
  layers: [copperRenderLayer],
32402
32597
  drawSoldermask: true,
@@ -32409,7 +32604,7 @@ var drawSoldermaskLayer = ({
32409
32604
  if (uncoveredPours.length > 0) {
32410
32605
  ctx.save();
32411
32606
  ctx.globalCompositeOperation = "destination-out";
32412
- const cutoutDrawer = new CircuitToCanvasDrawer4(ctx);
32607
+ const cutoutDrawer = new CircuitToCanvasDrawer5(ctx);
32413
32608
  cutoutDrawer.configure({
32414
32609
  colorOverrides: {
32415
32610
  copper: {
@@ -32424,7 +32619,7 @@ var drawSoldermaskLayer = ({
32424
32619
  }
32425
32620
  }
32426
32621
  });
32427
- setDrawerBounds3(cutoutDrawer, bounds);
32622
+ setDrawerBounds4(cutoutDrawer, bounds);
32428
32623
  cutoutDrawer.drawElements(uncoveredPours, { layers: [copperRenderLayer] });
32429
32624
  ctx.restore();
32430
32625
  }
@@ -32458,10 +32653,10 @@ function createSoldermaskTextureForLayer({
32458
32653
  elements,
32459
32654
  boardMaterial: boardData.material
32460
32655
  });
32461
- const texture = new THREE25.CanvasTexture(canvas);
32656
+ const texture = new THREE26.CanvasTexture(canvas);
32462
32657
  texture.generateMipmaps = true;
32463
- texture.minFilter = THREE25.LinearMipmapLinearFilter;
32464
- texture.magFilter = THREE25.LinearFilter;
32658
+ texture.minFilter = THREE26.LinearMipmapLinearFilter;
32659
+ texture.magFilter = THREE26.LinearFilter;
32465
32660
  texture.anisotropy = 16;
32466
32661
  texture.needsUpdate = true;
32467
32662
  return texture;
@@ -32499,10 +32694,10 @@ var createCombinedTexture = ({
32499
32694
  const image = texture.image;
32500
32695
  ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
32501
32696
  });
32502
- const combinedTexture = new THREE26.CanvasTexture(canvas);
32697
+ const combinedTexture = new THREE27.CanvasTexture(canvas);
32503
32698
  combinedTexture.generateMipmaps = false;
32504
- combinedTexture.minFilter = THREE26.LinearFilter;
32505
- combinedTexture.magFilter = THREE26.LinearFilter;
32699
+ combinedTexture.minFilter = THREE27.LinearFilter;
32700
+ combinedTexture.magFilter = THREE27.LinearFilter;
32506
32701
  combinedTexture.premultiplyAlpha = true;
32507
32702
  combinedTexture.anisotropy = 16;
32508
32703
  combinedTexture.needsUpdate = true;
@@ -32563,6 +32758,12 @@ function createCombinedBoardTextures({
32563
32758
  silkscreenColor,
32564
32759
  traceTextureResolution
32565
32760
  }) : null;
32761
+ const fabricationNoteTexture = showSilkscreen ? createFabricationNoteTextureForLayer({
32762
+ layer,
32763
+ circuitJson,
32764
+ boardData,
32765
+ traceTextureResolution
32766
+ }) : null;
32566
32767
  const panelOutlineTexture = showBoardBody ? createPanelOutlineTextureForLayer({
32567
32768
  layer,
32568
32769
  circuitJson,
@@ -32577,6 +32778,7 @@ function createCombinedBoardTextures({
32577
32778
  soldermaskTexture,
32578
32779
  copperTextTexture,
32579
32780
  silkscreenTexture,
32781
+ fabricationNoteTexture,
32580
32782
  panelOutlineTexture
32581
32783
  ],
32582
32784
  boardData,
@@ -32591,7 +32793,7 @@ function createCombinedBoardTextures({
32591
32793
  }
32592
32794
 
32593
32795
  // src/textures/create-three-texture-meshes.ts
32594
- import * as THREE27 from "three";
32796
+ import * as THREE28 from "three";
32595
32797
  function createTexturePlane(config, boardData) {
32596
32798
  const {
32597
32799
  texture,
@@ -32603,15 +32805,15 @@ function createTexturePlane(config, boardData) {
32603
32805
  } = config;
32604
32806
  if (!texture) return null;
32605
32807
  const boardOutlineBounds = calculateOutlineBounds(boardData);
32606
- const planeGeom = new THREE27.PlaneGeometry(
32808
+ const planeGeom = new THREE28.PlaneGeometry(
32607
32809
  boardOutlineBounds.width,
32608
32810
  boardOutlineBounds.height
32609
32811
  );
32610
- const material = new THREE27.MeshBasicMaterial({
32812
+ const material = new THREE28.MeshBasicMaterial({
32611
32813
  map: texture,
32612
32814
  transparent: true,
32613
32815
  alphaTest: 0.08,
32614
- side: THREE27.DoubleSide,
32816
+ side: THREE28.DoubleSide,
32615
32817
  depthWrite: true,
32616
32818
  polygonOffset: usePolygonOffset,
32617
32819
  polygonOffsetFactor: usePolygonOffset ? -4 : 0,
@@ -32619,7 +32821,7 @@ function createTexturePlane(config, boardData) {
32619
32821
  polygonOffsetUnits: usePolygonOffset ? -4 : 0,
32620
32822
  opacity: isFaux ? FAUX_BOARD_OPACITY : 1
32621
32823
  });
32622
- const mesh = new THREE27.Mesh(planeGeom, material);
32824
+ const mesh = new THREE28.Mesh(planeGeom, material);
32623
32825
  mesh.position.set(
32624
32826
  boardOutlineBounds.centerX,
32625
32827
  boardOutlineBounds.centerY,
@@ -32664,7 +32866,7 @@ function createTextureMeshes(textures, boardData, pcbThickness, isFaux = false)
32664
32866
  }
32665
32867
 
32666
32868
  // src/three-components/JscadBoardTextures.tsx
32667
- import * as THREE28 from "three";
32869
+ import * as THREE29 from "three";
32668
32870
 
32669
32871
  // src/utils/layer-texture-resolution.ts
32670
32872
  var DEFAULT_MAX_TEXTURE_PIXELS = 4e6;
@@ -32760,7 +32962,7 @@ function JscadBoardTextures({
32760
32962
  const typedMaterial = material;
32761
32963
  for (const prop of textureProps) {
32762
32964
  const texture = typedMaterial[prop];
32763
- if (texture && texture instanceof THREE28.Texture) {
32965
+ if (texture && texture instanceof THREE29.Texture) {
32764
32966
  texture.dispose();
32765
32967
  typedMaterial[prop] = null;
32766
32968
  }
@@ -32770,22 +32972,22 @@ function JscadBoardTextures({
32770
32972
  const createTexturePlane2 = (texture, zOffset, isBottomLayer, name, usePolygonOffset = false, depthWrite = true, renderOrder = 1) => {
32771
32973
  if (!texture) return null;
32772
32974
  const boardOutlineBounds = calculateOutlineBounds(boardData);
32773
- const planeGeom = new THREE28.PlaneGeometry(
32975
+ const planeGeom = new THREE29.PlaneGeometry(
32774
32976
  boardOutlineBounds.width,
32775
32977
  boardOutlineBounds.height
32776
32978
  );
32777
- const material = new THREE28.MeshBasicMaterial({
32979
+ const material = new THREE29.MeshBasicMaterial({
32778
32980
  map: texture,
32779
32981
  transparent: true,
32780
32982
  alphaTest: 0.08,
32781
- side: THREE28.DoubleSide,
32983
+ side: THREE29.DoubleSide,
32782
32984
  depthWrite,
32783
32985
  polygonOffset: usePolygonOffset,
32784
32986
  polygonOffsetFactor: usePolygonOffset ? -4 : 0,
32785
32987
  polygonOffsetUnits: usePolygonOffset ? -4 : 0,
32786
32988
  opacity: isFaux ? FAUX_BOARD_OPACITY : 1
32787
32989
  });
32788
- const mesh = new THREE28.Mesh(planeGeom, material);
32990
+ const mesh = new THREE29.Mesh(planeGeom, material);
32789
32991
  mesh.position.set(
32790
32992
  boardOutlineBounds.centerX,
32791
32993
  boardOutlineBounds.centerY,
@@ -32830,7 +33032,7 @@ function JscadBoardTextures({
32830
33032
  mesh.geometry.dispose();
32831
33033
  if (Array.isArray(mesh.material)) {
32832
33034
  mesh.material.forEach((material) => disposeTextureMaterial(material));
32833
- } else if (mesh.material instanceof THREE28.Material) {
33035
+ } else if (mesh.material instanceof THREE29.Material) {
32834
33036
  disposeTextureMaterial(mesh.material);
32835
33037
  }
32836
33038
  });
@@ -33063,12 +33265,12 @@ var CadViewerJscad = forwardRef3(
33063
33265
  // src/CadViewerManifold.tsx
33064
33266
  import { su as su17 } from "@tscircuit/circuit-json-util";
33065
33267
  import { useEffect as useEffect25, useMemo as useMemo22, useState as useState16 } from "react";
33066
- import * as THREE35 from "three";
33268
+ import * as THREE36 from "three";
33067
33269
 
33068
33270
  // src/hooks/useManifoldBoardBuilder.ts
33069
33271
  import { su as su16 } from "@tscircuit/circuit-json-util";
33070
33272
  import { useEffect as useEffect24, useMemo as useMemo21, useRef as useRef9, useState as useState15 } from "react";
33071
- import * as THREE32 from "three";
33273
+ import * as THREE33 from "three";
33072
33274
 
33073
33275
  // src/utils/manifold/create-manifold-board.ts
33074
33276
  var arePointsClockwise2 = (points) => {
@@ -33410,17 +33612,17 @@ function processNonPlatedHolesForManifold(Manifold, CrossSection, circuitJson, p
33410
33612
 
33411
33613
  // src/utils/manifold/process-plated-holes.ts
33412
33614
  import { su as su14 } from "@tscircuit/circuit-json-util";
33413
- import * as THREE30 from "three";
33615
+ import * as THREE31 from "three";
33414
33616
 
33415
33617
  // src/utils/manifold-mesh-to-three-geometry.ts
33416
- import * as THREE29 from "three";
33618
+ import * as THREE30 from "three";
33417
33619
  function manifoldMeshToThreeGeometry(manifoldMesh) {
33418
- const geometry = new THREE29.BufferGeometry();
33620
+ const geometry = new THREE30.BufferGeometry();
33419
33621
  geometry.setAttribute(
33420
33622
  "position",
33421
- new THREE29.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
33623
+ new THREE30.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
33422
33624
  );
33423
- geometry.setIndex(new THREE29.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
33625
+ geometry.setIndex(new THREE30.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
33424
33626
  if (manifoldMesh.runIndex && manifoldMesh.runIndex.length > 1 && manifoldMesh.runOriginalID) {
33425
33627
  for (let i = 0; i < manifoldMesh.runIndex.length - 1; i++) {
33426
33628
  const start = manifoldMesh.runIndex[i];
@@ -33454,7 +33656,7 @@ var createEllipsePoints = (width10, height10, segments) => {
33454
33656
  }
33455
33657
  return points;
33456
33658
  };
33457
- var COPPER_COLOR = new THREE30.Color(...colors.copper);
33659
+ var COPPER_COLOR = new THREE31.Color(...colors.copper);
33458
33660
  var PLATED_HOLE_LIP_HEIGHT = 0.05;
33459
33661
  var PLATED_HOLE_PAD_THICKNESS = 3e-3;
33460
33662
  var PLATED_HOLE_SURFACE_CLEARANCE = 5e-4;
@@ -34196,7 +34398,7 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
34196
34398
 
34197
34399
  // src/utils/manifold/process-vias.ts
34198
34400
  import { su as su15 } from "@tscircuit/circuit-json-util";
34199
- import * as THREE31 from "three";
34401
+ import * as THREE32 from "three";
34200
34402
 
34201
34403
  // src/utils/via-geoms.ts
34202
34404
  function createViaCopper2({
@@ -34249,7 +34451,7 @@ function createViaCopper2({
34249
34451
  }
34250
34452
 
34251
34453
  // src/utils/manifold/process-vias.ts
34252
- var COPPER_COLOR2 = new THREE31.Color(...colors.copper);
34454
+ var COPPER_COLOR2 = new THREE32.Color(...colors.copper);
34253
34455
  function processViasForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup, boardClipVolume) {
34254
34456
  const viaBoardDrills = [];
34255
34457
  const pcbVias = su15(circuitJson).pcb_via.list();
@@ -34469,7 +34671,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
34469
34671
  {
34470
34672
  key: "plated-holes-union",
34471
34673
  geometry: cutPlatedGeom,
34472
- color: new THREE32.Color(
34674
+ color: new THREE33.Color(
34473
34675
  colors.copper[0],
34474
34676
  colors.copper[1],
34475
34677
  colors.copper[2]
@@ -34499,7 +34701,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
34499
34701
  const matColorArray = boardMaterialColors[boardData.material] ?? colors.fr4Tan;
34500
34702
  currentGeoms.board = {
34501
34703
  geometry: finalBoardGeom,
34502
- color: new THREE32.Color(
34704
+ color: new THREE33.Color(
34503
34705
  matColorArray[0],
34504
34706
  matColorArray[1],
34505
34707
  matColorArray[2]
@@ -34544,11 +34746,11 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
34544
34746
  };
34545
34747
 
34546
34748
  // src/utils/manifold/create-three-geometry-meshes.ts
34547
- import * as THREE34 from "three";
34749
+ import * as THREE35 from "three";
34548
34750
 
34549
34751
  // src/utils/create-board-material.ts
34550
- import * as THREE33 from "three";
34551
- var DEFAULT_SIDE = THREE33.DoubleSide;
34752
+ import * as THREE34 from "three";
34753
+ var DEFAULT_SIDE = THREE34.DoubleSide;
34552
34754
  var createBoardMaterial = ({
34553
34755
  material,
34554
34756
  color,
@@ -34556,7 +34758,7 @@ var createBoardMaterial = ({
34556
34758
  isFaux = false
34557
34759
  }) => {
34558
34760
  if (material === "fr4") {
34559
- return new THREE33.MeshPhysicalMaterial({
34761
+ return new THREE34.MeshPhysicalMaterial({
34560
34762
  color,
34561
34763
  side,
34562
34764
  metalness: 0,
@@ -34573,7 +34775,7 @@ var createBoardMaterial = ({
34573
34775
  polygonOffsetUnits: 1
34574
34776
  });
34575
34777
  }
34576
- return new THREE33.MeshStandardMaterial({
34778
+ return new THREE34.MeshStandardMaterial({
34577
34779
  color,
34578
34780
  side,
34579
34781
  flatShading: true,
@@ -34592,12 +34794,12 @@ function createGeometryMeshes(geoms) {
34592
34794
  const meshes = [];
34593
34795
  if (!geoms) return meshes;
34594
34796
  if (geoms.board && geoms.board.geometry) {
34595
- const mesh = new THREE34.Mesh(
34797
+ const mesh = new THREE35.Mesh(
34596
34798
  geoms.board.geometry,
34597
34799
  createBoardMaterial({
34598
34800
  material: geoms.board.material,
34599
34801
  color: geoms.board.color,
34600
- side: THREE34.DoubleSide,
34802
+ side: THREE35.DoubleSide,
34601
34803
  isFaux: geoms.board.isFaux
34602
34804
  })
34603
34805
  );
@@ -34607,11 +34809,11 @@ function createGeometryMeshes(geoms) {
34607
34809
  const createMeshesFromArray = (geomArray) => {
34608
34810
  if (geomArray) {
34609
34811
  geomArray.forEach((comp) => {
34610
- const mesh = new THREE34.Mesh(
34812
+ const mesh = new THREE35.Mesh(
34611
34813
  comp.geometry,
34612
- new THREE34.MeshStandardMaterial({
34814
+ new THREE35.MeshStandardMaterial({
34613
34815
  color: comp.color,
34614
- side: THREE34.DoubleSide,
34816
+ side: THREE35.DoubleSide,
34615
34817
  flatShading: true
34616
34818
  // Consistent with board
34617
34819
  })
@@ -34655,7 +34857,7 @@ var BoardMeshes = ({
34655
34857
  const typedMaterial = material;
34656
34858
  for (const prop of textureProps) {
34657
34859
  const texture = typedMaterial[prop];
34658
- if (texture && texture instanceof THREE35.Texture) {
34860
+ if (texture && texture instanceof THREE36.Texture) {
34659
34861
  texture.dispose();
34660
34862
  typedMaterial[prop] = null;
34661
34863
  }
@@ -41544,7 +41746,7 @@ var KeyboardShortcutsDialog = ({
41544
41746
 
41545
41747
  // src/CadViewer.tsx
41546
41748
  import { jsx as jsx38, jsxs as jsxs11 } from "react/jsx-runtime";
41547
- var DEFAULT_TARGET = new THREE36.Vector3(0, 0, 0);
41749
+ var DEFAULT_TARGET = new THREE37.Vector3(0, 0, 0);
41548
41750
  var INITIAL_CAMERA_POSITION = [5, -5, 5];
41549
41751
  var CadViewerInner = (props) => {
41550
41752
  const [engine, setEngine] = useState36("manifold");
@@ -41811,11 +42013,11 @@ var CadViewer = (props) => {
41811
42013
  // src/convert-circuit-json-to-3d-svg.ts
41812
42014
  var import_debug = __toESM(require_browser(), 1);
41813
42015
  import { su as su18 } from "@tscircuit/circuit-json-util";
41814
- import * as THREE40 from "three";
42016
+ import * as THREE41 from "three";
41815
42017
  import { SVGRenderer } from "three/examples/jsm/renderers/SVGRenderer.js";
41816
42018
 
41817
42019
  // src/utils/create-geometry-from-polygons.ts
41818
- import * as THREE37 from "three";
42020
+ import * as THREE38 from "three";
41819
42021
  import { BufferGeometry as BufferGeometry4, Float32BufferAttribute as Float32BufferAttribute3 } from "three";
41820
42022
  function createGeometryFromPolygons(polygons) {
41821
42023
  const geometry = new BufferGeometry4();
@@ -41829,12 +42031,12 @@ function createGeometryFromPolygons(polygons) {
41829
42031
  ...polygon3.vertices[i + 1]
41830
42032
  // Third vertex
41831
42033
  );
41832
- const v1 = new THREE37.Vector3(...polygon3.vertices[0]);
41833
- const v2 = new THREE37.Vector3(...polygon3.vertices[i]);
41834
- const v3 = new THREE37.Vector3(...polygon3.vertices[i + 1]);
41835
- const normal = new THREE37.Vector3().crossVectors(
41836
- new THREE37.Vector3().subVectors(v2, v1),
41837
- new THREE37.Vector3().subVectors(v3, v1)
42034
+ const v1 = new THREE38.Vector3(...polygon3.vertices[0]);
42035
+ const v2 = new THREE38.Vector3(...polygon3.vertices[i]);
42036
+ const v3 = new THREE38.Vector3(...polygon3.vertices[i + 1]);
42037
+ const normal = new THREE38.Vector3().crossVectors(
42038
+ new THREE38.Vector3().subVectors(v2, v1),
42039
+ new THREE38.Vector3().subVectors(v3, v1)
41838
42040
  ).normalize();
41839
42041
  normals.push(
41840
42042
  normal.x,
@@ -41858,10 +42060,10 @@ function createGeometryFromPolygons(polygons) {
41858
42060
  var import_modeling2 = __toESM(require_src(), 1);
41859
42061
  var import_jscad_planner2 = __toESM(require_dist(), 1);
41860
42062
  var jscadModeling2 = __toESM(require_src(), 1);
41861
- import * as THREE39 from "three";
42063
+ import * as THREE40 from "three";
41862
42064
 
41863
42065
  // src/utils/load-model.ts
41864
- import * as THREE38 from "three";
42066
+ import * as THREE39 from "three";
41865
42067
  import { GLTFLoader as GLTFLoader2 } from "three/examples/jsm/loaders/GLTFLoader.js";
41866
42068
  import { OBJLoader as OBJLoader2 } from "three/examples/jsm/loaders/OBJLoader.js";
41867
42069
  import { STLLoader as STLLoader2 } from "three/examples/jsm/loaders/STLLoader.js";
@@ -41869,12 +42071,12 @@ async function load3DModel(url) {
41869
42071
  if (url.endsWith(".stl")) {
41870
42072
  const loader = new STLLoader2();
41871
42073
  const geometry = await loader.loadAsync(url);
41872
- const material = new THREE38.MeshStandardMaterial({
42074
+ const material = new THREE39.MeshStandardMaterial({
41873
42075
  color: 8947848,
41874
42076
  metalness: 0.5,
41875
42077
  roughness: 0.5
41876
42078
  });
41877
- return new THREE38.Mesh(geometry, material);
42079
+ return new THREE39.Mesh(geometry, material);
41878
42080
  }
41879
42081
  if (url.endsWith(".obj")) {
41880
42082
  const loader = new OBJLoader2();
@@ -41907,9 +42109,9 @@ async function renderComponent(component, scene) {
41907
42109
  }
41908
42110
  if (component.rotation) {
41909
42111
  model.rotation.set(
41910
- THREE39.MathUtils.degToRad(component.rotation.x ?? 0),
41911
- THREE39.MathUtils.degToRad(component.rotation.y ?? 0),
41912
- THREE39.MathUtils.degToRad(component.rotation.z ?? 0)
42112
+ THREE40.MathUtils.degToRad(component.rotation.x ?? 0),
42113
+ THREE40.MathUtils.degToRad(component.rotation.y ?? 0),
42114
+ THREE40.MathUtils.degToRad(component.rotation.z ?? 0)
41913
42115
  );
41914
42116
  }
41915
42117
  scene.add(model);
@@ -41923,13 +42125,13 @@ async function renderComponent(component, scene) {
41923
42125
  );
41924
42126
  if (jscadObject && (jscadObject.polygons || jscadObject.sides)) {
41925
42127
  const threeGeom = convertCSGToThreeGeom(jscadObject);
41926
- const material2 = new THREE39.MeshStandardMaterial({
42128
+ const material2 = new THREE40.MeshStandardMaterial({
41927
42129
  color: 8947848,
41928
42130
  metalness: 0.5,
41929
42131
  roughness: 0.5,
41930
- side: THREE39.DoubleSide
42132
+ side: THREE40.DoubleSide
41931
42133
  });
41932
- const mesh2 = new THREE39.Mesh(threeGeom, material2);
42134
+ const mesh2 = new THREE40.Mesh(threeGeom, material2);
41933
42135
  if (component.position) {
41934
42136
  mesh2.position.set(
41935
42137
  component.position.x ?? 0,
@@ -41939,9 +42141,9 @@ async function renderComponent(component, scene) {
41939
42141
  }
41940
42142
  if (component.rotation) {
41941
42143
  mesh2.rotation.set(
41942
- THREE39.MathUtils.degToRad(component.rotation.x ?? 0),
41943
- THREE39.MathUtils.degToRad(component.rotation.y ?? 0),
41944
- THREE39.MathUtils.degToRad(component.rotation.z ?? 0)
42144
+ THREE40.MathUtils.degToRad(component.rotation.x ?? 0),
42145
+ THREE40.MathUtils.degToRad(component.rotation.y ?? 0),
42146
+ THREE40.MathUtils.degToRad(component.rotation.z ?? 0)
41945
42147
  );
41946
42148
  }
41947
42149
  scene.add(mesh2);
@@ -41958,17 +42160,17 @@ async function renderComponent(component, scene) {
41958
42160
  if (!geom || !geom.polygons && !geom.sides) {
41959
42161
  continue;
41960
42162
  }
41961
- const color = new THREE39.Color(geomInfo.color);
42163
+ const color = new THREE40.Color(geomInfo.color);
41962
42164
  color.convertLinearToSRGB();
41963
42165
  const geomWithColor = { ...geom, color: [color.r, color.g, color.b] };
41964
42166
  const threeGeom = convertCSGToThreeGeom(geomWithColor);
41965
- const material2 = new THREE39.MeshStandardMaterial({
42167
+ const material2 = new THREE40.MeshStandardMaterial({
41966
42168
  vertexColors: true,
41967
42169
  metalness: 0.2,
41968
42170
  roughness: 0.8,
41969
- side: THREE39.DoubleSide
42171
+ side: THREE40.DoubleSide
41970
42172
  });
41971
- const mesh2 = new THREE39.Mesh(threeGeom, material2);
42173
+ const mesh2 = new THREE40.Mesh(threeGeom, material2);
41972
42174
  if (component.position) {
41973
42175
  mesh2.position.set(
41974
42176
  component.position.x ?? 0,
@@ -41978,22 +42180,22 @@ async function renderComponent(component, scene) {
41978
42180
  }
41979
42181
  if (component.rotation) {
41980
42182
  mesh2.rotation.set(
41981
- THREE39.MathUtils.degToRad(component.rotation.x ?? 0),
41982
- THREE39.MathUtils.degToRad(component.rotation.y ?? 0),
41983
- THREE39.MathUtils.degToRad(component.rotation.z ?? 0)
42183
+ THREE40.MathUtils.degToRad(component.rotation.x ?? 0),
42184
+ THREE40.MathUtils.degToRad(component.rotation.y ?? 0),
42185
+ THREE40.MathUtils.degToRad(component.rotation.z ?? 0)
41984
42186
  );
41985
42187
  }
41986
42188
  scene.add(mesh2);
41987
42189
  }
41988
42190
  return;
41989
42191
  }
41990
- const geometry = new THREE39.BoxGeometry(0.5, 0.5, 0.5);
41991
- const material = new THREE39.MeshStandardMaterial({
42192
+ const geometry = new THREE40.BoxGeometry(0.5, 0.5, 0.5);
42193
+ const material = new THREE40.MeshStandardMaterial({
41992
42194
  color: 16711680,
41993
42195
  transparent: true,
41994
42196
  opacity: 0.25
41995
42197
  });
41996
- const mesh = new THREE39.Mesh(geometry, material);
42198
+ const mesh = new THREE40.Mesh(geometry, material);
41997
42199
  if (component.position) {
41998
42200
  mesh.position.set(
41999
42201
  component.position.x ?? 0,
@@ -42014,11 +42216,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
42014
42216
  padding = 20,
42015
42217
  zoom = 1.5
42016
42218
  } = options;
42017
- const scene = new THREE40.Scene();
42219
+ const scene = new THREE41.Scene();
42018
42220
  const renderer = new SVGRenderer();
42019
42221
  renderer.setSize(width10, height10);
42020
- renderer.setClearColor(new THREE40.Color(backgroundColor), 1);
42021
- const camera = new THREE40.OrthographicCamera();
42222
+ renderer.setClearColor(new THREE41.Color(backgroundColor), 1);
42223
+ const camera = new THREE41.OrthographicCamera();
42022
42224
  const aspect = width10 / height10;
42023
42225
  const frustumSize = 100;
42024
42226
  const halfFrustumSize = frustumSize / 2 / zoom;
@@ -42032,11 +42234,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
42032
42234
  camera.position.set(position.x, position.y, position.z);
42033
42235
  camera.up.set(0, 1, 0);
42034
42236
  const lookAt = options.camera?.lookAt ?? { x: 0, y: 0, z: 0 };
42035
- camera.lookAt(new THREE40.Vector3(lookAt.x, lookAt.y, lookAt.z));
42237
+ camera.lookAt(new THREE41.Vector3(lookAt.x, lookAt.y, lookAt.z));
42036
42238
  camera.updateProjectionMatrix();
42037
- const ambientLight = new THREE40.AmbientLight(16777215, Math.PI / 2);
42239
+ const ambientLight = new THREE41.AmbientLight(16777215, Math.PI / 2);
42038
42240
  scene.add(ambientLight);
42039
- const pointLight = new THREE40.PointLight(16777215, Math.PI / 4);
42241
+ const pointLight = new THREE41.PointLight(16777215, Math.PI / 4);
42040
42242
  pointLight.position.set(-10, -10, 10);
42041
42243
  scene.add(pointLight);
42042
42244
  const components = su18(circuitJson).cad_component.list();
@@ -42047,7 +42249,7 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
42047
42249
  const boardGeom = createBoardGeomFromCircuitJson(circuitJson);
42048
42250
  if (boardGeom) {
42049
42251
  const solderMaskColor = colors.fr4SolderMaskGreen;
42050
- const baseColor = new THREE40.Color(
42252
+ const baseColor = new THREE41.Color(
42051
42253
  solderMaskColor[0],
42052
42254
  solderMaskColor[1],
42053
42255
  solderMaskColor[2]
@@ -42059,28 +42261,28 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
42059
42261
  const material = createBoardMaterial({
42060
42262
  material: boardData?.material,
42061
42263
  color: baseColor,
42062
- side: THREE40.DoubleSide
42264
+ side: THREE41.DoubleSide
42063
42265
  });
42064
- const mesh = new THREE40.Mesh(geometry, material);
42266
+ const mesh = new THREE41.Mesh(geometry, material);
42065
42267
  scene.add(mesh);
42066
42268
  }
42067
42269
  }
42068
- const gridColor = new THREE40.Color(8947848);
42069
- const gridHelper = new THREE40.GridHelper(100, 100, gridColor, gridColor);
42270
+ const gridColor = new THREE41.Color(8947848);
42271
+ const gridHelper = new THREE41.GridHelper(100, 100, gridColor, gridColor);
42070
42272
  gridHelper.rotation.x = Math.PI / 2;
42071
42273
  const materials = Array.isArray(gridHelper.material) ? gridHelper.material : [gridHelper.material];
42072
42274
  for (const mat of materials) {
42073
42275
  mat.transparent = true;
42074
42276
  mat.opacity = 0.3;
42075
- if (mat instanceof THREE40.LineBasicMaterial) {
42277
+ if (mat instanceof THREE41.LineBasicMaterial) {
42076
42278
  mat.color = gridColor;
42077
42279
  mat.vertexColors = false;
42078
42280
  }
42079
42281
  }
42080
42282
  scene.add(gridHelper);
42081
- const box = new THREE40.Box3().setFromObject(scene);
42082
- const center = box.getCenter(new THREE40.Vector3());
42083
- const size4 = box.getSize(new THREE40.Vector3());
42283
+ const box = new THREE41.Box3().setFromObject(scene);
42284
+ const center = box.getCenter(new THREE41.Vector3());
42285
+ const size4 = box.getSize(new THREE41.Vector3());
42084
42286
  scene.position.sub(center);
42085
42287
  const maxDim = Math.max(size4.x, size4.y, size4.z);
42086
42288
  if (maxDim > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.522",
3
+ "version": "0.0.523",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",