@tscircuit/core 0.0.805 → 0.0.806
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 +46 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1858,6 +1858,15 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1858
1858
|
if (props.shape === "rect") {
|
|
1859
1859
|
return { width: props.width, height: props.height };
|
|
1860
1860
|
}
|
|
1861
|
+
if (props.shape === "rotated_rect") {
|
|
1862
|
+
const rotationDegrees = props.ccwRotation ?? 0;
|
|
1863
|
+
const angleRad = rotationDegrees * Math.PI / 180;
|
|
1864
|
+
const cosAngle = Math.cos(angleRad);
|
|
1865
|
+
const sinAngle = Math.sin(angleRad);
|
|
1866
|
+
const width = Math.abs(props.width * cosAngle) + Math.abs(props.height * sinAngle);
|
|
1867
|
+
const height = Math.abs(props.width * sinAngle) + Math.abs(props.height * cosAngle);
|
|
1868
|
+
return { width, height };
|
|
1869
|
+
}
|
|
1861
1870
|
if (props.shape === "polygon") {
|
|
1862
1871
|
const points = props.points;
|
|
1863
1872
|
const xs = points.map((p) => p.x);
|
|
@@ -1908,6 +1917,7 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1908
1917
|
const isAxisAligned = Math.abs(normalizedRotationDegrees) < rotationTolerance || Math.abs(normalizedRotationDegrees - 180) < rotationTolerance || Math.abs(normalizedRotationDegrees - 360) < rotationTolerance;
|
|
1909
1918
|
const isRotated90Degrees = Math.abs(normalizedRotationDegrees - 90) < rotationTolerance || Math.abs(normalizedRotationDegrees - 270) < rotationTolerance;
|
|
1910
1919
|
let finalRotationDegrees = Math.abs(normalizedRotationDegrees - 360) < rotationTolerance ? 0 : normalizedRotationDegrees;
|
|
1920
|
+
const transformRotationBeforeFlip = finalRotationDegrees;
|
|
1911
1921
|
const { maybeFlipLayer, isFlipped } = this._getPcbPrimitiveFlippedHelpers();
|
|
1912
1922
|
if (isFlipped) {
|
|
1913
1923
|
finalRotationDegrees = (360 - finalRotationDegrees + 360) % 360;
|
|
@@ -1992,12 +2002,46 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1992
2002
|
height: pcb_smtpad.height * 0.7,
|
|
1993
2003
|
x: pcb_smtpad.x,
|
|
1994
2004
|
y: pcb_smtpad.y,
|
|
1995
|
-
ccw_rotation:
|
|
2005
|
+
ccw_rotation: pcb_smtpad.ccw_rotation,
|
|
1996
2006
|
pcb_component_id: pcb_smtpad.pcb_component_id,
|
|
1997
2007
|
pcb_smtpad_id: pcb_smtpad.pcb_smtpad_id,
|
|
1998
2008
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
1999
2009
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
2000
2010
|
});
|
|
2011
|
+
} else if (props.shape === "rotated_rect") {
|
|
2012
|
+
const baseRotation = props.ccwRotation ?? 0;
|
|
2013
|
+
const combinedRotationBeforeFlip = (transformRotationBeforeFlip + baseRotation + 360) % 360;
|
|
2014
|
+
const padRotation = isFlipped ? (360 - combinedRotationBeforeFlip + 360) % 360 : combinedRotationBeforeFlip;
|
|
2015
|
+
pcb_smtpad = db.pcb_smtpad.insert({
|
|
2016
|
+
pcb_component_id,
|
|
2017
|
+
pcb_port_id: this.matchedPort?.pcb_port_id,
|
|
2018
|
+
layer: maybeFlipLayer(props.layer ?? "top"),
|
|
2019
|
+
shape: "rotated_rect",
|
|
2020
|
+
width: props.width,
|
|
2021
|
+
height: props.height,
|
|
2022
|
+
corner_radius: props.cornerRadius ?? 0,
|
|
2023
|
+
x: position.x,
|
|
2024
|
+
y: position.y,
|
|
2025
|
+
ccw_rotation: padRotation,
|
|
2026
|
+
port_hints: props.portHints.map((ph) => ph.toString()),
|
|
2027
|
+
is_covered_with_solder_mask: isCoveredWithSolderMask,
|
|
2028
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
2029
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
2030
|
+
});
|
|
2031
|
+
if (shouldCreateSolderPaste)
|
|
2032
|
+
db.pcb_solder_paste.insert({
|
|
2033
|
+
layer: maybeFlipLayer(props.layer ?? "top"),
|
|
2034
|
+
shape: "rotated_rect",
|
|
2035
|
+
width: pcb_smtpad.width * 0.7,
|
|
2036
|
+
height: pcb_smtpad.height * 0.7,
|
|
2037
|
+
x: position.x,
|
|
2038
|
+
y: position.y,
|
|
2039
|
+
ccw_rotation: padRotation,
|
|
2040
|
+
pcb_component_id,
|
|
2041
|
+
pcb_smtpad_id: pcb_smtpad.pcb_smtpad_id,
|
|
2042
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
2043
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
2044
|
+
});
|
|
2001
2045
|
} else if (props.shape === "polygon") {
|
|
2002
2046
|
pcb_smtpad = db.pcb_smtpad.insert({
|
|
2003
2047
|
pcb_component_id,
|
|
@@ -17117,7 +17161,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17117
17161
|
var package_default = {
|
|
17118
17162
|
name: "@tscircuit/core",
|
|
17119
17163
|
type: "module",
|
|
17120
|
-
version: "0.0.
|
|
17164
|
+
version: "0.0.805",
|
|
17121
17165
|
types: "dist/index.d.ts",
|
|
17122
17166
|
main: "dist/index.js",
|
|
17123
17167
|
module: "dist/index.js",
|