@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
|
@@ -5122,7 +5122,13 @@ function localDeltaToWorld(dx, dy, angleDeg) {
|
|
|
5122
5122
|
function getWorldAngleDeg(obj) {
|
|
5123
5123
|
var _a2;
|
|
5124
5124
|
try {
|
|
5125
|
-
|
|
5125
|
+
let total = 0;
|
|
5126
|
+
let cur = obj;
|
|
5127
|
+
while (cur) {
|
|
5128
|
+
total += Number(cur.angle ?? 0) || 0;
|
|
5129
|
+
cur = cur.group;
|
|
5130
|
+
}
|
|
5131
|
+
if (Number.isFinite(total)) return total;
|
|
5126
5132
|
const matrix = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
|
|
5127
5133
|
return matrix ? fabric__namespace.util.qrDecompose(matrix).angle || 0 : obj.angle || 0;
|
|
5128
5134
|
} catch {
|
|
@@ -11682,10 +11688,16 @@ const applyTransformPreservingFlip = (obj, matrix) => {
|
|
|
11682
11688
|
}
|
|
11683
11689
|
obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
|
|
11684
11690
|
};
|
|
11685
|
-
const restorePersistedFlipState = (obj, flipX, flipY) => {
|
|
11691
|
+
const restorePersistedFlipState = (obj, flipX, flipY, angle) => {
|
|
11686
11692
|
const sx = Math.abs(Number(obj.scaleX ?? 1)) || 1;
|
|
11687
11693
|
const sy = Math.abs(Number(obj.scaleY ?? 1)) || 1;
|
|
11688
|
-
obj.set({
|
|
11694
|
+
obj.set({
|
|
11695
|
+
scaleX: sx,
|
|
11696
|
+
scaleY: sy,
|
|
11697
|
+
flipX,
|
|
11698
|
+
flipY,
|
|
11699
|
+
...Number.isFinite(angle) ? { angle } : {}
|
|
11700
|
+
});
|
|
11689
11701
|
obj.setCoords();
|
|
11690
11702
|
obj.dirty = true;
|
|
11691
11703
|
};
|
|
@@ -14650,7 +14662,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14650
14662
|
fabricCanvas.on("selection:cleared", () => {
|
|
14651
14663
|
});
|
|
14652
14664
|
fabricCanvas.on("object:scaling", (e) => {
|
|
14653
|
-
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
14665
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
14654
14666
|
if (!isActiveRef.current) return;
|
|
14655
14667
|
const t = e.target;
|
|
14656
14668
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
@@ -14943,9 +14955,12 @@ const PageCanvas = react.forwardRef(
|
|
|
14943
14955
|
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}`;
|
|
14944
14956
|
if (child.__asLiveGestureKey !== liveGestureKey) {
|
|
14945
14957
|
child.__asLiveGestureKey = liveGestureKey;
|
|
14946
|
-
|
|
14958
|
+
const childIdForAngle = getObjectId(child);
|
|
14959
|
+
const sourceChildForAngle = childIdForAngle ? elementsRef.current.find((el) => el.id === childIdForAngle) : null;
|
|
14960
|
+
const isFlippedImageLikeChild = (child instanceof fabric__namespace.FabricImage || child instanceof fabric__namespace.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);
|
|
14961
|
+
child.__asLiveOrigAngle = isFlippedImageLikeChild ? sourceChildForAngle.angle ?? 0 : Number.isFinite(child.angle) ? child.angle ?? 0 : 0;
|
|
14947
14962
|
}
|
|
14948
|
-
if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((
|
|
14963
|
+
if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_n = child._ct) == null ? void 0 : _n.isCropGroup))) {
|
|
14949
14964
|
const ct = child.__cropData;
|
|
14950
14965
|
if (!ct) continue;
|
|
14951
14966
|
if (child.__asLiveOrigAngle == null) {
|
|
@@ -15114,7 +15129,7 @@ const PageCanvas = react.forwardRef(
|
|
|
15114
15129
|
child.dirty = true;
|
|
15115
15130
|
didReflowTextChild = true;
|
|
15116
15131
|
}
|
|
15117
|
-
if (isXSide && ((
|
|
15132
|
+
if (isXSide && ((_o = groupShiftReflowSnapshotRef.current) == null ? void 0 : _o.selection) === obj) {
|
|
15118
15133
|
const snap = groupShiftReflowSnapshotRef.current;
|
|
15119
15134
|
const anchorEntry = snap.children[0];
|
|
15120
15135
|
const anchorTopLive = anchorEntry.obj.top ?? 0;
|
|
@@ -15276,7 +15291,7 @@ const PageCanvas = react.forwardRef(
|
|
|
15276
15291
|
setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
|
|
15277
15292
|
if (drilledGroupIdRef.current) {
|
|
15278
15293
|
try {
|
|
15279
|
-
(
|
|
15294
|
+
(_p = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _p.call(fabricCanvas);
|
|
15280
15295
|
} catch {
|
|
15281
15296
|
}
|
|
15282
15297
|
}
|
|
@@ -15683,12 +15698,18 @@ const PageCanvas = react.forwardRef(
|
|
|
15683
15698
|
const absLeft = (active.left ?? 0) - ct.frameW / 2;
|
|
15684
15699
|
const absTop = (active.top ?? 0) - ct.frameH / 2;
|
|
15685
15700
|
const storePosCrop = absoluteToStorePosition(absLeft, absTop, objId, pageChildrenCrop);
|
|
15701
|
+
const sourceCropElement = pageChildrenCrop.length ? findNodeById(pageChildrenCrop, objId) : null;
|
|
15702
|
+
const cropAngle = sourceCropElement && isElement(sourceCropElement) && (sourceCropElement.flipX || sourceCropElement.flipY) && Number.isFinite(sourceCropElement.angle) ? sourceCropElement.angle ?? 0 : active.angle ?? 0;
|
|
15703
|
+
if ((sourceCropElement == null ? void 0 : sourceCropElement.flipX) || (sourceCropElement == null ? void 0 : sourceCropElement.flipY)) {
|
|
15704
|
+
active.set({ angle: cropAngle, flipX: sourceCropElement.flipX ?? false, flipY: sourceCropElement.flipY ?? false });
|
|
15705
|
+
active.setCoords();
|
|
15706
|
+
}
|
|
15686
15707
|
updateElement2(objId, {
|
|
15687
15708
|
width: ct.frameW,
|
|
15688
15709
|
height: ct.frameH,
|
|
15689
15710
|
left: storePosCrop.left,
|
|
15690
15711
|
top: storePosCrop.top,
|
|
15691
|
-
angle:
|
|
15712
|
+
angle: cropAngle,
|
|
15692
15713
|
cropPanX: panX,
|
|
15693
15714
|
cropPanY: panY,
|
|
15694
15715
|
cropZoom: zoom3
|
|
@@ -16187,7 +16208,7 @@ const PageCanvas = react.forwardRef(
|
|
|
16187
16208
|
useEditorStore.getState().updateElement(objId, { src: newSrc }, { recordHistory: false, skipLayoutRecalc: true });
|
|
16188
16209
|
}
|
|
16189
16210
|
} else if (isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
|
|
16190
|
-
const imgChildLocalAngle = obj.__asLiveOrigAngle != null ? obj.__asLiveOrigAngle : obj.angle ?? 0;
|
|
16211
|
+
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;
|
|
16191
16212
|
const imgChildNormAngle = (imgChildLocalAngle % 360 + 360) % 360;
|
|
16192
16213
|
const imgChildIsRotated = Math.abs(imgChildNormAngle) > 0.5 && Math.abs(imgChildNormAngle - 360) > 0.5;
|
|
16193
16214
|
const imgHandle = activeSelectionResizeHandle;
|
|
@@ -16518,9 +16539,6 @@ const PageCanvas = react.forwardRef(
|
|
|
16518
16539
|
);
|
|
16519
16540
|
const cleanTransformMatrix = toggleLogicalFlipInMatrix(normalizedFinalAbsoluteMatrix, persistedFlipX, persistedFlipY);
|
|
16520
16541
|
const persistedDecomposed = fabric__namespace.util.qrDecompose(cleanTransformMatrix);
|
|
16521
|
-
if (isActiveSelection && (obj instanceof fabric__namespace.FabricImage || obj instanceof fabric__namespace.Group && obj.__cropGroup)) {
|
|
16522
|
-
activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY });
|
|
16523
|
-
}
|
|
16524
16542
|
const elementUpdate = {
|
|
16525
16543
|
left: storePos.left,
|
|
16526
16544
|
top: storePos.top,
|
|
@@ -16601,7 +16619,7 @@ const PageCanvas = react.forwardRef(
|
|
|
16601
16619
|
const isCropGroupObj = obj instanceof fabric__namespace.Group && obj.__cropGroup;
|
|
16602
16620
|
const isPlainImageObj = obj instanceof fabric__namespace.FabricImage && !obj.__cropGroup && !obj.smartElementType;
|
|
16603
16621
|
if (isActiveSelection && isActiveSelectionSideHandle && (isCropGroupObj || isPlainImageObj)) {
|
|
16604
|
-
const childLocalAngleSrc = obj.__asLiveOrigAngle != null ? obj.__asLiveOrigAngle : Number.isFinite(sourceElement == null ? void 0 : sourceElement.angle) ? sourceElement.angle ?? 0 : obj.angle ?? 0;
|
|
16622
|
+
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;
|
|
16605
16623
|
const normAng = (childLocalAngleSrc % 360 + 360) % 360;
|
|
16606
16624
|
const isRotatedImg = Math.min(normAng, 360 - normAng) > 0.5;
|
|
16607
16625
|
if (isRotatedImg && activeObj instanceof fabric__namespace.ActiveSelection) {
|
|
@@ -16649,6 +16667,9 @@ const PageCanvas = react.forwardRef(
|
|
|
16649
16667
|
objectBeforeStoreWrite: summarizeFabricObjectForResizeDebug(obj)
|
|
16650
16668
|
});
|
|
16651
16669
|
}
|
|
16670
|
+
if (isActiveSelection && (obj instanceof fabric__namespace.FabricImage || obj instanceof fabric__namespace.Group && obj.__cropGroup)) {
|
|
16671
|
+
activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY, angle: elementUpdate.angle });
|
|
16672
|
+
}
|
|
16652
16673
|
if (isActiveSelection) {
|
|
16653
16674
|
logRotGroupImageDrift("store-update-child", {
|
|
16654
16675
|
time: Math.round(performance.now()),
|
|
@@ -16745,14 +16766,14 @@ const PageCanvas = react.forwardRef(
|
|
|
16745
16766
|
skipActiveSelectionBakeOnClearRef.current = true;
|
|
16746
16767
|
try {
|
|
16747
16768
|
for (const restore of activeSelectionFlipRestores) {
|
|
16748
|
-
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
|
|
16769
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
|
|
16749
16770
|
}
|
|
16750
16771
|
fabricCanvas.discardActiveObject();
|
|
16751
16772
|
} finally {
|
|
16752
16773
|
skipActiveSelectionBakeOnClearRef.current = false;
|
|
16753
16774
|
}
|
|
16754
16775
|
for (const restore of activeSelectionFlipRestores) {
|
|
16755
|
-
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
|
|
16776
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
|
|
16756
16777
|
}
|
|
16757
16778
|
for (const bake of pendingCropGroupFrameBakes) {
|
|
16758
16779
|
const ct = bake.obj.__cropData;
|
|
@@ -25940,9 +25961,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25940
25961
|
}
|
|
25941
25962
|
return svgString;
|
|
25942
25963
|
}
|
|
25943
|
-
const resolvedPackageVersion = "0.5.
|
|
25964
|
+
const resolvedPackageVersion = "0.5.451";
|
|
25944
25965
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25945
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25966
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.451";
|
|
25946
25967
|
const roundParityValue = (value) => {
|
|
25947
25968
|
if (typeof value !== "number") return value;
|
|
25948
25969
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26756,7 +26777,7 @@ class PixldocsRenderer {
|
|
|
26756
26777
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26757
26778
|
}
|
|
26758
26779
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26759
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
26780
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-a8L9h6E3.cjs"));
|
|
26760
26781
|
const prepared = preparePagesForExport(
|
|
26761
26782
|
cloned.pages,
|
|
26762
26783
|
canvasWidth,
|
|
@@ -29076,7 +29097,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29076
29097
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29077
29098
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29078
29099
|
try {
|
|
29079
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
29100
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-a8L9h6E3.cjs"));
|
|
29080
29101
|
try {
|
|
29081
29102
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29082
29103
|
} catch {
|
|
@@ -29473,4 +29494,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29473
29494
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29474
29495
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29475
29496
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29476
|
-
//# sourceMappingURL=index-
|
|
29497
|
+
//# sourceMappingURL=index-xHv8_Y1M.cjs.map
|