@pixldocs/canvas-renderer 0.5.243 → 0.5.244
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-UuNicsNZ.cjs → index-Bu8x_hs7.cjs} +83 -44
- package/dist/index-Bu8x_hs7.cjs.map +1 -0
- package/dist/{index-C5mQ2kl5.js → index-xJBNIfjT.js} +83 -44
- package/dist/index-xJBNIfjT.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-V2qBQ4Xs.cjs → vectorPdfExport-BUlPzdRT.cjs} +4 -4
- package/dist/{vectorPdfExport-V2qBQ4Xs.cjs.map → vectorPdfExport-BUlPzdRT.cjs.map} +1 -1
- package/dist/{vectorPdfExport-DJD1vq7N.js → vectorPdfExport-BWQ8fyXp.js} +4 -4
- package/dist/{vectorPdfExport-DJD1vq7N.js.map → vectorPdfExport-BWQ8fyXp.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-C5mQ2kl5.js.map +0 -1
- package/dist/index-UuNicsNZ.cjs.map +0 -1
|
@@ -11176,6 +11176,7 @@ const PageCanvas = forwardRef(
|
|
|
11176
11176
|
const preserveEditingScopeOnSelectionClearRef = useRef(false);
|
|
11177
11177
|
const preserveActiveSelectionAfterTransformRef = useRef(null);
|
|
11178
11178
|
const pendingGroupPromotionRef = useRef(null);
|
|
11179
|
+
const pendingGroupDrillInRef = useRef(null);
|
|
11179
11180
|
const imageReloadRequestSeqRef = useRef(/* @__PURE__ */ new Map());
|
|
11180
11181
|
useRef(null);
|
|
11181
11182
|
const groupBoundsResizingRef = useRef(false);
|
|
@@ -12246,7 +12247,7 @@ const PageCanvas = forwardRef(
|
|
|
12246
12247
|
const active = fabricCanvas.getActiveObject();
|
|
12247
12248
|
let hitChild = null;
|
|
12248
12249
|
if (active instanceof fabric.ActiveSelection) {
|
|
12249
|
-
const pointer = fabricCanvas.
|
|
12250
|
+
const pointer = fabricCanvas.getPointer(opt.e);
|
|
12250
12251
|
const objs = active.getObjects();
|
|
12251
12252
|
for (let i = objs.length - 1; i >= 0; i--) {
|
|
12252
12253
|
const o = objs[i];
|
|
@@ -12467,10 +12468,36 @@ const PageCanvas = forwardRef(
|
|
|
12467
12468
|
}
|
|
12468
12469
|
};
|
|
12469
12470
|
const isMultiSelectModifier = (event) => !!((event == null ? void 0 : event.shiftKey) || (event == null ? void 0 : event.metaKey) || (event == null ? void 0 : event.ctrlKey));
|
|
12471
|
+
const pickChildInActiveSelectionAtPointer = (selection, event) => {
|
|
12472
|
+
var _a2, _b2, _c, _d, _e;
|
|
12473
|
+
try {
|
|
12474
|
+
const pointer = fabricCanvas.getPointer(event);
|
|
12475
|
+
const viewportPointer = (_a2 = fabricCanvas.getViewportPoint) == null ? void 0 : _a2.call(fabricCanvas, event);
|
|
12476
|
+
const zoom3 = ((_b2 = fabricCanvas.getZoom) == null ? void 0 : _b2.call(fabricCanvas)) || 1;
|
|
12477
|
+
const tolerance = Math.max(3, 6 / zoom3);
|
|
12478
|
+
const members = selection.getObjects();
|
|
12479
|
+
for (let i = members.length - 1; i >= 0; i--) {
|
|
12480
|
+
const obj = members[i];
|
|
12481
|
+
const id = getObjectId(obj);
|
|
12482
|
+
if (!id || id === "__background__" || obj.visible === false) continue;
|
|
12483
|
+
(_c = obj.setCoords) == null ? void 0 : _c.call(obj);
|
|
12484
|
+
const containsScene = typeof obj.containsPoint === "function" && obj.containsPoint(pointer);
|
|
12485
|
+
const containsViewport = !!(viewportPointer && typeof obj.containsPoint === "function" && obj.containsPoint(viewportPointer));
|
|
12486
|
+
if (containsScene || containsViewport) return obj;
|
|
12487
|
+
const br = ((_d = obj.getBoundingRect) == null ? void 0 : _d.call(obj, true, true)) ?? ((_e = obj.getBoundingRect) == null ? void 0 : _e.call(obj));
|
|
12488
|
+
if (br && pointer.x >= br.left - tolerance && pointer.x <= br.left + br.width + tolerance && pointer.y >= br.top - tolerance && pointer.y <= br.top + br.height + tolerance) {
|
|
12489
|
+
return obj;
|
|
12490
|
+
}
|
|
12491
|
+
}
|
|
12492
|
+
} catch {
|
|
12493
|
+
return null;
|
|
12494
|
+
}
|
|
12495
|
+
return null;
|
|
12496
|
+
};
|
|
12470
12497
|
const pickSelectableObjectAtPointer = (event) => {
|
|
12471
12498
|
var _a2;
|
|
12472
12499
|
try {
|
|
12473
|
-
const pointer = fabricCanvas.
|
|
12500
|
+
const pointer = fabricCanvas.getPointer(event);
|
|
12474
12501
|
const objects = fabricCanvas.getObjects();
|
|
12475
12502
|
for (let i = objects.length - 1; i >= 0; i--) {
|
|
12476
12503
|
const obj = objects[i];
|
|
@@ -12737,22 +12764,11 @@ const PageCanvas = forwardRef(
|
|
|
12737
12764
|
let target = opt.target;
|
|
12738
12765
|
let targetId = target ? getObjectId(target) : null;
|
|
12739
12766
|
if (target instanceof fabric.ActiveSelection && target.__pixldocsGroupSelection && target === fabricCanvas.getActiveObject()) {
|
|
12740
|
-
|
|
12741
|
-
|
|
12742
|
-
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
if (m.visible === false) continue;
|
|
12746
|
-
if (typeof m.containsPoint === "function" && m.containsPoint(pointer)) {
|
|
12747
|
-
const mid = getObjectId(m);
|
|
12748
|
-
if (mid) {
|
|
12749
|
-
target = m;
|
|
12750
|
-
targetId = mid;
|
|
12751
|
-
}
|
|
12752
|
-
break;
|
|
12753
|
-
}
|
|
12754
|
-
}
|
|
12755
|
-
} catch {
|
|
12767
|
+
const child = pickChildInActiveSelectionAtPointer(target, opt.e);
|
|
12768
|
+
const childId = child ? getObjectId(child) : null;
|
|
12769
|
+
if (child && childId) {
|
|
12770
|
+
target = child;
|
|
12771
|
+
targetId = childId;
|
|
12756
12772
|
}
|
|
12757
12773
|
}
|
|
12758
12774
|
const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
|
|
@@ -12771,6 +12787,7 @@ const PageCanvas = forwardRef(
|
|
|
12771
12787
|
activeObjects: fabricCanvas.getActiveObjects().slice()
|
|
12772
12788
|
};
|
|
12773
12789
|
pendingGroupPromotionRef.current = null;
|
|
12790
|
+
pendingGroupDrillInRef.current = null;
|
|
12774
12791
|
return;
|
|
12775
12792
|
}
|
|
12776
12793
|
}
|
|
@@ -12793,28 +12810,21 @@ const PageCanvas = forwardRef(
|
|
|
12793
12810
|
const activeNowEarly = fabricCanvas.getActiveObject();
|
|
12794
12811
|
const asGroupId = target instanceof fabric.ActiveSelection ? target.__pixldocsGroupSelection : void 0;
|
|
12795
12812
|
if (target instanceof fabric.ActiveSelection && asGroupId && target === activeNowEarly) {
|
|
12796
|
-
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
if (m.visible === false) continue;
|
|
12802
|
-
if (typeof m.containsPoint === "function" && m.containsPoint(pointer)) {
|
|
12803
|
-
const mid = getObjectId(m);
|
|
12804
|
-
if (mid) {
|
|
12805
|
-
effectiveTarget = m;
|
|
12806
|
-
effectiveTargetId = mid;
|
|
12807
|
-
}
|
|
12808
|
-
break;
|
|
12809
|
-
}
|
|
12810
|
-
}
|
|
12811
|
-
} catch {
|
|
12813
|
+
const child = pickChildInActiveSelectionAtPointer(target, opt.e);
|
|
12814
|
+
const childId = child ? getObjectId(child) : null;
|
|
12815
|
+
if (child && childId) {
|
|
12816
|
+
effectiveTarget = child;
|
|
12817
|
+
effectiveTargetId = childId;
|
|
12812
12818
|
}
|
|
12813
12819
|
}
|
|
12814
12820
|
const parent = findTopmostPromotableGroup(effectiveTargetId);
|
|
12815
12821
|
const targetIsInCrop = !!(effectiveTarget instanceof fabric.Group && isCropGroupInCropMode(effectiveTarget) || (effectiveTarget == null ? void 0 : effectiveTarget.group) instanceof fabric.Group && isCropGroupInCropMode(effectiveTarget.group));
|
|
12816
12822
|
const activeNow = fabricCanvas.getActiveObject();
|
|
12817
|
-
const
|
|
12823
|
+
const activeGroupSelectionId = activeNow instanceof fabric.ActiveSelection ? activeNow.__pixldocsGroupSelection : void 0;
|
|
12824
|
+
const activeGroupNode = activeGroupSelectionId ? findNodeById(childrenNow, activeGroupSelectionId) : null;
|
|
12825
|
+
const activeGroupContainsTarget = !!(activeGroupNode && isGroup(activeGroupNode) && getAllElementIds(activeGroupNode.children ?? []).includes(effectiveTargetId));
|
|
12826
|
+
const alreadyThisGroup = !!(activeGroupSelectionId && activeGroupContainsTarget);
|
|
12827
|
+
const drillGroup = alreadyThisGroup && activeGroupNode && isGroup(activeGroupNode) ? activeGroupNode : parent;
|
|
12818
12828
|
const isMultiSelectKey = !!(((_f = opt.e) == null ? void 0 : _f.shiftKey) || ((_g = opt.e) == null ? void 0 : _g.metaKey) || ((_h = opt.e) == null ? void 0 : _h.ctrlKey));
|
|
12819
12829
|
const isDeepSelectKey = !!((_i = opt.e) == null ? void 0 : _i.altKey);
|
|
12820
12830
|
if (isDeepSelectKey) {
|
|
@@ -12844,7 +12854,8 @@ const PageCanvas = forwardRef(
|
|
|
12844
12854
|
opt.target = only;
|
|
12845
12855
|
pendingGroupPromotionRef.current = { groupId: parent.id, selection: only };
|
|
12846
12856
|
}
|
|
12847
|
-
|
|
12857
|
+
pendingGroupDrillInRef.current = null;
|
|
12858
|
+
} else if (drillGroup && !drillGroup.backgroundColor && !targetIsInCrop && alreadyThisGroup && !isMultiSelectKey && effectiveTarget !== activeNow) {
|
|
12848
12859
|
try {
|
|
12849
12860
|
skipSelectionClearOnDiscardRef.current = true;
|
|
12850
12861
|
preserveEditingScopeOnSelectionClearRef.current = true;
|
|
@@ -12854,7 +12865,7 @@ const PageCanvas = forwardRef(
|
|
|
12854
12865
|
skipSelectionClearOnDiscardRef.current = false;
|
|
12855
12866
|
preserveEditingScopeOnSelectionClearRef.current = false;
|
|
12856
12867
|
}
|
|
12857
|
-
fabricCanvas.__activeEditingGroupId =
|
|
12868
|
+
fabricCanvas.__activeEditingGroupId = drillGroup.id;
|
|
12858
12869
|
delete effectiveTarget.__pixldocsGroupSelection;
|
|
12859
12870
|
delete effectiveTarget.__pixldocsLogicalGroupIds;
|
|
12860
12871
|
try {
|
|
@@ -12866,6 +12877,9 @@ const PageCanvas = forwardRef(
|
|
|
12866
12877
|
fabricCanvas._target = effectiveTarget;
|
|
12867
12878
|
opt.target = effectiveTarget;
|
|
12868
12879
|
pendingGroupPromotionRef.current = null;
|
|
12880
|
+
pendingGroupDrillInRef.current = { groupId: drillGroup.id, childId: effectiveTargetId, target: effectiveTarget };
|
|
12881
|
+
selectElements([effectiveTargetId], false, false);
|
|
12882
|
+
fabricCanvas.requestRenderAll();
|
|
12869
12883
|
}
|
|
12870
12884
|
} else if (!target || targetId === "__background__") {
|
|
12871
12885
|
const isMultiSelectKey = !!(((_k = opt.e) == null ? void 0 : _k.shiftKey) || ((_l = opt.e) == null ? void 0 : _l.metaKey) || ((_m = opt.e) == null ? void 0 : _m.ctrlKey));
|
|
@@ -12892,6 +12906,7 @@ const PageCanvas = forwardRef(
|
|
|
12892
12906
|
fabricCanvas._target = selection;
|
|
12893
12907
|
opt.target = selection;
|
|
12894
12908
|
pendingGroupPromotionRef.current = { groupId: parent.id, selection };
|
|
12909
|
+
pendingGroupDrillInRef.current = null;
|
|
12895
12910
|
} else if (memberObjs.length === 1) {
|
|
12896
12911
|
const only = memberObjs[0];
|
|
12897
12912
|
only.__pixldocsGroupSelection = parent.id;
|
|
@@ -12899,6 +12914,7 @@ const PageCanvas = forwardRef(
|
|
|
12899
12914
|
fabricCanvas._target = only;
|
|
12900
12915
|
opt.target = only;
|
|
12901
12916
|
pendingGroupPromotionRef.current = { groupId: parent.id, selection: only };
|
|
12917
|
+
pendingGroupDrillInRef.current = null;
|
|
12902
12918
|
}
|
|
12903
12919
|
}
|
|
12904
12920
|
}
|
|
@@ -13008,7 +13024,7 @@ const PageCanvas = forwardRef(
|
|
|
13008
13024
|
o.__lockScaleDuringCrop = false;
|
|
13009
13025
|
});
|
|
13010
13026
|
fabricCanvas.on("mouse:up", (e) => {
|
|
13011
|
-
var _a2;
|
|
13027
|
+
var _a2, _b2, _c;
|
|
13012
13028
|
clearTransforming();
|
|
13013
13029
|
setGuides([]);
|
|
13014
13030
|
setRotationLabel(null);
|
|
@@ -13016,6 +13032,29 @@ const PageCanvas = forwardRef(
|
|
|
13016
13032
|
objectResizeActiveSnapRef.current = null;
|
|
13017
13033
|
groupResizeActiveSnapRef.current = null;
|
|
13018
13034
|
dragStarted = false;
|
|
13035
|
+
const pendingDrillIn = pendingGroupDrillInRef.current;
|
|
13036
|
+
pendingGroupDrillInRef.current = null;
|
|
13037
|
+
if (pendingDrillIn && !didTransformRef.current) {
|
|
13038
|
+
const activeNow = fabricCanvas.getActiveObject();
|
|
13039
|
+
if (activeNow !== pendingDrillIn.target) {
|
|
13040
|
+
isSyncingSelectionToFabricRef.current = true;
|
|
13041
|
+
try {
|
|
13042
|
+
restoreSuppressedGroupBorders();
|
|
13043
|
+
fabricCanvas.__activeEditingGroupId = pendingDrillIn.groupId;
|
|
13044
|
+
delete pendingDrillIn.target.__pixldocsGroupSelection;
|
|
13045
|
+
delete pendingDrillIn.target.__pixldocsLogicalGroupIds;
|
|
13046
|
+
(_b2 = (_a2 = pendingDrillIn.target).set) == null ? void 0 : _b2.call(_a2, { selectable: true, evented: true, hasBorders: true, hasControls: true });
|
|
13047
|
+
fabricCanvas.setActiveObject(pendingDrillIn.target);
|
|
13048
|
+
pendingDrillIn.target.setCoords();
|
|
13049
|
+
fabricCanvas.requestRenderAll();
|
|
13050
|
+
} finally {
|
|
13051
|
+
requestAnimationFrame(() => {
|
|
13052
|
+
isSyncingSelectionToFabricRef.current = false;
|
|
13053
|
+
});
|
|
13054
|
+
}
|
|
13055
|
+
selectElements([pendingDrillIn.childId], false, false);
|
|
13056
|
+
}
|
|
13057
|
+
}
|
|
13019
13058
|
const pendingPromotion = pendingGroupPromotionRef.current;
|
|
13020
13059
|
pendingGroupPromotionRef.current = null;
|
|
13021
13060
|
if (pendingPromotion && !didTransformRef.current) {
|
|
@@ -13049,7 +13088,7 @@ const PageCanvas = forwardRef(
|
|
|
13049
13088
|
}
|
|
13050
13089
|
}
|
|
13051
13090
|
const activeObj = fabricCanvas.getActiveObject();
|
|
13052
|
-
if (activeObj && (activeObj.__cropGroup || ((
|
|
13091
|
+
if (activeObj && (activeObj.__cropGroup || ((_c = activeObj._ct) == null ? void 0 : _c.isCropGroup))) {
|
|
13053
13092
|
activeObj.__lockScaleDuringCrop = false;
|
|
13054
13093
|
if (activeObj.__cropDrag) {
|
|
13055
13094
|
delete activeObj.__cropDrag;
|
|
@@ -23253,9 +23292,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23253
23292
|
}
|
|
23254
23293
|
return svgString;
|
|
23255
23294
|
}
|
|
23256
|
-
const resolvedPackageVersion = "0.5.
|
|
23295
|
+
const resolvedPackageVersion = "0.5.244";
|
|
23257
23296
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23258
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23297
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.244";
|
|
23259
23298
|
const roundParityValue = (value) => {
|
|
23260
23299
|
if (typeof value !== "number") return value;
|
|
23261
23300
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24069,7 +24108,7 @@ class PixldocsRenderer {
|
|
|
24069
24108
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24070
24109
|
}
|
|
24071
24110
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24072
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
24111
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BWQ8fyXp.js");
|
|
24073
24112
|
const prepared = preparePagesForExport(
|
|
24074
24113
|
cloned.pages,
|
|
24075
24114
|
canvasWidth,
|
|
@@ -26389,7 +26428,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26389
26428
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26390
26429
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26391
26430
|
try {
|
|
26392
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
26431
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BWQ8fyXp.js");
|
|
26393
26432
|
try {
|
|
26394
26433
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26395
26434
|
} catch {
|
|
@@ -26789,4 +26828,4 @@ export {
|
|
|
26789
26828
|
buildTeaserBlurFlatKeys as y,
|
|
26790
26829
|
collectFontDescriptorsFromConfig as z
|
|
26791
26830
|
};
|
|
26792
|
-
//# sourceMappingURL=index-
|
|
26831
|
+
//# sourceMappingURL=index-xJBNIfjT.js.map
|