@pixldocs/canvas-renderer 0.5.242 → 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-YCh9sTg1.cjs → index-Bu8x_hs7.cjs} +88 -30
- package/dist/index-Bu8x_hs7.cjs.map +1 -0
- package/dist/{index-BQ5V2uT8.js → index-xJBNIfjT.js} +88 -30
- package/dist/index-xJBNIfjT.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-De9vylBF.cjs → vectorPdfExport-BUlPzdRT.cjs} +4 -4
- package/dist/{vectorPdfExport-De9vylBF.cjs.map → vectorPdfExport-BUlPzdRT.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CsrQStE8.js → vectorPdfExport-BWQ8fyXp.js} +4 -4
- package/dist/{vectorPdfExport-CsrQStE8.js.map → vectorPdfExport-BWQ8fyXp.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BQ5V2uT8.js.map +0 -1
- package/dist/index-YCh9sTg1.cjs.map +0 -1
|
@@ -11194,6 +11194,7 @@ const PageCanvas = react.forwardRef(
|
|
|
11194
11194
|
const preserveEditingScopeOnSelectionClearRef = react.useRef(false);
|
|
11195
11195
|
const preserveActiveSelectionAfterTransformRef = react.useRef(null);
|
|
11196
11196
|
const pendingGroupPromotionRef = react.useRef(null);
|
|
11197
|
+
const pendingGroupDrillInRef = react.useRef(null);
|
|
11197
11198
|
const imageReloadRequestSeqRef = react.useRef(/* @__PURE__ */ new Map());
|
|
11198
11199
|
react.useRef(null);
|
|
11199
11200
|
const groupBoundsResizingRef = react.useRef(false);
|
|
@@ -12264,7 +12265,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12264
12265
|
const active = fabricCanvas.getActiveObject();
|
|
12265
12266
|
let hitChild = null;
|
|
12266
12267
|
if (active instanceof fabric__namespace.ActiveSelection) {
|
|
12267
|
-
const pointer = fabricCanvas.
|
|
12268
|
+
const pointer = fabricCanvas.getPointer(opt.e);
|
|
12268
12269
|
const objs = active.getObjects();
|
|
12269
12270
|
for (let i = objs.length - 1; i >= 0; i--) {
|
|
12270
12271
|
const o = objs[i];
|
|
@@ -12485,10 +12486,36 @@ const PageCanvas = react.forwardRef(
|
|
|
12485
12486
|
}
|
|
12486
12487
|
};
|
|
12487
12488
|
const isMultiSelectModifier = (event) => !!((event == null ? void 0 : event.shiftKey) || (event == null ? void 0 : event.metaKey) || (event == null ? void 0 : event.ctrlKey));
|
|
12489
|
+
const pickChildInActiveSelectionAtPointer = (selection, event) => {
|
|
12490
|
+
var _a2, _b2, _c, _d, _e;
|
|
12491
|
+
try {
|
|
12492
|
+
const pointer = fabricCanvas.getPointer(event);
|
|
12493
|
+
const viewportPointer = (_a2 = fabricCanvas.getViewportPoint) == null ? void 0 : _a2.call(fabricCanvas, event);
|
|
12494
|
+
const zoom3 = ((_b2 = fabricCanvas.getZoom) == null ? void 0 : _b2.call(fabricCanvas)) || 1;
|
|
12495
|
+
const tolerance = Math.max(3, 6 / zoom3);
|
|
12496
|
+
const members = selection.getObjects();
|
|
12497
|
+
for (let i = members.length - 1; i >= 0; i--) {
|
|
12498
|
+
const obj = members[i];
|
|
12499
|
+
const id = getObjectId(obj);
|
|
12500
|
+
if (!id || id === "__background__" || obj.visible === false) continue;
|
|
12501
|
+
(_c = obj.setCoords) == null ? void 0 : _c.call(obj);
|
|
12502
|
+
const containsScene = typeof obj.containsPoint === "function" && obj.containsPoint(pointer);
|
|
12503
|
+
const containsViewport = !!(viewportPointer && typeof obj.containsPoint === "function" && obj.containsPoint(viewportPointer));
|
|
12504
|
+
if (containsScene || containsViewport) return obj;
|
|
12505
|
+
const br = ((_d = obj.getBoundingRect) == null ? void 0 : _d.call(obj, true, true)) ?? ((_e = obj.getBoundingRect) == null ? void 0 : _e.call(obj));
|
|
12506
|
+
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) {
|
|
12507
|
+
return obj;
|
|
12508
|
+
}
|
|
12509
|
+
}
|
|
12510
|
+
} catch {
|
|
12511
|
+
return null;
|
|
12512
|
+
}
|
|
12513
|
+
return null;
|
|
12514
|
+
};
|
|
12488
12515
|
const pickSelectableObjectAtPointer = (event) => {
|
|
12489
12516
|
var _a2;
|
|
12490
12517
|
try {
|
|
12491
|
-
const pointer = fabricCanvas.
|
|
12518
|
+
const pointer = fabricCanvas.getPointer(event);
|
|
12492
12519
|
const objects = fabricCanvas.getObjects();
|
|
12493
12520
|
for (let i = objects.length - 1; i >= 0; i--) {
|
|
12494
12521
|
const obj = objects[i];
|
|
@@ -12752,8 +12779,16 @@ const PageCanvas = react.forwardRef(
|
|
|
12752
12779
|
syncLockedRef.current = true;
|
|
12753
12780
|
lockEdits();
|
|
12754
12781
|
}
|
|
12755
|
-
|
|
12756
|
-
|
|
12782
|
+
let target = opt.target;
|
|
12783
|
+
let targetId = target ? getObjectId(target) : null;
|
|
12784
|
+
if (target instanceof fabric__namespace.ActiveSelection && target.__pixldocsGroupSelection && target === fabricCanvas.getActiveObject()) {
|
|
12785
|
+
const child = pickChildInActiveSelectionAtPointer(target, opt.e);
|
|
12786
|
+
const childId = child ? getObjectId(child) : null;
|
|
12787
|
+
if (child && childId) {
|
|
12788
|
+
target = child;
|
|
12789
|
+
targetId = childId;
|
|
12790
|
+
}
|
|
12791
|
+
}
|
|
12757
12792
|
const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
|
|
12758
12793
|
const pageNow = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId);
|
|
12759
12794
|
const childrenNow = (pageNow == null ? void 0 : pageNow.children) ?? [];
|
|
@@ -12770,6 +12805,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12770
12805
|
activeObjects: fabricCanvas.getActiveObjects().slice()
|
|
12771
12806
|
};
|
|
12772
12807
|
pendingGroupPromotionRef.current = null;
|
|
12808
|
+
pendingGroupDrillInRef.current = null;
|
|
12773
12809
|
return;
|
|
12774
12810
|
}
|
|
12775
12811
|
}
|
|
@@ -12792,28 +12828,21 @@ const PageCanvas = react.forwardRef(
|
|
|
12792
12828
|
const activeNowEarly = fabricCanvas.getActiveObject();
|
|
12793
12829
|
const asGroupId = target instanceof fabric__namespace.ActiveSelection ? target.__pixldocsGroupSelection : void 0;
|
|
12794
12830
|
if (target instanceof fabric__namespace.ActiveSelection && asGroupId && target === activeNowEarly) {
|
|
12795
|
-
|
|
12796
|
-
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
if (m.visible === false) continue;
|
|
12801
|
-
if (typeof m.containsPoint === "function" && m.containsPoint(pointer)) {
|
|
12802
|
-
const mid = getObjectId(m);
|
|
12803
|
-
if (mid) {
|
|
12804
|
-
effectiveTarget = m;
|
|
12805
|
-
effectiveTargetId = mid;
|
|
12806
|
-
}
|
|
12807
|
-
break;
|
|
12808
|
-
}
|
|
12809
|
-
}
|
|
12810
|
-
} catch {
|
|
12831
|
+
const child = pickChildInActiveSelectionAtPointer(target, opt.e);
|
|
12832
|
+
const childId = child ? getObjectId(child) : null;
|
|
12833
|
+
if (child && childId) {
|
|
12834
|
+
effectiveTarget = child;
|
|
12835
|
+
effectiveTargetId = childId;
|
|
12811
12836
|
}
|
|
12812
12837
|
}
|
|
12813
12838
|
const parent = findTopmostPromotableGroup(effectiveTargetId);
|
|
12814
12839
|
const targetIsInCrop = !!(effectiveTarget instanceof fabric__namespace.Group && isCropGroupInCropMode(effectiveTarget) || (effectiveTarget == null ? void 0 : effectiveTarget.group) instanceof fabric__namespace.Group && isCropGroupInCropMode(effectiveTarget.group));
|
|
12815
12840
|
const activeNow = fabricCanvas.getActiveObject();
|
|
12816
|
-
const
|
|
12841
|
+
const activeGroupSelectionId = activeNow instanceof fabric__namespace.ActiveSelection ? activeNow.__pixldocsGroupSelection : void 0;
|
|
12842
|
+
const activeGroupNode = activeGroupSelectionId ? findNodeById(childrenNow, activeGroupSelectionId) : null;
|
|
12843
|
+
const activeGroupContainsTarget = !!(activeGroupNode && isGroup(activeGroupNode) && getAllElementIds(activeGroupNode.children ?? []).includes(effectiveTargetId));
|
|
12844
|
+
const alreadyThisGroup = !!(activeGroupSelectionId && activeGroupContainsTarget);
|
|
12845
|
+
const drillGroup = alreadyThisGroup && activeGroupNode && isGroup(activeGroupNode) ? activeGroupNode : parent;
|
|
12817
12846
|
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));
|
|
12818
12847
|
const isDeepSelectKey = !!((_i = opt.e) == null ? void 0 : _i.altKey);
|
|
12819
12848
|
if (isDeepSelectKey) {
|
|
@@ -12843,7 +12872,8 @@ const PageCanvas = react.forwardRef(
|
|
|
12843
12872
|
opt.target = only;
|
|
12844
12873
|
pendingGroupPromotionRef.current = { groupId: parent.id, selection: only };
|
|
12845
12874
|
}
|
|
12846
|
-
|
|
12875
|
+
pendingGroupDrillInRef.current = null;
|
|
12876
|
+
} else if (drillGroup && !drillGroup.backgroundColor && !targetIsInCrop && alreadyThisGroup && !isMultiSelectKey && effectiveTarget !== activeNow) {
|
|
12847
12877
|
try {
|
|
12848
12878
|
skipSelectionClearOnDiscardRef.current = true;
|
|
12849
12879
|
preserveEditingScopeOnSelectionClearRef.current = true;
|
|
@@ -12853,7 +12883,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12853
12883
|
skipSelectionClearOnDiscardRef.current = false;
|
|
12854
12884
|
preserveEditingScopeOnSelectionClearRef.current = false;
|
|
12855
12885
|
}
|
|
12856
|
-
fabricCanvas.__activeEditingGroupId =
|
|
12886
|
+
fabricCanvas.__activeEditingGroupId = drillGroup.id;
|
|
12857
12887
|
delete effectiveTarget.__pixldocsGroupSelection;
|
|
12858
12888
|
delete effectiveTarget.__pixldocsLogicalGroupIds;
|
|
12859
12889
|
try {
|
|
@@ -12865,6 +12895,9 @@ const PageCanvas = react.forwardRef(
|
|
|
12865
12895
|
fabricCanvas._target = effectiveTarget;
|
|
12866
12896
|
opt.target = effectiveTarget;
|
|
12867
12897
|
pendingGroupPromotionRef.current = null;
|
|
12898
|
+
pendingGroupDrillInRef.current = { groupId: drillGroup.id, childId: effectiveTargetId, target: effectiveTarget };
|
|
12899
|
+
selectElements([effectiveTargetId], false, false);
|
|
12900
|
+
fabricCanvas.requestRenderAll();
|
|
12868
12901
|
}
|
|
12869
12902
|
} else if (!target || targetId === "__background__") {
|
|
12870
12903
|
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));
|
|
@@ -12891,6 +12924,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12891
12924
|
fabricCanvas._target = selection;
|
|
12892
12925
|
opt.target = selection;
|
|
12893
12926
|
pendingGroupPromotionRef.current = { groupId: parent.id, selection };
|
|
12927
|
+
pendingGroupDrillInRef.current = null;
|
|
12894
12928
|
} else if (memberObjs.length === 1) {
|
|
12895
12929
|
const only = memberObjs[0];
|
|
12896
12930
|
only.__pixldocsGroupSelection = parent.id;
|
|
@@ -12898,6 +12932,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12898
12932
|
fabricCanvas._target = only;
|
|
12899
12933
|
opt.target = only;
|
|
12900
12934
|
pendingGroupPromotionRef.current = { groupId: parent.id, selection: only };
|
|
12935
|
+
pendingGroupDrillInRef.current = null;
|
|
12901
12936
|
}
|
|
12902
12937
|
}
|
|
12903
12938
|
}
|
|
@@ -13007,7 +13042,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13007
13042
|
o.__lockScaleDuringCrop = false;
|
|
13008
13043
|
});
|
|
13009
13044
|
fabricCanvas.on("mouse:up", (e) => {
|
|
13010
|
-
var _a2;
|
|
13045
|
+
var _a2, _b2, _c;
|
|
13011
13046
|
clearTransforming();
|
|
13012
13047
|
setGuides([]);
|
|
13013
13048
|
setRotationLabel(null);
|
|
@@ -13015,6 +13050,29 @@ const PageCanvas = react.forwardRef(
|
|
|
13015
13050
|
objectResizeActiveSnapRef.current = null;
|
|
13016
13051
|
groupResizeActiveSnapRef.current = null;
|
|
13017
13052
|
dragStarted = false;
|
|
13053
|
+
const pendingDrillIn = pendingGroupDrillInRef.current;
|
|
13054
|
+
pendingGroupDrillInRef.current = null;
|
|
13055
|
+
if (pendingDrillIn && !didTransformRef.current) {
|
|
13056
|
+
const activeNow = fabricCanvas.getActiveObject();
|
|
13057
|
+
if (activeNow !== pendingDrillIn.target) {
|
|
13058
|
+
isSyncingSelectionToFabricRef.current = true;
|
|
13059
|
+
try {
|
|
13060
|
+
restoreSuppressedGroupBorders();
|
|
13061
|
+
fabricCanvas.__activeEditingGroupId = pendingDrillIn.groupId;
|
|
13062
|
+
delete pendingDrillIn.target.__pixldocsGroupSelection;
|
|
13063
|
+
delete pendingDrillIn.target.__pixldocsLogicalGroupIds;
|
|
13064
|
+
(_b2 = (_a2 = pendingDrillIn.target).set) == null ? void 0 : _b2.call(_a2, { selectable: true, evented: true, hasBorders: true, hasControls: true });
|
|
13065
|
+
fabricCanvas.setActiveObject(pendingDrillIn.target);
|
|
13066
|
+
pendingDrillIn.target.setCoords();
|
|
13067
|
+
fabricCanvas.requestRenderAll();
|
|
13068
|
+
} finally {
|
|
13069
|
+
requestAnimationFrame(() => {
|
|
13070
|
+
isSyncingSelectionToFabricRef.current = false;
|
|
13071
|
+
});
|
|
13072
|
+
}
|
|
13073
|
+
selectElements([pendingDrillIn.childId], false, false);
|
|
13074
|
+
}
|
|
13075
|
+
}
|
|
13018
13076
|
const pendingPromotion = pendingGroupPromotionRef.current;
|
|
13019
13077
|
pendingGroupPromotionRef.current = null;
|
|
13020
13078
|
if (pendingPromotion && !didTransformRef.current) {
|
|
@@ -13048,7 +13106,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13048
13106
|
}
|
|
13049
13107
|
}
|
|
13050
13108
|
const activeObj = fabricCanvas.getActiveObject();
|
|
13051
|
-
if (activeObj && (activeObj.__cropGroup || ((
|
|
13109
|
+
if (activeObj && (activeObj.__cropGroup || ((_c = activeObj._ct) == null ? void 0 : _c.isCropGroup))) {
|
|
13052
13110
|
activeObj.__lockScaleDuringCrop = false;
|
|
13053
13111
|
if (activeObj.__cropDrag) {
|
|
13054
13112
|
delete activeObj.__cropDrag;
|
|
@@ -23252,9 +23310,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23252
23310
|
}
|
|
23253
23311
|
return svgString;
|
|
23254
23312
|
}
|
|
23255
|
-
const resolvedPackageVersion = "0.5.
|
|
23313
|
+
const resolvedPackageVersion = "0.5.244";
|
|
23256
23314
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23257
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23315
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.244";
|
|
23258
23316
|
const roundParityValue = (value) => {
|
|
23259
23317
|
if (typeof value !== "number") return value;
|
|
23260
23318
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24068,7 +24126,7 @@ class PixldocsRenderer {
|
|
|
24068
24126
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24069
24127
|
}
|
|
24070
24128
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24071
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
24129
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BUlPzdRT.cjs"));
|
|
24072
24130
|
const prepared = preparePagesForExport(
|
|
24073
24131
|
cloned.pages,
|
|
24074
24132
|
canvasWidth,
|
|
@@ -26388,7 +26446,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26388
26446
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26389
26447
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26390
26448
|
try {
|
|
26391
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
26449
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BUlPzdRT.cjs"));
|
|
26392
26450
|
try {
|
|
26393
26451
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26394
26452
|
} catch {
|
|
@@ -26785,4 +26843,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
26785
26843
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
26786
26844
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
26787
26845
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
26788
|
-
//# sourceMappingURL=index-
|
|
26846
|
+
//# sourceMappingURL=index-Bu8x_hs7.cjs.map
|