lbrnts 0.0.9 → 0.0.10
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 +6 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -361,6 +361,10 @@ declare class ShapeBitmap extends ShapeBase {
|
|
|
361
361
|
|
|
362
362
|
interface GenerateSvgOptions {
|
|
363
363
|
margin?: number;
|
|
364
|
+
/** Target width for the SVG. When provided with height, scales the output. */
|
|
365
|
+
width?: number;
|
|
366
|
+
/** Target height for the SVG. When provided with width, scales the output. */
|
|
367
|
+
height?: number;
|
|
364
368
|
}
|
|
365
369
|
|
|
366
370
|
declare function generateLightBurnSvg(root: LightBurnBaseElement | LightBurnBaseElement[], options?: GenerateSvgOptions): string;
|
package/dist/index.js
CHANGED
|
@@ -1315,16 +1315,18 @@ function computeLayout(bbox, options) {
|
|
|
1315
1315
|
const minY = Math.min(0, bbox.minY) - margin;
|
|
1316
1316
|
const maxX = Math.max(0, bbox.maxX) + margin;
|
|
1317
1317
|
const maxY = Math.max(0, bbox.maxY) + margin;
|
|
1318
|
-
const
|
|
1319
|
-
const
|
|
1320
|
-
const viewBox = `${minX} ${minY} ${
|
|
1318
|
+
const contentWidth = maxX - minX;
|
|
1319
|
+
const contentHeight = maxY - minY;
|
|
1320
|
+
const viewBox = `${minX} ${minY} ${contentWidth} ${contentHeight}`;
|
|
1321
1321
|
const flipY = maxY + minY;
|
|
1322
|
+
const width = options?.width ?? contentWidth;
|
|
1323
|
+
const height = options?.height ?? contentHeight;
|
|
1322
1324
|
return {
|
|
1323
1325
|
viewBox,
|
|
1324
1326
|
width,
|
|
1325
1327
|
height,
|
|
1326
1328
|
flipY,
|
|
1327
|
-
bg: { x: minX, y: minY, width, height }
|
|
1329
|
+
bg: { x: minX, y: minY, width: contentWidth, height: contentHeight }
|
|
1328
1330
|
};
|
|
1329
1331
|
}
|
|
1330
1332
|
|