@pixldocs/canvas-renderer 0.4.2 → 0.4.4
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.cjs +13 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2577,13 +2577,23 @@ const clearFabricCharCache = () => {
|
|
|
2577
2577
|
};
|
|
2578
2578
|
const clearFontCacheAndRerender = (canvas) => {
|
|
2579
2579
|
clearFabricCharCache();
|
|
2580
|
-
|
|
2580
|
+
const fixTextbox = (obj) => {
|
|
2581
|
+
var _a;
|
|
2581
2582
|
if (obj instanceof fabric__namespace.Textbox) {
|
|
2583
|
+
const savedWidth = obj.width;
|
|
2582
2584
|
obj.dirty = true;
|
|
2583
2585
|
obj.initDimensions();
|
|
2586
|
+
if (savedWidth != null && Math.abs((obj.width ?? 0) - savedWidth) > 0.01) {
|
|
2587
|
+
obj.width = savedWidth;
|
|
2588
|
+
}
|
|
2589
|
+
obj.setCoords();
|
|
2590
|
+
} else if (obj instanceof fabric__namespace.Group) {
|
|
2591
|
+
(_a = obj._objects) == null ? void 0 : _a.forEach(fixTextbox);
|
|
2592
|
+
obj.dirty = true;
|
|
2584
2593
|
obj.setCoords();
|
|
2585
2594
|
}
|
|
2586
|
-
}
|
|
2595
|
+
};
|
|
2596
|
+
canvas.getObjects().forEach(fixTextbox);
|
|
2587
2597
|
canvas.requestRenderAll();
|
|
2588
2598
|
};
|
|
2589
2599
|
const ensureFontLoaded = async (fontFamily) => {
|
|
@@ -12948,13 +12958,13 @@ function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey, opti
|
|
|
12948
12958
|
svg.setAttribute("viewBox", `0 0 ${pageWidth} ${pageHeight}`);
|
|
12949
12959
|
sanitizeSvgTreeForPdf(svg);
|
|
12950
12960
|
normalizeSvgViewBoxOrigin(svg);
|
|
12961
|
+
disambiguateNestedSvgIds(svg);
|
|
12951
12962
|
expandSvgUseElements(svg);
|
|
12952
12963
|
const svgToDraw = normalizeSvgExplicitColors(svg);
|
|
12953
12964
|
inlineComputedStyles(svgToDraw);
|
|
12954
12965
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
12955
12966
|
normalizeSvgGradientStopOffsets(svgToDraw);
|
|
12956
12967
|
expandSvgGradientHrefs(svgToDraw);
|
|
12957
|
-
disambiguateNestedSvgIds(svgToDraw);
|
|
12958
12968
|
prefixSvgIds(svgToDraw, pageKey);
|
|
12959
12969
|
bakeGroupOpacityIntoChildren(svgToDraw);
|
|
12960
12970
|
stripSuspiciousFullPageOverlayNodes(svgToDraw);
|