@pixldocs/canvas-renderer 0.5.378 → 0.5.379
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-CKwhm9vr.js → index-DQaiAXYK.js} +49 -22
- package/dist/index-DQaiAXYK.js.map +1 -0
- package/dist/{index-DHsYlRj5.cjs → index-D_l8rDHU.cjs} +49 -22
- package/dist/index-D_l8rDHU.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-BShYUaFY.cjs → vectorPdfExport-C1UzGCn0.cjs} +4 -4
- package/dist/{vectorPdfExport-BShYUaFY.cjs.map → vectorPdfExport-C1UzGCn0.cjs.map} +1 -1
- package/dist/{vectorPdfExport-B7K76NIW.js → vectorPdfExport-CzLwUclq.js} +4 -4
- package/dist/{vectorPdfExport-B7K76NIW.js.map → vectorPdfExport-CzLwUclq.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CKwhm9vr.js.map +0 -1
- package/dist/index-DHsYlRj5.cjs.map +0 -1
|
@@ -10818,6 +10818,28 @@ try {
|
|
|
10818
10818
|
if (atLeftRight && atTopBottom) return `${y < 0 ? "t" : "b"}${x < 0 ? "l" : "r"}`;
|
|
10819
10819
|
return null;
|
|
10820
10820
|
};
|
|
10821
|
+
const isRotateControl = (control, controlKey) => {
|
|
10822
|
+
const actionName = String((control == null ? void 0 : control.actionName) ?? "");
|
|
10823
|
+
return controlKey === "mtr" || actionName === "rotate" || Math.abs(Number((control == null ? void 0 : control.x) ?? 0)) < 1e-3 && Math.abs(Number((control == null ? void 0 : control.y) ?? 0) + 0.5) < 1e-3 && Number((control == null ? void 0 : control.offsetY) ?? 0) < 0;
|
|
10824
|
+
};
|
|
10825
|
+
const resolveCanvaControlCursor = (fabricObject, controlKey, control) => {
|
|
10826
|
+
if (!fabricObject) return null;
|
|
10827
|
+
const key = typeof controlKey === "string" ? controlKey : null;
|
|
10828
|
+
const resolvedControl = control ?? (key && (fabricObject == null ? void 0 : fabricObject.controls) ? fabricObject.controls[key] : null);
|
|
10829
|
+
if (isRotateControl(resolvedControl, key)) return getRotateCursor(fabricObject);
|
|
10830
|
+
const resizeKey = key && baseAngleFor[key] !== void 0 ? key : inferControlKey(resolvedControl);
|
|
10831
|
+
return resizeKey && baseAngleFor[resizeKey] !== void 0 ? getRotatedCursor(resizeKey, fabricObject) : null;
|
|
10832
|
+
};
|
|
10833
|
+
const resolveCanvasControlCursor = (canvasLike, target) => {
|
|
10834
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
10835
|
+
const transform = canvasLike == null ? void 0 : canvasLike._currentTransform;
|
|
10836
|
+
const fabricObject = target ?? (transform == null ? void 0 : transform.target) ?? ((_a2 = canvasLike == null ? void 0 : canvasLike.getActiveObject) == null ? void 0 : _a2.call(canvasLike));
|
|
10837
|
+
if (!fabricObject) return null;
|
|
10838
|
+
const key = typeof (transform == null ? void 0 : transform.corner) === "string" ? transform.corner : typeof fabricObject.__corner === "string" ? fabricObject.__corner : (_c2 = (_b2 = fabricObject.getActiveControl) == null ? void 0 : _b2.call(fabricObject)) == null ? void 0 : _c2.key;
|
|
10839
|
+
if (!key) return null;
|
|
10840
|
+
const control = ((_d = fabricObject.controls) == null ? void 0 : _d[key]) ?? ((_f = (_e = fabricObject.getActiveControl) == null ? void 0 : _e.call(fabricObject)) == null ? void 0 : _f.control);
|
|
10841
|
+
return resolveCanvaControlCursor(fabricObject, key, control);
|
|
10842
|
+
};
|
|
10821
10843
|
const installPillRenders = (controls) => {
|
|
10822
10844
|
var _a2;
|
|
10823
10845
|
const MOVE_PATHS_2D = [
|
|
@@ -11002,13 +11024,14 @@ try {
|
|
|
11002
11024
|
};
|
|
11003
11025
|
ControlProto.__pixldocsCanvaRenderFallback = true;
|
|
11004
11026
|
}
|
|
11005
|
-
if (ControlProto &&
|
|
11006
|
-
const originalCursorHandler = ControlProto.cursorStyleHandler;
|
|
11027
|
+
if (ControlProto && ControlProto.__pixldocsCanvaCursorFallbackVersion !== 2) {
|
|
11028
|
+
const originalCursorHandler = ControlProto.__pixldocsOriginalCursorStyleHandler ?? ControlProto.cursorStyleHandler;
|
|
11029
|
+
ControlProto.__pixldocsOriginalCursorStyleHandler = originalCursorHandler;
|
|
11007
11030
|
ControlProto.cursorStyleHandler = function(eventData, control, fabricObject) {
|
|
11008
|
-
const
|
|
11009
|
-
const
|
|
11010
|
-
|
|
11011
|
-
|
|
11031
|
+
const activeCorner = typeof (fabricObject == null ? void 0 : fabricObject.__corner) === "string" ? fabricObject.__corner : null;
|
|
11032
|
+
const key = activeCorner ?? inferControlKey(this) ?? inferControlKey(control);
|
|
11033
|
+
const cursor = resolveCanvaControlCursor(fabricObject, key, this ?? control);
|
|
11034
|
+
if (cursor) {
|
|
11012
11035
|
try {
|
|
11013
11036
|
const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
|
|
11014
11037
|
if (canvas) canvas.__pixldocsGetRotateCursor = getRotateCursor;
|
|
@@ -11018,17 +11041,13 @@ try {
|
|
|
11018
11041
|
}
|
|
11019
11042
|
return cursor;
|
|
11020
11043
|
}
|
|
11021
|
-
const activeCorner = typeof (fabricObject == null ? void 0 : fabricObject.__corner) === "string" ? fabricObject.__corner : null;
|
|
11022
|
-
const key = activeCorner && baseAngleFor[activeCorner] !== void 0 ? activeCorner : inferControlKey(this) ?? inferControlKey(control);
|
|
11023
|
-
if (key && baseAngleFor[key] !== void 0) {
|
|
11024
|
-
return getRotatedCursor(key, fabricObject);
|
|
11025
|
-
}
|
|
11026
11044
|
if (typeof originalCursorHandler === "function") {
|
|
11027
11045
|
return originalCursorHandler.call(this, eventData, control, fabricObject);
|
|
11028
11046
|
}
|
|
11029
11047
|
return this.cursorStyle || "default";
|
|
11030
11048
|
};
|
|
11031
11049
|
ControlProto.__pixldocsCanvaCursorFallback = true;
|
|
11050
|
+
ControlProto.__pixldocsCanvaCursorFallbackVersion = 2;
|
|
11032
11051
|
}
|
|
11033
11052
|
ensureCanvaControlRenders = (obj) => {
|
|
11034
11053
|
try {
|
|
@@ -11063,18 +11082,25 @@ try {
|
|
|
11063
11082
|
wrapClassCreateControls(fabric.ActiveSelection);
|
|
11064
11083
|
wrapClassCreateControls(fabric.Group);
|
|
11065
11084
|
const CanvasProto = (_c = fabric.Canvas) == null ? void 0 : _c.prototype;
|
|
11066
|
-
if (CanvasProto && typeof CanvasProto.
|
|
11067
|
-
const
|
|
11085
|
+
if (CanvasProto && CanvasProto.__pixldocsCanvaSetCursorVersion !== 1 && typeof CanvasProto.setCursor === "function") {
|
|
11086
|
+
const origSetCursor = CanvasProto.__pixldocsOriginalSetCursor ?? CanvasProto.setCursor;
|
|
11087
|
+
CanvasProto.__pixldocsOriginalSetCursor = origSetCursor;
|
|
11088
|
+
CanvasProto.setCursor = function(value) {
|
|
11089
|
+
const cursor = resolveCanvasControlCursor(this);
|
|
11090
|
+
return origSetCursor.call(this, cursor || value);
|
|
11091
|
+
};
|
|
11092
|
+
CanvasProto.__pixldocsCanvaSetCursorVersion = 1;
|
|
11093
|
+
}
|
|
11094
|
+
if (CanvasProto && typeof CanvasProto._setCursorFromEvent === "function" && CanvasProto.__pixldocsCanvaCursorEventVersion !== 2) {
|
|
11095
|
+
const origSet = CanvasProto.__pixldocsOriginalSetCursorFromEvent ?? CanvasProto._setCursorFromEvent;
|
|
11096
|
+
CanvasProto.__pixldocsOriginalSetCursorFromEvent = origSet;
|
|
11068
11097
|
CanvasProto._setCursorFromEvent = function(e, target) {
|
|
11069
11098
|
const prev = target && target.__corner;
|
|
11070
11099
|
const res = origSet.call(this, e, target);
|
|
11071
11100
|
const next = target && target.__corner;
|
|
11072
11101
|
try {
|
|
11073
11102
|
const control = next && (target == null ? void 0 : target.controls) ? target.controls[next] : null;
|
|
11074
|
-
const
|
|
11075
|
-
const isRotateHandle = next === "mtr" || actionName === "rotate" || control && Math.abs(Number(control.x ?? 0)) < 1e-3 && Math.abs(Number(control.y ?? 0) + 0.5) < 1e-3 && Number(control.offsetY ?? 0) < 0;
|
|
11076
|
-
const key = typeof next === "string" && baseAngleFor[next] !== void 0 ? next : inferControlKey(control);
|
|
11077
|
-
const cursor = isRotateHandle ? getRotateCursor(target) : key ? getRotatedCursor(key, target) : null;
|
|
11103
|
+
const cursor = resolveCanvaControlCursor(target, typeof next === "string" ? next : null, control);
|
|
11078
11104
|
if (cursor) {
|
|
11079
11105
|
if (typeof this.setCursor === "function") this.setCursor(cursor);
|
|
11080
11106
|
else if (this.upperCanvasEl) this.upperCanvasEl.style.cursor = cursor;
|
|
@@ -11089,6 +11115,7 @@ try {
|
|
|
11089
11115
|
}
|
|
11090
11116
|
return res;
|
|
11091
11117
|
};
|
|
11118
|
+
CanvasProto.__pixldocsCanvaCursorEventVersion = 2;
|
|
11092
11119
|
}
|
|
11093
11120
|
}
|
|
11094
11121
|
} catch (e) {
|
|
@@ -24763,9 +24790,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24763
24790
|
}
|
|
24764
24791
|
return svgString;
|
|
24765
24792
|
}
|
|
24766
|
-
const resolvedPackageVersion = "0.5.
|
|
24793
|
+
const resolvedPackageVersion = "0.5.379";
|
|
24767
24794
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24768
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24795
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.379";
|
|
24769
24796
|
const roundParityValue = (value) => {
|
|
24770
24797
|
if (typeof value !== "number") return value;
|
|
24771
24798
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25579,7 +25606,7 @@ class PixldocsRenderer {
|
|
|
25579
25606
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25580
25607
|
}
|
|
25581
25608
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25582
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25609
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CzLwUclq.js");
|
|
25583
25610
|
const prepared = preparePagesForExport(
|
|
25584
25611
|
cloned.pages,
|
|
25585
25612
|
canvasWidth,
|
|
@@ -27899,7 +27926,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27899
27926
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27900
27927
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27901
27928
|
try {
|
|
27902
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27929
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CzLwUclq.js");
|
|
27903
27930
|
try {
|
|
27904
27931
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27905
27932
|
} catch {
|
|
@@ -28299,4 +28326,4 @@ export {
|
|
|
28299
28326
|
buildTeaserBlurFlatKeys as y,
|
|
28300
28327
|
collectFontDescriptorsFromConfig as z
|
|
28301
28328
|
};
|
|
28302
|
-
//# sourceMappingURL=index-
|
|
28329
|
+
//# sourceMappingURL=index-DQaiAXYK.js.map
|