@pixldocs/canvas-renderer 0.5.442 → 0.5.444
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-DFHTSlHV.js → index-BBkKxCQ_.js} +70 -35
- package/dist/index-BBkKxCQ_.js.map +1 -0
- package/dist/{index-SGFlXODe.cjs → index-DTJ_wDD-.cjs} +70 -35
- package/dist/index-DTJ_wDD-.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-m9l318xa.cjs → vectorPdfExport-Cy6iRFYd.cjs} +4 -4
- package/dist/{vectorPdfExport-m9l318xa.cjs.map → vectorPdfExport-Cy6iRFYd.cjs.map} +1 -1
- package/dist/{vectorPdfExport-Hv54w3Cm.js → vectorPdfExport-D4YSdx4j.js} +4 -4
- package/dist/{vectorPdfExport-Hv54w3Cm.js.map → vectorPdfExport-D4YSdx4j.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DFHTSlHV.js.map +0 -1
- package/dist/index-SGFlXODe.cjs.map +0 -1
|
@@ -11661,12 +11661,31 @@ const applyTransformPreservingFlip = (obj, matrix) => {
|
|
|
11661
11661
|
}
|
|
11662
11662
|
obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
|
|
11663
11663
|
};
|
|
11664
|
+
const restorePersistedFlipState = (obj, flipX, flipY) => {
|
|
11665
|
+
const sx = Math.abs(Number(obj.scaleX ?? 1)) || 1;
|
|
11666
|
+
const sy = Math.abs(Number(obj.scaleY ?? 1)) || 1;
|
|
11667
|
+
obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
|
|
11668
|
+
obj.setCoords();
|
|
11669
|
+
obj.dirty = true;
|
|
11670
|
+
};
|
|
11664
11671
|
const toggleLogicalFlipInMatrix = (matrix, flipX, flipY) => {
|
|
11665
11672
|
if (!flipX && !flipY) return matrix;
|
|
11666
11673
|
const sx = flipX ? -1 : 1;
|
|
11667
11674
|
const sy = flipY ? -1 : 1;
|
|
11668
11675
|
return [matrix[0] * sx, matrix[1] * sx, matrix[2] * sy, matrix[3] * sy, matrix[4], matrix[5]];
|
|
11669
11676
|
};
|
|
11677
|
+
const angleDistanceDeg = (a, b) => {
|
|
11678
|
+
const delta = Math.abs(((a - b) % 360 + 540) % 360 - 180);
|
|
11679
|
+
return Number.isFinite(delta) ? delta : Number.POSITIVE_INFINITY;
|
|
11680
|
+
};
|
|
11681
|
+
const normalizeMatrixForPersistedFlip = (matrix, persistedFlipX, persistedFlipY, expectedCleanAngle) => {
|
|
11682
|
+
if (!persistedFlipX && !persistedFlipY) return matrix;
|
|
11683
|
+
if (!Number.isFinite(expectedCleanAngle)) return matrix;
|
|
11684
|
+
const toggledVisual = toggleLogicalFlipInMatrix(matrix, persistedFlipX, persistedFlipY);
|
|
11685
|
+
const cleanIfMatrixAlreadyHasFlip = fabric.util.qrDecompose(toggleLogicalFlipInMatrix(matrix, persistedFlipX, persistedFlipY)).angle ?? 0;
|
|
11686
|
+
const cleanIfMatrixLostFlip = fabric.util.qrDecompose(matrix).angle ?? 0;
|
|
11687
|
+
return angleDistanceDeg(cleanIfMatrixLostFlip, expectedCleanAngle) + 0.1 < angleDistanceDeg(cleanIfMatrixAlreadyHasFlip, expectedCleanAngle) ? toggledVisual : matrix;
|
|
11688
|
+
};
|
|
11670
11689
|
function applyWarpAwareSelectionBorders(selection) {
|
|
11671
11690
|
var _a2;
|
|
11672
11691
|
if (selection.__pixldocsOrigASHasBorders !== void 0) {
|
|
@@ -15945,6 +15964,7 @@ const PageCanvas = forwardRef(
|
|
|
15945
15964
|
}
|
|
15946
15965
|
}
|
|
15947
15966
|
const pendingCropGroupFrameBakes = [];
|
|
15967
|
+
const activeSelectionFlipRestores = [];
|
|
15948
15968
|
for (const obj of activeObjects) {
|
|
15949
15969
|
const objId = getObjectId(obj);
|
|
15950
15970
|
if (!objId || objId === "__background__") continue;
|
|
@@ -16459,10 +16479,27 @@ const PageCanvas = forwardRef(
|
|
|
16459
16479
|
const isLineObj = obj instanceof fabric.Line;
|
|
16460
16480
|
const isAutoShrinkText = (sourceElement == null ? void 0 : sourceElement.type) === "text" && sourceElement.overflowPolicy === "auto-shrink";
|
|
16461
16481
|
const autoShrinkStoredHeight = isAutoShrinkText ? sourceElement.height : void 0;
|
|
16462
|
-
const
|
|
16463
|
-
const
|
|
16464
|
-
const
|
|
16482
|
+
const objectFlipX = obj.flipX ?? false;
|
|
16483
|
+
const objectFlipY = obj.flipY ?? false;
|
|
16484
|
+
const persistedFlipX = (sourceElement == null ? void 0 : sourceElement.flipX) ?? objectFlipX;
|
|
16485
|
+
const persistedFlipY = (sourceElement == null ? void 0 : sourceElement.flipY) ?? objectFlipY;
|
|
16486
|
+
const isActiveSelectionResizeGesture = activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb" || activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br";
|
|
16487
|
+
const expectedCleanAngle = isActiveSelection && isActiveSelectionResizeGesture ? Number.isFinite(sourceElement == null ? void 0 : sourceElement.angle) ? (sourceElement == null ? void 0 : sourceElement.angle) ?? 0 : Number.isFinite(obj.angle) ? obj.angle ?? 0 : void 0 : void 0;
|
|
16488
|
+
const normalizedFinalAbsoluteMatrix = normalizeMatrixForPersistedFlip(
|
|
16489
|
+
toggleLogicalFlipInMatrix(
|
|
16490
|
+
finalAbsoluteMatrix,
|
|
16491
|
+
objectFlipX !== persistedFlipX,
|
|
16492
|
+
objectFlipY !== persistedFlipY
|
|
16493
|
+
),
|
|
16494
|
+
persistedFlipX,
|
|
16495
|
+
persistedFlipY,
|
|
16496
|
+
expectedCleanAngle
|
|
16497
|
+
);
|
|
16498
|
+
const cleanTransformMatrix = toggleLogicalFlipInMatrix(normalizedFinalAbsoluteMatrix, persistedFlipX, persistedFlipY);
|
|
16465
16499
|
const persistedDecomposed = fabric.util.qrDecompose(cleanTransformMatrix);
|
|
16500
|
+
if (isActiveSelection && (obj instanceof fabric.FabricImage || obj instanceof fabric.Group && obj.__cropGroup)) {
|
|
16501
|
+
activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY });
|
|
16502
|
+
}
|
|
16466
16503
|
const elementUpdate = {
|
|
16467
16504
|
left: storePos.left,
|
|
16468
16505
|
top: storePos.top,
|
|
@@ -16478,7 +16515,7 @@ const PageCanvas = forwardRef(
|
|
|
16478
16515
|
scaleY: finalScaleY,
|
|
16479
16516
|
flipX: persistedFlipX,
|
|
16480
16517
|
flipY: persistedFlipY,
|
|
16481
|
-
transformMatrix:
|
|
16518
|
+
transformMatrix: cleanTransformMatrix
|
|
16482
16519
|
};
|
|
16483
16520
|
if (obj instanceof fabric.Textbox) {
|
|
16484
16521
|
const bakedTextScaleUpdates = obj.__pixldocsBakedTextScaleUpdates;
|
|
@@ -16527,19 +16564,15 @@ const PageCanvas = forwardRef(
|
|
|
16527
16564
|
elementUpdate.scaleY = 1;
|
|
16528
16565
|
elementUpdate.skewX = 0;
|
|
16529
16566
|
elementUpdate.skewY = 0;
|
|
16530
|
-
elementUpdate.transformMatrix =
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
}),
|
|
16540
|
-
elementUpdate.flipX,
|
|
16541
|
-
elementUpdate.flipY
|
|
16542
|
-
);
|
|
16567
|
+
elementUpdate.transformMatrix = fabric.util.composeMatrix({
|
|
16568
|
+
translateX: cx,
|
|
16569
|
+
translateY: cy,
|
|
16570
|
+
angle: cleanAngle,
|
|
16571
|
+
scaleX: 1,
|
|
16572
|
+
scaleY: 1,
|
|
16573
|
+
skewX: 0,
|
|
16574
|
+
skewY: 0
|
|
16575
|
+
});
|
|
16543
16576
|
} catch {
|
|
16544
16577
|
}
|
|
16545
16578
|
}
|
|
@@ -16573,19 +16606,15 @@ const PageCanvas = forwardRef(
|
|
|
16573
16606
|
elementUpdate.scaleY = 1;
|
|
16574
16607
|
elementUpdate.skewX = 0;
|
|
16575
16608
|
elementUpdate.skewY = 0;
|
|
16576
|
-
elementUpdate.transformMatrix =
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
}),
|
|
16586
|
-
elementUpdate.flipX,
|
|
16587
|
-
elementUpdate.flipY
|
|
16588
|
-
);
|
|
16609
|
+
elementUpdate.transformMatrix = fabric.util.composeMatrix({
|
|
16610
|
+
translateX: cx,
|
|
16611
|
+
translateY: cy,
|
|
16612
|
+
angle: cleanAngleI,
|
|
16613
|
+
scaleX: 1,
|
|
16614
|
+
scaleY: 1,
|
|
16615
|
+
skewX: 0,
|
|
16616
|
+
skewY: 0
|
|
16617
|
+
});
|
|
16589
16618
|
} catch {
|
|
16590
16619
|
}
|
|
16591
16620
|
}
|
|
@@ -16694,10 +16723,16 @@ const PageCanvas = forwardRef(
|
|
|
16694
16723
|
skipSelectionClearOnDiscardRef.current = true;
|
|
16695
16724
|
skipActiveSelectionBakeOnClearRef.current = true;
|
|
16696
16725
|
try {
|
|
16726
|
+
for (const restore of activeSelectionFlipRestores) {
|
|
16727
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
|
|
16728
|
+
}
|
|
16697
16729
|
fabricCanvas.discardActiveObject();
|
|
16698
16730
|
} finally {
|
|
16699
16731
|
skipActiveSelectionBakeOnClearRef.current = false;
|
|
16700
16732
|
}
|
|
16733
|
+
for (const restore of activeSelectionFlipRestores) {
|
|
16734
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
|
|
16735
|
+
}
|
|
16701
16736
|
for (const bake of pendingCropGroupFrameBakes) {
|
|
16702
16737
|
const ct = bake.obj.__cropData;
|
|
16703
16738
|
if (!ct) continue;
|
|
@@ -25884,9 +25919,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25884
25919
|
}
|
|
25885
25920
|
return svgString;
|
|
25886
25921
|
}
|
|
25887
|
-
const resolvedPackageVersion = "0.5.
|
|
25922
|
+
const resolvedPackageVersion = "0.5.444";
|
|
25888
25923
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25889
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25924
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.444";
|
|
25890
25925
|
const roundParityValue = (value) => {
|
|
25891
25926
|
if (typeof value !== "number") return value;
|
|
25892
25927
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26700,7 +26735,7 @@ class PixldocsRenderer {
|
|
|
26700
26735
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26701
26736
|
}
|
|
26702
26737
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26703
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26738
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-D4YSdx4j.js");
|
|
26704
26739
|
const prepared = preparePagesForExport(
|
|
26705
26740
|
cloned.pages,
|
|
26706
26741
|
canvasWidth,
|
|
@@ -29020,7 +29055,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29020
29055
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29021
29056
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29022
29057
|
try {
|
|
29023
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29058
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-D4YSdx4j.js");
|
|
29024
29059
|
try {
|
|
29025
29060
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29026
29061
|
} catch {
|
|
@@ -29420,4 +29455,4 @@ export {
|
|
|
29420
29455
|
buildTeaserBlurFlatKeys as y,
|
|
29421
29456
|
collectFontDescriptorsFromConfig as z
|
|
29422
29457
|
};
|
|
29423
|
-
//# sourceMappingURL=index-
|
|
29458
|
+
//# sourceMappingURL=index-BBkKxCQ_.js.map
|