@tscircuit/core 0.0.743 → 0.0.744
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 +13 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1850,16 +1850,18 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1850
1850
|
const { db } = this.root;
|
|
1851
1851
|
const { _parsedProps: props } = this;
|
|
1852
1852
|
if (!props.portHints) return;
|
|
1853
|
-
const container = this.getPrimitiveContainer();
|
|
1854
1853
|
const subcircuit = this.getSubcircuit();
|
|
1855
1854
|
const position = this._getGlobalPcbPositionBeforeLayout();
|
|
1856
|
-
const
|
|
1857
|
-
const decomposedMat = decomposeTSR(
|
|
1855
|
+
const decomposedTransform = decomposeTSR(
|
|
1858
1856
|
this._computePcbGlobalTransformBeforeLayout()
|
|
1859
1857
|
);
|
|
1860
|
-
const
|
|
1858
|
+
const rotationDegrees = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
1859
|
+
const normalizedRotationDegrees = (rotationDegrees % 360 + 360) % 360;
|
|
1860
|
+
const rotationTolerance = 0.01;
|
|
1861
|
+
const isAxisAligned = Math.abs(normalizedRotationDegrees) < rotationTolerance || Math.abs(normalizedRotationDegrees - 180) < rotationTolerance || Math.abs(normalizedRotationDegrees - 360) < rotationTolerance;
|
|
1862
|
+
const isRotated90Degrees = Math.abs(normalizedRotationDegrees - 90) < rotationTolerance || Math.abs(normalizedRotationDegrees - 270) < rotationTolerance;
|
|
1863
|
+
const finalRotationDegrees = Math.abs(normalizedRotationDegrees - 360) < rotationTolerance ? 0 : normalizedRotationDegrees;
|
|
1861
1864
|
const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
|
|
1862
|
-
const parentRotation = container?._parsedProps.pcbRotation ?? 0;
|
|
1863
1865
|
let pcb_smtpad = null;
|
|
1864
1866
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
|
|
1865
1867
|
if (props.shape === "circle") {
|
|
@@ -1888,14 +1890,14 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1888
1890
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1889
1891
|
});
|
|
1890
1892
|
} else if (props.shape === "rect") {
|
|
1891
|
-
pcb_smtpad =
|
|
1893
|
+
pcb_smtpad = isAxisAligned || isRotated90Degrees ? db.pcb_smtpad.insert({
|
|
1892
1894
|
pcb_component_id,
|
|
1893
1895
|
pcb_port_id: this.matchedPort?.pcb_port_id,
|
|
1894
1896
|
// port likely isn't matched
|
|
1895
1897
|
layer: maybeFlipLayer(props.layer ?? "top"),
|
|
1896
1898
|
shape: "rect",
|
|
1897
|
-
width:
|
|
1898
|
-
height:
|
|
1899
|
+
width: isRotated90Degrees ? props.height : props.width,
|
|
1900
|
+
height: isRotated90Degrees ? props.width : props.height,
|
|
1899
1901
|
port_hints: props.portHints.map((ph) => ph.toString()),
|
|
1900
1902
|
is_covered_with_solder_mask: props.coveredWithSolderMask ?? false,
|
|
1901
1903
|
x: position.x,
|
|
@@ -1910,7 +1912,7 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1910
1912
|
height: props.height,
|
|
1911
1913
|
x: position.x,
|
|
1912
1914
|
y: position.y,
|
|
1913
|
-
ccw_rotation:
|
|
1915
|
+
ccw_rotation: finalRotationDegrees,
|
|
1914
1916
|
port_hints: props.portHints.map((ph) => ph.toString()),
|
|
1915
1917
|
is_covered_with_solder_mask: props.coveredWithSolderMask ?? false,
|
|
1916
1918
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
@@ -1937,7 +1939,7 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1937
1939
|
height: pcb_smtpad.height * 0.7,
|
|
1938
1940
|
x: pcb_smtpad.x,
|
|
1939
1941
|
y: pcb_smtpad.y,
|
|
1940
|
-
ccw_rotation:
|
|
1942
|
+
ccw_rotation: finalRotationDegrees,
|
|
1941
1943
|
pcb_component_id: pcb_smtpad.pcb_component_id,
|
|
1942
1944
|
pcb_smtpad_id: pcb_smtpad.pcb_smtpad_id,
|
|
1943
1945
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
@@ -15703,7 +15705,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
15703
15705
|
var package_default = {
|
|
15704
15706
|
name: "@tscircuit/core",
|
|
15705
15707
|
type: "module",
|
|
15706
|
-
version: "0.0.
|
|
15708
|
+
version: "0.0.743",
|
|
15707
15709
|
types: "dist/index.d.ts",
|
|
15708
15710
|
main: "dist/index.js",
|
|
15709
15711
|
module: "dist/index.js",
|