@pixldocs/canvas-renderer 0.5.449 → 0.5.451
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-CyBVRtoh.js → index-CmdwL3tr.js} +42 -21
- package/dist/index-CmdwL3tr.js.map +1 -0
- package/dist/{index-DJhcPNx7.cjs → index-xHv8_Y1M.cjs} +42 -21
- package/dist/index-xHv8_Y1M.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DDTYu7h6.cjs → vectorPdfExport-a8L9h6E3.cjs} +4 -4
- package/dist/{vectorPdfExport-DDTYu7h6.cjs.map → vectorPdfExport-a8L9h6E3.cjs.map} +1 -1
- package/dist/{vectorPdfExport-BeSrh7Sq.js → vectorPdfExport-hQLfUhri.js} +4 -4
- package/dist/{vectorPdfExport-BeSrh7Sq.js.map → vectorPdfExport-hQLfUhri.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CyBVRtoh.js.map +0 -1
- package/dist/index-DJhcPNx7.cjs.map +0 -1
|
@@ -5104,7 +5104,13 @@ function localDeltaToWorld(dx, dy, angleDeg) {
|
|
|
5104
5104
|
function getWorldAngleDeg(obj) {
|
|
5105
5105
|
var _a2;
|
|
5106
5106
|
try {
|
|
5107
|
-
|
|
5107
|
+
let total = 0;
|
|
5108
|
+
let cur = obj;
|
|
5109
|
+
while (cur) {
|
|
5110
|
+
total += Number(cur.angle ?? 0) || 0;
|
|
5111
|
+
cur = cur.group;
|
|
5112
|
+
}
|
|
5113
|
+
if (Number.isFinite(total)) return total;
|
|
5108
5114
|
const matrix = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
|
|
5109
5115
|
return matrix ? fabric.util.qrDecompose(matrix).angle || 0 : obj.angle || 0;
|
|
5110
5116
|
} catch {
|
|
@@ -11664,10 +11670,16 @@ const applyTransformPreservingFlip = (obj, matrix) => {
|
|
|
11664
11670
|
}
|
|
11665
11671
|
obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
|
|
11666
11672
|
};
|
|
11667
|
-
const restorePersistedFlipState = (obj, flipX, flipY) => {
|
|
11673
|
+
const restorePersistedFlipState = (obj, flipX, flipY, angle) => {
|
|
11668
11674
|
const sx = Math.abs(Number(obj.scaleX ?? 1)) || 1;
|
|
11669
11675
|
const sy = Math.abs(Number(obj.scaleY ?? 1)) || 1;
|
|
11670
|
-
obj.set({
|
|
11676
|
+
obj.set({
|
|
11677
|
+
scaleX: sx,
|
|
11678
|
+
scaleY: sy,
|
|
11679
|
+
flipX,
|
|
11680
|
+
flipY,
|
|
11681
|
+
...Number.isFinite(angle) ? { angle } : {}
|
|
11682
|
+
});
|
|
11671
11683
|
obj.setCoords();
|
|
11672
11684
|
obj.dirty = true;
|
|
11673
11685
|
};
|
|
@@ -14632,7 +14644,7 @@ const PageCanvas = forwardRef(
|
|
|
14632
14644
|
fabricCanvas.on("selection:cleared", () => {
|
|
14633
14645
|
});
|
|
14634
14646
|
fabricCanvas.on("object:scaling", (e) => {
|
|
14635
|
-
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
14647
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
14636
14648
|
if (!isActiveRef.current) return;
|
|
14637
14649
|
const t = e.target;
|
|
14638
14650
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
@@ -14925,9 +14937,12 @@ const PageCanvas = forwardRef(
|
|
|
14925
14937
|
const liveGestureKey = `${obj.__pixldocsGroupSelection ?? "selection"}:${corner}:${((_k = groupSelectionTransformStartRef.current) == null ? void 0 : _k.selectionLeft) ?? obj.left ?? 0}:${((_l = groupSelectionTransformStartRef.current) == null ? void 0 : _l.selectionTop) ?? obj.top ?? 0}`;
|
|
14926
14938
|
if (child.__asLiveGestureKey !== liveGestureKey) {
|
|
14927
14939
|
child.__asLiveGestureKey = liveGestureKey;
|
|
14928
|
-
|
|
14940
|
+
const childIdForAngle = getObjectId(child);
|
|
14941
|
+
const sourceChildForAngle = childIdForAngle ? elementsRef.current.find((el) => el.id === childIdForAngle) : null;
|
|
14942
|
+
const isFlippedImageLikeChild = (child instanceof fabric.FabricImage || child instanceof fabric.Group && (child.__cropGroup || ((_m = child._ct) == null ? void 0 : _m.isCropGroup))) && !!((sourceChildForAngle == null ? void 0 : sourceChildForAngle.flipX) || (sourceChildForAngle == null ? void 0 : sourceChildForAngle.flipY)) && Number.isFinite(sourceChildForAngle == null ? void 0 : sourceChildForAngle.angle);
|
|
14943
|
+
child.__asLiveOrigAngle = isFlippedImageLikeChild ? sourceChildForAngle.angle ?? 0 : Number.isFinite(child.angle) ? child.angle ?? 0 : 0;
|
|
14929
14944
|
}
|
|
14930
|
-
if (child instanceof fabric.Group && (child.__cropGroup || ((
|
|
14945
|
+
if (child instanceof fabric.Group && (child.__cropGroup || ((_n = child._ct) == null ? void 0 : _n.isCropGroup))) {
|
|
14931
14946
|
const ct = child.__cropData;
|
|
14932
14947
|
if (!ct) continue;
|
|
14933
14948
|
if (child.__asLiveOrigAngle == null) {
|
|
@@ -15096,7 +15111,7 @@ const PageCanvas = forwardRef(
|
|
|
15096
15111
|
child.dirty = true;
|
|
15097
15112
|
didReflowTextChild = true;
|
|
15098
15113
|
}
|
|
15099
|
-
if (isXSide && ((
|
|
15114
|
+
if (isXSide && ((_o = groupShiftReflowSnapshotRef.current) == null ? void 0 : _o.selection) === obj) {
|
|
15100
15115
|
const snap = groupShiftReflowSnapshotRef.current;
|
|
15101
15116
|
const anchorEntry = snap.children[0];
|
|
15102
15117
|
const anchorTopLive = anchorEntry.obj.top ?? 0;
|
|
@@ -15258,7 +15273,7 @@ const PageCanvas = forwardRef(
|
|
|
15258
15273
|
setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
|
|
15259
15274
|
if (drilledGroupIdRef.current) {
|
|
15260
15275
|
try {
|
|
15261
|
-
(
|
|
15276
|
+
(_p = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _p.call(fabricCanvas);
|
|
15262
15277
|
} catch {
|
|
15263
15278
|
}
|
|
15264
15279
|
}
|
|
@@ -15665,12 +15680,18 @@ const PageCanvas = forwardRef(
|
|
|
15665
15680
|
const absLeft = (active.left ?? 0) - ct.frameW / 2;
|
|
15666
15681
|
const absTop = (active.top ?? 0) - ct.frameH / 2;
|
|
15667
15682
|
const storePosCrop = absoluteToStorePosition(absLeft, absTop, objId, pageChildrenCrop);
|
|
15683
|
+
const sourceCropElement = pageChildrenCrop.length ? findNodeById(pageChildrenCrop, objId) : null;
|
|
15684
|
+
const cropAngle = sourceCropElement && isElement(sourceCropElement) && (sourceCropElement.flipX || sourceCropElement.flipY) && Number.isFinite(sourceCropElement.angle) ? sourceCropElement.angle ?? 0 : active.angle ?? 0;
|
|
15685
|
+
if ((sourceCropElement == null ? void 0 : sourceCropElement.flipX) || (sourceCropElement == null ? void 0 : sourceCropElement.flipY)) {
|
|
15686
|
+
active.set({ angle: cropAngle, flipX: sourceCropElement.flipX ?? false, flipY: sourceCropElement.flipY ?? false });
|
|
15687
|
+
active.setCoords();
|
|
15688
|
+
}
|
|
15668
15689
|
updateElement2(objId, {
|
|
15669
15690
|
width: ct.frameW,
|
|
15670
15691
|
height: ct.frameH,
|
|
15671
15692
|
left: storePosCrop.left,
|
|
15672
15693
|
top: storePosCrop.top,
|
|
15673
|
-
angle:
|
|
15694
|
+
angle: cropAngle,
|
|
15674
15695
|
cropPanX: panX,
|
|
15675
15696
|
cropPanY: panY,
|
|
15676
15697
|
cropZoom: zoom3
|
|
@@ -16169,7 +16190,7 @@ const PageCanvas = forwardRef(
|
|
|
16169
16190
|
useEditorStore.getState().updateElement(objId, { src: newSrc }, { recordHistory: false, skipLayoutRecalc: true });
|
|
16170
16191
|
}
|
|
16171
16192
|
} else if (isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
|
|
16172
|
-
const imgChildLocalAngle = obj.__asLiveOrigAngle != null ? obj.__asLiveOrigAngle : obj.angle ?? 0;
|
|
16193
|
+
const imgChildLocalAngle = obj.__asLiveOrigAngle != null ? obj.__asLiveOrigAngle : ((sourceElement == null ? void 0 : sourceElement.flipX) || (sourceElement == null ? void 0 : sourceElement.flipY)) && Number.isFinite(sourceElement == null ? void 0 : sourceElement.angle) ? sourceElement.angle ?? 0 : obj.angle ?? 0;
|
|
16173
16194
|
const imgChildNormAngle = (imgChildLocalAngle % 360 + 360) % 360;
|
|
16174
16195
|
const imgChildIsRotated = Math.abs(imgChildNormAngle) > 0.5 && Math.abs(imgChildNormAngle - 360) > 0.5;
|
|
16175
16196
|
const imgHandle = activeSelectionResizeHandle;
|
|
@@ -16500,9 +16521,6 @@ const PageCanvas = forwardRef(
|
|
|
16500
16521
|
);
|
|
16501
16522
|
const cleanTransformMatrix = toggleLogicalFlipInMatrix(normalizedFinalAbsoluteMatrix, persistedFlipX, persistedFlipY);
|
|
16502
16523
|
const persistedDecomposed = fabric.util.qrDecompose(cleanTransformMatrix);
|
|
16503
|
-
if (isActiveSelection && (obj instanceof fabric.FabricImage || obj instanceof fabric.Group && obj.__cropGroup)) {
|
|
16504
|
-
activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY });
|
|
16505
|
-
}
|
|
16506
16524
|
const elementUpdate = {
|
|
16507
16525
|
left: storePos.left,
|
|
16508
16526
|
top: storePos.top,
|
|
@@ -16583,7 +16601,7 @@ const PageCanvas = forwardRef(
|
|
|
16583
16601
|
const isCropGroupObj = obj instanceof fabric.Group && obj.__cropGroup;
|
|
16584
16602
|
const isPlainImageObj = obj instanceof fabric.FabricImage && !obj.__cropGroup && !obj.smartElementType;
|
|
16585
16603
|
if (isActiveSelection && isActiveSelectionSideHandle && (isCropGroupObj || isPlainImageObj)) {
|
|
16586
|
-
const childLocalAngleSrc = obj.__asLiveOrigAngle != null ? obj.__asLiveOrigAngle : Number.isFinite(sourceElement == null ? void 0 : sourceElement.angle) ? sourceElement.angle ?? 0 : obj.angle ?? 0;
|
|
16604
|
+
const childLocalAngleSrc = obj.__asLiveOrigAngle != null ? obj.__asLiveOrigAngle : ((sourceElement == null ? void 0 : sourceElement.flipX) || (sourceElement == null ? void 0 : sourceElement.flipY)) && Number.isFinite(sourceElement == null ? void 0 : sourceElement.angle) ? sourceElement.angle ?? 0 : Number.isFinite(sourceElement == null ? void 0 : sourceElement.angle) ? sourceElement.angle ?? 0 : obj.angle ?? 0;
|
|
16587
16605
|
const normAng = (childLocalAngleSrc % 360 + 360) % 360;
|
|
16588
16606
|
const isRotatedImg = Math.min(normAng, 360 - normAng) > 0.5;
|
|
16589
16607
|
if (isRotatedImg && activeObj instanceof fabric.ActiveSelection) {
|
|
@@ -16631,6 +16649,9 @@ const PageCanvas = forwardRef(
|
|
|
16631
16649
|
objectBeforeStoreWrite: summarizeFabricObjectForResizeDebug(obj)
|
|
16632
16650
|
});
|
|
16633
16651
|
}
|
|
16652
|
+
if (isActiveSelection && (obj instanceof fabric.FabricImage || obj instanceof fabric.Group && obj.__cropGroup)) {
|
|
16653
|
+
activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY, angle: elementUpdate.angle });
|
|
16654
|
+
}
|
|
16634
16655
|
if (isActiveSelection) {
|
|
16635
16656
|
logRotGroupImageDrift("store-update-child", {
|
|
16636
16657
|
time: Math.round(performance.now()),
|
|
@@ -16727,14 +16748,14 @@ const PageCanvas = forwardRef(
|
|
|
16727
16748
|
skipActiveSelectionBakeOnClearRef.current = true;
|
|
16728
16749
|
try {
|
|
16729
16750
|
for (const restore of activeSelectionFlipRestores) {
|
|
16730
|
-
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
|
|
16751
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
|
|
16731
16752
|
}
|
|
16732
16753
|
fabricCanvas.discardActiveObject();
|
|
16733
16754
|
} finally {
|
|
16734
16755
|
skipActiveSelectionBakeOnClearRef.current = false;
|
|
16735
16756
|
}
|
|
16736
16757
|
for (const restore of activeSelectionFlipRestores) {
|
|
16737
|
-
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
|
|
16758
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
|
|
16738
16759
|
}
|
|
16739
16760
|
for (const bake of pendingCropGroupFrameBakes) {
|
|
16740
16761
|
const ct = bake.obj.__cropData;
|
|
@@ -25922,9 +25943,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25922
25943
|
}
|
|
25923
25944
|
return svgString;
|
|
25924
25945
|
}
|
|
25925
|
-
const resolvedPackageVersion = "0.5.
|
|
25946
|
+
const resolvedPackageVersion = "0.5.451";
|
|
25926
25947
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25927
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25948
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.451";
|
|
25928
25949
|
const roundParityValue = (value) => {
|
|
25929
25950
|
if (typeof value !== "number") return value;
|
|
25930
25951
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26738,7 +26759,7 @@ class PixldocsRenderer {
|
|
|
26738
26759
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26739
26760
|
}
|
|
26740
26761
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26741
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26762
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-hQLfUhri.js");
|
|
26742
26763
|
const prepared = preparePagesForExport(
|
|
26743
26764
|
cloned.pages,
|
|
26744
26765
|
canvasWidth,
|
|
@@ -29058,7 +29079,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29058
29079
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29059
29080
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29060
29081
|
try {
|
|
29061
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29082
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-hQLfUhri.js");
|
|
29062
29083
|
try {
|
|
29063
29084
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29064
29085
|
} catch {
|
|
@@ -29458,4 +29479,4 @@ export {
|
|
|
29458
29479
|
buildTeaserBlurFlatKeys as y,
|
|
29459
29480
|
collectFontDescriptorsFromConfig as z
|
|
29460
29481
|
};
|
|
29461
|
-
//# sourceMappingURL=index-
|
|
29482
|
+
//# sourceMappingURL=index-CmdwL3tr.js.map
|