@pixldocs/canvas-renderer 0.5.378 → 0.5.380
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-8XP6VUfk.js} +62 -22
- package/dist/index-8XP6VUfk.js.map +1 -0
- package/dist/{index-DHsYlRj5.cjs → index-B-wkU613.cjs} +62 -22
- package/dist/index-B-wkU613.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-BShYUaFY.cjs → vectorPdfExport-C4lbJ3r7.cjs} +4 -4
- package/dist/{vectorPdfExport-BShYUaFY.cjs.map → vectorPdfExport-C4lbJ3r7.cjs.map} +1 -1
- package/dist/{vectorPdfExport-B7K76NIW.js → vectorPdfExport-DR72C-Lv.js} +4 -4
- package/dist/{vectorPdfExport-B7K76NIW.js.map → vectorPdfExport-DR72C-Lv.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,38 @@ 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 !== 3) {
|
|
11095
|
+
const origSet = CanvasProto.__pixldocsOriginalSetCursorFromEvent ?? CanvasProto._setCursorFromEvent;
|
|
11096
|
+
CanvasProto.__pixldocsOriginalSetCursorFromEvent = origSet;
|
|
11068
11097
|
CanvasProto._setCursorFromEvent = function(e, target) {
|
|
11098
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
11069
11099
|
const prev = target && target.__corner;
|
|
11070
11100
|
const res = origSet.call(this, e, target);
|
|
11071
11101
|
const next = target && target.__corner;
|
|
11072
11102
|
try {
|
|
11103
|
+
let cursor = null;
|
|
11073
11104
|
const control = next && (target == null ? void 0 : target.controls) ? target.controls[next] : null;
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11105
|
+
cursor = resolveCanvaControlCursor(target, typeof next === "string" ? next : null, control);
|
|
11106
|
+
if (!cursor) {
|
|
11107
|
+
const active = (_a2 = this.getActiveObject) == null ? void 0 : _a2.call(this);
|
|
11108
|
+
const isActiveSelection = active instanceof fabric.ActiveSelection;
|
|
11109
|
+
if (isActiveSelection && active !== target) {
|
|
11110
|
+
const pointer = (_b2 = this.getViewportPoint) == null ? void 0 : _b2.call(this, e);
|
|
11111
|
+
const activeCorner = pointer ? (_c2 = active.findControl) == null ? void 0 : _c2.call(active, pointer) : (_d = active.getActiveControl) == null ? void 0 : _d.call(active);
|
|
11112
|
+
const key = (activeCorner == null ? void 0 : activeCorner.key) ?? ((_f = (_e = active.getActiveControl) == null ? void 0 : _e.call(active)) == null ? void 0 : _f.key);
|
|
11113
|
+
const activeControl = (activeCorner == null ? void 0 : activeCorner.control) ?? (key && active.controls ? active.controls[key] : null);
|
|
11114
|
+
cursor = resolveCanvaControlCursor(active, typeof key === "string" ? key : null, activeControl);
|
|
11115
|
+
}
|
|
11116
|
+
}
|
|
11078
11117
|
if (cursor) {
|
|
11079
11118
|
if (typeof this.setCursor === "function") this.setCursor(cursor);
|
|
11080
11119
|
else if (this.upperCanvasEl) this.upperCanvasEl.style.cursor = cursor;
|
|
@@ -11089,6 +11128,7 @@ try {
|
|
|
11089
11128
|
}
|
|
11090
11129
|
return res;
|
|
11091
11130
|
};
|
|
11131
|
+
CanvasProto.__pixldocsCanvaCursorEventVersion = 3;
|
|
11092
11132
|
}
|
|
11093
11133
|
}
|
|
11094
11134
|
} catch (e) {
|
|
@@ -24763,9 +24803,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24763
24803
|
}
|
|
24764
24804
|
return svgString;
|
|
24765
24805
|
}
|
|
24766
|
-
const resolvedPackageVersion = "0.5.
|
|
24806
|
+
const resolvedPackageVersion = "0.5.380";
|
|
24767
24807
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24768
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24808
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.380";
|
|
24769
24809
|
const roundParityValue = (value) => {
|
|
24770
24810
|
if (typeof value !== "number") return value;
|
|
24771
24811
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25579,7 +25619,7 @@ class PixldocsRenderer {
|
|
|
25579
25619
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25580
25620
|
}
|
|
25581
25621
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25582
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25622
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DR72C-Lv.js");
|
|
25583
25623
|
const prepared = preparePagesForExport(
|
|
25584
25624
|
cloned.pages,
|
|
25585
25625
|
canvasWidth,
|
|
@@ -27899,7 +27939,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27899
27939
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27900
27940
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27901
27941
|
try {
|
|
27902
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27942
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DR72C-Lv.js");
|
|
27903
27943
|
try {
|
|
27904
27944
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27905
27945
|
} catch {
|
|
@@ -28299,4 +28339,4 @@ export {
|
|
|
28299
28339
|
buildTeaserBlurFlatKeys as y,
|
|
28300
28340
|
collectFontDescriptorsFromConfig as z
|
|
28301
28341
|
};
|
|
28302
|
-
//# sourceMappingURL=index-
|
|
28342
|
+
//# sourceMappingURL=index-8XP6VUfk.js.map
|