circuit-to-svg 0.0.180 → 0.0.181
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 +61 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1495,7 +1495,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
1495
1495
|
var package_default = {
|
|
1496
1496
|
name: "circuit-to-svg",
|
|
1497
1497
|
type: "module",
|
|
1498
|
-
version: "0.0.
|
|
1498
|
+
version: "0.0.180",
|
|
1499
1499
|
description: "Convert Circuit JSON to SVG",
|
|
1500
1500
|
main: "dist/index.js",
|
|
1501
1501
|
files: [
|
|
@@ -5240,7 +5240,8 @@ function createSchematicTrace({
|
|
|
5240
5240
|
}) {
|
|
5241
5241
|
const edges = trace.edges;
|
|
5242
5242
|
if (edges.length === 0) return [];
|
|
5243
|
-
const
|
|
5243
|
+
const baseObjects = [];
|
|
5244
|
+
const overlayObjects = [];
|
|
5244
5245
|
let path = "";
|
|
5245
5246
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
5246
5247
|
const edge = edges[edgeIndex];
|
|
@@ -5259,6 +5260,38 @@ function createSchematicTrace({
|
|
|
5259
5260
|
path += ` L ${screenToX} ${screenToY}`;
|
|
5260
5261
|
}
|
|
5261
5262
|
}
|
|
5263
|
+
if (path) {
|
|
5264
|
+
baseObjects.push({
|
|
5265
|
+
name: "path",
|
|
5266
|
+
type: "element",
|
|
5267
|
+
attributes: {
|
|
5268
|
+
d: path,
|
|
5269
|
+
class: "trace-invisible-hover-outline",
|
|
5270
|
+
stroke: colorMap2.schematic.wire,
|
|
5271
|
+
fill: "none",
|
|
5272
|
+
"stroke-width": `${getSchStrokeSize(transform) * 8}px`,
|
|
5273
|
+
"stroke-linecap": "round",
|
|
5274
|
+
opacity: "0",
|
|
5275
|
+
"stroke-linejoin": "round"
|
|
5276
|
+
},
|
|
5277
|
+
value: "",
|
|
5278
|
+
children: []
|
|
5279
|
+
});
|
|
5280
|
+
baseObjects.push({
|
|
5281
|
+
name: "path",
|
|
5282
|
+
type: "element",
|
|
5283
|
+
attributes: {
|
|
5284
|
+
d: path,
|
|
5285
|
+
stroke: colorMap2.schematic.wire,
|
|
5286
|
+
fill: "none",
|
|
5287
|
+
"stroke-width": `${getSchStrokeSize(transform)}px`,
|
|
5288
|
+
"stroke-linecap": "round",
|
|
5289
|
+
"stroke-linejoin": "round"
|
|
5290
|
+
},
|
|
5291
|
+
value: "",
|
|
5292
|
+
children: []
|
|
5293
|
+
});
|
|
5294
|
+
}
|
|
5262
5295
|
for (const edge of edges) {
|
|
5263
5296
|
if (!edge.is_crossing) continue;
|
|
5264
5297
|
const [screenFromX, screenFromY] = applyToPoint38(transform, [
|
|
@@ -5279,7 +5312,7 @@ function createSchematicTrace({
|
|
|
5279
5312
|
const perpY = dx / len * hopHeight;
|
|
5280
5313
|
const controlX = midX + perpX;
|
|
5281
5314
|
const controlY = midY - Math.abs(perpY);
|
|
5282
|
-
|
|
5315
|
+
overlayObjects.push({
|
|
5283
5316
|
name: "path",
|
|
5284
5317
|
type: "element",
|
|
5285
5318
|
attributes: {
|
|
@@ -5288,12 +5321,12 @@ function createSchematicTrace({
|
|
|
5288
5321
|
stroke: colorMap2.schematic.background,
|
|
5289
5322
|
fill: "none",
|
|
5290
5323
|
"stroke-width": `${getSchStrokeSize(transform) * 1.5}px`,
|
|
5291
|
-
"stroke-linecap": "
|
|
5324
|
+
"stroke-linecap": "butt"
|
|
5292
5325
|
},
|
|
5293
5326
|
value: "",
|
|
5294
5327
|
children: []
|
|
5295
5328
|
});
|
|
5296
|
-
|
|
5329
|
+
overlayObjects.push({
|
|
5297
5330
|
name: "path",
|
|
5298
5331
|
type: "element",
|
|
5299
5332
|
attributes: {
|
|
@@ -5307,45 +5340,13 @@ function createSchematicTrace({
|
|
|
5307
5340
|
children: []
|
|
5308
5341
|
});
|
|
5309
5342
|
}
|
|
5310
|
-
if (path) {
|
|
5311
|
-
svgObjects.push({
|
|
5312
|
-
name: "path",
|
|
5313
|
-
type: "element",
|
|
5314
|
-
attributes: {
|
|
5315
|
-
d: path,
|
|
5316
|
-
class: "trace-invisible-hover-outline",
|
|
5317
|
-
stroke: colorMap2.schematic.wire,
|
|
5318
|
-
fill: "none",
|
|
5319
|
-
"stroke-width": `${getSchStrokeSize(transform) * 8}px`,
|
|
5320
|
-
"stroke-linecap": "round",
|
|
5321
|
-
opacity: "0",
|
|
5322
|
-
"stroke-linejoin": "round"
|
|
5323
|
-
},
|
|
5324
|
-
value: "",
|
|
5325
|
-
children: []
|
|
5326
|
-
});
|
|
5327
|
-
svgObjects.push({
|
|
5328
|
-
name: "path",
|
|
5329
|
-
type: "element",
|
|
5330
|
-
attributes: {
|
|
5331
|
-
d: path,
|
|
5332
|
-
stroke: colorMap2.schematic.wire,
|
|
5333
|
-
fill: "none",
|
|
5334
|
-
"stroke-width": `${getSchStrokeSize(transform)}px`,
|
|
5335
|
-
"stroke-linecap": "round",
|
|
5336
|
-
"stroke-linejoin": "round"
|
|
5337
|
-
},
|
|
5338
|
-
value: "",
|
|
5339
|
-
children: []
|
|
5340
|
-
});
|
|
5341
|
-
}
|
|
5342
5343
|
if (trace.junctions) {
|
|
5343
5344
|
for (const junction of trace.junctions) {
|
|
5344
5345
|
const [screenX, screenY] = applyToPoint38(transform, [
|
|
5345
5346
|
junction.x,
|
|
5346
5347
|
junction.y
|
|
5347
5348
|
]);
|
|
5348
|
-
|
|
5349
|
+
overlayObjects.push({
|
|
5349
5350
|
name: "circle",
|
|
5350
5351
|
type: "element",
|
|
5351
5352
|
attributes: {
|
|
@@ -5367,10 +5368,23 @@ function createSchematicTrace({
|
|
|
5367
5368
|
value: "",
|
|
5368
5369
|
attributes: {
|
|
5369
5370
|
class: "trace",
|
|
5371
|
+
"data-layer": "base",
|
|
5370
5372
|
"data-circuit-json-type": "schematic_trace",
|
|
5371
5373
|
"data-schematic-trace-id": trace.schematic_trace_id
|
|
5372
5374
|
},
|
|
5373
|
-
children:
|
|
5375
|
+
children: baseObjects
|
|
5376
|
+
},
|
|
5377
|
+
{
|
|
5378
|
+
name: "g",
|
|
5379
|
+
type: "element",
|
|
5380
|
+
value: "",
|
|
5381
|
+
attributes: {
|
|
5382
|
+
class: "trace-overlays",
|
|
5383
|
+
"data-layer": "overlay",
|
|
5384
|
+
"data-circuit-json-type": "schematic_trace",
|
|
5385
|
+
"data-schematic-trace-id": trace.schematic_trace_id
|
|
5386
|
+
},
|
|
5387
|
+
children: overlayObjects
|
|
5374
5388
|
}
|
|
5375
5389
|
];
|
|
5376
5390
|
}
|
|
@@ -6199,9 +6213,16 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
|
|
|
6199
6213
|
);
|
|
6200
6214
|
}
|
|
6201
6215
|
}
|
|
6216
|
+
const schTraceBaseSvgs = schTraceSvgs.filter(
|
|
6217
|
+
(o) => o.attributes?.["data-layer"] !== "overlay"
|
|
6218
|
+
);
|
|
6219
|
+
const schTraceOverlaySvgs = schTraceSvgs.filter(
|
|
6220
|
+
(o) => o.attributes?.["data-layer"] === "overlay"
|
|
6221
|
+
);
|
|
6202
6222
|
svgChildren.push(
|
|
6203
6223
|
...schDebugObjectSvgs,
|
|
6204
|
-
...
|
|
6224
|
+
...schTraceBaseSvgs,
|
|
6225
|
+
...schTraceOverlaySvgs,
|
|
6205
6226
|
...schComponentSvgs,
|
|
6206
6227
|
...schPortHoverSvgs,
|
|
6207
6228
|
...schNetLabel,
|