circuit-to-svg 0.0.144 → 0.0.145
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 +8 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1466,8 +1466,12 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
1466
1466
|
}
|
|
1467
1467
|
}
|
|
1468
1468
|
const padding = drawPaddingOutsideBoard ? 1 : 0;
|
|
1469
|
-
const
|
|
1470
|
-
const
|
|
1469
|
+
const boundsMinX = drawPaddingOutsideBoard || !isFinite(boardMinX) ? minX : boardMinX;
|
|
1470
|
+
const boundsMinY = drawPaddingOutsideBoard || !isFinite(boardMinY) ? minY : boardMinY;
|
|
1471
|
+
const boundsMaxX = drawPaddingOutsideBoard || !isFinite(boardMaxX) ? maxX : boardMaxX;
|
|
1472
|
+
const boundsMaxY = drawPaddingOutsideBoard || !isFinite(boardMaxY) ? maxY : boardMaxY;
|
|
1473
|
+
const circuitWidth = boundsMaxX - boundsMinX + 2 * padding;
|
|
1474
|
+
const circuitHeight = boundsMaxY - boundsMinY + 2 * padding;
|
|
1471
1475
|
let svgWidth = options?.width ?? 800;
|
|
1472
1476
|
let svgHeight = options?.height ?? 600;
|
|
1473
1477
|
if (options?.matchBoardAspectRatio) {
|
|
@@ -1497,8 +1501,8 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
1497
1501
|
const offsetY = (svgHeight - circuitHeight * scaleFactor) / 2;
|
|
1498
1502
|
const transform = compose4(
|
|
1499
1503
|
translate4(
|
|
1500
|
-
offsetX -
|
|
1501
|
-
svgHeight - offsetY +
|
|
1504
|
+
offsetX - boundsMinX * scaleFactor + padding * scaleFactor,
|
|
1505
|
+
svgHeight - offsetY + boundsMinY * scaleFactor - padding * scaleFactor
|
|
1502
1506
|
),
|
|
1503
1507
|
scale2(scaleFactor, -scaleFactor)
|
|
1504
1508
|
// Flip in y-direction
|