@pixldocs/canvas-renderer 0.5.305 → 0.5.307
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-fZq9e7bO.js → index-D4p1jWxS.js} +125 -12
- package/dist/index-D4p1jWxS.js.map +1 -0
- package/dist/{index-C8ZNStHz.cjs → index-DDubE6xA.cjs} +125 -12
- package/dist/index-DDubE6xA.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-BwMJ3-iw.js → vectorPdfExport-B6HX4s-I.js} +4 -4
- package/dist/{vectorPdfExport-BwMJ3-iw.js.map → vectorPdfExport-B6HX4s-I.js.map} +1 -1
- package/dist/{vectorPdfExport-fYp0UsD2.cjs → vectorPdfExport-BLbk8p1V.cjs} +4 -4
- package/dist/{vectorPdfExport-fYp0UsD2.cjs.map → vectorPdfExport-BLbk8p1V.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-C8ZNStHz.cjs.map +0 -1
- package/dist/index-fZq9e7bO.js.map +0 -1
|
@@ -11241,10 +11241,31 @@ const PageCanvas = forwardRef(
|
|
|
11241
11241
|
const [ready, setReady] = useState(false);
|
|
11242
11242
|
const [unlockRequestId, setUnlockRequestId] = useState(0);
|
|
11243
11243
|
const applyLogicalGroupSelectionVisualState = useCallback((selection, groupId) => {
|
|
11244
|
-
var _a2;
|
|
11244
|
+
var _a2, _b2;
|
|
11245
11245
|
selection.__pixldocsGroupSelection = groupId;
|
|
11246
11246
|
delete selection.__pixldocsLogicalGroupIds;
|
|
11247
11247
|
selection.hasBorders = true;
|
|
11248
|
+
try {
|
|
11249
|
+
const state = useEditorStore.getState();
|
|
11250
|
+
const pages = ((_a2 = state.canvas) == null ? void 0 : _a2.pages) ?? [];
|
|
11251
|
+
let groupNode = null;
|
|
11252
|
+
for (const page of pages) {
|
|
11253
|
+
const found = findNodeById(page.children ?? [], groupId);
|
|
11254
|
+
if (found && isGroup(found)) {
|
|
11255
|
+
groupNode = found;
|
|
11256
|
+
break;
|
|
11257
|
+
}
|
|
11258
|
+
}
|
|
11259
|
+
if (groupNode && !isStackLayoutMode(groupNode.layoutMode) && typeof groupNode.angle === "number" && Math.abs(groupNode.angle) > 0.01) {
|
|
11260
|
+
const currentAngle = ((selection.angle ?? 0) % 360 + 360) % 360;
|
|
11261
|
+
const targetAngle = ((groupNode.angle ?? 0) % 360 + 360) % 360;
|
|
11262
|
+
if (Math.abs(currentAngle - targetAngle) > 0.01) {
|
|
11263
|
+
selection.rotate(targetAngle);
|
|
11264
|
+
selection.setCoords();
|
|
11265
|
+
}
|
|
11266
|
+
}
|
|
11267
|
+
} catch {
|
|
11268
|
+
}
|
|
11248
11269
|
const members = selection.getObjects();
|
|
11249
11270
|
for (const prev of suppressGroupMemberBordersRef.current) {
|
|
11250
11271
|
if (members.includes(prev)) continue;
|
|
@@ -11268,7 +11289,7 @@ const PageCanvas = forwardRef(
|
|
|
11268
11289
|
if (m.__pixldocsOrigHasControls === void 0) m.__pixldocsOrigHasControls = m.hasControls;
|
|
11269
11290
|
m.hasBorders = false;
|
|
11270
11291
|
m.hasControls = false;
|
|
11271
|
-
if (m.__cropGroup || ((
|
|
11292
|
+
if (m.__cropGroup || ((_b2 = m._ct) == null ? void 0 : _b2.isCropGroup)) {
|
|
11272
11293
|
if (m.__pixldocsOrigLockScalingX === void 0) {
|
|
11273
11294
|
m.__pixldocsOrigLockScalingX = m.lockScalingX;
|
|
11274
11295
|
m.__pixldocsOrigLockScalingY = m.lockScalingY;
|
|
@@ -13851,6 +13872,12 @@ const PageCanvas = forwardRef(
|
|
|
13851
13872
|
if (didShift) didReflowTextChild = true;
|
|
13852
13873
|
}
|
|
13853
13874
|
if (isXSide && didReflowTextChild && typeof obj.triggerLayout === "function") {
|
|
13875
|
+
obj.setCoords();
|
|
13876
|
+
const cornersBefore = obj.aCoords;
|
|
13877
|
+
let fixedMidBefore = null;
|
|
13878
|
+
if (cornersBefore) {
|
|
13879
|
+
fixedMidBefore = corner === "ml" ? { x: (cornersBefore.tr.x + cornersBefore.br.x) / 2, y: (cornersBefore.tr.y + cornersBefore.br.y) / 2 } : { x: (cornersBefore.tl.x + cornersBefore.bl.x) / 2, y: (cornersBefore.tl.y + cornersBefore.bl.y) / 2 };
|
|
13880
|
+
}
|
|
13854
13881
|
try {
|
|
13855
13882
|
obj.triggerLayout();
|
|
13856
13883
|
} catch {
|
|
@@ -13859,11 +13886,22 @@ const PageCanvas = forwardRef(
|
|
|
13859
13886
|
obj._set("scaleX", asSx0);
|
|
13860
13887
|
obj._set("scaleY", asSy0);
|
|
13861
13888
|
obj.setCoords();
|
|
13862
|
-
const
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13889
|
+
const cornersAfter = obj.aCoords;
|
|
13890
|
+
if (fixedMidBefore && cornersAfter) {
|
|
13891
|
+
const fixedMidAfter = corner === "ml" ? { x: (cornersAfter.tr.x + cornersAfter.br.x) / 2, y: (cornersAfter.tr.y + cornersAfter.br.y) / 2 } : { x: (cornersAfter.tl.x + cornersAfter.bl.x) / 2, y: (cornersAfter.tl.y + cornersAfter.bl.y) / 2 };
|
|
13892
|
+
const dx = fixedMidBefore.x - fixedMidAfter.x;
|
|
13893
|
+
const dy = fixedMidBefore.y - fixedMidAfter.y;
|
|
13894
|
+
if (Math.abs(dx) > 0.01 || Math.abs(dy) > 0.01) {
|
|
13895
|
+
obj._set("left", (obj.left ?? 0) + dx);
|
|
13896
|
+
obj._set("top", (obj.top ?? 0) + dy);
|
|
13897
|
+
}
|
|
13898
|
+
} else {
|
|
13899
|
+
const afterRect = obj.getBoundingRect();
|
|
13900
|
+
const fixedLeft = asRect0.left;
|
|
13901
|
+
const fixedRight = asRect0.left + asRect0.width;
|
|
13902
|
+
const nextLeft = corner === "ml" ? (obj.left ?? 0) + (fixedRight - (afterRect.left + afterRect.width)) : (obj.left ?? 0) + (fixedLeft - afterRect.left);
|
|
13903
|
+
obj._set("left", nextLeft);
|
|
13904
|
+
}
|
|
13867
13905
|
} else {
|
|
13868
13906
|
obj._set("height", asH0);
|
|
13869
13907
|
obj._set("left", asLeft0);
|
|
@@ -14608,6 +14646,47 @@ const PageCanvas = forwardRef(
|
|
|
14608
14646
|
unlockEditsSoon();
|
|
14609
14647
|
return;
|
|
14610
14648
|
}
|
|
14649
|
+
if (hadRotation && !hadScale && isActiveSelection && activeObj instanceof fabric.ActiveSelection && !isStackLayoutMode(groupToMove.layoutMode)) {
|
|
14650
|
+
const groupSelectionId = activeObj.__pixldocsGroupSelection ?? groupToMove.id;
|
|
14651
|
+
const newAngle = ((activeObj.angle ?? 0) % 360 + 360) % 360;
|
|
14652
|
+
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
14653
|
+
const rotPatch = { angle: newAngle === 0 ? void 0 : newAngle };
|
|
14654
|
+
if (Math.abs(deltaX) > 0.1) rotPatch.left = (groupToMove.left ?? 0) + deltaX;
|
|
14655
|
+
if (Math.abs(deltaY) > 0.1) rotPatch.top = (groupToMove.top ?? 0) + deltaY;
|
|
14656
|
+
updateNodeStore(groupToMove.id, rotPatch, { recordHistory: false, skipLayoutRecalc: true });
|
|
14657
|
+
commitHistoryStore();
|
|
14658
|
+
pendingGroupDrillInRef.current = null;
|
|
14659
|
+
fabricCanvas.__activeEditingGroupId = null;
|
|
14660
|
+
setDrilledGroupBounds(null);
|
|
14661
|
+
drilledGroupIdRef.current = null;
|
|
14662
|
+
if (groupSelectionId) {
|
|
14663
|
+
restoreGroupSelectionVisualState(activeObj, groupSelectionId);
|
|
14664
|
+
fabricCanvas.setActiveObject(activeObj);
|
|
14665
|
+
activeObj.setCoords();
|
|
14666
|
+
}
|
|
14667
|
+
selectElements([groupSelectionId], false, false);
|
|
14668
|
+
fabricCanvas.requestRenderAll();
|
|
14669
|
+
elementsRef.current = getCurrentElements();
|
|
14670
|
+
const rotTargets = activeObj.getObjects();
|
|
14671
|
+
for (const o of rotTargets) {
|
|
14672
|
+
const oid = getObjectId(o);
|
|
14673
|
+
if (oid && oid !== "__background__") {
|
|
14674
|
+
justModifiedIdsRef.current.add(oid);
|
|
14675
|
+
modifiedIdsThisRound.add(oid);
|
|
14676
|
+
}
|
|
14677
|
+
}
|
|
14678
|
+
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14679
|
+
groupSelectionTransformStartRef.current = null;
|
|
14680
|
+
const rotSnapshot = {
|
|
14681
|
+
memberIds: rotTargets.map((o) => getObjectId(o)).filter((id) => !!id && id !== "__background__"),
|
|
14682
|
+
groupSelectionId,
|
|
14683
|
+
expiresAt: Date.now() + 1200
|
|
14684
|
+
};
|
|
14685
|
+
recentGroupSelectionRestoreRef.current = rotSnapshot;
|
|
14686
|
+
restorePreservedGroupSelectionSoon(rotSnapshot);
|
|
14687
|
+
unlockEditsSoon();
|
|
14688
|
+
return;
|
|
14689
|
+
}
|
|
14611
14690
|
}
|
|
14612
14691
|
}
|
|
14613
14692
|
const pendingCropGroupFrameBakes = [];
|
|
@@ -14883,6 +14962,40 @@ const PageCanvas = forwardRef(
|
|
|
14883
14962
|
bakedTextScaleUpdates.minBoxHeight = Math.max(0, nextMinH);
|
|
14884
14963
|
obj.minBoxHeight = bakedTextScaleUpdates.minBoxHeight;
|
|
14885
14964
|
}
|
|
14965
|
+
const effectScale = isCornerHandle ? fontScale : Math.max(1e-3, Math.sqrt(sx * sy));
|
|
14966
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "strokeWidth", effectScale);
|
|
14967
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textShadowBlur", effectScale);
|
|
14968
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textShadowDistance", effectScale);
|
|
14969
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textShadowOffsetX", sx);
|
|
14970
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textShadowOffsetY", sy);
|
|
14971
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textBgPaddingTop", sy);
|
|
14972
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textBgPaddingBottom", sy);
|
|
14973
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textBgPaddingLeft", sx);
|
|
14974
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textBgPaddingRight", sx);
|
|
14975
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textBgPadding", effectScale);
|
|
14976
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textBgRxTL", effectScale);
|
|
14977
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textBgRxTR", effectScale);
|
|
14978
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textBgRxBR", effectScale);
|
|
14979
|
+
scaleUpdateNumber(bakedTextScaleUpdates, sourceElement ?? void 0, "textBgRxBL", effectScale);
|
|
14980
|
+
const tpSource = obj.textPath ?? (sourceElement == null ? void 0 : sourceElement.textPath);
|
|
14981
|
+
if (tpSource) {
|
|
14982
|
+
bakedTextScaleUpdates.textPath = scaleTextPathConfig(tpSource, sx, sy, effectScale);
|
|
14983
|
+
obj.textPath = bakedTextScaleUpdates.textPath;
|
|
14984
|
+
}
|
|
14985
|
+
if (bakedTextScaleUpdates.strokeWidth !== void 0) {
|
|
14986
|
+
obj.set({ strokeWidth: bakedTextScaleUpdates.strokeWidth });
|
|
14987
|
+
}
|
|
14988
|
+
const shadow = obj.shadow;
|
|
14989
|
+
if (shadow) {
|
|
14990
|
+
if (bakedTextScaleUpdates.textShadowBlur !== void 0) shadow.blur = bakedTextScaleUpdates.textShadowBlur;
|
|
14991
|
+
if (bakedTextScaleUpdates.textShadowOffsetX !== void 0) shadow.offsetX = bakedTextScaleUpdates.textShadowOffsetX;
|
|
14992
|
+
if (bakedTextScaleUpdates.textShadowOffsetY !== void 0) shadow.offsetY = bakedTextScaleUpdates.textShadowOffsetY;
|
|
14993
|
+
}
|
|
14994
|
+
if ((sourceElement == null ? void 0 : sourceElement.type) === "text") {
|
|
14995
|
+
const bakedElement = { ...sourceElement, ...bakedTextScaleUpdates };
|
|
14996
|
+
applyTextBackground(obj, extractTextBgConfig(bakedElement));
|
|
14997
|
+
applyTextShadow(obj, bakedElement);
|
|
14998
|
+
}
|
|
14886
14999
|
const prevObjCaching = obj.objectCaching;
|
|
14887
15000
|
obj.set({ width: bakedWidth, scaleX: 1, scaleY: 1, objectCaching: false });
|
|
14888
15001
|
obj.initDimensions();
|
|
@@ -24159,9 +24272,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24159
24272
|
}
|
|
24160
24273
|
return svgString;
|
|
24161
24274
|
}
|
|
24162
|
-
const resolvedPackageVersion = "0.5.
|
|
24275
|
+
const resolvedPackageVersion = "0.5.307";
|
|
24163
24276
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24164
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24277
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.307";
|
|
24165
24278
|
const roundParityValue = (value) => {
|
|
24166
24279
|
if (typeof value !== "number") return value;
|
|
24167
24280
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24975,7 +25088,7 @@ class PixldocsRenderer {
|
|
|
24975
25088
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24976
25089
|
}
|
|
24977
25090
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24978
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25091
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-B6HX4s-I.js");
|
|
24979
25092
|
const prepared = preparePagesForExport(
|
|
24980
25093
|
cloned.pages,
|
|
24981
25094
|
canvasWidth,
|
|
@@ -27295,7 +27408,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27295
27408
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27296
27409
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27297
27410
|
try {
|
|
27298
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27411
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-B6HX4s-I.js");
|
|
27299
27412
|
try {
|
|
27300
27413
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27301
27414
|
} catch {
|
|
@@ -27695,4 +27808,4 @@ export {
|
|
|
27695
27808
|
buildTeaserBlurFlatKeys as y,
|
|
27696
27809
|
collectFontDescriptorsFromConfig as z
|
|
27697
27810
|
};
|
|
27698
|
-
//# sourceMappingURL=index-
|
|
27811
|
+
//# sourceMappingURL=index-D4p1jWxS.js.map
|