@tscircuit/pcb-viewer 1.11.308 → 1.11.310

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.
package/dist/index.js CHANGED
@@ -7412,43 +7412,6 @@ var convertElementToPrimitives = (element, allElements) => {
7412
7412
  }
7413
7413
  return [];
7414
7414
  }
7415
- case "pcb_keepout": {
7416
- if (element.shape === "circle") {
7417
- const { center, radius } = element;
7418
- return [
7419
- {
7420
- _pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
7421
- pcb_drawing_type: "circle",
7422
- x: center.x,
7423
- y: center.y,
7424
- r: radius,
7425
- layer: "top",
7426
- _element: element,
7427
- _parent_pcb_component,
7428
- _parent_source_component,
7429
- mesh_fill: true
7430
- }
7431
- ];
7432
- } else if (element.shape === "rect") {
7433
- const { center, width, height } = element;
7434
- return [
7435
- {
7436
- _pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
7437
- pcb_drawing_type: "rect",
7438
- x: center.x,
7439
- y: center.y,
7440
- w: width,
7441
- h: height,
7442
- layer: "top",
7443
- _element: element,
7444
- _parent_pcb_component,
7445
- _parent_source_component,
7446
- mesh_fill: true
7447
- }
7448
- ];
7449
- }
7450
- break;
7451
- }
7452
7415
  case "pcb_trace": {
7453
7416
  const primitives = [];
7454
7417
  if (element.route_thickness_mode === "interpolated") {
@@ -9318,10 +9281,28 @@ function drawPcbSmtPadElementsForLayer({
9318
9281
  }
9319
9282
  }
9320
9283
 
9284
+ // src/lib/draw-pcb-keepout.ts
9285
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer9 } from "circuit-to-canvas";
9286
+ function isPcbKeepout(element) {
9287
+ return element.type === "pcb_keepout";
9288
+ }
9289
+ function drawPcbKeepoutElementsForLayer({
9290
+ canvas,
9291
+ elements,
9292
+ layers,
9293
+ realToCanvasMat
9294
+ }) {
9295
+ const keepoutElements = elements.filter(isPcbKeepout);
9296
+ if (keepoutElements.length === 0) return;
9297
+ const drawer = new CircuitToCanvasDrawer9(canvas);
9298
+ drawer.realToCanvasMat = realToCanvasMat;
9299
+ drawer.drawElements(keepoutElements, { layers: [] });
9300
+ }
9301
+
9321
9302
  // src/lib/draw-via.ts
9322
9303
  import {
9323
9304
  DEFAULT_PCB_COLOR_MAP as DEFAULT_PCB_COLOR_MAP6,
9324
- CircuitToCanvasDrawer as CircuitToCanvasDrawer9
9305
+ CircuitToCanvasDrawer as CircuitToCanvasDrawer10
9325
9306
  } from "circuit-to-canvas";
9326
9307
  import color4 from "color";
9327
9308
  var HOVER_COLOR_MAP3 = {
@@ -9361,12 +9342,12 @@ function drawPcbViaElementsForLayer({
9361
9342
  (element) => !highlightedElementIds.has(element.pcb_via_id)
9362
9343
  );
9363
9344
  if (nonHighlightedElements.length > 0) {
9364
- const drawer = new CircuitToCanvasDrawer9(canvas);
9345
+ const drawer = new CircuitToCanvasDrawer10(canvas);
9365
9346
  drawer.realToCanvasMat = realToCanvasMat;
9366
9347
  drawer.drawElements(nonHighlightedElements, { layers });
9367
9348
  }
9368
9349
  if (highlightedElements.length > 0) {
9369
- const highlightDrawer = new CircuitToCanvasDrawer9(canvas);
9350
+ const highlightDrawer = new CircuitToCanvasDrawer10(canvas);
9370
9351
  highlightDrawer.configure({ colorOverrides: HOVER_COLOR_MAP3 });
9371
9352
  highlightDrawer.realToCanvasMat = realToCanvasMat;
9372
9353
  highlightDrawer.drawElements(highlightedElements, { layers });
@@ -9557,6 +9538,22 @@ var CanvasPrimitiveRenderer = ({
9557
9538
  transform
9558
9539
  );
9559
9540
  }
9541
+ if (topCanvas) {
9542
+ drawPcbKeepoutElementsForLayer({
9543
+ canvas: topCanvas,
9544
+ elements,
9545
+ layers: ["top"],
9546
+ realToCanvasMat: transform
9547
+ });
9548
+ }
9549
+ if (bottomCanvas) {
9550
+ drawPcbKeepoutElementsForLayer({
9551
+ canvas: bottomCanvas,
9552
+ elements,
9553
+ layers: ["bottom"],
9554
+ realToCanvasMat: transform
9555
+ });
9556
+ }
9560
9557
  }
9561
9558
  drawer.orderAndFadeLayers();
9562
9559
  }, [primitives, elements, transform, selectedLayer, isShowingSolderMask]);
@@ -13594,7 +13591,7 @@ import { css as css3 } from "@emotion/css";
13594
13591
  // package.json
13595
13592
  var package_default = {
13596
13593
  name: "@tscircuit/pcb-viewer",
13597
- version: "1.11.307",
13594
+ version: "1.11.309",
13598
13595
  main: "dist/index.js",
13599
13596
  type: "module",
13600
13597
  repository: "tscircuit/pcb-viewer",
@@ -13648,7 +13645,7 @@ var package_default = {
13648
13645
  "@tscircuit/math-utils": "^0.0.29",
13649
13646
  "@vitejs/plugin-react": "^5.0.2",
13650
13647
  "circuit-json": "^0.0.353",
13651
- "circuit-to-canvas": "^0.0.41",
13648
+ "circuit-to-canvas": "^0.0.47",
13652
13649
  "circuit-to-svg": "^0.0.271",
13653
13650
  color: "^4.2.3",
13654
13651
  "react-supergrid": "^1.0.10",