circuit-to-svg 0.0.150 → 0.0.152
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 +15 -32
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3615,6 +3615,7 @@ function createSchematicTrace({
|
|
|
3615
3615
|
cx: screenX.toString(),
|
|
3616
3616
|
cy: screenY.toString(),
|
|
3617
3617
|
r: (Math.abs(transform.a) * 0.03).toString(),
|
|
3618
|
+
class: "trace-junction",
|
|
3618
3619
|
fill: colorMap2.schematic.junction
|
|
3619
3620
|
},
|
|
3620
3621
|
value: "",
|
|
@@ -4453,31 +4454,16 @@ var ninePointAnchorToTextAnchor2 = {
|
|
|
4453
4454
|
middle_bottom: "middle"
|
|
4454
4455
|
};
|
|
4455
4456
|
var ninePointAnchorToDominantBaseline = {
|
|
4456
|
-
top_left: "
|
|
4457
|
-
top_right: "
|
|
4458
|
-
bottom_left: "
|
|
4459
|
-
bottom_right: "
|
|
4460
|
-
center: "
|
|
4457
|
+
top_left: "hanging",
|
|
4458
|
+
top_right: "hanging",
|
|
4459
|
+
bottom_left: "ideographic",
|
|
4460
|
+
bottom_right: "ideographic",
|
|
4461
|
+
center: "middle",
|
|
4461
4462
|
middle_left: "middle",
|
|
4462
4463
|
middle_right: "middle",
|
|
4463
|
-
middle_top: "
|
|
4464
|
-
middle_bottom: "
|
|
4464
|
+
middle_top: "hanging",
|
|
4465
|
+
middle_bottom: "ideographic"
|
|
4465
4466
|
};
|
|
4466
|
-
function getTextOffsets(pathRotation, transform) {
|
|
4467
|
-
const scale9 = Math.abs(transform.a);
|
|
4468
|
-
const baseOffset = scale9 * 0.1;
|
|
4469
|
-
const rotationOffsetMap = {
|
|
4470
|
-
"0": { x: baseOffset * 0.8, y: -baseOffset },
|
|
4471
|
-
// Left
|
|
4472
|
-
"-90": { x: baseOffset * -3.5, y: baseOffset * 2.8 },
|
|
4473
|
-
// Top
|
|
4474
|
-
"90": { x: -baseOffset * -3.55, y: -baseOffset * 4.2 },
|
|
4475
|
-
// Bottom
|
|
4476
|
-
"180": { x: -baseOffset * 0.85, y: -baseOffset * 0.2 }
|
|
4477
|
-
// Right
|
|
4478
|
-
};
|
|
4479
|
-
return rotationOffsetMap[pathRotation.toString()] || { x: 0, y: 0 };
|
|
4480
|
-
}
|
|
4481
4467
|
|
|
4482
4468
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
4483
4469
|
var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
@@ -4518,12 +4504,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4518
4504
|
x: schNetLabel.center.x - realTextGrowthVec.x * fullWidthFsr * fontSizeMm / 2,
|
|
4519
4505
|
y: schNetLabel.center.y - realTextGrowthVec.y * fullWidthFsr * fontSizeMm / 2
|
|
4520
4506
|
};
|
|
4521
|
-
const pathRotation =
|
|
4522
|
-
left: 0,
|
|
4523
|
-
top: -90,
|
|
4524
|
-
bottom: 90,
|
|
4525
|
-
right: 180
|
|
4526
|
-
}[schNetLabel.anchor_side];
|
|
4507
|
+
const pathRotation = 0;
|
|
4527
4508
|
const rotationMatrix = rotate4(pathRotation / 180 * Math.PI);
|
|
4528
4509
|
const symbolBounds = {
|
|
4529
4510
|
minX: Math.min(
|
|
@@ -4547,7 +4528,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4547
4528
|
)
|
|
4548
4529
|
)
|
|
4549
4530
|
};
|
|
4550
|
-
const symbolEndPoint = {
|
|
4531
|
+
const symbolEndPoint = symbol.ports?.[0] ? { x: symbol.ports[0].x, y: symbol.ports[0].y } : {
|
|
4551
4532
|
x: symbolBounds.minX,
|
|
4552
4533
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
4553
4534
|
};
|
|
@@ -4621,10 +4602,9 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4621
4602
|
}
|
|
4622
4603
|
const scale9 = Math.abs(realToScreenTransform.a);
|
|
4623
4604
|
const baseOffset = scale9 * 0.1;
|
|
4624
|
-
const rotationOffset = getTextOffsets(pathRotation, realToScreenTransform);
|
|
4625
4605
|
const offsetScreenPos = {
|
|
4626
|
-
x: screenTextPos.x
|
|
4627
|
-
y: screenTextPos.y
|
|
4606
|
+
x: screenTextPos.x,
|
|
4607
|
+
y: screenTextPos.y
|
|
4628
4608
|
};
|
|
4629
4609
|
svgObjects.push({
|
|
4630
4610
|
name: "text",
|
|
@@ -5063,6 +5043,9 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
|
|
|
5063
5043
|
.trace:hover .trace-crossing-outline {
|
|
5064
5044
|
opacity: 0;
|
|
5065
5045
|
}
|
|
5046
|
+
.trace:hover .trace-junction {
|
|
5047
|
+
filter: invert(1);
|
|
5048
|
+
}
|
|
5066
5049
|
.text { font-family: sans-serif; fill: ${colorMap2.schematic.wire}; }
|
|
5067
5050
|
.pin-number { fill: ${colorMap2.schematic.pin_number}; }
|
|
5068
5051
|
.port-label { fill: ${colorMap2.schematic.reference}; }
|