@pixldocs/canvas-renderer 0.5.28 → 0.5.30
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 +16 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2733,6 +2733,13 @@ const clearFabricCharCache = () => {
|
|
|
2733
2733
|
};
|
|
2734
2734
|
const clearFontCacheAndRerender = (canvas) => {
|
|
2735
2735
|
clearFabricCharCache();
|
|
2736
|
+
const logUnderlineDebug = (stage, payload) => {
|
|
2737
|
+
try {
|
|
2738
|
+
console.log(`[canvas-renderer][underline-debug] ${stage} ${JSON.stringify(payload)}`);
|
|
2739
|
+
} catch {
|
|
2740
|
+
console.log("[canvas-renderer][underline-debug]", stage, payload);
|
|
2741
|
+
}
|
|
2742
|
+
};
|
|
2736
2743
|
const collectUnderlineMetrics = (obj) => {
|
|
2737
2744
|
var _a, _b;
|
|
2738
2745
|
if (obj instanceof fabric__namespace.Textbox) {
|
|
@@ -2760,7 +2767,7 @@ const clearFontCacheAndRerender = (canvas) => {
|
|
|
2760
2767
|
};
|
|
2761
2768
|
const beforeMetrics = canvas.getObjects().flatMap(collectUnderlineMetrics);
|
|
2762
2769
|
if (beforeMetrics.length > 0) {
|
|
2763
|
-
|
|
2770
|
+
logUnderlineDebug("before-rerender", beforeMetrics);
|
|
2764
2771
|
}
|
|
2765
2772
|
const resetTextboxLayoutInternals = (obj) => {
|
|
2766
2773
|
var _a;
|
|
@@ -2791,7 +2798,7 @@ const clearFontCacheAndRerender = (canvas) => {
|
|
|
2791
2798
|
}
|
|
2792
2799
|
if (obj.underline) {
|
|
2793
2800
|
const lineWidths = obj.__lineWidths;
|
|
2794
|
-
|
|
2801
|
+
logUnderlineDebug("textbox-rerender", {
|
|
2795
2802
|
id: getObjectId(obj) ?? null,
|
|
2796
2803
|
text: (obj.text || "").slice(0, 120),
|
|
2797
2804
|
fontFamily: obj.fontFamily,
|
|
@@ -2816,7 +2823,7 @@ const clearFontCacheAndRerender = (canvas) => {
|
|
|
2816
2823
|
canvas.getObjects().forEach(fixTextbox);
|
|
2817
2824
|
const afterMetrics = canvas.getObjects().flatMap(collectUnderlineMetrics);
|
|
2818
2825
|
if (afterMetrics.length > 0) {
|
|
2819
|
-
|
|
2826
|
+
logUnderlineDebug("after-rerender", afterMetrics);
|
|
2820
2827
|
}
|
|
2821
2828
|
canvas.requestRenderAll();
|
|
2822
2829
|
};
|
|
@@ -12554,6 +12561,8 @@ class PixldocsRenderer {
|
|
|
12554
12561
|
const fabricInstance = this.getFabricCanvasFromContainer(container);
|
|
12555
12562
|
const expectedImageCount = this.getExpectedImageCount(config, pageIndex);
|
|
12556
12563
|
await this.waitForCanvasImages(container, expectedImageCount);
|
|
12564
|
+
await this.waitForStableTextMetrics(container, config);
|
|
12565
|
+
await this.waitForCanvasScene(container, config, pageIndex);
|
|
12557
12566
|
const fabricCanvas = container.querySelector("canvas.upper-canvas, canvas");
|
|
12558
12567
|
const sourceCanvas = (fabricInstance == null ? void 0 : fabricInstance.lowerCanvasEl) || container.querySelector("canvas.lower-canvas") || fabricCanvas;
|
|
12559
12568
|
if (!sourceCanvas) {
|
|
@@ -12592,7 +12601,7 @@ class PixldocsRenderer {
|
|
|
12592
12601
|
pageIndex,
|
|
12593
12602
|
zoom: pixelRatio,
|
|
12594
12603
|
absoluteZoom: true,
|
|
12595
|
-
skipFontReadyWait:
|
|
12604
|
+
skipFontReadyWait: false,
|
|
12596
12605
|
onReady
|
|
12597
12606
|
})
|
|
12598
12607
|
);
|
|
@@ -12641,6 +12650,8 @@ class PixldocsRenderer {
|
|
|
12641
12650
|
}
|
|
12642
12651
|
const expectedImageCount = this.getExpectedImageCount(config, pageIndex);
|
|
12643
12652
|
await this.waitForCanvasImages(container, expectedImageCount);
|
|
12653
|
+
await this.waitForStableTextMetrics(container, config);
|
|
12654
|
+
await this.waitForCanvasScene(container, config, pageIndex);
|
|
12644
12655
|
const prevVPT = fabricInstance.viewportTransform ? [...fabricInstance.viewportTransform] : void 0;
|
|
12645
12656
|
const prevSvgVPT = fabricInstance.svgViewportTransformation;
|
|
12646
12657
|
const prevRetina = fabricInstance.enableRetinaScaling;
|
|
@@ -12691,7 +12702,7 @@ class PixldocsRenderer {
|
|
|
12691
12702
|
zoom: 1,
|
|
12692
12703
|
// 1:1 — no UI scaling for SVG capture
|
|
12693
12704
|
absoluteZoom: true,
|
|
12694
|
-
skipFontReadyWait:
|
|
12705
|
+
skipFontReadyWait: false,
|
|
12695
12706
|
onReady
|
|
12696
12707
|
})
|
|
12697
12708
|
);
|