@pixldocs/canvas-renderer 0.5.17 → 0.5.18

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.js CHANGED
@@ -5670,6 +5670,7 @@ const PageCanvas = forwardRef(
5670
5670
  onDynamicFieldClick,
5671
5671
  canvasUpdateVersion = 0,
5672
5672
  pageChildren,
5673
+ skipFontReadyWait = false,
5673
5674
  onReady
5674
5675
  }, ref) => {
5675
5676
  const isEditorMode = mode === "editor";
@@ -5955,9 +5956,11 @@ const PageCanvas = forwardRef(
5955
5956
  await Promise.all(fontFamilies.map((f) => ensureFontLoaded(f)));
5956
5957
  }
5957
5958
  }
5958
- await waitForFontsReady();
5959
- await waitUntilFontsAvailable(fontFamilies, { timeoutMs: 3500, pollIntervalMs: 60 });
5960
- await new Promise((r) => requestAnimationFrame(() => r()));
5959
+ if (!skipFontReadyWait) {
5960
+ await waitForFontsReady();
5961
+ await waitUntilFontsAvailable(fontFamilies, { timeoutMs: 3500, pollIntervalMs: 60 });
5962
+ await new Promise((r) => requestAnimationFrame(() => r()));
5963
+ }
5961
5964
  clearFabricCharCache();
5962
5965
  clearMeasurementCache();
5963
5966
  setReady(true);
@@ -9394,6 +9397,7 @@ function PreviewCanvas({
9394
9397
  pageIndex = 0,
9395
9398
  zoom = 1,
9396
9399
  absoluteZoom = false,
9400
+ skipFontReadyWait = false,
9397
9401
  className,
9398
9402
  onDynamicFieldClick,
9399
9403
  onReady
@@ -9548,6 +9552,7 @@ function PreviewCanvas({
9548
9552
  selectedIds: [],
9549
9553
  activeTool: "select",
9550
9554
  mode: "preview",
9555
+ skipFontReadyWait,
9551
9556
  dynamicFieldIds,
9552
9557
  onDynamicFieldClick: handleDynamicFieldClick,
9553
9558
  onReady
@@ -12431,6 +12436,7 @@ class PixldocsRenderer {
12431
12436
  pageIndex,
12432
12437
  zoom: pixelRatio,
12433
12438
  absoluteZoom: true,
12439
+ skipFontReadyWait: true,
12434
12440
  onReady
12435
12441
  })
12436
12442
  );
@@ -12441,7 +12447,6 @@ class PixldocsRenderer {
12441
12447
  const fabricInstance = this.getFabricCanvasFromContainer(container);
12442
12448
  const expectedImageCount = this.getExpectedImageCount(config, pageIndex);
12443
12449
  await this.waitForCanvasImages(container, expectedImageCount);
12444
- await this.waitForStableTextMetrics(container, config);
12445
12450
  const fabricCanvas = container.querySelector("canvas.upper-canvas, canvas");
12446
12451
  const sourceCanvas = (fabricInstance == null ? void 0 : fabricInstance.lowerCanvasEl) || container.querySelector("canvas.lower-canvas") || fabricCanvas;
12447
12452
  if (!sourceCanvas) {
@@ -12480,6 +12485,7 @@ class PixldocsRenderer {
12480
12485
  pageIndex,
12481
12486
  zoom: pixelRatio,
12482
12487
  absoluteZoom: true,
12488
+ skipFontReadyWait: true,
12483
12489
  onReady
12484
12490
  })
12485
12491
  );
@@ -12526,6 +12532,7 @@ class PixldocsRenderer {
12526
12532
  pageIndex,
12527
12533
  zoom: 1,
12528
12534
  absoluteZoom: true,
12535
+ skipFontReadyWait: true,
12529
12536
  onReady
12530
12537
  })
12531
12538
  );
@@ -12542,7 +12549,6 @@ class PixldocsRenderer {
12542
12549
  }
12543
12550
  const expectedImageCount = this.getExpectedImageCount(config, pageIndex);
12544
12551
  await this.waitForCanvasImages(container, expectedImageCount);
12545
- await this.waitForStableTextMetrics(container, config);
12546
12552
  const prevVPT = fabricInstance.viewportTransform ? [...fabricInstance.viewportTransform] : void 0;
12547
12553
  const prevSvgVPT = fabricInstance.svgViewportTransformation;
12548
12554
  const prevRetina = fabricInstance.enableRetinaScaling;
@@ -12593,6 +12599,7 @@ class PixldocsRenderer {
12593
12599
  zoom: 1,
12594
12600
  // 1:1 — no UI scaling for SVG capture
12595
12601
  absoluteZoom: true,
12602
+ skipFontReadyWait: true,
12596
12603
  onReady
12597
12604
  })
12598
12605
  );