@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.cjs CHANGED
@@ -5689,6 +5689,7 @@ const PageCanvas = react.forwardRef(
5689
5689
  onDynamicFieldClick,
5690
5690
  canvasUpdateVersion = 0,
5691
5691
  pageChildren,
5692
+ skipFontReadyWait = false,
5692
5693
  onReady
5693
5694
  }, ref) => {
5694
5695
  const isEditorMode = mode === "editor";
@@ -5974,9 +5975,11 @@ const PageCanvas = react.forwardRef(
5974
5975
  await Promise.all(fontFamilies.map((f) => ensureFontLoaded(f)));
5975
5976
  }
5976
5977
  }
5977
- await waitForFontsReady();
5978
- await waitUntilFontsAvailable(fontFamilies, { timeoutMs: 3500, pollIntervalMs: 60 });
5979
- await new Promise((r) => requestAnimationFrame(() => r()));
5978
+ if (!skipFontReadyWait) {
5979
+ await waitForFontsReady();
5980
+ await waitUntilFontsAvailable(fontFamilies, { timeoutMs: 3500, pollIntervalMs: 60 });
5981
+ await new Promise((r) => requestAnimationFrame(() => r()));
5982
+ }
5980
5983
  clearFabricCharCache();
5981
5984
  clearMeasurementCache();
5982
5985
  setReady(true);
@@ -9413,6 +9416,7 @@ function PreviewCanvas({
9413
9416
  pageIndex = 0,
9414
9417
  zoom = 1,
9415
9418
  absoluteZoom = false,
9419
+ skipFontReadyWait = false,
9416
9420
  className,
9417
9421
  onDynamicFieldClick,
9418
9422
  onReady
@@ -9567,6 +9571,7 @@ function PreviewCanvas({
9567
9571
  selectedIds: [],
9568
9572
  activeTool: "select",
9569
9573
  mode: "preview",
9574
+ skipFontReadyWait,
9570
9575
  dynamicFieldIds,
9571
9576
  onDynamicFieldClick: handleDynamicFieldClick,
9572
9577
  onReady
@@ -12450,6 +12455,7 @@ class PixldocsRenderer {
12450
12455
  pageIndex,
12451
12456
  zoom: pixelRatio,
12452
12457
  absoluteZoom: true,
12458
+ skipFontReadyWait: true,
12453
12459
  onReady
12454
12460
  })
12455
12461
  );
@@ -12460,7 +12466,6 @@ class PixldocsRenderer {
12460
12466
  const fabricInstance = this.getFabricCanvasFromContainer(container);
12461
12467
  const expectedImageCount = this.getExpectedImageCount(config, pageIndex);
12462
12468
  await this.waitForCanvasImages(container, expectedImageCount);
12463
- await this.waitForStableTextMetrics(container, config);
12464
12469
  const fabricCanvas = container.querySelector("canvas.upper-canvas, canvas");
12465
12470
  const sourceCanvas = (fabricInstance == null ? void 0 : fabricInstance.lowerCanvasEl) || container.querySelector("canvas.lower-canvas") || fabricCanvas;
12466
12471
  if (!sourceCanvas) {
@@ -12499,6 +12504,7 @@ class PixldocsRenderer {
12499
12504
  pageIndex,
12500
12505
  zoom: pixelRatio,
12501
12506
  absoluteZoom: true,
12507
+ skipFontReadyWait: true,
12502
12508
  onReady
12503
12509
  })
12504
12510
  );
@@ -12545,6 +12551,7 @@ class PixldocsRenderer {
12545
12551
  pageIndex,
12546
12552
  zoom: 1,
12547
12553
  absoluteZoom: true,
12554
+ skipFontReadyWait: true,
12548
12555
  onReady
12549
12556
  })
12550
12557
  );
@@ -12561,7 +12568,6 @@ class PixldocsRenderer {
12561
12568
  }
12562
12569
  const expectedImageCount = this.getExpectedImageCount(config, pageIndex);
12563
12570
  await this.waitForCanvasImages(container, expectedImageCount);
12564
- await this.waitForStableTextMetrics(container, config);
12565
12571
  const prevVPT = fabricInstance.viewportTransform ? [...fabricInstance.viewportTransform] : void 0;
12566
12572
  const prevSvgVPT = fabricInstance.svgViewportTransformation;
12567
12573
  const prevRetina = fabricInstance.enableRetinaScaling;
@@ -12612,6 +12618,7 @@ class PixldocsRenderer {
12612
12618
  zoom: 1,
12613
12619
  // 1:1 — no UI scaling for SVG capture
12614
12620
  absoluteZoom: true,
12621
+ skipFontReadyWait: true,
12615
12622
  onReady
12616
12623
  })
12617
12624
  );