@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
|
@@ -10726,6 +10726,8 @@ const SELECTION_PRIMARY = "hsl(217, 91%, 60%)";
|
|
|
10726
10726
|
const SELECTION_BORDER_SCALE = 2;
|
|
10727
10727
|
let ensureCanvaControlRenders = () => {
|
|
10728
10728
|
};
|
|
10729
|
+
let ensureCanvaEdgeHitArea = () => {
|
|
10730
|
+
};
|
|
10729
10731
|
try {
|
|
10730
10732
|
const InteractiveBase = fabric__namespace.InteractiveFabricObject ?? fabric__namespace.Object;
|
|
10731
10733
|
if ((InteractiveBase == null ? void 0 : InteractiveBase.prototype) && !InteractiveBase.prototype.__pixldocsCenteredSelectionBorder) {
|
|
@@ -12746,6 +12748,74 @@ const PageCanvas = react.forwardRef(
|
|
|
12746
12748
|
prevKey = null;
|
|
12747
12749
|
});
|
|
12748
12750
|
}
|
|
12751
|
+
{
|
|
12752
|
+
const EDGE_HIT_ALONG_MIN = 44;
|
|
12753
|
+
const CORNER_BUFFER = 24;
|
|
12754
|
+
const syncEdgeHitSizes = (obj) => {
|
|
12755
|
+
var _a2, _b2, _c2;
|
|
12756
|
+
if (!obj || !obj.controls) return;
|
|
12757
|
+
try {
|
|
12758
|
+
ensureCanvaControlRenders(obj);
|
|
12759
|
+
const canvasForObj = obj.canvas ?? fabricCanvas;
|
|
12760
|
+
const zoom3 = ((_a2 = canvasForObj.getZoom) == null ? void 0 : _a2.call(canvasForObj)) || 1;
|
|
12761
|
+
let scaleX = obj.scaleX ?? 1;
|
|
12762
|
+
let scaleY = obj.scaleY ?? 1;
|
|
12763
|
+
try {
|
|
12764
|
+
const m = (_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj);
|
|
12765
|
+
if (m) {
|
|
12766
|
+
const dec = fabric__namespace.util.qrDecompose(m);
|
|
12767
|
+
scaleX = Math.abs(dec.scaleX ?? scaleX);
|
|
12768
|
+
scaleY = Math.abs(dec.scaleY ?? scaleY);
|
|
12769
|
+
}
|
|
12770
|
+
} catch {
|
|
12771
|
+
}
|
|
12772
|
+
const screenW = (obj.width ?? 0) * scaleX * zoom3;
|
|
12773
|
+
const screenH = (obj.height ?? 0) * scaleY * zoom3;
|
|
12774
|
+
const alongW = Math.max(EDGE_HIT_ALONG_MIN, screenW - CORNER_BUFFER);
|
|
12775
|
+
const alongH = Math.max(EDGE_HIT_ALONG_MIN, screenH - CORNER_BUFFER);
|
|
12776
|
+
let changed = false;
|
|
12777
|
+
for (const k of ["ml", "mr"]) {
|
|
12778
|
+
const c = obj.controls[k];
|
|
12779
|
+
if (!c) continue;
|
|
12780
|
+
if (c.sizeY !== alongH || c.touchSizeY !== alongH) changed = true;
|
|
12781
|
+
c.sizeY = alongH;
|
|
12782
|
+
c.touchSizeY = alongH;
|
|
12783
|
+
}
|
|
12784
|
+
for (const k of ["mt", "mb"]) {
|
|
12785
|
+
const c = obj.controls[k];
|
|
12786
|
+
if (!c) continue;
|
|
12787
|
+
if (c.sizeX !== alongW || c.touchSizeX !== alongW) changed = true;
|
|
12788
|
+
c.sizeX = alongW;
|
|
12789
|
+
c.touchSizeX = alongW;
|
|
12790
|
+
}
|
|
12791
|
+
if (changed) (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
|
|
12792
|
+
} catch {
|
|
12793
|
+
}
|
|
12794
|
+
};
|
|
12795
|
+
ensureCanvaEdgeHitArea = syncEdgeHitSizes;
|
|
12796
|
+
const syncActive = () => {
|
|
12797
|
+
const obj = fabricCanvas.getActiveObject();
|
|
12798
|
+
if (obj) {
|
|
12799
|
+
syncEdgeHitSizes(obj);
|
|
12800
|
+
requestAnimationFrame(() => syncEdgeHitSizes(obj));
|
|
12801
|
+
}
|
|
12802
|
+
};
|
|
12803
|
+
fabricCanvas.on("selection:created", syncActive);
|
|
12804
|
+
fabricCanvas.on("selection:updated", syncActive);
|
|
12805
|
+
fabricCanvas.on("object:scaling", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
|
|
12806
|
+
fabricCanvas.on("object:modified", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
|
|
12807
|
+
fabricCanvas.on("object:resizing", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
|
|
12808
|
+
fabricCanvas.on("after:render", () => {
|
|
12809
|
+
const obj = fabricCanvas.getActiveObject();
|
|
12810
|
+
if (!obj) return;
|
|
12811
|
+
const lastZoom = obj.__pixldocsLastEdgeHitZoom;
|
|
12812
|
+
const z = fabricCanvas.getZoom() || 1;
|
|
12813
|
+
if (lastZoom !== z) {
|
|
12814
|
+
obj.__pixldocsLastEdgeHitZoom = z;
|
|
12815
|
+
syncEdgeHitSizes(obj);
|
|
12816
|
+
}
|
|
12817
|
+
});
|
|
12818
|
+
}
|
|
12749
12819
|
const initFonts = async () => {
|
|
12750
12820
|
try {
|
|
12751
12821
|
await preloadAllFonts();
|
|
@@ -13237,9 +13307,11 @@ const PageCanvas = react.forwardRef(
|
|
|
13237
13307
|
if (activeObj instanceof fabric__namespace.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
|
|
13238
13308
|
if (activeObj) applyControlSizeForZoom(fabricCanvas, activeObj);
|
|
13239
13309
|
if (activeObj) ensureCanvaControlRenders(activeObj);
|
|
13310
|
+
if (activeObj) ensureCanvaEdgeHitArea(activeObj);
|
|
13240
13311
|
if (activeObj && !(activeObj instanceof fabric__namespace.ActiveSelection) && (((_a2 = activeObj._ct) == null ? void 0 : _a2.isCropGroup) || activeObj.__cropGroup)) {
|
|
13241
13312
|
installImageResizeControlsWithSnap(activeObj);
|
|
13242
13313
|
ensureCanvaControlRenders(activeObj);
|
|
13314
|
+
ensureCanvaEdgeHitArea(activeObj);
|
|
13243
13315
|
}
|
|
13244
13316
|
});
|
|
13245
13317
|
fabricCanvas.on("selection:updated", () => {
|
|
@@ -13253,9 +13325,11 @@ const PageCanvas = react.forwardRef(
|
|
|
13253
13325
|
if (activeObj instanceof fabric__namespace.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
|
|
13254
13326
|
if (activeObj) applyControlSizeForZoom(fabricCanvas, activeObj);
|
|
13255
13327
|
if (activeObj) ensureCanvaControlRenders(activeObj);
|
|
13328
|
+
if (activeObj) ensureCanvaEdgeHitArea(activeObj);
|
|
13256
13329
|
if (activeObj && !(activeObj instanceof fabric__namespace.ActiveSelection) && (((_a2 = activeObj._ct) == null ? void 0 : _a2.isCropGroup) || activeObj.__cropGroup)) {
|
|
13257
13330
|
installImageResizeControlsWithSnap(activeObj);
|
|
13258
13331
|
ensureCanvaControlRenders(activeObj);
|
|
13332
|
+
ensureCanvaEdgeHitArea(activeObj);
|
|
13259
13333
|
}
|
|
13260
13334
|
});
|
|
13261
13335
|
fabricCanvas.on("mouse:dblclick", (opt) => {
|
|
@@ -16728,7 +16802,10 @@ const PageCanvas = react.forwardRef(
|
|
|
16728
16802
|
fc.setViewportTransform([zoom2, 0, 0, zoom2, 0, 0]);
|
|
16729
16803
|
fc.getObjects().forEach((obj) => applyControlSizeForZoom(fc, obj));
|
|
16730
16804
|
const active = fc.getActiveObject();
|
|
16731
|
-
if (active
|
|
16805
|
+
if (active) {
|
|
16806
|
+
if (active instanceof fabric__namespace.ActiveSelection) applyControlSizeForZoom(fc, active);
|
|
16807
|
+
ensureCanvaEdgeHitArea(active);
|
|
16808
|
+
}
|
|
16732
16809
|
fc.requestRenderAll();
|
|
16733
16810
|
}, [workspaceZoom, canvasWidth, canvasHeight]);
|
|
16734
16811
|
react.useEffect(() => {
|
|
@@ -25576,9 +25653,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25576
25653
|
}
|
|
25577
25654
|
return svgString;
|
|
25578
25655
|
}
|
|
25579
|
-
const resolvedPackageVersion = "0.5.
|
|
25656
|
+
const resolvedPackageVersion = "0.5.425";
|
|
25580
25657
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25581
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25658
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.425";
|
|
25582
25659
|
const roundParityValue = (value) => {
|
|
25583
25660
|
if (typeof value !== "number") return value;
|
|
25584
25661
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26392,7 +26469,7 @@ class PixldocsRenderer {
|
|
|
26392
26469
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26393
26470
|
}
|
|
26394
26471
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26395
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
26472
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-ygzscD4n.cjs"));
|
|
26396
26473
|
const prepared = preparePagesForExport(
|
|
26397
26474
|
cloned.pages,
|
|
26398
26475
|
canvasWidth,
|
|
@@ -28712,7 +28789,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28712
28789
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28713
28790
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28714
28791
|
try {
|
|
28715
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
28792
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-ygzscD4n.cjs"));
|
|
28716
28793
|
try {
|
|
28717
28794
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28718
28795
|
} catch {
|
|
@@ -29109,4 +29186,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29109
29186
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29110
29187
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29111
29188
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29112
|
-
//# sourceMappingURL=index-
|
|
29189
|
+
//# sourceMappingURL=index-qOAH-a4l.cjs.map
|