@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
|
@@ -10836,6 +10836,28 @@ try {
|
|
|
10836
10836
|
if (atLeftRight && atTopBottom) return `${y < 0 ? "t" : "b"}${x < 0 ? "l" : "r"}`;
|
|
10837
10837
|
return null;
|
|
10838
10838
|
};
|
|
10839
|
+
const isRotateControl = (control, controlKey) => {
|
|
10840
|
+
const actionName = String((control == null ? void 0 : control.actionName) ?? "");
|
|
10841
|
+
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;
|
|
10842
|
+
};
|
|
10843
|
+
const resolveCanvaControlCursor = (fabricObject, controlKey, control) => {
|
|
10844
|
+
if (!fabricObject) return null;
|
|
10845
|
+
const key = typeof controlKey === "string" ? controlKey : null;
|
|
10846
|
+
const resolvedControl = control ?? (key && (fabricObject == null ? void 0 : fabricObject.controls) ? fabricObject.controls[key] : null);
|
|
10847
|
+
if (isRotateControl(resolvedControl, key)) return getRotateCursor(fabricObject);
|
|
10848
|
+
const resizeKey = key && baseAngleFor[key] !== void 0 ? key : inferControlKey(resolvedControl);
|
|
10849
|
+
return resizeKey && baseAngleFor[resizeKey] !== void 0 ? getRotatedCursor(resizeKey, fabricObject) : null;
|
|
10850
|
+
};
|
|
10851
|
+
const resolveCanvasControlCursor = (canvasLike, target) => {
|
|
10852
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
10853
|
+
const transform = canvasLike == null ? void 0 : canvasLike._currentTransform;
|
|
10854
|
+
const fabricObject = target ?? (transform == null ? void 0 : transform.target) ?? ((_a2 = canvasLike == null ? void 0 : canvasLike.getActiveObject) == null ? void 0 : _a2.call(canvasLike));
|
|
10855
|
+
if (!fabricObject) return null;
|
|
10856
|
+
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;
|
|
10857
|
+
if (!key) return null;
|
|
10858
|
+
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);
|
|
10859
|
+
return resolveCanvaControlCursor(fabricObject, key, control);
|
|
10860
|
+
};
|
|
10839
10861
|
const installPillRenders = (controls) => {
|
|
10840
10862
|
var _a2;
|
|
10841
10863
|
const MOVE_PATHS_2D = [
|
|
@@ -11020,13 +11042,14 @@ try {
|
|
|
11020
11042
|
};
|
|
11021
11043
|
ControlProto.__pixldocsCanvaRenderFallback = true;
|
|
11022
11044
|
}
|
|
11023
|
-
if (ControlProto &&
|
|
11024
|
-
const originalCursorHandler = ControlProto.cursorStyleHandler;
|
|
11045
|
+
if (ControlProto && ControlProto.__pixldocsCanvaCursorFallbackVersion !== 2) {
|
|
11046
|
+
const originalCursorHandler = ControlProto.__pixldocsOriginalCursorStyleHandler ?? ControlProto.cursorStyleHandler;
|
|
11047
|
+
ControlProto.__pixldocsOriginalCursorStyleHandler = originalCursorHandler;
|
|
11025
11048
|
ControlProto.cursorStyleHandler = function(eventData, control, fabricObject) {
|
|
11026
|
-
const
|
|
11027
|
-
const
|
|
11028
|
-
|
|
11029
|
-
|
|
11049
|
+
const activeCorner = typeof (fabricObject == null ? void 0 : fabricObject.__corner) === "string" ? fabricObject.__corner : null;
|
|
11050
|
+
const key = activeCorner ?? inferControlKey(this) ?? inferControlKey(control);
|
|
11051
|
+
const cursor = resolveCanvaControlCursor(fabricObject, key, this ?? control);
|
|
11052
|
+
if (cursor) {
|
|
11030
11053
|
try {
|
|
11031
11054
|
const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
|
|
11032
11055
|
if (canvas) canvas.__pixldocsGetRotateCursor = getRotateCursor;
|
|
@@ -11036,17 +11059,13 @@ try {
|
|
|
11036
11059
|
}
|
|
11037
11060
|
return cursor;
|
|
11038
11061
|
}
|
|
11039
|
-
const activeCorner = typeof (fabricObject == null ? void 0 : fabricObject.__corner) === "string" ? fabricObject.__corner : null;
|
|
11040
|
-
const key = activeCorner && baseAngleFor[activeCorner] !== void 0 ? activeCorner : inferControlKey(this) ?? inferControlKey(control);
|
|
11041
|
-
if (key && baseAngleFor[key] !== void 0) {
|
|
11042
|
-
return getRotatedCursor(key, fabricObject);
|
|
11043
|
-
}
|
|
11044
11062
|
if (typeof originalCursorHandler === "function") {
|
|
11045
11063
|
return originalCursorHandler.call(this, eventData, control, fabricObject);
|
|
11046
11064
|
}
|
|
11047
11065
|
return this.cursorStyle || "default";
|
|
11048
11066
|
};
|
|
11049
11067
|
ControlProto.__pixldocsCanvaCursorFallback = true;
|
|
11068
|
+
ControlProto.__pixldocsCanvaCursorFallbackVersion = 2;
|
|
11050
11069
|
}
|
|
11051
11070
|
ensureCanvaControlRenders = (obj) => {
|
|
11052
11071
|
try {
|
|
@@ -11081,18 +11100,38 @@ try {
|
|
|
11081
11100
|
wrapClassCreateControls(fabric__namespace.ActiveSelection);
|
|
11082
11101
|
wrapClassCreateControls(fabric__namespace.Group);
|
|
11083
11102
|
const CanvasProto = (_c = fabric__namespace.Canvas) == null ? void 0 : _c.prototype;
|
|
11084
|
-
if (CanvasProto && typeof CanvasProto.
|
|
11085
|
-
const
|
|
11103
|
+
if (CanvasProto && CanvasProto.__pixldocsCanvaSetCursorVersion !== 1 && typeof CanvasProto.setCursor === "function") {
|
|
11104
|
+
const origSetCursor = CanvasProto.__pixldocsOriginalSetCursor ?? CanvasProto.setCursor;
|
|
11105
|
+
CanvasProto.__pixldocsOriginalSetCursor = origSetCursor;
|
|
11106
|
+
CanvasProto.setCursor = function(value) {
|
|
11107
|
+
const cursor = resolveCanvasControlCursor(this);
|
|
11108
|
+
return origSetCursor.call(this, cursor || value);
|
|
11109
|
+
};
|
|
11110
|
+
CanvasProto.__pixldocsCanvaSetCursorVersion = 1;
|
|
11111
|
+
}
|
|
11112
|
+
if (CanvasProto && typeof CanvasProto._setCursorFromEvent === "function" && CanvasProto.__pixldocsCanvaCursorEventVersion !== 3) {
|
|
11113
|
+
const origSet = CanvasProto.__pixldocsOriginalSetCursorFromEvent ?? CanvasProto._setCursorFromEvent;
|
|
11114
|
+
CanvasProto.__pixldocsOriginalSetCursorFromEvent = origSet;
|
|
11086
11115
|
CanvasProto._setCursorFromEvent = function(e, target) {
|
|
11116
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
11087
11117
|
const prev = target && target.__corner;
|
|
11088
11118
|
const res = origSet.call(this, e, target);
|
|
11089
11119
|
const next = target && target.__corner;
|
|
11090
11120
|
try {
|
|
11121
|
+
let cursor = null;
|
|
11091
11122
|
const control = next && (target == null ? void 0 : target.controls) ? target.controls[next] : null;
|
|
11092
|
-
|
|
11093
|
-
|
|
11094
|
-
|
|
11095
|
-
|
|
11123
|
+
cursor = resolveCanvaControlCursor(target, typeof next === "string" ? next : null, control);
|
|
11124
|
+
if (!cursor) {
|
|
11125
|
+
const active = (_a2 = this.getActiveObject) == null ? void 0 : _a2.call(this);
|
|
11126
|
+
const isActiveSelection = active instanceof fabric__namespace.ActiveSelection;
|
|
11127
|
+
if (isActiveSelection && active !== target) {
|
|
11128
|
+
const pointer = (_b2 = this.getViewportPoint) == null ? void 0 : _b2.call(this, e);
|
|
11129
|
+
const activeCorner = pointer ? (_c2 = active.findControl) == null ? void 0 : _c2.call(active, pointer) : (_d = active.getActiveControl) == null ? void 0 : _d.call(active);
|
|
11130
|
+
const key = (activeCorner == null ? void 0 : activeCorner.key) ?? ((_f = (_e = active.getActiveControl) == null ? void 0 : _e.call(active)) == null ? void 0 : _f.key);
|
|
11131
|
+
const activeControl = (activeCorner == null ? void 0 : activeCorner.control) ?? (key && active.controls ? active.controls[key] : null);
|
|
11132
|
+
cursor = resolveCanvaControlCursor(active, typeof key === "string" ? key : null, activeControl);
|
|
11133
|
+
}
|
|
11134
|
+
}
|
|
11096
11135
|
if (cursor) {
|
|
11097
11136
|
if (typeof this.setCursor === "function") this.setCursor(cursor);
|
|
11098
11137
|
else if (this.upperCanvasEl) this.upperCanvasEl.style.cursor = cursor;
|
|
@@ -11107,6 +11146,7 @@ try {
|
|
|
11107
11146
|
}
|
|
11108
11147
|
return res;
|
|
11109
11148
|
};
|
|
11149
|
+
CanvasProto.__pixldocsCanvaCursorEventVersion = 3;
|
|
11110
11150
|
}
|
|
11111
11151
|
}
|
|
11112
11152
|
} catch (e) {
|
|
@@ -24781,9 +24821,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24781
24821
|
}
|
|
24782
24822
|
return svgString;
|
|
24783
24823
|
}
|
|
24784
|
-
const resolvedPackageVersion = "0.5.
|
|
24824
|
+
const resolvedPackageVersion = "0.5.380";
|
|
24785
24825
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24786
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24826
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.380";
|
|
24787
24827
|
const roundParityValue = (value) => {
|
|
24788
24828
|
if (typeof value !== "number") return value;
|
|
24789
24829
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25597,7 +25637,7 @@ class PixldocsRenderer {
|
|
|
25597
25637
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25598
25638
|
}
|
|
25599
25639
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25600
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
25640
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-C4lbJ3r7.cjs"));
|
|
25601
25641
|
const prepared = preparePagesForExport(
|
|
25602
25642
|
cloned.pages,
|
|
25603
25643
|
canvasWidth,
|
|
@@ -27917,7 +27957,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27917
27957
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27918
27958
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27919
27959
|
try {
|
|
27920
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27960
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-C4lbJ3r7.cjs"));
|
|
27921
27961
|
try {
|
|
27922
27962
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27923
27963
|
} catch {
|
|
@@ -28314,4 +28354,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
28314
28354
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
28315
28355
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
28316
28356
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
28317
|
-
//# sourceMappingURL=index-
|
|
28357
|
+
//# sourceMappingURL=index-B-wkU613.cjs.map
|