@tscircuit/pcb-viewer 1.11.229 → 1.11.230

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
@@ -7746,6 +7746,131 @@ var convertElementToPrimitives = (element, allElements) => {
7746
7746
  }
7747
7747
  return [];
7748
7748
  }
7749
+ case "pcb_fabrication_note_dimension": {
7750
+ const dimensionElement = element;
7751
+ const { from, to, text, font_size, arrow_size } = dimensionElement;
7752
+ const layer = element.layer === "bottom" ? "bottom_fabrication" : "top_fabrication";
7753
+ const primitives = [];
7754
+ const arrowSize = typeof arrow_size === "number" && !Number.isNaN(arrow_size) ? arrow_size : 1;
7755
+ primitives.push({
7756
+ _pcb_drawing_object_id: getNewPcbDrawingObjectId(
7757
+ "pcb_fabrication_note_dimension"
7758
+ ),
7759
+ pcb_drawing_type: "line",
7760
+ x1: from.x,
7761
+ y1: from.y,
7762
+ x2: to.x,
7763
+ y2: to.y,
7764
+ width: 0.05,
7765
+ squareCap: false,
7766
+ layer,
7767
+ _element: element,
7768
+ _parent_pcb_component,
7769
+ _parent_source_component,
7770
+ _source_port
7771
+ });
7772
+ const dx = to.x - from.x;
7773
+ const dy = to.y - from.y;
7774
+ const length = Math.sqrt(dx * dx + dy * dy) || 1;
7775
+ const unitX = dx / length;
7776
+ const unitY = dy / length;
7777
+ const arrowAngle = Math.PI / 6;
7778
+ const arrow1X1 = from.x + arrowSize * (unitX * Math.cos(arrowAngle) - unitY * Math.sin(arrowAngle));
7779
+ const arrow1Y1 = from.y + arrowSize * (unitX * Math.sin(arrowAngle) + unitY * Math.cos(arrowAngle));
7780
+ const arrow1X2 = from.x + arrowSize * (unitX * Math.cos(-arrowAngle) - unitY * Math.sin(-arrowAngle));
7781
+ const arrow1Y2 = from.y + arrowSize * (unitX * Math.sin(-arrowAngle) + unitY * Math.cos(-arrowAngle));
7782
+ primitives.push({
7783
+ _pcb_drawing_object_id: getNewPcbDrawingObjectId(
7784
+ "pcb_fabrication_note_dimension"
7785
+ ),
7786
+ pcb_drawing_type: "line",
7787
+ x1: from.x,
7788
+ y1: from.y,
7789
+ x2: arrow1X1,
7790
+ y2: arrow1Y1,
7791
+ width: 0.05,
7792
+ squareCap: false,
7793
+ layer,
7794
+ _element: element,
7795
+ _parent_pcb_component,
7796
+ _parent_source_component,
7797
+ _source_port
7798
+ });
7799
+ primitives.push({
7800
+ _pcb_drawing_object_id: getNewPcbDrawingObjectId(
7801
+ "pcb_fabrication_note_dimension"
7802
+ ),
7803
+ pcb_drawing_type: "line",
7804
+ x1: from.x,
7805
+ y1: from.y,
7806
+ x2: arrow1X2,
7807
+ y2: arrow1Y2,
7808
+ width: 0.05,
7809
+ squareCap: false,
7810
+ layer,
7811
+ _element: element,
7812
+ _parent_pcb_component,
7813
+ _parent_source_component,
7814
+ _source_port
7815
+ });
7816
+ const arrow2X1 = to.x - arrowSize * (unitX * Math.cos(arrowAngle) - unitY * Math.sin(arrowAngle));
7817
+ const arrow2Y1 = to.y - arrowSize * (unitX * Math.sin(arrowAngle) + unitY * Math.cos(arrowAngle));
7818
+ const arrow2X2 = to.x - arrowSize * (unitX * Math.cos(-arrowAngle) - unitY * Math.sin(-arrowAngle));
7819
+ const arrow2Y2 = to.y - arrowSize * (unitX * Math.sin(-arrowAngle) + unitY * Math.cos(-arrowAngle));
7820
+ primitives.push({
7821
+ _pcb_drawing_object_id: getNewPcbDrawingObjectId(
7822
+ "pcb_fabrication_note_dimension"
7823
+ ),
7824
+ pcb_drawing_type: "line",
7825
+ x1: to.x,
7826
+ y1: to.y,
7827
+ x2: arrow2X1,
7828
+ y2: arrow2Y1,
7829
+ width: 0.05,
7830
+ squareCap: false,
7831
+ layer,
7832
+ _element: element,
7833
+ _parent_pcb_component,
7834
+ _parent_source_component,
7835
+ _source_port
7836
+ });
7837
+ primitives.push({
7838
+ _pcb_drawing_object_id: getNewPcbDrawingObjectId(
7839
+ "pcb_fabrication_note_dimension"
7840
+ ),
7841
+ pcb_drawing_type: "line",
7842
+ x1: to.x,
7843
+ y1: to.y,
7844
+ x2: arrow2X2,
7845
+ y2: arrow2Y2,
7846
+ width: 0.05,
7847
+ squareCap: false,
7848
+ layer,
7849
+ _element: element,
7850
+ _parent_pcb_component,
7851
+ _parent_source_component,
7852
+ _source_port
7853
+ });
7854
+ if (text) {
7855
+ primitives.push({
7856
+ _pcb_drawing_object_id: getNewPcbDrawingObjectId(
7857
+ "pcb_fabrication_note_dimension"
7858
+ ),
7859
+ pcb_drawing_type: "text",
7860
+ x: (from.x + to.x) / 2,
7861
+ y: (from.y + to.y) / 2,
7862
+ layer,
7863
+ align: "center",
7864
+ text,
7865
+ size: font_size,
7866
+ _element: element,
7867
+ _parent_pcb_component,
7868
+ _parent_source_component,
7869
+ _source_port
7870
+ });
7871
+ }
7872
+ return primitives;
7873
+ }
7749
7874
  case "pcb_fabrication_note_text": {
7750
7875
  return [
7751
7876
  {
@@ -11733,7 +11858,7 @@ import { css as css3 } from "@emotion/css";
11733
11858
  // package.json
11734
11859
  var package_default = {
11735
11860
  name: "@tscircuit/pcb-viewer",
11736
- version: "1.11.228",
11861
+ version: "1.11.229",
11737
11862
  main: "dist/index.js",
11738
11863
  type: "module",
11739
11864
  repository: "tscircuit/pcb-viewer",
@@ -11785,7 +11910,7 @@ var package_default = {
11785
11910
  "@emotion/css": "^11.11.2",
11786
11911
  "@vitejs/plugin-react": "^5.0.2",
11787
11912
  "circuit-json": "^0.0.279",
11788
- "circuit-to-svg": "^0.0.191",
11913
+ "circuit-to-svg": "^0.0.240",
11789
11914
  color: "^4.2.3",
11790
11915
  "react-supergrid": "^1.0.10",
11791
11916
  "react-toastify": "^10.0.5",