@pixldocs/canvas-renderer 0.5.441 → 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-BPlFxSU1.cjs → index-BxmYD_or.cjs} +75 -35
- package/dist/index-BxmYD_or.cjs.map +1 -0
- package/dist/{index-0kscM6nx.js → index-mfdztOqY.js} +75 -35
- package/dist/index-mfdztOqY.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-BKPFy7-t.cjs → vectorPdfExport-C6WM_grg.cjs} +4 -4
- package/dist/{vectorPdfExport-BKPFy7-t.cjs.map → vectorPdfExport-C6WM_grg.cjs.map} +1 -1
- package/dist/{vectorPdfExport-DDz6_cPc.js → vectorPdfExport-Chx_7ffv.js} +4 -4
- package/dist/{vectorPdfExport-DDz6_cPc.js.map → vectorPdfExport-Chx_7ffv.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-0kscM6nx.js.map +0 -1
- package/dist/index-BPlFxSU1.cjs.map +0 -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) {
|
|
@@ -11857,6 +11869,7 @@ const PageCanvas = forwardRef(
|
|
|
11857
11869
|
const selectAllTextOnEditingEnterRef = useRef(null);
|
|
11858
11870
|
const suppressedTextEditObjectsRef = useRef([]);
|
|
11859
11871
|
const suppressTextDoubleClickUntilRef = useRef(0);
|
|
11872
|
+
const cropGroupActivatedAtRef = useRef(/* @__PURE__ */ new WeakMap());
|
|
11860
11873
|
const syncLockedRef = useRef(false);
|
|
11861
11874
|
const editLockRef = useRef(false);
|
|
11862
11875
|
const editLockCountRef = useRef(0);
|
|
@@ -15944,6 +15957,7 @@ const PageCanvas = forwardRef(
|
|
|
15944
15957
|
}
|
|
15945
15958
|
}
|
|
15946
15959
|
const pendingCropGroupFrameBakes = [];
|
|
15960
|
+
const activeSelectionFlipRestores = [];
|
|
15947
15961
|
for (const obj of activeObjects) {
|
|
15948
15962
|
const objId = getObjectId(obj);
|
|
15949
15963
|
if (!objId || objId === "__background__") continue;
|
|
@@ -16458,10 +16472,27 @@ const PageCanvas = forwardRef(
|
|
|
16458
16472
|
const isLineObj = obj instanceof fabric.Line;
|
|
16459
16473
|
const isAutoShrinkText = (sourceElement == null ? void 0 : sourceElement.type) === "text" && sourceElement.overflowPolicy === "auto-shrink";
|
|
16460
16474
|
const autoShrinkStoredHeight = isAutoShrinkText ? sourceElement.height : void 0;
|
|
16461
|
-
const
|
|
16462
|
-
const
|
|
16463
|
-
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);
|
|
16464
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
|
+
}
|
|
16465
16496
|
const elementUpdate = {
|
|
16466
16497
|
left: storePos.left,
|
|
16467
16498
|
top: storePos.top,
|
|
@@ -16477,7 +16508,7 @@ const PageCanvas = forwardRef(
|
|
|
16477
16508
|
scaleY: finalScaleY,
|
|
16478
16509
|
flipX: persistedFlipX,
|
|
16479
16510
|
flipY: persistedFlipY,
|
|
16480
|
-
transformMatrix:
|
|
16511
|
+
transformMatrix: cleanTransformMatrix
|
|
16481
16512
|
};
|
|
16482
16513
|
if (obj instanceof fabric.Textbox) {
|
|
16483
16514
|
const bakedTextScaleUpdates = obj.__pixldocsBakedTextScaleUpdates;
|
|
@@ -16526,19 +16557,15 @@ const PageCanvas = forwardRef(
|
|
|
16526
16557
|
elementUpdate.scaleY = 1;
|
|
16527
16558
|
elementUpdate.skewX = 0;
|
|
16528
16559
|
elementUpdate.skewY = 0;
|
|
16529
|
-
elementUpdate.transformMatrix =
|
|
16530
|
-
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
}),
|
|
16539
|
-
elementUpdate.flipX,
|
|
16540
|
-
elementUpdate.flipY
|
|
16541
|
-
);
|
|
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
|
+
});
|
|
16542
16569
|
} catch {
|
|
16543
16570
|
}
|
|
16544
16571
|
}
|
|
@@ -16572,19 +16599,15 @@ const PageCanvas = forwardRef(
|
|
|
16572
16599
|
elementUpdate.scaleY = 1;
|
|
16573
16600
|
elementUpdate.skewX = 0;
|
|
16574
16601
|
elementUpdate.skewY = 0;
|
|
16575
|
-
elementUpdate.transformMatrix =
|
|
16576
|
-
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
}),
|
|
16585
|
-
elementUpdate.flipX,
|
|
16586
|
-
elementUpdate.flipY
|
|
16587
|
-
);
|
|
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
|
+
});
|
|
16588
16611
|
} catch {
|
|
16589
16612
|
}
|
|
16590
16613
|
}
|
|
@@ -16693,6 +16716,11 @@ const PageCanvas = forwardRef(
|
|
|
16693
16716
|
skipSelectionClearOnDiscardRef.current = true;
|
|
16694
16717
|
skipActiveSelectionBakeOnClearRef.current = true;
|
|
16695
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
|
+
}
|
|
16696
16724
|
fabricCanvas.discardActiveObject();
|
|
16697
16725
|
} finally {
|
|
16698
16726
|
skipActiveSelectionBakeOnClearRef.current = false;
|
|
@@ -16815,6 +16843,14 @@ const PageCanvas = forwardRef(
|
|
|
16815
16843
|
obj.setCoords();
|
|
16816
16844
|
}
|
|
16817
16845
|
});
|
|
16846
|
+
const recordCropGroupActivation = () => {
|
|
16847
|
+
const active = fabricCanvas.getActiveObject();
|
|
16848
|
+
if (active && active instanceof fabric.Group && active.__cropGroup) {
|
|
16849
|
+
cropGroupActivatedAtRef.current.set(active, Date.now());
|
|
16850
|
+
}
|
|
16851
|
+
};
|
|
16852
|
+
fabricCanvas.on("selection:created", recordCropGroupActivation);
|
|
16853
|
+
fabricCanvas.on("selection:updated", recordCropGroupActivation);
|
|
16818
16854
|
fabricCanvas.on("mouse:dblclick", (e) => {
|
|
16819
16855
|
var _a2, _b2, _c2;
|
|
16820
16856
|
if (!isActiveRef.current || !allowEditing) return;
|
|
@@ -16844,6 +16880,10 @@ const PageCanvas = forwardRef(
|
|
|
16844
16880
|
}
|
|
16845
16881
|
return;
|
|
16846
16882
|
}
|
|
16883
|
+
const activatedAt = cropGroupActivatedAtRef.current.get(target) ?? 0;
|
|
16884
|
+
if (Date.now() - activatedAt < 400) {
|
|
16885
|
+
return;
|
|
16886
|
+
}
|
|
16847
16887
|
}
|
|
16848
16888
|
if (innerImg && !isPlaceholder && !isCropGroupInCropMode(target)) {
|
|
16849
16889
|
enterCropMode(target);
|
|
@@ -25871,9 +25911,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25871
25911
|
}
|
|
25872
25912
|
return svgString;
|
|
25873
25913
|
}
|
|
25874
|
-
const resolvedPackageVersion = "0.5.
|
|
25914
|
+
const resolvedPackageVersion = "0.5.443";
|
|
25875
25915
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25876
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25916
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.443";
|
|
25877
25917
|
const roundParityValue = (value) => {
|
|
25878
25918
|
if (typeof value !== "number") return value;
|
|
25879
25919
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26687,7 +26727,7 @@ class PixldocsRenderer {
|
|
|
26687
26727
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26688
26728
|
}
|
|
26689
26729
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26690
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26730
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Chx_7ffv.js");
|
|
26691
26731
|
const prepared = preparePagesForExport(
|
|
26692
26732
|
cloned.pages,
|
|
26693
26733
|
canvasWidth,
|
|
@@ -29007,7 +29047,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29007
29047
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29008
29048
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29009
29049
|
try {
|
|
29010
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29050
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Chx_7ffv.js");
|
|
29011
29051
|
try {
|
|
29012
29052
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29013
29053
|
} catch {
|
|
@@ -29407,4 +29447,4 @@ export {
|
|
|
29407
29447
|
buildTeaserBlurFlatKeys as y,
|
|
29408
29448
|
collectFontDescriptorsFromConfig as z
|
|
29409
29449
|
};
|
|
29410
|
-
//# sourceMappingURL=index-
|
|
29450
|
+
//# sourceMappingURL=index-mfdztOqY.js.map
|