@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.js
CHANGED
|
@@ -2558,13 +2558,23 @@ const clearFabricCharCache = () => {
|
|
|
2558
2558
|
};
|
|
2559
2559
|
const clearFontCacheAndRerender = (canvas) => {
|
|
2560
2560
|
clearFabricCharCache();
|
|
2561
|
-
|
|
2561
|
+
const fixTextbox = (obj) => {
|
|
2562
|
+
var _a;
|
|
2562
2563
|
if (obj instanceof fabric.Textbox) {
|
|
2564
|
+
const savedWidth = obj.width;
|
|
2563
2565
|
obj.dirty = true;
|
|
2564
2566
|
obj.initDimensions();
|
|
2567
|
+
if (savedWidth != null && Math.abs((obj.width ?? 0) - savedWidth) > 0.01) {
|
|
2568
|
+
obj.width = savedWidth;
|
|
2569
|
+
}
|
|
2570
|
+
obj.setCoords();
|
|
2571
|
+
} else if (obj instanceof fabric.Group) {
|
|
2572
|
+
(_a = obj._objects) == null ? void 0 : _a.forEach(fixTextbox);
|
|
2573
|
+
obj.dirty = true;
|
|
2565
2574
|
obj.setCoords();
|
|
2566
2575
|
}
|
|
2567
|
-
}
|
|
2576
|
+
};
|
|
2577
|
+
canvas.getObjects().forEach(fixTextbox);
|
|
2568
2578
|
canvas.requestRenderAll();
|
|
2569
2579
|
};
|
|
2570
2580
|
const ensureFontLoaded = async (fontFamily) => {
|
|
@@ -12929,13 +12939,13 @@ function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey, opti
|
|
|
12929
12939
|
svg.setAttribute("viewBox", `0 0 ${pageWidth} ${pageHeight}`);
|
|
12930
12940
|
sanitizeSvgTreeForPdf(svg);
|
|
12931
12941
|
normalizeSvgViewBoxOrigin(svg);
|
|
12942
|
+
disambiguateNestedSvgIds(svg);
|
|
12932
12943
|
expandSvgUseElements(svg);
|
|
12933
12944
|
const svgToDraw = normalizeSvgExplicitColors(svg);
|
|
12934
12945
|
inlineComputedStyles(svgToDraw);
|
|
12935
12946
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
12936
12947
|
normalizeSvgGradientStopOffsets(svgToDraw);
|
|
12937
12948
|
expandSvgGradientHrefs(svgToDraw);
|
|
12938
|
-
disambiguateNestedSvgIds(svgToDraw);
|
|
12939
12949
|
prefixSvgIds(svgToDraw, pageKey);
|
|
12940
12950
|
bakeGroupOpacityIntoChildren(svgToDraw);
|
|
12941
12951
|
stripSuspiciousFullPageOverlayNodes(svgToDraw);
|