@pixldocs/canvas-renderer 0.5.423 → 0.5.425
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-Bai6zGgn.js → index-C3izL-t6.js} +83 -6
- package/dist/index-C3izL-t6.js.map +1 -0
- package/dist/{index-DNExytIw.cjs → index-qOAH-a4l.cjs} +83 -6
- package/dist/index-qOAH-a4l.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CpifSUUc.js → vectorPdfExport-DR3TOj0C.js} +4 -4
- package/dist/{vectorPdfExport-CpifSUUc.js.map → vectorPdfExport-DR3TOj0C.js.map} +1 -1
- package/dist/{vectorPdfExport-DiLsMhi9.cjs → vectorPdfExport-ygzscD4n.cjs} +4 -4
- package/dist/{vectorPdfExport-DiLsMhi9.cjs.map → vectorPdfExport-ygzscD4n.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-Bai6zGgn.js.map +0 -1
- package/dist/index-DNExytIw.cjs.map +0 -1
|
@@ -10708,6 +10708,8 @@ const SELECTION_PRIMARY = "hsl(217, 91%, 60%)";
|
|
|
10708
10708
|
const SELECTION_BORDER_SCALE = 2;
|
|
10709
10709
|
let ensureCanvaControlRenders = () => {
|
|
10710
10710
|
};
|
|
10711
|
+
let ensureCanvaEdgeHitArea = () => {
|
|
10712
|
+
};
|
|
10711
10713
|
try {
|
|
10712
10714
|
const InteractiveBase = fabric.InteractiveFabricObject ?? fabric.Object;
|
|
10713
10715
|
if ((InteractiveBase == null ? void 0 : InteractiveBase.prototype) && !InteractiveBase.prototype.__pixldocsCenteredSelectionBorder) {
|
|
@@ -12728,6 +12730,74 @@ const PageCanvas = forwardRef(
|
|
|
12728
12730
|
prevKey = null;
|
|
12729
12731
|
});
|
|
12730
12732
|
}
|
|
12733
|
+
{
|
|
12734
|
+
const EDGE_HIT_ALONG_MIN = 44;
|
|
12735
|
+
const CORNER_BUFFER = 24;
|
|
12736
|
+
const syncEdgeHitSizes = (obj) => {
|
|
12737
|
+
var _a2, _b2, _c2;
|
|
12738
|
+
if (!obj || !obj.controls) return;
|
|
12739
|
+
try {
|
|
12740
|
+
ensureCanvaControlRenders(obj);
|
|
12741
|
+
const canvasForObj = obj.canvas ?? fabricCanvas;
|
|
12742
|
+
const zoom3 = ((_a2 = canvasForObj.getZoom) == null ? void 0 : _a2.call(canvasForObj)) || 1;
|
|
12743
|
+
let scaleX = obj.scaleX ?? 1;
|
|
12744
|
+
let scaleY = obj.scaleY ?? 1;
|
|
12745
|
+
try {
|
|
12746
|
+
const m = (_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj);
|
|
12747
|
+
if (m) {
|
|
12748
|
+
const dec = fabric.util.qrDecompose(m);
|
|
12749
|
+
scaleX = Math.abs(dec.scaleX ?? scaleX);
|
|
12750
|
+
scaleY = Math.abs(dec.scaleY ?? scaleY);
|
|
12751
|
+
}
|
|
12752
|
+
} catch {
|
|
12753
|
+
}
|
|
12754
|
+
const screenW = (obj.width ?? 0) * scaleX * zoom3;
|
|
12755
|
+
const screenH = (obj.height ?? 0) * scaleY * zoom3;
|
|
12756
|
+
const alongW = Math.max(EDGE_HIT_ALONG_MIN, screenW - CORNER_BUFFER);
|
|
12757
|
+
const alongH = Math.max(EDGE_HIT_ALONG_MIN, screenH - CORNER_BUFFER);
|
|
12758
|
+
let changed = false;
|
|
12759
|
+
for (const k of ["ml", "mr"]) {
|
|
12760
|
+
const c = obj.controls[k];
|
|
12761
|
+
if (!c) continue;
|
|
12762
|
+
if (c.sizeY !== alongH || c.touchSizeY !== alongH) changed = true;
|
|
12763
|
+
c.sizeY = alongH;
|
|
12764
|
+
c.touchSizeY = alongH;
|
|
12765
|
+
}
|
|
12766
|
+
for (const k of ["mt", "mb"]) {
|
|
12767
|
+
const c = obj.controls[k];
|
|
12768
|
+
if (!c) continue;
|
|
12769
|
+
if (c.sizeX !== alongW || c.touchSizeX !== alongW) changed = true;
|
|
12770
|
+
c.sizeX = alongW;
|
|
12771
|
+
c.touchSizeX = alongW;
|
|
12772
|
+
}
|
|
12773
|
+
if (changed) (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
|
|
12774
|
+
} catch {
|
|
12775
|
+
}
|
|
12776
|
+
};
|
|
12777
|
+
ensureCanvaEdgeHitArea = syncEdgeHitSizes;
|
|
12778
|
+
const syncActive = () => {
|
|
12779
|
+
const obj = fabricCanvas.getActiveObject();
|
|
12780
|
+
if (obj) {
|
|
12781
|
+
syncEdgeHitSizes(obj);
|
|
12782
|
+
requestAnimationFrame(() => syncEdgeHitSizes(obj));
|
|
12783
|
+
}
|
|
12784
|
+
};
|
|
12785
|
+
fabricCanvas.on("selection:created", syncActive);
|
|
12786
|
+
fabricCanvas.on("selection:updated", syncActive);
|
|
12787
|
+
fabricCanvas.on("object:scaling", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
|
|
12788
|
+
fabricCanvas.on("object:modified", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
|
|
12789
|
+
fabricCanvas.on("object:resizing", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
|
|
12790
|
+
fabricCanvas.on("after:render", () => {
|
|
12791
|
+
const obj = fabricCanvas.getActiveObject();
|
|
12792
|
+
if (!obj) return;
|
|
12793
|
+
const lastZoom = obj.__pixldocsLastEdgeHitZoom;
|
|
12794
|
+
const z = fabricCanvas.getZoom() || 1;
|
|
12795
|
+
if (lastZoom !== z) {
|
|
12796
|
+
obj.__pixldocsLastEdgeHitZoom = z;
|
|
12797
|
+
syncEdgeHitSizes(obj);
|
|
12798
|
+
}
|
|
12799
|
+
});
|
|
12800
|
+
}
|
|
12731
12801
|
const initFonts = async () => {
|
|
12732
12802
|
try {
|
|
12733
12803
|
await preloadAllFonts();
|
|
@@ -13219,9 +13289,11 @@ const PageCanvas = forwardRef(
|
|
|
13219
13289
|
if (activeObj instanceof fabric.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
|
|
13220
13290
|
if (activeObj) applyControlSizeForZoom(fabricCanvas, activeObj);
|
|
13221
13291
|
if (activeObj) ensureCanvaControlRenders(activeObj);
|
|
13292
|
+
if (activeObj) ensureCanvaEdgeHitArea(activeObj);
|
|
13222
13293
|
if (activeObj && !(activeObj instanceof fabric.ActiveSelection) && (((_a2 = activeObj._ct) == null ? void 0 : _a2.isCropGroup) || activeObj.__cropGroup)) {
|
|
13223
13294
|
installImageResizeControlsWithSnap(activeObj);
|
|
13224
13295
|
ensureCanvaControlRenders(activeObj);
|
|
13296
|
+
ensureCanvaEdgeHitArea(activeObj);
|
|
13225
13297
|
}
|
|
13226
13298
|
});
|
|
13227
13299
|
fabricCanvas.on("selection:updated", () => {
|
|
@@ -13235,9 +13307,11 @@ const PageCanvas = forwardRef(
|
|
|
13235
13307
|
if (activeObj instanceof fabric.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
|
|
13236
13308
|
if (activeObj) applyControlSizeForZoom(fabricCanvas, activeObj);
|
|
13237
13309
|
if (activeObj) ensureCanvaControlRenders(activeObj);
|
|
13310
|
+
if (activeObj) ensureCanvaEdgeHitArea(activeObj);
|
|
13238
13311
|
if (activeObj && !(activeObj instanceof fabric.ActiveSelection) && (((_a2 = activeObj._ct) == null ? void 0 : _a2.isCropGroup) || activeObj.__cropGroup)) {
|
|
13239
13312
|
installImageResizeControlsWithSnap(activeObj);
|
|
13240
13313
|
ensureCanvaControlRenders(activeObj);
|
|
13314
|
+
ensureCanvaEdgeHitArea(activeObj);
|
|
13241
13315
|
}
|
|
13242
13316
|
});
|
|
13243
13317
|
fabricCanvas.on("mouse:dblclick", (opt) => {
|
|
@@ -16710,7 +16784,10 @@ const PageCanvas = forwardRef(
|
|
|
16710
16784
|
fc.setViewportTransform([zoom2, 0, 0, zoom2, 0, 0]);
|
|
16711
16785
|
fc.getObjects().forEach((obj) => applyControlSizeForZoom(fc, obj));
|
|
16712
16786
|
const active = fc.getActiveObject();
|
|
16713
|
-
if (active
|
|
16787
|
+
if (active) {
|
|
16788
|
+
if (active instanceof fabric.ActiveSelection) applyControlSizeForZoom(fc, active);
|
|
16789
|
+
ensureCanvaEdgeHitArea(active);
|
|
16790
|
+
}
|
|
16714
16791
|
fc.requestRenderAll();
|
|
16715
16792
|
}, [workspaceZoom, canvasWidth, canvasHeight]);
|
|
16716
16793
|
useEffect(() => {
|
|
@@ -25558,9 +25635,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25558
25635
|
}
|
|
25559
25636
|
return svgString;
|
|
25560
25637
|
}
|
|
25561
|
-
const resolvedPackageVersion = "0.5.
|
|
25638
|
+
const resolvedPackageVersion = "0.5.425";
|
|
25562
25639
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25563
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25640
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.425";
|
|
25564
25641
|
const roundParityValue = (value) => {
|
|
25565
25642
|
if (typeof value !== "number") return value;
|
|
25566
25643
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26374,7 +26451,7 @@ class PixldocsRenderer {
|
|
|
26374
26451
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26375
26452
|
}
|
|
26376
26453
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26377
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26454
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DR3TOj0C.js");
|
|
26378
26455
|
const prepared = preparePagesForExport(
|
|
26379
26456
|
cloned.pages,
|
|
26380
26457
|
canvasWidth,
|
|
@@ -28694,7 +28771,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28694
28771
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28695
28772
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28696
28773
|
try {
|
|
28697
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28774
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DR3TOj0C.js");
|
|
28698
28775
|
try {
|
|
28699
28776
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28700
28777
|
} catch {
|
|
@@ -29094,4 +29171,4 @@ export {
|
|
|
29094
29171
|
buildTeaserBlurFlatKeys as y,
|
|
29095
29172
|
collectFontDescriptorsFromConfig as z
|
|
29096
29173
|
};
|
|
29097
|
-
//# sourceMappingURL=index-
|
|
29174
|
+
//# sourceMappingURL=index-C3izL-t6.js.map
|