@tscircuit/3d-viewer 0.0.597 → 0.0.599

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 +15 -23
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -35765,7 +35765,7 @@ import * as THREE23 from "three";
35765
35765
  // package.json
35766
35766
  var package_default = {
35767
35767
  name: "@tscircuit/3d-viewer",
35768
- version: "0.0.596",
35768
+ version: "0.0.598",
35769
35769
  repository: {
35770
35770
  type: "git",
35771
35771
  url: "https://github.com/tscircuit/3d-viewer"
@@ -35816,6 +35816,7 @@ var package_default = {
35816
35816
  "@biomejs/biome": "^2.1.4",
35817
35817
  "@chromatic-com/storybook": "^1.9.0",
35818
35818
  "@jscad/modeling": "^2.12.5",
35819
+ "@napi-rs/canvas": "^1.0.9",
35819
35820
  "@storybook/blocks": "9.0.0-alpha.17",
35820
35821
  "@storybook/react-vite": "^9.1.5",
35821
35822
  "@tscircuit/alphabet": "^0.0.25",
@@ -40856,10 +40857,12 @@ var createCombinedTexture = ({
40856
40857
  };
40857
40858
  var createMaskedCopperMask = ({
40858
40859
  textures,
40860
+ soldermaskTexture,
40859
40861
  boardData,
40860
40862
  traceTextureResolution
40861
40863
  }) => {
40862
- if (!textures.some((texture) => texture?.image)) return null;
40864
+ if (!soldermaskTexture?.image || !textures.some((texture) => texture?.image))
40865
+ return null;
40863
40866
  const bounds = calculateOutlineBounds(boardData);
40864
40867
  const width10 = Math.floor(bounds.width * traceTextureResolution);
40865
40868
  const height10 = Math.floor(bounds.height * traceTextureResolution);
@@ -40873,6 +40876,15 @@ var createMaskedCopperMask = ({
40873
40876
  if (!texture?.image) continue;
40874
40877
  ctx.drawImage(texture.image, 0, 0, width10, height10);
40875
40878
  }
40879
+ ctx.globalCompositeOperation = "destination-in";
40880
+ ctx.drawImage(
40881
+ soldermaskTexture.image,
40882
+ 0,
40883
+ 0,
40884
+ width10,
40885
+ height10
40886
+ );
40887
+ ctx.globalCompositeOperation = "source-over";
40876
40888
  const maskTexture = new THREE39.CanvasTexture(canvas);
40877
40889
  maskTexture.colorSpace = THREE39.NoColorSpace;
40878
40890
  maskTexture.generateMipmaps = false;
@@ -40999,6 +41011,7 @@ function createCombinedBoardTextures({
40999
41011
  });
41000
41012
  const maskedCopperTexture = showMask && showCopper ? createMaskedCopperMask({
41001
41013
  textures: [traceTexture, maskedCopperPourTexture],
41014
+ soldermaskTexture,
41002
41015
  boardData,
41003
41016
  traceTextureResolution
41004
41017
  }) : null;
@@ -51501,27 +51514,6 @@ var CadViewerInner = (props) => {
51501
51514
  referenceObject
51502
51515
  }
51503
51516
  ),
51504
- /* @__PURE__ */ jsxs11(
51505
- "div",
51506
- {
51507
- style: {
51508
- position: "absolute",
51509
- right: 8,
51510
- top: 8,
51511
- background: "#222",
51512
- color: "#fff",
51513
- padding: "2px 8px",
51514
- borderRadius: 4,
51515
- fontSize: 12,
51516
- opacity: 0.7,
51517
- userSelect: "none"
51518
- },
51519
- children: [
51520
- "Engine: ",
51521
- /* @__PURE__ */ jsx37("b", { children: engine === "jscad" ? "JSCAD" : "Manifold" })
51522
- ]
51523
- }
51524
- ),
51525
51517
  menuVisible && /* @__PURE__ */ jsx37(
51526
51518
  ContextMenu,
51527
51519
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.597",
3
+ "version": "0.0.599",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/3d-viewer"
@@ -51,6 +51,7 @@
51
51
  "@biomejs/biome": "^2.1.4",
52
52
  "@chromatic-com/storybook": "^1.9.0",
53
53
  "@jscad/modeling": "^2.12.5",
54
+ "@napi-rs/canvas": "^1.0.9",
54
55
  "@storybook/blocks": "9.0.0-alpha.17",
55
56
  "@storybook/react-vite": "^9.1.5",
56
57
  "@tscircuit/alphabet": "^0.0.25",