@tscircuit/pcb-viewer 1.11.198 → 1.11.200

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
@@ -102186,7 +102186,8 @@ var convertElementToPrimitives = (element, allElements) => {
102186
102186
  _element: element,
102187
102187
  _parent_pcb_component,
102188
102188
  _parent_source_component,
102189
- _source_port
102189
+ _source_port,
102190
+ ccw_rotation: element.ccw_rotation
102190
102191
  }
102191
102192
  ];
102192
102193
  } else if (element.shape === "circle") {
@@ -102377,6 +102378,46 @@ var convertElementToPrimitives = (element, allElements) => {
102377
102378
  // Pill-shaped hole in drill layer
102378
102379
  }
102379
102380
  ];
102381
+ } else if (element.shape === "rotated_pill_hole_with_rect_pad") {
102382
+ const {
102383
+ x,
102384
+ y,
102385
+ hole_width,
102386
+ hole_height,
102387
+ hole_ccw_rotation,
102388
+ rect_pad_width,
102389
+ rect_pad_height,
102390
+ rect_ccw_rotation
102391
+ } = element;
102392
+ return [
102393
+ {
102394
+ _pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
102395
+ pcb_drawing_type: "rect",
102396
+ x,
102397
+ y,
102398
+ w: rect_pad_width,
102399
+ h: rect_pad_height,
102400
+ layer: "top",
102401
+ // Rectangular pad on top layer
102402
+ _element: element,
102403
+ _parent_pcb_component,
102404
+ _parent_source_component,
102405
+ _source_port,
102406
+ ccw_rotation: rect_ccw_rotation
102407
+ },
102408
+ {
102409
+ _pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
102410
+ _element: element,
102411
+ pcb_drawing_type: "pill",
102412
+ x,
102413
+ y,
102414
+ w: hole_width,
102415
+ h: hole_height,
102416
+ layer: "drill",
102417
+ // Pill-shaped hole in drill layer
102418
+ ccw_rotation: hole_ccw_rotation
102419
+ }
102420
+ ];
102380
102421
  } else {
102381
102422
  return [];
102382
102423
  }
@@ -103160,6 +103201,18 @@ var Drawer = class {
103160
103201
  }
103161
103202
  ctx.restore();
103162
103203
  }
103204
+ rotatedPill(x, y, w, h, ccw_rotation) {
103205
+ const ctx = this.getLayerCtx();
103206
+ this.applyAperture();
103207
+ ctx.save();
103208
+ const [centerX, centerY] = applyToPoint9(this.transform, [x, y]);
103209
+ ctx.translate(centerX, centerY);
103210
+ const cw_rotation = 360 - ccw_rotation;
103211
+ if (ccw_rotation) ctx.rotate(cw_rotation * Math.PI / 180);
103212
+ ctx.translate(-centerX, -centerY);
103213
+ this.pill(x, y, w, h);
103214
+ ctx.restore();
103215
+ }
103163
103216
  circle(x, y, r, mesh_fill) {
103164
103217
  const r$ = scaleOnly(this.transform, r);
103165
103218
  const [x$, y$] = applyToPoint9(this.transform, [x, y]);
@@ -103606,6 +103659,13 @@ var drawRotatedRect = (drawer, rect) => {
103606
103659
  });
103607
103660
  drawer.rotatedRect(rect.x, rect.y, rect.w, rect.h, rect.ccw_rotation);
103608
103661
  };
103662
+ var drawRotatedPill = (drawer, pill) => {
103663
+ drawer.equip({
103664
+ color: getColor(pill),
103665
+ layer: pill.layer
103666
+ });
103667
+ drawer.rotatedPill(pill.x, pill.y, pill.w, pill.h, pill.ccw_rotation);
103668
+ };
103609
103669
  var drawCircle = (drawer, circle) => {
103610
103670
  drawer.equip({
103611
103671
  color: getColor(circle),
@@ -103641,13 +103701,8 @@ var drawPrimitive = (drawer, primitive) => {
103641
103701
  case "text":
103642
103702
  return drawText(drawer, primitive);
103643
103703
  case "rect":
103644
- if (primitive._element?.shape === "rotated_rect") {
103645
- return drawRotatedRect(drawer, {
103646
- ...primitive,
103647
- // @ts-ignore
103648
- ccw_rotation: primitive._element.ccw_rotation,
103649
- mesh_fill: primitive.mesh_fill
103650
- });
103704
+ if (primitive.ccw_rotation) {
103705
+ return drawRotatedRect(drawer, primitive);
103651
103706
  }
103652
103707
  return drawRect(drawer, primitive);
103653
103708
  case "circle":
@@ -103655,6 +103710,9 @@ var drawPrimitive = (drawer, primitive) => {
103655
103710
  case "oval":
103656
103711
  return drawOval(drawer, primitive);
103657
103712
  case "pill":
103713
+ if (primitive.ccw_rotation) {
103714
+ return drawRotatedPill(drawer, primitive);
103715
+ }
103658
103716
  return drawPill(drawer, primitive);
103659
103717
  case "polygon":
103660
103718
  return drawPolygon(drawer, primitive);
@@ -105061,17 +105119,20 @@ var getTextForHighlightedPrimitive = (prim) => {
105061
105119
  case "pcb_smtpad":
105062
105120
  case "pcb_plated_hole": {
105063
105121
  let s = "";
105064
- if (_parent_source_component && "name" in _parent_source_component && _parent_source_component.name) {
105065
- s += `.${_parent_source_component.name} > `;
105066
- }
105067
105122
  const port_hints = Array.from(
105068
105123
  new Set(
105069
105124
  (element.port_hints ?? []).concat(
105070
105125
  _source_port?.port_hints ?? []
105071
105126
  )
105072
105127
  )
105073
- ).sort((a, b) => b.localeCompare(a));
105074
- s += port_hints.map((ph) => ph.match(/^[0-9]+$/) ? `port.${ph}` : `.${ph}`).join(", ");
105128
+ ).filter((ph) => !/^[0-9]+$/.test(ph)).sort((a, b) => b.localeCompare(a));
105129
+ if (_parent_source_component && "name" in _parent_source_component && _parent_source_component.name) {
105130
+ s += `.${_parent_source_component.name}`;
105131
+ if (port_hints.length > 0) s += " > ";
105132
+ }
105133
+ if (port_hints.length > 0) {
105134
+ s += port_hints.map((ph) => `.${ph}`).join(", ");
105135
+ }
105075
105136
  return s;
105076
105137
  }
105077
105138
  default: {
@@ -105481,7 +105542,7 @@ import { css as css3 } from "@emotion/css";
105481
105542
  // package.json
105482
105543
  var package_default2 = {
105483
105544
  name: "@tscircuit/pcb-viewer",
105484
- version: "1.11.197",
105545
+ version: "1.11.199",
105485
105546
  main: "dist/index.js",
105486
105547
  type: "module",
105487
105548
  repository: "tscircuit/pcb-viewer",