@pixldocs/canvas-renderer 0.5.29 → 0.5.31
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 +8 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2769,30 +2769,17 @@ const clearFontCacheAndRerender = (canvas) => {
|
|
|
2769
2769
|
if (beforeMetrics.length > 0) {
|
|
2770
2770
|
logUnderlineDebug("before-rerender", beforeMetrics);
|
|
2771
2771
|
}
|
|
2772
|
-
const resetTextboxLayoutInternals = (obj) => {
|
|
2773
|
-
var _a;
|
|
2774
|
-
(_a = obj._clearCache) == null ? void 0 : _a.call(obj);
|
|
2775
|
-
obj.__charBounds = [];
|
|
2776
|
-
obj.__lineWidths = [];
|
|
2777
|
-
obj.__lineHeights = [];
|
|
2778
|
-
obj.__graphemeLines = [];
|
|
2779
|
-
obj._textLines = [];
|
|
2780
|
-
obj.textLines = [];
|
|
2781
|
-
obj._styleMap = null;
|
|
2782
|
-
obj.styleMap = null;
|
|
2783
|
-
obj.dirty = true;
|
|
2784
|
-
};
|
|
2785
2772
|
const fixTextbox = (obj) => {
|
|
2786
2773
|
var _a, _b, _c;
|
|
2787
2774
|
if (obj instanceof fabric__namespace.Textbox) {
|
|
2788
2775
|
const savedWidth = obj.width;
|
|
2789
2776
|
const savedScaleX = obj.scaleX;
|
|
2790
2777
|
const savedScaleY = obj.scaleY;
|
|
2791
|
-
|
|
2778
|
+
obj._forceClearCache = true;
|
|
2792
2779
|
obj.initDimensions();
|
|
2793
2780
|
if (savedWidth != null) {
|
|
2794
2781
|
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY });
|
|
2795
|
-
|
|
2782
|
+
obj._forceClearCache = true;
|
|
2796
2783
|
obj.initDimensions();
|
|
2797
2784
|
obj.set({ width: savedWidth, scaleX: savedScaleX, scaleY: savedScaleY, dirty: true });
|
|
2798
2785
|
}
|
|
@@ -12561,6 +12548,8 @@ class PixldocsRenderer {
|
|
|
12561
12548
|
const fabricInstance = this.getFabricCanvasFromContainer(container);
|
|
12562
12549
|
const expectedImageCount = this.getExpectedImageCount(config, pageIndex);
|
|
12563
12550
|
await this.waitForCanvasImages(container, expectedImageCount);
|
|
12551
|
+
await this.waitForStableTextMetrics(container, config);
|
|
12552
|
+
await this.waitForCanvasScene(container, config, pageIndex);
|
|
12564
12553
|
const fabricCanvas = container.querySelector("canvas.upper-canvas, canvas");
|
|
12565
12554
|
const sourceCanvas = (fabricInstance == null ? void 0 : fabricInstance.lowerCanvasEl) || container.querySelector("canvas.lower-canvas") || fabricCanvas;
|
|
12566
12555
|
if (!sourceCanvas) {
|
|
@@ -12599,7 +12588,7 @@ class PixldocsRenderer {
|
|
|
12599
12588
|
pageIndex,
|
|
12600
12589
|
zoom: pixelRatio,
|
|
12601
12590
|
absoluteZoom: true,
|
|
12602
|
-
skipFontReadyWait:
|
|
12591
|
+
skipFontReadyWait: false,
|
|
12603
12592
|
onReady
|
|
12604
12593
|
})
|
|
12605
12594
|
);
|
|
@@ -12648,6 +12637,8 @@ class PixldocsRenderer {
|
|
|
12648
12637
|
}
|
|
12649
12638
|
const expectedImageCount = this.getExpectedImageCount(config, pageIndex);
|
|
12650
12639
|
await this.waitForCanvasImages(container, expectedImageCount);
|
|
12640
|
+
await this.waitForStableTextMetrics(container, config);
|
|
12641
|
+
await this.waitForCanvasScene(container, config, pageIndex);
|
|
12651
12642
|
const prevVPT = fabricInstance.viewportTransform ? [...fabricInstance.viewportTransform] : void 0;
|
|
12652
12643
|
const prevSvgVPT = fabricInstance.svgViewportTransformation;
|
|
12653
12644
|
const prevRetina = fabricInstance.enableRetinaScaling;
|
|
@@ -12698,7 +12689,7 @@ class PixldocsRenderer {
|
|
|
12698
12689
|
zoom: 1,
|
|
12699
12690
|
// 1:1 — no UI scaling for SVG capture
|
|
12700
12691
|
absoluteZoom: true,
|
|
12701
|
-
skipFontReadyWait:
|
|
12692
|
+
skipFontReadyWait: false,
|
|
12702
12693
|
onReady
|
|
12703
12694
|
})
|
|
12704
12695
|
);
|