@tscircuit/core 0.0.595 → 0.0.596
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.d.ts +4 -0
- package/dist/index.js +35 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8648,6 +8648,10 @@ declare class SilkscreenPath extends PrimitiveComponent<typeof silkscreenPathPro
|
|
|
8648
8648
|
}>;
|
|
8649
8649
|
};
|
|
8650
8650
|
doInitialPcbPrimitiveRender(): void;
|
|
8651
|
+
_setPositionFromLayout(newCenter: {
|
|
8652
|
+
x: number;
|
|
8653
|
+
y: number;
|
|
8654
|
+
}): void;
|
|
8651
8655
|
getPcbSize(): {
|
|
8652
8656
|
width: number;
|
|
8653
8657
|
height: number;
|
package/dist/index.js
CHANGED
|
@@ -1978,8 +1978,9 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
|
|
|
1978
1978
|
}
|
|
1979
1979
|
const transform = this._computePcbGlobalTransformBeforeLayout();
|
|
1980
1980
|
const subcircuit = this.getSubcircuit();
|
|
1981
|
+
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
|
|
1981
1982
|
const pcb_silkscreen_path = db.pcb_silkscreen_path.insert({
|
|
1982
|
-
pcb_component_id
|
|
1983
|
+
pcb_component_id,
|
|
1983
1984
|
layer,
|
|
1984
1985
|
route: props.route.map((p) => {
|
|
1985
1986
|
const transformedPosition = applyToPoint2(transform, {
|
|
@@ -1998,6 +1999,30 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
|
|
|
1998
1999
|
});
|
|
1999
2000
|
this.pcb_silkscreen_path_id = pcb_silkscreen_path.pcb_silkscreen_path_id;
|
|
2000
2001
|
}
|
|
2002
|
+
_setPositionFromLayout(newCenter) {
|
|
2003
|
+
const { db } = this.root;
|
|
2004
|
+
const { _parsedProps: props } = this;
|
|
2005
|
+
const currentPath = db.pcb_silkscreen_path.get(this.pcb_silkscreen_path_id);
|
|
2006
|
+
if (!currentPath) return;
|
|
2007
|
+
let currentCenterX = 0;
|
|
2008
|
+
let currentCenterY = 0;
|
|
2009
|
+
for (const point of currentPath.route) {
|
|
2010
|
+
currentCenterX += point.x;
|
|
2011
|
+
currentCenterY += point.y;
|
|
2012
|
+
}
|
|
2013
|
+
currentCenterX /= currentPath.route.length;
|
|
2014
|
+
currentCenterY /= currentPath.route.length;
|
|
2015
|
+
const offsetX = newCenter.x - currentCenterX;
|
|
2016
|
+
const offsetY = newCenter.y - currentCenterY;
|
|
2017
|
+
const newRoute = currentPath.route.map((point) => ({
|
|
2018
|
+
...point,
|
|
2019
|
+
x: point.x + offsetX,
|
|
2020
|
+
y: point.y + offsetY
|
|
2021
|
+
}));
|
|
2022
|
+
db.pcb_silkscreen_path.update(this.pcb_silkscreen_path_id, {
|
|
2023
|
+
route: newRoute
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2001
2026
|
getPcbSize() {
|
|
2002
2027
|
const { _parsedProps: props } = this;
|
|
2003
2028
|
if (!props.route || props.route.length === 0) {
|
|
@@ -9812,8 +9837,9 @@ var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
|
9812
9837
|
);
|
|
9813
9838
|
}
|
|
9814
9839
|
const transform = this._computePcbGlobalTransformBeforeLayout();
|
|
9840
|
+
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
|
|
9815
9841
|
const fabrication_note_path = db.pcb_fabrication_note_path.insert({
|
|
9816
|
-
pcb_component_id
|
|
9842
|
+
pcb_component_id,
|
|
9817
9843
|
layer,
|
|
9818
9844
|
color: props.color,
|
|
9819
9845
|
route: props.route.map((p) => {
|
|
@@ -10133,8 +10159,9 @@ var SilkscreenCircle = class extends PrimitiveComponent2 {
|
|
|
10133
10159
|
}
|
|
10134
10160
|
const transform = this._computePcbGlobalTransformBeforeLayout();
|
|
10135
10161
|
const subcircuit = this.getSubcircuit();
|
|
10162
|
+
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
|
|
10136
10163
|
const pcb_silkscreen_circle = db.pcb_silkscreen_circle.insert({
|
|
10137
|
-
pcb_component_id
|
|
10164
|
+
pcb_component_id,
|
|
10138
10165
|
layer,
|
|
10139
10166
|
center: {
|
|
10140
10167
|
x: props.pcbX ?? 0,
|
|
@@ -10177,8 +10204,9 @@ var SilkscreenRect = class extends PrimitiveComponent2 {
|
|
|
10177
10204
|
);
|
|
10178
10205
|
}
|
|
10179
10206
|
const subcircuit = this.getSubcircuit();
|
|
10207
|
+
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
|
|
10180
10208
|
const pcb_silkscreen_rect = db.pcb_silkscreen_rect.insert({
|
|
10181
|
-
pcb_component_id
|
|
10209
|
+
pcb_component_id,
|
|
10182
10210
|
layer,
|
|
10183
10211
|
center: {
|
|
10184
10212
|
x: props.pcbX ?? 0,
|
|
@@ -10221,8 +10249,9 @@ var SilkscreenLine = class extends PrimitiveComponent2 {
|
|
|
10221
10249
|
);
|
|
10222
10250
|
}
|
|
10223
10251
|
const subcircuit = this.getSubcircuit();
|
|
10252
|
+
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
|
|
10224
10253
|
const pcb_silkscreen_line = db.pcb_silkscreen_line.insert({
|
|
10225
|
-
pcb_component_id
|
|
10254
|
+
pcb_component_id,
|
|
10226
10255
|
layer,
|
|
10227
10256
|
x1: props.x1,
|
|
10228
10257
|
y1: props.y1,
|
|
@@ -11228,7 +11257,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11228
11257
|
var package_default = {
|
|
11229
11258
|
name: "@tscircuit/core",
|
|
11230
11259
|
type: "module",
|
|
11231
|
-
version: "0.0.
|
|
11260
|
+
version: "0.0.595",
|
|
11232
11261
|
types: "dist/index.d.ts",
|
|
11233
11262
|
main: "dist/index.js",
|
|
11234
11263
|
module: "dist/index.js",
|