@pixldocs/canvas-renderer 0.5.442 → 0.5.443
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-SGFlXODe.cjs → index-BxmYD_or.cjs} +62 -35
- package/dist/{index-SGFlXODe.cjs.map → index-BxmYD_or.cjs.map} +1 -1
- package/dist/{index-DFHTSlHV.js → index-mfdztOqY.js} +62 -35
- package/dist/{index-DFHTSlHV.js.map → index-mfdztOqY.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-m9l318xa.cjs → vectorPdfExport-C6WM_grg.cjs} +4 -4
- package/dist/{vectorPdfExport-m9l318xa.cjs.map → vectorPdfExport-C6WM_grg.cjs.map} +1 -1
- package/dist/{vectorPdfExport-Hv54w3Cm.js → vectorPdfExport-Chx_7ffv.js} +4 -4
- package/dist/{vectorPdfExport-Hv54w3Cm.js.map → vectorPdfExport-Chx_7ffv.js.map} +1 -1
- package/package.json +1 -1
|
@@ -11667,6 +11667,18 @@ const toggleLogicalFlipInMatrix = (matrix, flipX, flipY) => {
|
|
|
11667
11667
|
const sy = flipY ? -1 : 1;
|
|
11668
11668
|
return [matrix[0] * sx, matrix[1] * sx, matrix[2] * sy, matrix[3] * sy, matrix[4], matrix[5]];
|
|
11669
11669
|
};
|
|
11670
|
+
const angleDistanceDeg = (a, b) => {
|
|
11671
|
+
const delta = Math.abs(((a - b) % 360 + 540) % 360 - 180);
|
|
11672
|
+
return Number.isFinite(delta) ? delta : Number.POSITIVE_INFINITY;
|
|
11673
|
+
};
|
|
11674
|
+
const normalizeMatrixForPersistedFlip = (matrix, persistedFlipX, persistedFlipY, expectedCleanAngle) => {
|
|
11675
|
+
if (!persistedFlipX && !persistedFlipY) return matrix;
|
|
11676
|
+
if (!Number.isFinite(expectedCleanAngle)) return matrix;
|
|
11677
|
+
const toggledVisual = toggleLogicalFlipInMatrix(matrix, persistedFlipX, persistedFlipY);
|
|
11678
|
+
const cleanIfMatrixAlreadyHasFlip = fabric.util.qrDecompose(toggleLogicalFlipInMatrix(matrix, persistedFlipX, persistedFlipY)).angle ?? 0;
|
|
11679
|
+
const cleanIfMatrixLostFlip = fabric.util.qrDecompose(matrix).angle ?? 0;
|
|
11680
|
+
return angleDistanceDeg(cleanIfMatrixLostFlip, expectedCleanAngle) + 0.1 < angleDistanceDeg(cleanIfMatrixAlreadyHasFlip, expectedCleanAngle) ? toggledVisual : matrix;
|
|
11681
|
+
};
|
|
11670
11682
|
function applyWarpAwareSelectionBorders(selection) {
|
|
11671
11683
|
var _a2;
|
|
11672
11684
|
if (selection.__pixldocsOrigASHasBorders !== void 0) {
|
|
@@ -15945,6 +15957,7 @@ const PageCanvas = forwardRef(
|
|
|
15945
15957
|
}
|
|
15946
15958
|
}
|
|
15947
15959
|
const pendingCropGroupFrameBakes = [];
|
|
15960
|
+
const activeSelectionFlipRestores = [];
|
|
15948
15961
|
for (const obj of activeObjects) {
|
|
15949
15962
|
const objId = getObjectId(obj);
|
|
15950
15963
|
if (!objId || objId === "__background__") continue;
|
|
@@ -16459,10 +16472,27 @@ const PageCanvas = forwardRef(
|
|
|
16459
16472
|
const isLineObj = obj instanceof fabric.Line;
|
|
16460
16473
|
const isAutoShrinkText = (sourceElement == null ? void 0 : sourceElement.type) === "text" && sourceElement.overflowPolicy === "auto-shrink";
|
|
16461
16474
|
const autoShrinkStoredHeight = isAutoShrinkText ? sourceElement.height : void 0;
|
|
16462
|
-
const
|
|
16463
|
-
const
|
|
16464
|
-
const
|
|
16475
|
+
const objectFlipX = obj.flipX ?? false;
|
|
16476
|
+
const objectFlipY = obj.flipY ?? false;
|
|
16477
|
+
const persistedFlipX = (sourceElement == null ? void 0 : sourceElement.flipX) ?? objectFlipX;
|
|
16478
|
+
const persistedFlipY = (sourceElement == null ? void 0 : sourceElement.flipY) ?? objectFlipY;
|
|
16479
|
+
const isActiveSelectionResizeGesture = activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb" || activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br";
|
|
16480
|
+
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;
|
|
16481
|
+
const normalizedFinalAbsoluteMatrix = normalizeMatrixForPersistedFlip(
|
|
16482
|
+
toggleLogicalFlipInMatrix(
|
|
16483
|
+
finalAbsoluteMatrix,
|
|
16484
|
+
objectFlipX !== persistedFlipX,
|
|
16485
|
+
objectFlipY !== persistedFlipY
|
|
16486
|
+
),
|
|
16487
|
+
persistedFlipX,
|
|
16488
|
+
persistedFlipY,
|
|
16489
|
+
expectedCleanAngle
|
|
16490
|
+
);
|
|
16491
|
+
const cleanTransformMatrix = toggleLogicalFlipInMatrix(normalizedFinalAbsoluteMatrix, persistedFlipX, persistedFlipY);
|
|
16465
16492
|
const persistedDecomposed = fabric.util.qrDecompose(cleanTransformMatrix);
|
|
16493
|
+
if (isActiveSelection && (obj instanceof fabric.FabricImage || obj instanceof fabric.Group && obj.__cropGroup)) {
|
|
16494
|
+
activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY });
|
|
16495
|
+
}
|
|
16466
16496
|
const elementUpdate = {
|
|
16467
16497
|
left: storePos.left,
|
|
16468
16498
|
top: storePos.top,
|
|
@@ -16478,7 +16508,7 @@ const PageCanvas = forwardRef(
|
|
|
16478
16508
|
scaleY: finalScaleY,
|
|
16479
16509
|
flipX: persistedFlipX,
|
|
16480
16510
|
flipY: persistedFlipY,
|
|
16481
|
-
transformMatrix:
|
|
16511
|
+
transformMatrix: cleanTransformMatrix
|
|
16482
16512
|
};
|
|
16483
16513
|
if (obj instanceof fabric.Textbox) {
|
|
16484
16514
|
const bakedTextScaleUpdates = obj.__pixldocsBakedTextScaleUpdates;
|
|
@@ -16527,19 +16557,15 @@ const PageCanvas = forwardRef(
|
|
|
16527
16557
|
elementUpdate.scaleY = 1;
|
|
16528
16558
|
elementUpdate.skewX = 0;
|
|
16529
16559
|
elementUpdate.skewY = 0;
|
|
16530
|
-
elementUpdate.transformMatrix =
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
}),
|
|
16540
|
-
elementUpdate.flipX,
|
|
16541
|
-
elementUpdate.flipY
|
|
16542
|
-
);
|
|
16560
|
+
elementUpdate.transformMatrix = fabric.util.composeMatrix({
|
|
16561
|
+
translateX: cx,
|
|
16562
|
+
translateY: cy,
|
|
16563
|
+
angle: cleanAngle,
|
|
16564
|
+
scaleX: 1,
|
|
16565
|
+
scaleY: 1,
|
|
16566
|
+
skewX: 0,
|
|
16567
|
+
skewY: 0
|
|
16568
|
+
});
|
|
16543
16569
|
} catch {
|
|
16544
16570
|
}
|
|
16545
16571
|
}
|
|
@@ -16573,19 +16599,15 @@ const PageCanvas = forwardRef(
|
|
|
16573
16599
|
elementUpdate.scaleY = 1;
|
|
16574
16600
|
elementUpdate.skewX = 0;
|
|
16575
16601
|
elementUpdate.skewY = 0;
|
|
16576
|
-
elementUpdate.transformMatrix =
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
}),
|
|
16586
|
-
elementUpdate.flipX,
|
|
16587
|
-
elementUpdate.flipY
|
|
16588
|
-
);
|
|
16602
|
+
elementUpdate.transformMatrix = fabric.util.composeMatrix({
|
|
16603
|
+
translateX: cx,
|
|
16604
|
+
translateY: cy,
|
|
16605
|
+
angle: cleanAngleI,
|
|
16606
|
+
scaleX: 1,
|
|
16607
|
+
scaleY: 1,
|
|
16608
|
+
skewX: 0,
|
|
16609
|
+
skewY: 0
|
|
16610
|
+
});
|
|
16589
16611
|
} catch {
|
|
16590
16612
|
}
|
|
16591
16613
|
}
|
|
@@ -16694,6 +16716,11 @@ const PageCanvas = forwardRef(
|
|
|
16694
16716
|
skipSelectionClearOnDiscardRef.current = true;
|
|
16695
16717
|
skipActiveSelectionBakeOnClearRef.current = true;
|
|
16696
16718
|
try {
|
|
16719
|
+
for (const restore of activeSelectionFlipRestores) {
|
|
16720
|
+
restore.obj.set({ flipX: restore.flipX, flipY: restore.flipY });
|
|
16721
|
+
restore.obj.setCoords();
|
|
16722
|
+
restore.obj.dirty = true;
|
|
16723
|
+
}
|
|
16697
16724
|
fabricCanvas.discardActiveObject();
|
|
16698
16725
|
} finally {
|
|
16699
16726
|
skipActiveSelectionBakeOnClearRef.current = false;
|
|
@@ -25884,9 +25911,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25884
25911
|
}
|
|
25885
25912
|
return svgString;
|
|
25886
25913
|
}
|
|
25887
|
-
const resolvedPackageVersion = "0.5.
|
|
25914
|
+
const resolvedPackageVersion = "0.5.443";
|
|
25888
25915
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25889
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25916
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.443";
|
|
25890
25917
|
const roundParityValue = (value) => {
|
|
25891
25918
|
if (typeof value !== "number") return value;
|
|
25892
25919
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26700,7 +26727,7 @@ class PixldocsRenderer {
|
|
|
26700
26727
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26701
26728
|
}
|
|
26702
26729
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26703
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26730
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Chx_7ffv.js");
|
|
26704
26731
|
const prepared = preparePagesForExport(
|
|
26705
26732
|
cloned.pages,
|
|
26706
26733
|
canvasWidth,
|
|
@@ -29020,7 +29047,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29020
29047
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29021
29048
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29022
29049
|
try {
|
|
29023
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29050
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Chx_7ffv.js");
|
|
29024
29051
|
try {
|
|
29025
29052
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29026
29053
|
} catch {
|
|
@@ -29420,4 +29447,4 @@ export {
|
|
|
29420
29447
|
buildTeaserBlurFlatKeys as y,
|
|
29421
29448
|
collectFontDescriptorsFromConfig as z
|
|
29422
29449
|
};
|
|
29423
|
-
//# sourceMappingURL=index-
|
|
29450
|
+
//# sourceMappingURL=index-mfdztOqY.js.map
|