circuit-to-svg 0.0.366 → 0.0.367
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 +6 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6933,7 +6933,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
6933
6933
|
var package_default = {
|
|
6934
6934
|
name: "circuit-to-svg",
|
|
6935
6935
|
type: "module",
|
|
6936
|
-
version: "0.0.
|
|
6936
|
+
version: "0.0.366",
|
|
6937
6937
|
description: "Convert Circuit JSON to SVG",
|
|
6938
6938
|
main: "dist/index.js",
|
|
6939
6939
|
files: [
|
|
@@ -11350,12 +11350,8 @@ var DEFAULT_SCHEMATIC_SHEET_WIDTH = 297 / SCHEMATIC_UNIT_TO_MM;
|
|
|
11350
11350
|
var DEFAULT_SCHEMATIC_SHEET_HEIGHT = 210 / SCHEMATIC_UNIT_TO_MM;
|
|
11351
11351
|
var SCHEMATIC_SHEET_GAP = 20 / SCHEMATIC_UNIT_TO_MM;
|
|
11352
11352
|
var SCHEMATIC_SHEET_INNER_MARGIN = 5 / SCHEMATIC_UNIT_TO_MM;
|
|
11353
|
-
function getSchematicSheetLayout(
|
|
11354
|
-
const
|
|
11355
|
-
const center = {
|
|
11356
|
-
x: sheetIndex * (DEFAULT_SCHEMATIC_SHEET_WIDTH + SCHEMATIC_SHEET_GAP),
|
|
11357
|
-
y: 0
|
|
11358
|
-
};
|
|
11353
|
+
function getSchematicSheetLayout() {
|
|
11354
|
+
const center = { x: 0, y: 0 };
|
|
11359
11355
|
const minX = center.x - DEFAULT_SCHEMATIC_SHEET_WIDTH / 2;
|
|
11360
11356
|
const maxX = center.x + DEFAULT_SCHEMATIC_SHEET_WIDTH / 2;
|
|
11361
11357
|
const minY = center.y - DEFAULT_SCHEMATIC_SHEET_HEIGHT / 2;
|
|
@@ -11384,7 +11380,7 @@ function getSchematicBoundsFromCircuitJson(soup, padding = 0.5) {
|
|
|
11384
11380
|
const portSize = 0.2;
|
|
11385
11381
|
for (const item of soup) {
|
|
11386
11382
|
if (item.type === "schematic_sheet") {
|
|
11387
|
-
const layout = getSchematicSheetLayout(
|
|
11383
|
+
const layout = getSchematicSheetLayout();
|
|
11388
11384
|
updateBounds(
|
|
11389
11385
|
layout.center,
|
|
11390
11386
|
{ width: layout.width, height: layout.height },
|
|
@@ -13480,7 +13476,7 @@ function createSvgObjectsFromSchematicSheet({
|
|
|
13480
13476
|
transform,
|
|
13481
13477
|
colorMap: colorMap2
|
|
13482
13478
|
}) {
|
|
13483
|
-
const layout = getSchematicSheetLayout(
|
|
13479
|
+
const layout = getSchematicSheetLayout();
|
|
13484
13480
|
const sheetColor = colorMap2.schematic.sheet;
|
|
13485
13481
|
const labelColor = colorMap2.schematic.net_name;
|
|
13486
13482
|
const children = [
|
|
@@ -14680,7 +14676,6 @@ function convertCircuitJsonToStackedSchematicSheetsSvg(circuitJson, options) {
|
|
|
14680
14676
|
const panelTop = yOffset + labelHeight;
|
|
14681
14677
|
const labelText = sheet.display_name ?? sheet.name ?? `Sheet ${sheet.sheet_index ?? index + 1}`;
|
|
14682
14678
|
const labelPosition = getSheetLabelPosition({
|
|
14683
|
-
sheet,
|
|
14684
14679
|
transformStr: sheetNode.attributes?.["data-real-to-screen-transform"],
|
|
14685
14680
|
panelTop,
|
|
14686
14681
|
labelHeight
|
|
@@ -14747,7 +14742,6 @@ function convertCircuitJsonToStackedSchematicSheetsSvg(circuitJson, options) {
|
|
|
14747
14742
|
return stringify5(svgObject);
|
|
14748
14743
|
}
|
|
14749
14744
|
function getSheetLabelPosition({
|
|
14750
|
-
sheet,
|
|
14751
14745
|
transformStr,
|
|
14752
14746
|
panelTop,
|
|
14753
14747
|
labelHeight
|
|
@@ -14756,7 +14750,7 @@ function getSheetLabelPosition({
|
|
|
14756
14750
|
if (!transformStr) {
|
|
14757
14751
|
return { x: 4, y };
|
|
14758
14752
|
}
|
|
14759
|
-
const layout = getSchematicSheetLayout(
|
|
14753
|
+
const layout = getSchematicSheetLayout();
|
|
14760
14754
|
const frameLeft = applyToPoint84(fromString(transformStr), {
|
|
14761
14755
|
x: layout.minX,
|
|
14762
14756
|
y: layout.maxY
|