@anu3ev/fabric-image-editor 0.9.6 → 0.9.8
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/main.js +454 -410
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2346,7 +2346,7 @@ var tt = class e extends l {
|
|
|
2346
2346
|
let { action: t, corner: n } = e;
|
|
2347
2347
|
return typeof t == "string" && (t.includes("scale") || t.includes("resiz")) ? !0 : n === "tl" || n === "tr" || n === "br" || n === "bl" || n === "ml" || n === "mr" || n === "mt" || n === "mb";
|
|
2348
2348
|
}
|
|
2349
|
-
}, ft = 36, pt = 14, mt =
|
|
2349
|
+
}, ft = 36, pt = 14, mt = 4, ht = 5, gt = 40, _t = class e {
|
|
2350
2350
|
constructor({ editor: t }) {
|
|
2351
2351
|
this.state = e._createEmptyState(), this.dragState = null, this._handleCameraStateChanged = () => {
|
|
2352
2352
|
this.update();
|
|
@@ -5962,7 +5962,7 @@ var ci = ({ transform: e, key: t }) => {
|
|
|
5962
5962
|
if (!n || typeof n != "object") return null;
|
|
5963
5963
|
let r = n[t];
|
|
5964
5964
|
return typeof r != "number" || !Number.isFinite(r) ? null : r;
|
|
5965
|
-
}, li = ({ value: e }) => e === "left" || e === "center" || e === "right" || typeof e == "number" && Number.isFinite(e) ? e : null, ui = ({ value: e }) => e === "top" || e === "center" || e === "bottom" || typeof e == "number" && Number.isFinite(e) ? e : null,
|
|
5965
|
+
}, li = ({ value: e }) => e === "left" || e === "center" || e === "right" || typeof e == "number" && Number.isFinite(e) ? e : null, ui = ({ value: e }) => e === "top" || e === "center" || e === "bottom" || typeof e == "number" && Number.isFinite(e) ? e : null, di = ({ transform: e }) => {
|
|
5966
5966
|
let t = e?.action ?? "", n = typeof e?.corner == "string" ? e.corner : "", r = n === "tl" || n === "tr" || n === "bl" || n === "br", i = t === "scaleX" || n === "ml" || n === "mr", a = t === "scaleY" || n === "mt" || n === "mb", o = i || r, s = a || r;
|
|
5967
5967
|
return {
|
|
5968
5968
|
canScaleWidth: o,
|
|
@@ -5970,37 +5970,37 @@ var ci = ({ transform: e, key: t }) => {
|
|
|
5970
5970
|
isCornerScaleAction: r,
|
|
5971
5971
|
isVerticalOnlyScale: s && !o
|
|
5972
5972
|
};
|
|
5973
|
-
},
|
|
5973
|
+
}, fi = ({ event: e, target: t, transform: n, canvas: r }) => {
|
|
5974
5974
|
if (!e) return null;
|
|
5975
5975
|
let i = t.canvas ?? r, a = i.getScenePoint(e), o = t.getRelativeCenterPoint(), s = t.translateToGivenOrigin(o, "center", "center", n.originX, n.originY), c = t.angle ?? 0, l = (c === 0 ? a : a.rotate(-c * Math.PI / 180, o)).subtract(s), u = t.controls[n.corner], d = i.getZoom() || 1, f = (t.padding ?? 0) / d;
|
|
5976
5976
|
return l.x >= f && (l.x -= f), l.x <= -f && (l.x += f), l.y >= f && (l.y -= f), l.y <= -f && (l.y += f), l.x -= u?.offsetX ?? 0, l.y -= u?.offsetY ?? 0, l;
|
|
5977
|
-
},
|
|
5977
|
+
}, pi = ({ group: e, originX: t, originY: n }) => {
|
|
5978
5978
|
if (t === null || n === null) return null;
|
|
5979
5979
|
let r = e, i = typeof r.getRelativeCenterPoint == "function" ? r.getRelativeCenterPoint() : e.getCenterPoint();
|
|
5980
5980
|
return typeof r.translateToOriginPoint == "function" ? r.translateToOriginPoint(i, t, n) : i;
|
|
5981
|
-
},
|
|
5981
|
+
}, mi = ({ state: e, transform: t }) => {
|
|
5982
5982
|
if (!t || e.startTransformOriginX === null && e.startTransformOriginY === null) return !1;
|
|
5983
5983
|
let n = li({ value: t.originX }), r = ui({ value: t.originY });
|
|
5984
5984
|
return n !== e.startTransformOriginX || r !== e.startTransformOriginY;
|
|
5985
|
-
},
|
|
5985
|
+
}, hi = ({ state: e, transform: t }) => !t || !e.startTransformCorner ? !1 : t.corner !== e.startTransformCorner;
|
|
5986
5986
|
//#endregion
|
|
5987
5987
|
//#region src/editor/shape-manager/scaling/shape-scaling-preview.ts
|
|
5988
|
-
function
|
|
5988
|
+
function gi({ size: e, scale: t, strokeWidth: n, minSize: r, scaleEpsilon: i }) {
|
|
5989
5989
|
let a = Math.max(i, Math.abs(t) || 1), o = Math.max(0, n);
|
|
5990
5990
|
return o <= 0 ? Math.max(r, e / a) : Math.max(r, e / a + o - o / a);
|
|
5991
5991
|
}
|
|
5992
|
-
function
|
|
5992
|
+
function _i({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, minSize: o, scaleEpsilon: s }) {
|
|
5993
5993
|
let c = Math.max(0, e.shapeStrokeWidth ?? 0);
|
|
5994
5994
|
Gn({
|
|
5995
5995
|
shape: t,
|
|
5996
|
-
width:
|
|
5996
|
+
width: gi({
|
|
5997
5997
|
size: n,
|
|
5998
5998
|
scale: i,
|
|
5999
5999
|
strokeWidth: c,
|
|
6000
6000
|
minSize: o,
|
|
6001
6001
|
scaleEpsilon: s
|
|
6002
6002
|
}),
|
|
6003
|
-
height:
|
|
6003
|
+
height: gi({
|
|
6004
6004
|
size: r,
|
|
6005
6005
|
scale: a,
|
|
6006
6006
|
strokeWidth: c,
|
|
@@ -6011,7 +6011,7 @@ function gi({ group: e, shape: t, width: n, height: r, scaleX: i, scaleY: a, min
|
|
|
6011
6011
|
strokeWidth: c
|
|
6012
6012
|
});
|
|
6013
6013
|
}
|
|
6014
|
-
function
|
|
6014
|
+
function vi({ text: e, layout: t, alignH: n, scaleX: r, scaleY: i, scaleEpsilon: a }) {
|
|
6015
6015
|
let o = Math.max(a, Math.abs(r) || 1), s = Math.max(a, Math.abs(i) || 1), c = n ?? "center";
|
|
6016
6016
|
e.set({
|
|
6017
6017
|
autoExpand: !1,
|
|
@@ -6026,13 +6026,13 @@ function _i({ text: e, layout: t, alignH: n, scaleX: r, scaleY: i, scaleEpsilon:
|
|
|
6026
6026
|
scaleY: 1 / s
|
|
6027
6027
|
}), e.initDimensions(), e.setCoords();
|
|
6028
6028
|
}
|
|
6029
|
-
var
|
|
6029
|
+
var yi = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY: o, minSize: s, scaleEpsilon: c }) => {
|
|
6030
6030
|
let l = Math.max(c, Math.abs(a) || 1), u = Math.max(c, Math.abs(o) || 1);
|
|
6031
6031
|
e.set({
|
|
6032
6032
|
width: r.width / l,
|
|
6033
6033
|
height: r.height / u,
|
|
6034
6034
|
dirty: !0
|
|
6035
|
-
}),
|
|
6035
|
+
}), _i({
|
|
6036
6036
|
group: e,
|
|
6037
6037
|
shape: t,
|
|
6038
6038
|
width: r.width,
|
|
@@ -6041,7 +6041,7 @@ var vi = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6041
6041
|
scaleY: o,
|
|
6042
6042
|
minSize: s,
|
|
6043
6043
|
scaleEpsilon: c
|
|
6044
|
-
}),
|
|
6044
|
+
}), vi({
|
|
6045
6045
|
text: n,
|
|
6046
6046
|
layout: r,
|
|
6047
6047
|
alignH: i,
|
|
@@ -6049,23 +6049,23 @@ var vi = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
6049
6049
|
scaleY: o,
|
|
6050
6050
|
scaleEpsilon: c
|
|
6051
6051
|
});
|
|
6052
|
-
},
|
|
6053
|
-
function
|
|
6052
|
+
}, J = 1e-4, bi = .5;
|
|
6053
|
+
function xi({ isProportionalScaling: e, startTextSplitByGrapheme: t }) {
|
|
6054
6054
|
if (e && !t) return "words-only";
|
|
6055
6055
|
}
|
|
6056
|
-
function
|
|
6056
|
+
function Si({ width: e, height: t }) {
|
|
6057
6057
|
return `${Math.round(Math.max(1, e) * 1e6) / 1e6}:${Math.round(Math.max(1, t) * 1e6) / 1e6}`;
|
|
6058
6058
|
}
|
|
6059
|
-
function
|
|
6059
|
+
function Ci({ width: e, padding: t }) {
|
|
6060
6060
|
return Math.max(1, e - Math.max(0, t.left) - Math.max(0, t.right));
|
|
6061
6061
|
}
|
|
6062
|
-
function
|
|
6062
|
+
function wi({ height: e, padding: t }) {
|
|
6063
6063
|
return Math.max(1, e - Math.max(0, t.top) - Math.max(0, t.bottom));
|
|
6064
6064
|
}
|
|
6065
|
-
function
|
|
6065
|
+
function Ti({ text: e }) {
|
|
6066
6066
|
return (e.text ?? "").trim().length > 0;
|
|
6067
6067
|
}
|
|
6068
|
-
function
|
|
6068
|
+
function Ei({ height: e }) {
|
|
6069
6069
|
return {
|
|
6070
6070
|
measuredHeight: e,
|
|
6071
6071
|
renderedLineCount: 0,
|
|
@@ -6074,7 +6074,7 @@ function Ti({ height: e }) {
|
|
|
6074
6074
|
isValid: !0
|
|
6075
6075
|
};
|
|
6076
6076
|
}
|
|
6077
|
-
function
|
|
6077
|
+
function Di({ group: e }) {
|
|
6078
6078
|
return Be({ padding: {
|
|
6079
6079
|
top: e.shapePaddingTop,
|
|
6080
6080
|
right: e.shapePaddingRight,
|
|
@@ -6082,7 +6082,7 @@ function Ei({ group: e }) {
|
|
|
6082
6082
|
left: e.shapePaddingLeft
|
|
6083
6083
|
} });
|
|
6084
6084
|
}
|
|
6085
|
-
function
|
|
6085
|
+
function Oi({ group: e, width: t, height: n }) {
|
|
6086
6086
|
let r = e.shapePresetKey ?? "", i = r ? je({ presetKey: r }) : null;
|
|
6087
6087
|
return We({
|
|
6088
6088
|
baseInset: i ? Pe({
|
|
@@ -6094,31 +6094,31 @@ function Di({ group: e, width: t, height: n }) {
|
|
|
6094
6094
|
strokeWidth: e.shapeStrokeWidth
|
|
6095
6095
|
});
|
|
6096
6096
|
}
|
|
6097
|
-
function
|
|
6098
|
-
return
|
|
6097
|
+
function Y({ group: e, width: t, height: n }) {
|
|
6098
|
+
return Oi({
|
|
6099
6099
|
group: e,
|
|
6100
6100
|
width: Math.max(1, t ?? e.shapeBaseWidth ?? e.width ?? e.shapeManualBaseWidth ?? 1),
|
|
6101
6101
|
height: Math.max(1, n ?? e.shapeBaseHeight ?? e.height ?? e.shapeManualBaseHeight ?? 1)
|
|
6102
6102
|
});
|
|
6103
6103
|
}
|
|
6104
|
-
function
|
|
6105
|
-
let o = Math.max(1, n), s = Math.max(1, r), c =
|
|
6104
|
+
function ki({ group: e, text: t, width: n, height: r, measurementCache: i, constraintCache: a }) {
|
|
6105
|
+
let o = Math.max(1, n), s = Math.max(1, r), c = Si({
|
|
6106
6106
|
width: o,
|
|
6107
6107
|
height: s
|
|
6108
6108
|
}), l = a?.get(c);
|
|
6109
6109
|
if (l) return l;
|
|
6110
|
-
if (!
|
|
6111
|
-
let e =
|
|
6110
|
+
if (!Ti({ text: t })) {
|
|
6111
|
+
let e = Ei({ height: s });
|
|
6112
6112
|
return a?.set(c, e), e;
|
|
6113
6113
|
}
|
|
6114
|
-
let u =
|
|
6114
|
+
let u = Y({
|
|
6115
6115
|
group: e,
|
|
6116
6116
|
width: o,
|
|
6117
6117
|
height: s
|
|
6118
|
-
}), d =
|
|
6118
|
+
}), d = Ci({
|
|
6119
6119
|
width: o,
|
|
6120
6120
|
padding: u
|
|
6121
|
-
}), f =
|
|
6121
|
+
}), f = wi({
|
|
6122
6122
|
height: s,
|
|
6123
6123
|
padding: u
|
|
6124
6124
|
}), p = Cr({
|
|
@@ -6132,9 +6132,9 @@ function Oi({ group: e, text: t, width: n, height: r, measurementCache: i, const
|
|
|
6132
6132
|
};
|
|
6133
6133
|
return a?.set(c, m), m;
|
|
6134
6134
|
}
|
|
6135
|
-
function
|
|
6135
|
+
function Ai({ group: e, text: t, state: n }) {
|
|
6136
6136
|
let { startHeight: r, startWidth: i, startScaleX: a, startScaleY: o, lastAllowedScaleX: s, lastAllowedScaleY: c } = n, l = Math.max(1 / i, 1 / r), u = Math.max(l, a, o, s, c), d = ({ scale: a }) => {
|
|
6137
|
-
let o =
|
|
6137
|
+
let o = ki({
|
|
6138
6138
|
group: e,
|
|
6139
6139
|
text: t,
|
|
6140
6140
|
width: Math.max(1, i * a),
|
|
@@ -6165,7 +6165,7 @@ function ki({ group: e, text: t, state: n }) {
|
|
|
6165
6165
|
minimumHeight: g
|
|
6166
6166
|
};
|
|
6167
6167
|
}
|
|
6168
|
-
function
|
|
6168
|
+
function ji({ group: e, text: t, width: n, padding: r, wrapPolicy: i, measurementCache: a }) {
|
|
6169
6169
|
return $r({
|
|
6170
6170
|
text: t,
|
|
6171
6171
|
width: n,
|
|
@@ -6173,14 +6173,14 @@ function Ai({ group: e, text: t, width: n, padding: r, wrapPolicy: i, measuremen
|
|
|
6173
6173
|
padding: r,
|
|
6174
6174
|
wrapPolicy: i,
|
|
6175
6175
|
measurementCache: a ?? void 0,
|
|
6176
|
-
resolvePaddingForSize: ({ width: t, height: n }) =>
|
|
6176
|
+
resolvePaddingForSize: ({ width: t, height: n }) => Y({
|
|
6177
6177
|
group: e,
|
|
6178
6178
|
width: t,
|
|
6179
6179
|
height: n
|
|
6180
6180
|
})
|
|
6181
6181
|
});
|
|
6182
6182
|
}
|
|
6183
|
-
function
|
|
6183
|
+
function Mi({ group: e, text: t, constraintPadding: n, startDimensions: r, appliedScaleX: i, appliedScaleY: a, minimumHeight: o, wrapPolicy: s, measurementCache: c }) {
|
|
6184
6184
|
let l = r.canScaleWidth ? Math.max(1, r.startWidth * i) : r.startWidth, u = r.canScaleHeight ? Math.max(1, r.startHeight * a) : r.startManualBaseHeight, d = o ?? $r({
|
|
6185
6185
|
text: t,
|
|
6186
6186
|
width: l,
|
|
@@ -6188,7 +6188,7 @@ function ji({ group: e, text: t, constraintPadding: n, startDimensions: r, appli
|
|
|
6188
6188
|
padding: n,
|
|
6189
6189
|
wrapPolicy: s,
|
|
6190
6190
|
measurementCache: c ?? void 0,
|
|
6191
|
-
resolvePaddingForSize: ({ width: t, height: n }) =>
|
|
6191
|
+
resolvePaddingForSize: ({ width: t, height: n }) => Y({
|
|
6192
6192
|
group: e,
|
|
6193
6193
|
width: t,
|
|
6194
6194
|
height: n
|
|
@@ -6199,8 +6199,8 @@ function ji({ group: e, text: t, constraintPadding: n, startDimensions: r, appli
|
|
|
6199
6199
|
previewHeight: Math.max(u, d)
|
|
6200
6200
|
};
|
|
6201
6201
|
}
|
|
6202
|
-
function
|
|
6203
|
-
let o = n.canScaleWidth ? Math.max(1, n.startWidth * r) : n.startWidth, s = n.canScaleHeight ? Math.max(1, n.startHeight * i) : n.startManualBaseHeight, c = a == null ? s : Math.max(s, a), l = !n.canScaleHeight, u =
|
|
6202
|
+
function Ni({ group: e, text: t, state: n, appliedScaleX: r, appliedScaleY: i, minimumHeight: a }) {
|
|
6203
|
+
let o = n.canScaleWidth ? Math.max(1, n.startWidth * r) : n.startWidth, s = n.canScaleHeight ? Math.max(1, n.startHeight * i) : n.startManualBaseHeight, c = a == null ? s : Math.max(s, a), l = !n.canScaleHeight, u = xi({
|
|
6204
6204
|
isProportionalScaling: n.isProportionalScaling,
|
|
6205
6205
|
startTextSplitByGrapheme: n.startTextSplitByGrapheme
|
|
6206
6206
|
});
|
|
@@ -6209,19 +6209,19 @@ function Mi({ group: e, text: t, state: n, appliedScaleX: r, appliedScaleY: i, m
|
|
|
6209
6209
|
width: o,
|
|
6210
6210
|
height: c,
|
|
6211
6211
|
alignV: e.shapeAlignVertical ?? "middle",
|
|
6212
|
-
padding:
|
|
6212
|
+
padding: Di({ group: e }),
|
|
6213
6213
|
wrapPolicy: u,
|
|
6214
6214
|
expandShapeHeightToFitText: l,
|
|
6215
6215
|
measurementCache: n.previewTextMeasurementCache ?? void 0,
|
|
6216
|
-
resolveInternalShapeTextInset: ({ width: t, height: n }) =>
|
|
6216
|
+
resolveInternalShapeTextInset: ({ width: t, height: n }) => Oi({
|
|
6217
6217
|
group: e,
|
|
6218
6218
|
width: t,
|
|
6219
6219
|
height: n
|
|
6220
6220
|
})
|
|
6221
6221
|
});
|
|
6222
6222
|
}
|
|
6223
|
-
function
|
|
6224
|
-
let { canScaleWidth: n, canScaleHeight: r } =
|
|
6223
|
+
function Pi({ group: e, transform: t }) {
|
|
6224
|
+
let { canScaleWidth: n, canScaleHeight: r } = di({ transform: t }), i = Math.max(1, e.shapeBaseWidth ?? e.width ?? e.shapeManualBaseWidth ?? 1), a = Math.max(1, e.shapeBaseHeight ?? e.height ?? e.shapeManualBaseHeight ?? 1);
|
|
6225
6225
|
return {
|
|
6226
6226
|
startWidth: i,
|
|
6227
6227
|
startHeight: a,
|
|
@@ -6231,7 +6231,7 @@ function Ni({ group: e, transform: t }) {
|
|
|
6231
6231
|
canScaleHeight: r
|
|
6232
6232
|
};
|
|
6233
6233
|
}
|
|
6234
|
-
function
|
|
6234
|
+
function Fi({ group: e, transform: t }) {
|
|
6235
6235
|
let n = ci({
|
|
6236
6236
|
transform: t,
|
|
6237
6237
|
key: "scaleX"
|
|
@@ -6244,7 +6244,7 @@ function Pi({ group: e, transform: t }) {
|
|
|
6244
6244
|
}), a = ci({
|
|
6245
6245
|
transform: t,
|
|
6246
6246
|
key: "top"
|
|
6247
|
-
}), o = li({ value: t?.original?.originX ?? t?.originX }), s = ui({ value: t?.original?.originY ?? t?.originY }), c =
|
|
6247
|
+
}), o = li({ value: t?.original?.originX ?? t?.originX }), s = ui({ value: t?.original?.originY ?? t?.originY }), c = pi({
|
|
6248
6248
|
group: e,
|
|
6249
6249
|
originX: o,
|
|
6250
6250
|
originY: s
|
|
@@ -6261,18 +6261,18 @@ function Pi({ group: e, transform: t }) {
|
|
|
6261
6261
|
scalingAnchorY: c?.y ?? null
|
|
6262
6262
|
};
|
|
6263
6263
|
}
|
|
6264
|
-
function
|
|
6265
|
-
let i =
|
|
6264
|
+
function Ii({ group: e, text: t, constraintPadding: n, transform: r }) {
|
|
6265
|
+
let i = Pi({
|
|
6266
6266
|
group: e,
|
|
6267
6267
|
transform: r
|
|
6268
|
-
}), a =
|
|
6268
|
+
}), a = Fi({
|
|
6269
6269
|
group: e,
|
|
6270
6270
|
transform: r
|
|
6271
6271
|
}), o = !i.canScaleWidth && i.canScaleHeight, s = {
|
|
6272
6272
|
measurementsByKey: /* @__PURE__ */ new Map(),
|
|
6273
6273
|
splitByGraphemeByFrameWidth: /* @__PURE__ */ new Map(),
|
|
6274
6274
|
minimumTextFrameWidth: null
|
|
6275
|
-
}, c = /* @__PURE__ */ new Map(), l =
|
|
6275
|
+
}, c = /* @__PURE__ */ new Map(), l = ji({
|
|
6276
6276
|
group: e,
|
|
6277
6277
|
text: t,
|
|
6278
6278
|
width: i.startWidth,
|
|
@@ -6281,7 +6281,7 @@ function Fi({ group: e, text: t, constraintPadding: n, transform: r }) {
|
|
|
6281
6281
|
});
|
|
6282
6282
|
return {
|
|
6283
6283
|
...i,
|
|
6284
|
-
cannotScaleDownAtStart: l >= i.startHeight -
|
|
6284
|
+
cannotScaleDownAtStart: l >= i.startHeight - J,
|
|
6285
6285
|
startTextSplitByGrapheme: !!t.splitByGrapheme,
|
|
6286
6286
|
isProportionalScaling: !1,
|
|
6287
6287
|
blockedScaleAttempt: !1,
|
|
@@ -6302,17 +6302,17 @@ function Fi({ group: e, text: t, constraintPadding: n, transform: r }) {
|
|
|
6302
6302
|
proportionalTextConstraintCache: c
|
|
6303
6303
|
};
|
|
6304
6304
|
}
|
|
6305
|
-
function
|
|
6305
|
+
function Li({ scalingState: e, group: t, text: n, constraintPadding: r, transform: i }) {
|
|
6306
6306
|
let a = e.get(t);
|
|
6307
|
-
return a || (a =
|
|
6307
|
+
return a || (a = Ii({
|
|
6308
6308
|
group: t,
|
|
6309
6309
|
text: n,
|
|
6310
6310
|
constraintPadding: r,
|
|
6311
6311
|
transform: i
|
|
6312
6312
|
}), e.set(t, a), a);
|
|
6313
6313
|
}
|
|
6314
|
-
function
|
|
6315
|
-
let { previewWidth: s, previewHeight: c } =
|
|
6314
|
+
function Ri({ group: e, text: t, constraintPadding: n, startDimensions: r, scaleX: i, scaleY: a, wrapPolicy: o }) {
|
|
6315
|
+
let { previewWidth: s, previewHeight: c } = Mi({
|
|
6316
6316
|
group: e,
|
|
6317
6317
|
text: t,
|
|
6318
6318
|
constraintPadding: n,
|
|
@@ -6320,7 +6320,7 @@ function Li({ group: e, text: t, constraintPadding: n, startDimensions: r, scale
|
|
|
6320
6320
|
appliedScaleX: i,
|
|
6321
6321
|
appliedScaleY: a,
|
|
6322
6322
|
wrapPolicy: o
|
|
6323
|
-
}), { startWidth: l, startHeight: u } = r, d = Math.abs(s - l) >
|
|
6323
|
+
}), { startWidth: l, startHeight: u } = r, d = Math.abs(s - l) > bi, f = Math.abs(c - u) > bi;
|
|
6324
6324
|
return {
|
|
6325
6325
|
width: s,
|
|
6326
6326
|
height: c,
|
|
@@ -6328,7 +6328,7 @@ function Li({ group: e, text: t, constraintPadding: n, startDimensions: r, scale
|
|
|
6328
6328
|
hasDimensionChange: d || f
|
|
6329
6329
|
};
|
|
6330
6330
|
}
|
|
6331
|
-
function
|
|
6331
|
+
function zi({ startManualBaseWidth: e, startManualBaseHeight: t, canScaleWidth: n, canScaleHeight: r, finalWidth: i, finalHeight: a }) {
|
|
6332
6332
|
let o = e;
|
|
6333
6333
|
n && (o = i);
|
|
6334
6334
|
let s = t;
|
|
@@ -6337,8 +6337,8 @@ function Ri({ startManualBaseWidth: e, startManualBaseHeight: t, canScaleWidth:
|
|
|
6337
6337
|
height: s
|
|
6338
6338
|
};
|
|
6339
6339
|
}
|
|
6340
|
-
function
|
|
6341
|
-
let p =
|
|
6340
|
+
function Bi({ group: e, shape: t, text: n, width: r, height: i, alignH: a, alignV: o, startManualBaseWidth: s, startManualBaseHeight: c, canScaleWidth: l, canScaleHeight: u, hasWidthChange: d, wrapPolicy: f }) {
|
|
6341
|
+
let p = zi({
|
|
6342
6342
|
startManualBaseWidth: s,
|
|
6343
6343
|
startManualBaseHeight: c,
|
|
6344
6344
|
canScaleWidth: l,
|
|
@@ -6347,11 +6347,11 @@ function zi({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
6347
6347
|
finalHeight: i
|
|
6348
6348
|
});
|
|
6349
6349
|
e.shapeManualBaseWidth = p.width, e.shapeManualBaseHeight = p.height, l && d && (e.shapeTextAutoExpand = !1);
|
|
6350
|
-
let m =
|
|
6350
|
+
let m = Di({ group: e }), h = Oi({
|
|
6351
6351
|
group: e,
|
|
6352
6352
|
width: r,
|
|
6353
6353
|
height: i
|
|
6354
|
-
}), g = !u, _ = ({ width: t, height: n }) =>
|
|
6354
|
+
}), g = !u, _ = ({ width: t, height: n }) => Oi({
|
|
6355
6355
|
group: e,
|
|
6356
6356
|
width: t,
|
|
6357
6357
|
height: n
|
|
@@ -6393,13 +6393,13 @@ function zi({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
6393
6393
|
}
|
|
6394
6394
|
//#endregion
|
|
6395
6395
|
//#region src/editor/shape-manager/scaling/active-selection-scaling-controller.ts
|
|
6396
|
-
var
|
|
6396
|
+
var Vi = class {
|
|
6397
6397
|
constructor({ canvas: e, shapeScalingState: t }) {
|
|
6398
6398
|
this.canvas = e, this.shapeScalingState = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.scalingSessions = /* @__PURE__ */ new WeakMap(), this.groupLayoutScales = /* @__PURE__ */ new WeakMap();
|
|
6399
6399
|
}
|
|
6400
6400
|
handleScalingPreview({ selection: e, transform: t, event: n }) {
|
|
6401
6401
|
if (!t) return;
|
|
6402
|
-
let { canScaleWidth: r, canScaleHeight: i, isCornerScaleAction: a } =
|
|
6402
|
+
let { canScaleWidth: r, canScaleHeight: i, isCornerScaleAction: a } = di({ transform: t });
|
|
6403
6403
|
if (!r && !i) return;
|
|
6404
6404
|
let o = this._collectPreviewItems({
|
|
6405
6405
|
selection: e,
|
|
@@ -6445,24 +6445,24 @@ var Bi = class {
|
|
|
6445
6445
|
} else c = this._resolveShapeLayoutScale({
|
|
6446
6446
|
item: e,
|
|
6447
6447
|
selectionScale: p
|
|
6448
|
-
}), u =
|
|
6448
|
+
}), u = Mi({
|
|
6449
6449
|
group: t,
|
|
6450
6450
|
text: r,
|
|
6451
6451
|
constraintPadding: i,
|
|
6452
6452
|
startDimensions: a,
|
|
6453
6453
|
appliedScaleX: c.scaleX,
|
|
6454
6454
|
appliedScaleY: c.scaleY,
|
|
6455
|
-
wrapPolicy:
|
|
6455
|
+
wrapPolicy: xi({
|
|
6456
6456
|
isProportionalScaling: a.isProportionalScaling,
|
|
6457
6457
|
startTextSplitByGrapheme: a.startTextSplitByGrapheme
|
|
6458
6458
|
}),
|
|
6459
6459
|
measurementCache: a.previewTextMeasurementCache
|
|
6460
6460
|
}).previewHeight;
|
|
6461
|
-
|
|
6461
|
+
yi({
|
|
6462
6462
|
group: t,
|
|
6463
6463
|
shape: n,
|
|
6464
6464
|
text: r,
|
|
6465
|
-
layout:
|
|
6465
|
+
layout: Ni({
|
|
6466
6466
|
group: t,
|
|
6467
6467
|
text: r,
|
|
6468
6468
|
state: a,
|
|
@@ -6474,7 +6474,7 @@ var Bi = class {
|
|
|
6474
6474
|
scaleX: p.scaleX,
|
|
6475
6475
|
scaleY: p.scaleY,
|
|
6476
6476
|
minSize: 1,
|
|
6477
|
-
scaleEpsilon:
|
|
6477
|
+
scaleEpsilon: J
|
|
6478
6478
|
}), this.groupLayoutScales.set(t, c), this._positionShapeInSelection({
|
|
6479
6479
|
group: t,
|
|
6480
6480
|
sessionItem: o
|
|
@@ -6485,13 +6485,13 @@ var Bi = class {
|
|
|
6485
6485
|
commitGroupScaling({ group: e, scaleX: t, scaleY: n, transform: r }) {
|
|
6486
6486
|
let { shape: i, text: a } = V({ group: e });
|
|
6487
6487
|
if (!i || !a) return this.shapeScalingState.delete(e), !1;
|
|
6488
|
-
let o = this.shapeScalingState.get(e), s = o ??
|
|
6488
|
+
let o = this.shapeScalingState.get(e), s = o ?? Pi({
|
|
6489
6489
|
group: e,
|
|
6490
6490
|
transform: r
|
|
6491
|
-
}), c = r ?
|
|
6491
|
+
}), c = r ? di({ transform: r }) : null, l = o?.canScaleWidth ?? c?.canScaleWidth ?? Math.abs(t - 1) > 1e-4, u = o?.canScaleHeight ?? c?.canScaleHeight ?? Math.abs(n - 1) > 1e-4, d = e.shapeAlignHorizontal ?? "center", f = e.shapeAlignVertical ?? "middle", p = Y({ group: e }), m = this.groupLayoutScales.get(e) ?? {
|
|
6492
6492
|
scaleX: t,
|
|
6493
6493
|
scaleY: n
|
|
6494
|
-
}, { width: h, height: g, hasWidthChange: _, hasDimensionChange: v } =
|
|
6494
|
+
}, { width: h, height: g, hasWidthChange: _, hasDimensionChange: v } = Ri({
|
|
6495
6495
|
group: e,
|
|
6496
6496
|
text: a,
|
|
6497
6497
|
constraintPadding: p,
|
|
@@ -6502,12 +6502,12 @@ var Bi = class {
|
|
|
6502
6502
|
},
|
|
6503
6503
|
scaleX: m.scaleX,
|
|
6504
6504
|
scaleY: m.scaleY,
|
|
6505
|
-
wrapPolicy:
|
|
6505
|
+
wrapPolicy: xi({
|
|
6506
6506
|
isProportionalScaling: o?.isProportionalScaling,
|
|
6507
6507
|
startTextSplitByGrapheme: o?.startTextSplitByGrapheme
|
|
6508
6508
|
})
|
|
6509
6509
|
});
|
|
6510
|
-
return v ? (
|
|
6510
|
+
return v ? (Bi({
|
|
6511
6511
|
group: e,
|
|
6512
6512
|
shape: i,
|
|
6513
6513
|
text: a,
|
|
@@ -6520,7 +6520,7 @@ var Bi = class {
|
|
|
6520
6520
|
canScaleWidth: l,
|
|
6521
6521
|
canScaleHeight: u,
|
|
6522
6522
|
hasWidthChange: _,
|
|
6523
|
-
wrapPolicy:
|
|
6523
|
+
wrapPolicy: xi({
|
|
6524
6524
|
isProportionalScaling: o?.isProportionalScaling,
|
|
6525
6525
|
startTextSplitByGrapheme: o?.startTextSplitByGrapheme
|
|
6526
6526
|
})
|
|
@@ -6547,7 +6547,7 @@ var Bi = class {
|
|
|
6547
6547
|
if (!H(r)) continue;
|
|
6548
6548
|
let { shape: e, text: i } = V({ group: r });
|
|
6549
6549
|
if (!e || !i) continue;
|
|
6550
|
-
let a =
|
|
6550
|
+
let a = Y({ group: r }), o = Li({
|
|
6551
6551
|
scalingState: this.shapeScalingState,
|
|
6552
6552
|
group: r,
|
|
6553
6553
|
text: i,
|
|
@@ -6594,7 +6594,7 @@ var Bi = class {
|
|
|
6594
6594
|
return this.scalingSessions.set(e, u), u;
|
|
6595
6595
|
}
|
|
6596
6596
|
_resolveSelectionScale({ items: e, session: t, transform: n, proportionalLayoutResults: r, scaleX: i, scaleY: a, event: o }) {
|
|
6597
|
-
let { canScaleWidth: s, canScaleHeight: c, isCornerScaleAction: l } =
|
|
6597
|
+
let { canScaleWidth: s, canScaleHeight: c, isCornerScaleAction: l } = di({ transform: n }), u = !!(o && "shiftKey" in o && o.shiftKey), d = l && !u, f = i, p = a;
|
|
6598
6598
|
if (d) {
|
|
6599
6599
|
let n = Math.max(i, a);
|
|
6600
6600
|
if (!r) return {
|
|
@@ -6668,7 +6668,7 @@ var Bi = class {
|
|
|
6668
6668
|
return o;
|
|
6669
6669
|
}
|
|
6670
6670
|
_resolveSelectionScaleAtPointerBoundary({ selection: e, items: t, session: n, transform: r, selectionScale: i, event: a }) {
|
|
6671
|
-
let { canScaleWidth: o, canScaleHeight: s, isCornerScaleAction: c } =
|
|
6671
|
+
let { canScaleWidth: o, canScaleHeight: s, isCornerScaleAction: c } = di({ transform: r }), l = !!(a && "shiftKey" in a && a.shiftKey);
|
|
6672
6672
|
if (c && !l) return i;
|
|
6673
6673
|
let u = o && this._hasPointerReachedSelectionScaleOrigin({
|
|
6674
6674
|
selection: e,
|
|
@@ -6787,7 +6787,7 @@ var Bi = class {
|
|
|
6787
6787
|
_resolveProportionalLayoutResults({ items: e }) {
|
|
6788
6788
|
let t = /* @__PURE__ */ new Map();
|
|
6789
6789
|
for (let n of e) {
|
|
6790
|
-
let e =
|
|
6790
|
+
let e = Ai({
|
|
6791
6791
|
group: n.group,
|
|
6792
6792
|
text: n.text,
|
|
6793
6793
|
state: n.state
|
|
@@ -6805,7 +6805,7 @@ var Bi = class {
|
|
|
6805
6805
|
text: r,
|
|
6806
6806
|
padding: i,
|
|
6807
6807
|
measurementCache: a.previewTextMeasurementCache ?? void 0,
|
|
6808
|
-
resolvePaddingForWidth: ({ width: e }) =>
|
|
6808
|
+
resolvePaddingForWidth: ({ width: e }) => Y({
|
|
6809
6809
|
group: n,
|
|
6810
6810
|
width: e,
|
|
6811
6811
|
height: o
|
|
@@ -6818,7 +6818,7 @@ var Bi = class {
|
|
|
6818
6818
|
}
|
|
6819
6819
|
_resolveMinimumShapeHeight({ item: e, scaleX: t }) {
|
|
6820
6820
|
let { group: n, text: r, constraintPadding: i, state: a } = e;
|
|
6821
|
-
return
|
|
6821
|
+
return ji({
|
|
6822
6822
|
group: n,
|
|
6823
6823
|
text: r,
|
|
6824
6824
|
width: Math.max(1, a.startWidth * t),
|
|
@@ -6857,7 +6857,7 @@ var Bi = class {
|
|
|
6857
6857
|
};
|
|
6858
6858
|
}
|
|
6859
6859
|
_resolveVerticalAttachment({ selectionBounds: e, shapeBounds: t }) {
|
|
6860
|
-
let n = Math.max(0, t.top - e.top), r = Math.max(0, e.bottom - t.bottom), i = n <=
|
|
6860
|
+
let n = Math.max(0, t.top - e.top), r = Math.max(0, e.bottom - t.bottom), i = n <= bi, a = r <= bi;
|
|
6861
6861
|
return i && !a ? "top" : a && !i ? "bottom" : Math.abs(n - r) <= .5 ? "center" : n < r ? "top" : "bottom";
|
|
6862
6862
|
}
|
|
6863
6863
|
_resolveOriginOffset({ origin: e }) {
|
|
@@ -6878,7 +6878,7 @@ var Bi = class {
|
|
|
6878
6878
|
_hasPointerReachedSelectionScaleOrigin({ selection: e, transform: t, event: n, axis: r }) {
|
|
6879
6879
|
let i = t, a = r === "x" ? i.signX : i.signY;
|
|
6880
6880
|
if (typeof a != "number" || !Number.isFinite(a)) return !1;
|
|
6881
|
-
let o =
|
|
6881
|
+
let o = fi({
|
|
6882
6882
|
target: e,
|
|
6883
6883
|
transform: t,
|
|
6884
6884
|
event: n,
|
|
@@ -6897,7 +6897,7 @@ var Bi = class {
|
|
|
6897
6897
|
scaleY: r
|
|
6898
6898
|
}), c && o !== null && s !== null && e.setPositionByOrigin(c, o, s), e.setCoords();
|
|
6899
6899
|
}
|
|
6900
|
-
},
|
|
6900
|
+
}, Hi = class {
|
|
6901
6901
|
constructor({ canvas: t }) {
|
|
6902
6902
|
this.handleObjectScaling = (t) => {
|
|
6903
6903
|
let { target: n, transform: r } = t;
|
|
@@ -6916,7 +6916,7 @@ var Bi = class {
|
|
|
6916
6916
|
lockScalingFlip: !0,
|
|
6917
6917
|
centeredScaling: !1
|
|
6918
6918
|
});
|
|
6919
|
-
let s =
|
|
6919
|
+
let s = Y({ group: i }), c = Li({
|
|
6920
6920
|
scalingState: this.scalingState,
|
|
6921
6921
|
group: i,
|
|
6922
6922
|
text: o,
|
|
@@ -6945,7 +6945,7 @@ var Bi = class {
|
|
|
6945
6945
|
});
|
|
6946
6946
|
return;
|
|
6947
6947
|
}
|
|
6948
|
-
let _ =
|
|
6948
|
+
let _ = Ni({
|
|
6949
6949
|
group: i,
|
|
6950
6950
|
text: o,
|
|
6951
6951
|
state: c,
|
|
@@ -6959,7 +6959,7 @@ var Bi = class {
|
|
|
6959
6959
|
shouldHandleAsNoop: !1,
|
|
6960
6960
|
scaleX: g.appliedScaleX,
|
|
6961
6961
|
scaleY: g.appliedScaleY
|
|
6962
|
-
}),
|
|
6962
|
+
}), yi({
|
|
6963
6963
|
group: i,
|
|
6964
6964
|
shape: a,
|
|
6965
6965
|
text: o,
|
|
@@ -6968,7 +6968,7 @@ var Bi = class {
|
|
|
6968
6968
|
scaleX: g.appliedScaleX,
|
|
6969
6969
|
scaleY: g.appliedScaleY,
|
|
6970
6970
|
minSize: 1,
|
|
6971
|
-
scaleEpsilon:
|
|
6971
|
+
scaleEpsilon: J
|
|
6972
6972
|
}), this._restoreScalingAnchorPosition({
|
|
6973
6973
|
group: i,
|
|
6974
6974
|
state: c
|
|
@@ -6999,7 +6999,7 @@ var Bi = class {
|
|
|
6999
6999
|
if (!a) return;
|
|
7000
7000
|
let { shape: o, text: s } = V({ group: i });
|
|
7001
7001
|
if (!o || !s) return;
|
|
7002
|
-
let c =
|
|
7002
|
+
let c = Y({ group: i }), l = i.shapeAlignHorizontal ?? "center", { canScaleWidth: u, canScaleHeight: d } = a;
|
|
7003
7003
|
if (!u && !d) return;
|
|
7004
7004
|
let f = Math.abs(i.scaleX ?? a.startScaleX) || a.startScaleX, p = Math.abs(i.scaleY ?? a.startScaleY) || a.startScaleY, { scaleX: m, scaleY: h } = this._resolveCurrentDragScales({
|
|
7005
7005
|
group: i,
|
|
@@ -7021,7 +7021,7 @@ var Bi = class {
|
|
|
7021
7021
|
axis: "y"
|
|
7022
7022
|
});
|
|
7023
7023
|
if (!e && !t) return;
|
|
7024
|
-
let n =
|
|
7024
|
+
let n = Ai({
|
|
7025
7025
|
group: i,
|
|
7026
7026
|
text: s,
|
|
7027
7027
|
state: a
|
|
@@ -7038,7 +7038,7 @@ var Bi = class {
|
|
|
7038
7038
|
let e = Zr({
|
|
7039
7039
|
text: s,
|
|
7040
7040
|
padding: c,
|
|
7041
|
-
resolvePaddingForWidth: ({ width: e }) =>
|
|
7041
|
+
resolvePaddingForWidth: ({ width: e }) => Y({
|
|
7042
7042
|
group: i,
|
|
7043
7043
|
width: e,
|
|
7044
7044
|
height: Math.max(1, a.startHeight * v)
|
|
@@ -7061,7 +7061,7 @@ var Bi = class {
|
|
|
7061
7061
|
});
|
|
7062
7062
|
return;
|
|
7063
7063
|
}
|
|
7064
|
-
y = C ??
|
|
7064
|
+
y = C ?? ji({
|
|
7065
7065
|
group: i,
|
|
7066
7066
|
text: s,
|
|
7067
7067
|
width: Math.max(1, a.startWidth * _),
|
|
@@ -7074,7 +7074,7 @@ var Bi = class {
|
|
|
7074
7074
|
}
|
|
7075
7075
|
if (!x && !S) return;
|
|
7076
7076
|
y ??= C;
|
|
7077
|
-
let w =
|
|
7077
|
+
let w = Mi({
|
|
7078
7078
|
group: i,
|
|
7079
7079
|
text: s,
|
|
7080
7080
|
constraintPadding: c,
|
|
@@ -7083,7 +7083,7 @@ var Bi = class {
|
|
|
7083
7083
|
appliedScaleY: v,
|
|
7084
7084
|
minimumHeight: b ? null : y,
|
|
7085
7085
|
measurementCache: a.previewTextMeasurementCache
|
|
7086
|
-
}), T =
|
|
7086
|
+
}), T = Ni({
|
|
7087
7087
|
group: i,
|
|
7088
7088
|
text: s,
|
|
7089
7089
|
state: a,
|
|
@@ -7097,7 +7097,7 @@ var Bi = class {
|
|
|
7097
7097
|
shouldHandleAsNoop: !1,
|
|
7098
7098
|
scaleX: _,
|
|
7099
7099
|
scaleY: v
|
|
7100
|
-
}),
|
|
7100
|
+
}), yi({
|
|
7101
7101
|
group: i,
|
|
7102
7102
|
shape: o,
|
|
7103
7103
|
text: s,
|
|
@@ -7106,7 +7106,7 @@ var Bi = class {
|
|
|
7106
7106
|
scaleX: _,
|
|
7107
7107
|
scaleY: v,
|
|
7108
7108
|
minSize: 1,
|
|
7109
|
-
scaleEpsilon:
|
|
7109
|
+
scaleEpsilon: J
|
|
7110
7110
|
}), this._restoreScalingAnchorPosition({
|
|
7111
7111
|
group: i,
|
|
7112
7112
|
state: a
|
|
@@ -7141,7 +7141,7 @@ var Bi = class {
|
|
|
7141
7141
|
startHeight: s,
|
|
7142
7142
|
alignH: n.shapeAlignHorizontal,
|
|
7143
7143
|
alignV: n.shapeAlignVertical,
|
|
7144
|
-
userPadding:
|
|
7144
|
+
userPadding: Di({ group: n })
|
|
7145
7145
|
}), n.shapeScalingNoopTransform = !1, this.scalingState.delete(n), this.canvas.requestRenderAll();
|
|
7146
7146
|
return;
|
|
7147
7147
|
}
|
|
@@ -7150,7 +7150,7 @@ var Bi = class {
|
|
|
7150
7150
|
this.scalingState.delete(n);
|
|
7151
7151
|
return;
|
|
7152
7152
|
}
|
|
7153
|
-
let f = n.shapeAlignHorizontal ?? "center", p = n.shapeAlignVertical ?? "middle", m =
|
|
7153
|
+
let f = n.shapeAlignHorizontal ?? "center", p = n.shapeAlignVertical ?? "middle", m = Y({ group: n }), h = e.transform ? di({ transform: e.transform }) : null, g = r?.canScaleWidth ?? h?.canScaleWidth ?? Math.abs(i - 1) > 1e-4, _ = r?.canScaleHeight ?? h?.canScaleHeight ?? Math.abs(a - 1) > 1e-4, v = r?.lastAllowedScaleX ?? i, y = r?.lastAllowedScaleY ?? a;
|
|
7154
7154
|
if (r?.isProportionalScaling) {
|
|
7155
7155
|
let t = this._hasPointerReachedScaleOrigin({
|
|
7156
7156
|
event: e,
|
|
@@ -7164,7 +7164,7 @@ var Bi = class {
|
|
|
7164
7164
|
axis: "y"
|
|
7165
7165
|
});
|
|
7166
7166
|
if (t || o) {
|
|
7167
|
-
let e =
|
|
7167
|
+
let e = Ai({
|
|
7168
7168
|
group: n,
|
|
7169
7169
|
text: d,
|
|
7170
7170
|
state: r
|
|
@@ -7175,7 +7175,7 @@ var Bi = class {
|
|
|
7175
7175
|
let t = Zr({
|
|
7176
7176
|
text: d,
|
|
7177
7177
|
padding: m,
|
|
7178
|
-
resolvePaddingForWidth: ({ width: e }) =>
|
|
7178
|
+
resolvePaddingForWidth: ({ width: e }) => Y({
|
|
7179
7179
|
group: n,
|
|
7180
7180
|
width: e,
|
|
7181
7181
|
height: Math.max(1, s * y)
|
|
@@ -7187,7 +7187,7 @@ var Bi = class {
|
|
|
7187
7187
|
minimumWidth: t,
|
|
7188
7188
|
state: r
|
|
7189
7189
|
}) && (v = Math.max(1 / o, t / o));
|
|
7190
|
-
let i =
|
|
7190
|
+
let i = ji({
|
|
7191
7191
|
group: n,
|
|
7192
7192
|
text: d,
|
|
7193
7193
|
width: Math.max(1, o * v),
|
|
@@ -7200,7 +7200,7 @@ var Bi = class {
|
|
|
7200
7200
|
state: r
|
|
7201
7201
|
}) && (y = Math.max(1 / s, i / s));
|
|
7202
7202
|
}
|
|
7203
|
-
let { width: b, height: x, hasWidthChange: S, hasDimensionChange: C } =
|
|
7203
|
+
let { width: b, height: x, hasWidthChange: S, hasDimensionChange: C } = Ri({
|
|
7204
7204
|
group: n,
|
|
7205
7205
|
text: d,
|
|
7206
7206
|
constraintPadding: m,
|
|
@@ -7214,7 +7214,7 @@ var Bi = class {
|
|
|
7214
7214
|
},
|
|
7215
7215
|
scaleX: v,
|
|
7216
7216
|
scaleY: y,
|
|
7217
|
-
wrapPolicy:
|
|
7217
|
+
wrapPolicy: xi({
|
|
7218
7218
|
isProportionalScaling: r?.isProportionalScaling,
|
|
7219
7219
|
startTextSplitByGrapheme: r?.startTextSplitByGrapheme
|
|
7220
7220
|
})
|
|
@@ -7229,14 +7229,14 @@ var Bi = class {
|
|
|
7229
7229
|
startHeight: s,
|
|
7230
7230
|
alignH: f,
|
|
7231
7231
|
alignV: p,
|
|
7232
|
-
userPadding:
|
|
7232
|
+
userPadding: Di({ group: n })
|
|
7233
7233
|
}), this.scalingState.delete(n), this.canvas.requestRenderAll();
|
|
7234
7234
|
return;
|
|
7235
7235
|
}
|
|
7236
7236
|
r && n.set({
|
|
7237
7237
|
left: r.lastAllowedLeft,
|
|
7238
7238
|
top: r.lastAllowedTop
|
|
7239
|
-
}),
|
|
7239
|
+
}), Bi({
|
|
7240
7240
|
group: n,
|
|
7241
7241
|
shape: u,
|
|
7242
7242
|
text: d,
|
|
@@ -7249,7 +7249,7 @@ var Bi = class {
|
|
|
7249
7249
|
canScaleWidth: g,
|
|
7250
7250
|
canScaleHeight: _,
|
|
7251
7251
|
hasWidthChange: S,
|
|
7252
|
-
wrapPolicy:
|
|
7252
|
+
wrapPolicy: xi({
|
|
7253
7253
|
isProportionalScaling: r?.isProportionalScaling,
|
|
7254
7254
|
startTextSplitByGrapheme: r?.startTextSplitByGrapheme
|
|
7255
7255
|
})
|
|
@@ -7257,7 +7257,7 @@ var Bi = class {
|
|
|
7257
7257
|
group: n,
|
|
7258
7258
|
state: r
|
|
7259
7259
|
}), n.setCoords(), d.setCoords(), u.setCoords(), this.scalingState.delete(n), n.shapeScalingNoopTransform = !1, this.canvas.requestRenderAll();
|
|
7260
|
-
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.activeSelectionScalingController = new
|
|
7260
|
+
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.activeSelectionScalingController = new Vi({
|
|
7261
7261
|
canvas: t,
|
|
7262
7262
|
shapeScalingState: this.scalingState
|
|
7263
7263
|
});
|
|
@@ -7266,10 +7266,10 @@ var Bi = class {
|
|
|
7266
7266
|
let a = e.scaleX ?? 1, o = e.scaleY ?? 1, { scaleX: s, scaleY: c } = this._resolveCurrentDragScales({
|
|
7267
7267
|
group: e,
|
|
7268
7268
|
state: r
|
|
7269
|
-
}), l = r.canScaleWidth && a < 0 || r.canScaleHeight && o < 0, u =
|
|
7269
|
+
}), l = r.canScaleWidth && a < 0 || r.canScaleHeight && o < 0, u = mi({
|
|
7270
7270
|
state: r,
|
|
7271
7271
|
transform: i
|
|
7272
|
-
}), d =
|
|
7272
|
+
}), d = hi({
|
|
7273
7273
|
state: r,
|
|
7274
7274
|
transform: i
|
|
7275
7275
|
});
|
|
@@ -7285,7 +7285,7 @@ var Bi = class {
|
|
|
7285
7285
|
f.shouldRestoreLastAllowedTransform && (h = r.lastAllowedScaleX, g = r.lastAllowedScaleY), f.shouldHandleAsNoop && (h = r.startScaleX, g = r.startScaleY);
|
|
7286
7286
|
let _ = f.resolvedMinimumHeight, v = !r.canScaleWidth && r.canScaleHeight ? r.fixedWidthMinimumTextFitHeight : null;
|
|
7287
7287
|
f.shouldHandleAsNoop ? _ = r.startHeight : _ ??= v;
|
|
7288
|
-
let { previewHeight: y } =
|
|
7288
|
+
let { previewHeight: y } = Mi({
|
|
7289
7289
|
group: e,
|
|
7290
7290
|
text: t,
|
|
7291
7291
|
constraintPadding: n,
|
|
@@ -7304,16 +7304,16 @@ var Bi = class {
|
|
|
7304
7304
|
};
|
|
7305
7305
|
}
|
|
7306
7306
|
_resolveScalingConstraintState({ group: e, text: t, constraintPadding: n, state: r, scaleX: i, scaleY: a }) {
|
|
7307
|
-
let { canScaleHeight: o, canScaleWidth: s, startHeight: c, startWidth: l, cannotScaleDownAtStart: u, crossedOppositeCorner: d, isProportionalScaling: f, lastAllowedScaleX: p, lastAllowedScaleY: m, startScaleY: h } = r, g = o && !s, _ = s ? Math.max(1, l * i) : l, v = o ? Math.max(1, c * a) : c, y = i < p -
|
|
7307
|
+
let { canScaleHeight: o, canScaleWidth: s, startHeight: c, startWidth: l, cannotScaleDownAtStart: u, crossedOppositeCorner: d, isProportionalScaling: f, lastAllowedScaleX: p, lastAllowedScaleY: m, startScaleY: h } = r, g = o && !s, _ = s ? Math.max(1, l * i) : l, v = o ? Math.max(1, c * a) : c, y = i < p - J, b = a < m - J, x = a < h - J, S = g ? r.fixedWidthMinimumTextFitHeight : null, C = s && y ? Zr({
|
|
7308
7308
|
text: t,
|
|
7309
7309
|
padding: n,
|
|
7310
7310
|
measurementCache: r.previewTextMeasurementCache ?? void 0,
|
|
7311
|
-
resolvePaddingForWidth: ({ width: t }) =>
|
|
7311
|
+
resolvePaddingForWidth: ({ width: t }) => Y({
|
|
7312
7312
|
group: e,
|
|
7313
7313
|
width: t,
|
|
7314
7314
|
height: v
|
|
7315
7315
|
})
|
|
7316
|
-
}) : null, w = o && b ? S ??
|
|
7316
|
+
}) : null, w = o && b ? S ?? ji({
|
|
7317
7317
|
group: e,
|
|
7318
7318
|
text: t,
|
|
7319
7319
|
width: _,
|
|
@@ -7321,7 +7321,7 @@ var Bi = class {
|
|
|
7321
7321
|
measurementCache: r.previewTextMeasurementCache
|
|
7322
7322
|
}) : null, T = g && u && x;
|
|
7323
7323
|
if (f && s && o && (y || b)) {
|
|
7324
|
-
if (!
|
|
7324
|
+
if (!ki({
|
|
7325
7325
|
group: e,
|
|
7326
7326
|
text: t,
|
|
7327
7327
|
width: _,
|
|
@@ -7329,7 +7329,7 @@ var Bi = class {
|
|
|
7329
7329
|
measurementCache: r.previewTextMeasurementCache,
|
|
7330
7330
|
constraintCache: r.proportionalTextConstraintCache
|
|
7331
7331
|
}).isValid) {
|
|
7332
|
-
let n =
|
|
7332
|
+
let n = Ai({
|
|
7333
7333
|
group: e,
|
|
7334
7334
|
text: t,
|
|
7335
7335
|
state: r
|
|
@@ -7352,7 +7352,7 @@ var Bi = class {
|
|
|
7352
7352
|
}
|
|
7353
7353
|
let E = C !== null && _ < C + 1e-4, D = w !== null && v < w + 1e-4, O = E || D, k = d, A = null, j = null;
|
|
7354
7354
|
if (f && O) {
|
|
7355
|
-
let n =
|
|
7355
|
+
let n = Ai({
|
|
7356
7356
|
group: e,
|
|
7357
7357
|
text: t,
|
|
7358
7358
|
state: r
|
|
@@ -7381,11 +7381,11 @@ var Bi = class {
|
|
|
7381
7381
|
shouldHandleAsNoop: !0,
|
|
7382
7382
|
scaleX: r.startScaleX,
|
|
7383
7383
|
scaleY: r.startScaleY
|
|
7384
|
-
}),
|
|
7384
|
+
}), yi({
|
|
7385
7385
|
group: e,
|
|
7386
7386
|
shape: t,
|
|
7387
7387
|
text: n,
|
|
7388
|
-
layout:
|
|
7388
|
+
layout: Ni({
|
|
7389
7389
|
group: e,
|
|
7390
7390
|
text: n,
|
|
7391
7391
|
state: r,
|
|
@@ -7397,7 +7397,7 @@ var Bi = class {
|
|
|
7397
7397
|
scaleX: r.startScaleX,
|
|
7398
7398
|
scaleY: r.startScaleY,
|
|
7399
7399
|
minSize: 1,
|
|
7400
|
-
scaleEpsilon:
|
|
7400
|
+
scaleEpsilon: J
|
|
7401
7401
|
}), this._restoreScalingAnchorPosition({
|
|
7402
7402
|
group: e,
|
|
7403
7403
|
state: r
|
|
@@ -7440,7 +7440,7 @@ var Bi = class {
|
|
|
7440
7440
|
if (!r) return !1;
|
|
7441
7441
|
let { transform: i } = e;
|
|
7442
7442
|
if (!i) return !1;
|
|
7443
|
-
let { canScaleWidth: a } =
|
|
7443
|
+
let { canScaleWidth: a } = di({ transform: i });
|
|
7444
7444
|
if (!a || !this._hasPointerReachedScaleOrigin({
|
|
7445
7445
|
event: e,
|
|
7446
7446
|
group: t,
|
|
@@ -7448,13 +7448,13 @@ var Bi = class {
|
|
|
7448
7448
|
axis: "x"
|
|
7449
7449
|
})) return !1;
|
|
7450
7450
|
let o = Math.max(1 / r.startWidth, n / r.startWidth);
|
|
7451
|
-
return r.lastAllowedScaleX > o +
|
|
7451
|
+
return r.lastAllowedScaleX > o + J;
|
|
7452
7452
|
}
|
|
7453
7453
|
_shouldClampHeightToMinimum({ event: e, group: t, minimumHeight: n, state: r }) {
|
|
7454
7454
|
if (!r) return !1;
|
|
7455
7455
|
let { transform: i } = e;
|
|
7456
7456
|
if (!i) return !1;
|
|
7457
|
-
let { canScaleHeight: a } =
|
|
7457
|
+
let { canScaleHeight: a } = di({ transform: i });
|
|
7458
7458
|
if (!a || !this._hasPointerReachedScaleOrigin({
|
|
7459
7459
|
event: e,
|
|
7460
7460
|
group: t,
|
|
@@ -7462,14 +7462,14 @@ var Bi = class {
|
|
|
7462
7462
|
axis: "y"
|
|
7463
7463
|
})) return !1;
|
|
7464
7464
|
let o = Math.max(1 / r.startHeight, n / r.startHeight);
|
|
7465
|
-
return r.lastAllowedScaleY > o +
|
|
7465
|
+
return r.lastAllowedScaleY > o + J;
|
|
7466
7466
|
}
|
|
7467
7467
|
_hasPointerReachedScaleOrigin({ event: e, group: t, state: n, axis: r }) {
|
|
7468
7468
|
let { transform: i } = e;
|
|
7469
7469
|
if (!i) return !1;
|
|
7470
7470
|
let a = i, o = r === "x" ? n?.scaleDirectionX ?? null : n?.scaleDirectionY ?? null, s = this._resolveScaleDirection({ value: r === "x" ? a.signX : a.signY }) ?? o;
|
|
7471
7471
|
if (s === null) return !1;
|
|
7472
|
-
let c =
|
|
7472
|
+
let c = fi({
|
|
7473
7473
|
event: e.e,
|
|
7474
7474
|
target: t,
|
|
7475
7475
|
transform: i,
|
|
@@ -7479,7 +7479,7 @@ var Bi = class {
|
|
|
7479
7479
|
}
|
|
7480
7480
|
_storeScaleDirectionsForCurrentTransform({ group: e, state: t, event: n, transform: r }) {
|
|
7481
7481
|
if (!r) return;
|
|
7482
|
-
let { canScaleHeight: i, canScaleWidth: a, isCornerScaleAction: o } =
|
|
7482
|
+
let { canScaleHeight: i, canScaleWidth: a, isCornerScaleAction: o } = di({ transform: r });
|
|
7483
7483
|
if (!o) return;
|
|
7484
7484
|
let s = !a || t.scaleDirectionX !== null, c = !i || t.scaleDirectionY !== null;
|
|
7485
7485
|
if (s && c) return;
|
|
@@ -7487,7 +7487,7 @@ var Bi = class {
|
|
|
7487
7487
|
a && t.scaleDirectionX === null && (t.scaleDirectionX = this._resolveScaleDirection({ value: l.signX })), i && t.scaleDirectionY === null && (t.scaleDirectionY = this._resolveScaleDirection({ value: l.signY }));
|
|
7488
7488
|
let u = !a || t.scaleDirectionX !== null, d = !i || t.scaleDirectionY !== null;
|
|
7489
7489
|
if (u && d) return;
|
|
7490
|
-
let f =
|
|
7490
|
+
let f = fi({
|
|
7491
7491
|
event: n,
|
|
7492
7492
|
target: e,
|
|
7493
7493
|
transform: r,
|
|
@@ -7516,14 +7516,14 @@ var Bi = class {
|
|
|
7516
7516
|
e.setPositionByOrigin(new m(n, r), i, a), e.setCoords();
|
|
7517
7517
|
}
|
|
7518
7518
|
_restoreShapeStateWithoutResize({ group: e, shape: t, text: n, state: r, startWidth: i, startHeight: a, alignH: o, alignV: s, userPadding: c }) {
|
|
7519
|
-
let l = Math.max(1, e.shapeBaseWidth ?? e.width ?? i), u = Math.max(1, e.shapeBaseHeight ?? e.height ?? a), d =
|
|
7519
|
+
let l = Math.max(1, e.shapeBaseWidth ?? e.width ?? i), u = Math.max(1, e.shapeBaseHeight ?? e.height ?? a), d = Oi({
|
|
7520
7520
|
group: e,
|
|
7521
7521
|
width: l,
|
|
7522
7522
|
height: u
|
|
7523
|
-
}), f = o ?? "center", p = s ?? "middle", m =
|
|
7523
|
+
}), f = o ?? "center", p = s ?? "middle", m = xi({
|
|
7524
7524
|
isProportionalScaling: r.isProportionalScaling,
|
|
7525
7525
|
startTextSplitByGrapheme: r.startTextSplitByGrapheme
|
|
7526
|
-
}), h = ({ width: t, height: n }) =>
|
|
7526
|
+
}), h = ({ width: t, height: n }) => Oi({
|
|
7527
7527
|
group: e,
|
|
7528
7528
|
width: t,
|
|
7529
7529
|
height: n
|
|
@@ -7564,7 +7564,7 @@ var Bi = class {
|
|
|
7564
7564
|
state: r
|
|
7565
7565
|
});
|
|
7566
7566
|
}
|
|
7567
|
-
},
|
|
7567
|
+
}, Ui = class {
|
|
7568
7568
|
constructor({ canvas: e }) {
|
|
7569
7569
|
this.handleMouseDown = (e) => {
|
|
7570
7570
|
let { target: t, e: n, subTargets: r = [] } = e, i = rt({
|
|
@@ -7688,7 +7688,7 @@ var Bi = class {
|
|
|
7688
7688
|
let t = this.canvas;
|
|
7689
7689
|
t.findTarget = e.findTarget, this.editingTargetResolverState = void 0;
|
|
7690
7690
|
}
|
|
7691
|
-
},
|
|
7691
|
+
}, Wi = 1e-4, Gi = class {
|
|
7692
7692
|
constructor({ runtime: t }) {
|
|
7693
7693
|
this._handleObjectScaling = (e) => {
|
|
7694
7694
|
this.runtime.collectShapeGroupsFromTarget({
|
|
@@ -7773,7 +7773,7 @@ var Bi = class {
|
|
|
7773
7773
|
let r = t.getObjects(), i = r.filter((e) => H(e));
|
|
7774
7774
|
if (!i.length) return;
|
|
7775
7775
|
let { scaleX: a, scaleY: o } = this.runtime.scalingController.resolveActiveSelectionCommittedScale({ selection: t });
|
|
7776
|
-
if (!(Math.abs(a - 1) >
|
|
7776
|
+
if (!(Math.abs(a - 1) > Wi || Math.abs(o - 1) > Wi)) {
|
|
7777
7777
|
this.runtime.scalingController.clearActiveSelectionState({ selection: t });
|
|
7778
7778
|
return;
|
|
7779
7779
|
}
|
|
@@ -7791,7 +7791,7 @@ var Bi = class {
|
|
|
7791
7791
|
}), e.setCoords());
|
|
7792
7792
|
}), this.runtime.scalingController.clearActiveSelectionState({ selection: t }), s.setActiveObject(new e(r, { canvas: s })), s.requestRenderAll();
|
|
7793
7793
|
}
|
|
7794
|
-
},
|
|
7794
|
+
}, Ki = class {
|
|
7795
7795
|
constructor({ editor: e }) {
|
|
7796
7796
|
this.editor = e;
|
|
7797
7797
|
}
|
|
@@ -7943,7 +7943,7 @@ var Bi = class {
|
|
|
7943
7943
|
resolvePaddingForWidth: i
|
|
7944
7944
|
}) : Math.max(1, t, n);
|
|
7945
7945
|
}
|
|
7946
|
-
},
|
|
7946
|
+
}, qi = class e {
|
|
7947
7947
|
constructor({ canvas: e }) {
|
|
7948
7948
|
this.canvas = e, this.textEditingSnapshots = /* @__PURE__ */ new WeakMap(), this.pendingTextUpdates = /* @__PURE__ */ new WeakMap(), this.resizeStartSnapshots = /* @__PURE__ */ new Map(), this.pendingResizeUpdates = /* @__PURE__ */ new WeakMap();
|
|
7949
7949
|
}
|
|
@@ -8139,7 +8139,7 @@ var Bi = class {
|
|
|
8139
8139
|
}
|
|
8140
8140
|
}), ee;
|
|
8141
8141
|
}
|
|
8142
|
-
},
|
|
8142
|
+
}, Ji = .01, Yi = ({ textbox: e }) => {
|
|
8143
8143
|
let t = e.text ?? "";
|
|
8144
8144
|
if (!t.length) return [];
|
|
8145
8145
|
let n = t.split("\n"), r = [], i = 0;
|
|
@@ -8151,7 +8151,7 @@ var Bi = class {
|
|
|
8151
8151
|
});
|
|
8152
8152
|
}
|
|
8153
8153
|
return r;
|
|
8154
|
-
},
|
|
8154
|
+
}, Xi = ({ range: e, text: t }) => {
|
|
8155
8155
|
if (!e) return null;
|
|
8156
8156
|
let n = t.length;
|
|
8157
8157
|
if (n <= 0) return null;
|
|
@@ -8160,8 +8160,8 @@ var Bi = class {
|
|
|
8160
8160
|
start: l,
|
|
8161
8161
|
end: u
|
|
8162
8162
|
};
|
|
8163
|
-
},
|
|
8164
|
-
let n =
|
|
8163
|
+
}, Zi = ({ textbox: e, range: t }) => {
|
|
8164
|
+
let n = Yi({ textbox: e });
|
|
8165
8165
|
if (!n.length) return t;
|
|
8166
8166
|
let { start: r } = t, { end: i } = t;
|
|
8167
8167
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -8174,7 +8174,7 @@ var Bi = class {
|
|
|
8174
8174
|
start: r,
|
|
8175
8175
|
end: i
|
|
8176
8176
|
};
|
|
8177
|
-
},
|
|
8177
|
+
}, Qi = ({ textbox: e, range: t }) => {
|
|
8178
8178
|
let n = e.text ?? "";
|
|
8179
8179
|
if (!n.length) return [];
|
|
8180
8180
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -8183,7 +8183,7 @@ var Bi = class {
|
|
|
8183
8183
|
i > n && r < c && o.push(e), s = c + 1;
|
|
8184
8184
|
}
|
|
8185
8185
|
return o;
|
|
8186
|
-
},
|
|
8186
|
+
}, $i = ({ textbox: e, range: t }) => {
|
|
8187
8187
|
let n = e.text ?? "";
|
|
8188
8188
|
if (!n.length) return [];
|
|
8189
8189
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -8192,21 +8192,21 @@ var Bi = class {
|
|
|
8192
8192
|
r <= n && i >= c && o.push(e), s = c + 1;
|
|
8193
8193
|
}
|
|
8194
8194
|
return o;
|
|
8195
|
-
},
|
|
8195
|
+
}, ea = ({ previous: e, next: t }) => {
|
|
8196
8196
|
let n = Math.min(e.length, t.length);
|
|
8197
8197
|
for (let r = 0; r < n; r += 1) if (e[r] !== t[r]) return r;
|
|
8198
8198
|
return n;
|
|
8199
|
-
},
|
|
8199
|
+
}, ta = ({ text: e, charIndex: t }) => {
|
|
8200
8200
|
let n = Math.max(0, Math.min(t, e.length)), r = 0;
|
|
8201
8201
|
for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1);
|
|
8202
8202
|
return r;
|
|
8203
|
-
},
|
|
8203
|
+
}, na = ({ text: e, lineIndex: t }) => {
|
|
8204
8204
|
if (t <= 0) return 0;
|
|
8205
8205
|
let n = 0;
|
|
8206
8206
|
for (let r = 0; r < e.length; r += 1) if (e[r] === "\n" && (n += 1, n === t)) return r + 1;
|
|
8207
8207
|
return e.length;
|
|
8208
|
-
},
|
|
8209
|
-
let a =
|
|
8208
|
+
}, ra = ({ deltaLines: e, diffIndex: t, lineFontDefaults: n, lineIndexOld: r, previousText: i }) => {
|
|
8209
|
+
let a = na({
|
|
8210
8210
|
text: i,
|
|
8211
8211
|
lineIndex: r
|
|
8212
8212
|
}), o = r + 1;
|
|
@@ -8225,7 +8225,7 @@ var Bi = class {
|
|
|
8225
8225
|
lineFontDefaults: s,
|
|
8226
8226
|
changed: !0
|
|
8227
8227
|
};
|
|
8228
|
-
},
|
|
8228
|
+
}, ia = ({ deltaLines: e, diffIndex: t, lineFontDefaults: n, lineIndexOld: r, previousLines: i, previousText: a }) => {
|
|
8229
8229
|
let o = Math.abs(e), s = r;
|
|
8230
8230
|
a[t] === "\n" && (i[r] ?? "").length > 0 && (s = r + 1);
|
|
8231
8231
|
let c = s + o - 1, l = {}, u = [];
|
|
@@ -8248,7 +8248,7 @@ var Bi = class {
|
|
|
8248
8248
|
lineDefaults: u
|
|
8249
8249
|
}
|
|
8250
8250
|
};
|
|
8251
|
-
},
|
|
8251
|
+
}, aa = ({ lineFontDefaults: e, previousText: t, currentText: n }) => {
|
|
8252
8252
|
if (!e || !Object.keys(e).length) return {
|
|
8253
8253
|
lineFontDefaults: e,
|
|
8254
8254
|
changed: !1
|
|
@@ -8258,20 +8258,20 @@ var Bi = class {
|
|
|
8258
8258
|
lineFontDefaults: e,
|
|
8259
8259
|
changed: !1
|
|
8260
8260
|
};
|
|
8261
|
-
let a =
|
|
8261
|
+
let a = ea({
|
|
8262
8262
|
previous: t,
|
|
8263
8263
|
next: n
|
|
8264
|
-
}), o =
|
|
8264
|
+
}), o = ta({
|
|
8265
8265
|
text: t,
|
|
8266
8266
|
charIndex: a
|
|
8267
8267
|
});
|
|
8268
|
-
return i > 0 ?
|
|
8268
|
+
return i > 0 ? ra({
|
|
8269
8269
|
deltaLines: i,
|
|
8270
8270
|
diffIndex: a,
|
|
8271
8271
|
lineFontDefaults: e,
|
|
8272
8272
|
lineIndexOld: o,
|
|
8273
8273
|
previousText: t
|
|
8274
|
-
}) :
|
|
8274
|
+
}) : ia({
|
|
8275
8275
|
deltaLines: i,
|
|
8276
8276
|
diffIndex: a,
|
|
8277
8277
|
lineFontDefaults: e,
|
|
@@ -8279,10 +8279,10 @@ var Bi = class {
|
|
|
8279
8279
|
previousLines: r,
|
|
8280
8280
|
previousText: t
|
|
8281
8281
|
});
|
|
8282
|
-
},
|
|
8282
|
+
}, oa = ({ lineDefaults: e }) => {
|
|
8283
8283
|
let t = {};
|
|
8284
8284
|
return e.fontFamily !== void 0 && (t.fontFamily = e.fontFamily), e.fontSize !== void 0 && (t.fontSize = e.fontSize), e.fontWeight !== void 0 && (t.fontWeight = e.fontWeight), e.fontStyle !== void 0 && (t.fontStyle = e.fontStyle), e.underline !== void 0 && (t.underline = e.underline), e.linethrough !== void 0 && (t.linethrough = e.linethrough), e.fill !== void 0 && (t.fill = e.fill), e.stroke !== void 0 && (t.stroke = e.stroke), e.strokeWidth !== void 0 && (t.strokeWidth = e.strokeWidth), t;
|
|
8285
|
-
},
|
|
8285
|
+
}, sa = ({ textbox: e, lineIndices: t, updates: n }) => {
|
|
8286
8286
|
if (!t.length) return !1;
|
|
8287
8287
|
let { fill: r, fontFamily: i, fontSize: a, fontStyle: o, fontWeight: s, linethrough: c, stroke: l, strokeWidth: u, underline: d } = n;
|
|
8288
8288
|
if (!(r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0 || s !== void 0 || c !== void 0 || l !== void 0 || u !== void 0 || d !== void 0)) return !1;
|
|
@@ -8294,12 +8294,12 @@ var Bi = class {
|
|
|
8294
8294
|
i !== void 0 && g?.fontFamily !== i && (_.fontFamily = i, v = !0), a !== void 0 && g?.fontSize !== a && (_.fontSize = a, v = !0), s !== void 0 && g?.fontWeight !== s && (_.fontWeight = s, v = !0), o !== void 0 && g?.fontStyle !== o && (_.fontStyle = o, v = !0), d !== void 0 && g?.underline !== d && (_.underline = d, v = !0), c !== void 0 && g?.linethrough !== c && (_.linethrough = c, v = !0), r !== void 0 && g?.fill !== r && (_.fill = r, v = !0), l !== void 0 && (l === null && g?.stroke !== void 0 && (delete _.stroke, v = !0), l !== null && g?.stroke !== l && (_.stroke = l, v = !0)), u !== void 0 && g?.strokeWidth !== u && (_.strokeWidth = u, v = !0), v && (h ||= (p = { ...p }, !0), p[n] = _, m = !0);
|
|
8295
8295
|
}
|
|
8296
8296
|
return m && (e.lineFontDefaults = p), m;
|
|
8297
|
-
},
|
|
8297
|
+
}, ca = ({ lineStyles: e, lineDefaults: t }) => {
|
|
8298
8298
|
if (!e) return {
|
|
8299
8299
|
lineStyles: e,
|
|
8300
8300
|
changed: !1
|
|
8301
8301
|
};
|
|
8302
|
-
let n =
|
|
8302
|
+
let n = oa({ lineDefaults: t }), r = Object.keys(n);
|
|
8303
8303
|
if (!r.length) return {
|
|
8304
8304
|
lineStyles: e,
|
|
8305
8305
|
changed: !1
|
|
@@ -8323,7 +8323,7 @@ var Bi = class {
|
|
|
8323
8323
|
lineStyles: e,
|
|
8324
8324
|
changed: !1
|
|
8325
8325
|
};
|
|
8326
|
-
},
|
|
8326
|
+
}, la = ({ cleanup: e, lineCount: t, styles: n }) => {
|
|
8327
8327
|
if (!e) return {
|
|
8328
8328
|
styles: n,
|
|
8329
8329
|
changed: !1
|
|
@@ -8343,7 +8343,7 @@ var Bi = class {
|
|
|
8343
8343
|
for (let t = 0; t < e.lineDefaults.length; t += 1) {
|
|
8344
8344
|
let n = e.lineDefaults[t];
|
|
8345
8345
|
if (!n) continue;
|
|
8346
|
-
let a =
|
|
8346
|
+
let a = ca({
|
|
8347
8347
|
lineStyles: r,
|
|
8348
8348
|
lineDefaults: n
|
|
8349
8349
|
});
|
|
@@ -8358,19 +8358,19 @@ var Bi = class {
|
|
|
8358
8358
|
styles: a,
|
|
8359
8359
|
changed: !0
|
|
8360
8360
|
};
|
|
8361
|
-
},
|
|
8361
|
+
}, ua = ({ textbox: e }) => {
|
|
8362
8362
|
let { fontFamily: t, fontSize: n, fontStyle: r, fontWeight: i, fill: a, stroke: o, strokeWidth: s, linethrough: c, underline: l } = e, u = {}, d = typeof a == "string" ? a : void 0, f = typeof o == "string" ? o : void 0;
|
|
8363
8363
|
return t !== void 0 && (u.fontFamily = t), n !== void 0 && (u.fontSize = n), i !== void 0 && (u.fontWeight = i), r !== void 0 && (u.fontStyle = r), l !== void 0 && (u.underline = l), c !== void 0 && (u.linethrough = c), d !== void 0 && (u.fill = d), f !== void 0 && (u.stroke = f), s !== void 0 && (u.strokeWidth = s), u;
|
|
8364
|
-
},
|
|
8364
|
+
}, da = ({ sourceDefaults: e, globalLineDefaults: t }) => {
|
|
8365
8365
|
let n = {};
|
|
8366
8366
|
return e?.fontFamily === void 0 ? t.fontFamily !== void 0 && (n.fontFamily = t.fontFamily) : n.fontFamily = e.fontFamily, e?.fontSize === void 0 ? t.fontSize !== void 0 && (n.fontSize = t.fontSize) : n.fontSize = e.fontSize, e?.fontWeight === void 0 ? t.fontWeight !== void 0 && (n.fontWeight = t.fontWeight) : n.fontWeight = e.fontWeight, e?.fontStyle === void 0 ? t.fontStyle !== void 0 && (n.fontStyle = t.fontStyle) : n.fontStyle = e.fontStyle, e?.underline === void 0 ? t.underline !== void 0 && (n.underline = t.underline) : n.underline = e.underline, e?.linethrough === void 0 ? t.linethrough !== void 0 && (n.linethrough = t.linethrough) : n.linethrough = e.linethrough, e?.fill === void 0 ? t.fill !== void 0 && (n.fill = t.fill) : n.fill = e.fill, e?.stroke === void 0 ? t.stroke !== void 0 && (n.stroke = t.stroke) : n.stroke = e.stroke, e?.strokeWidth === void 0 ? n.stroke !== void 0 && t.strokeWidth !== void 0 && (n.strokeWidth = t.strokeWidth) : n.strokeWidth = e.strokeWidth, n;
|
|
8367
|
-
},
|
|
8367
|
+
}, fa = ({ lineText: e, lineStyles: t, lineDefaults: n }) => {
|
|
8368
8368
|
let r = e.length;
|
|
8369
8369
|
if (r === 0) return {
|
|
8370
8370
|
lineStyles: t,
|
|
8371
8371
|
changed: !1
|
|
8372
8372
|
};
|
|
8373
|
-
let i =
|
|
8373
|
+
let i = oa({ lineDefaults: n }), a = Object.keys(i);
|
|
8374
8374
|
if (!a.length) return {
|
|
8375
8375
|
lineStyles: t,
|
|
8376
8376
|
changed: !1
|
|
@@ -8396,8 +8396,8 @@ var Bi = class {
|
|
|
8396
8396
|
lineStyles: o,
|
|
8397
8397
|
changed: s
|
|
8398
8398
|
};
|
|
8399
|
-
},
|
|
8400
|
-
let a = n, o = !1, s = !1, c = i, l = !1, u = !1, d, f =
|
|
8399
|
+
}, pa = ({ deletedLineDefaultsCleanup: e, globalLineDefaults: t, lineFontDefaults: n, lines: r, styles: i }) => {
|
|
8400
|
+
let a = n, o = !1, s = !1, c = i, l = !1, u = !1, d, f = la({
|
|
8401
8401
|
styles: c ?? {},
|
|
8402
8402
|
lineCount: r.length,
|
|
8403
8403
|
cleanup: e
|
|
@@ -8408,7 +8408,7 @@ var Bi = class {
|
|
|
8408
8408
|
if (i && (d = i), n.length !== 0) {
|
|
8409
8409
|
let t = i;
|
|
8410
8410
|
if (!t && d && (t = { ...d }, a || (a = {}, s = !0), s ||= (a = { ...a }, !0), a[e] = t, o = !0), t) {
|
|
8411
|
-
let r =
|
|
8411
|
+
let r = fa({
|
|
8412
8412
|
lineText: n,
|
|
8413
8413
|
lineStyles: c ? c[e] : void 0,
|
|
8414
8414
|
lineDefaults: t
|
|
@@ -8417,12 +8417,12 @@ var Bi = class {
|
|
|
8417
8417
|
}
|
|
8418
8418
|
continue;
|
|
8419
8419
|
}
|
|
8420
|
-
let f =
|
|
8420
|
+
let f = da({
|
|
8421
8421
|
sourceDefaults: i ?? d,
|
|
8422
8422
|
globalLineDefaults: t
|
|
8423
8423
|
});
|
|
8424
8424
|
!i && Object.keys(f).length && (a || (a = {}, s = !0), s ||= (a = { ...a }, !0), a[e] = f, o = !0, d = f), i && (d = i);
|
|
8425
|
-
let p =
|
|
8425
|
+
let p = oa({ lineDefaults: f }), m = Object.keys(p).length > 0;
|
|
8426
8426
|
(m || c && c[e]) && (c || (c = {}, u = !0), u ||= (c = { ...c }, !0), m && (c[e] = { 0: p }), !m && c[e] && delete c[e], l = !0);
|
|
8427
8427
|
}
|
|
8428
8428
|
return {
|
|
@@ -8432,8 +8432,8 @@ var Bi = class {
|
|
|
8432
8432
|
stylesChanged: l
|
|
8433
8433
|
};
|
|
8434
8434
|
};
|
|
8435
|
-
function
|
|
8436
|
-
let t = (e.text ?? "").split("\n"), n =
|
|
8435
|
+
function ma({ textbox: e }) {
|
|
8436
|
+
let t = (e.text ?? "").split("\n"), n = ua({ textbox: e }), r = pa({
|
|
8437
8437
|
lines: t,
|
|
8438
8438
|
styles: e.styles,
|
|
8439
8439
|
lineFontDefaults: e.lineFontDefaults,
|
|
@@ -8445,7 +8445,7 @@ function pa({ textbox: e }) {
|
|
|
8445
8445
|
if (!Number.isInteger(t) || t < 0) continue;
|
|
8446
8446
|
let o = r.styles[e];
|
|
8447
8447
|
if (!o) continue;
|
|
8448
|
-
let s =
|
|
8448
|
+
let s = ca({
|
|
8449
8449
|
lineStyles: o,
|
|
8450
8450
|
lineDefaults: i?.[t] ?? n
|
|
8451
8451
|
});
|
|
@@ -8456,31 +8456,31 @@ function pa({ textbox: e }) {
|
|
|
8456
8456
|
styles: a
|
|
8457
8457
|
};
|
|
8458
8458
|
}
|
|
8459
|
-
var
|
|
8460
|
-
let r =
|
|
8459
|
+
var ha = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
8460
|
+
let r = aa({
|
|
8461
8461
|
lineFontDefaults: n.lineFontDefaults,
|
|
8462
8462
|
previousText: t,
|
|
8463
8463
|
currentText: e
|
|
8464
|
-
}), i =
|
|
8464
|
+
}), i = pa({
|
|
8465
8465
|
lines: e.split("\n"),
|
|
8466
8466
|
styles: n.styles,
|
|
8467
8467
|
lineFontDefaults: r.lineFontDefaults,
|
|
8468
8468
|
deletedLineDefaultsCleanup: r.deletedLineDefaultsCleanup,
|
|
8469
|
-
globalLineDefaults:
|
|
8469
|
+
globalLineDefaults: ua({ textbox: n })
|
|
8470
8470
|
});
|
|
8471
8471
|
return {
|
|
8472
8472
|
...i,
|
|
8473
8473
|
lineFontDefaultsChanged: r.changed || i.lineFontDefaultsChanged
|
|
8474
8474
|
};
|
|
8475
|
-
},
|
|
8476
|
-
let t =
|
|
8475
|
+
}, ga = ({ textbox: e }) => {
|
|
8476
|
+
let t = pa({
|
|
8477
8477
|
lines: (e.text ?? "").split("\n"),
|
|
8478
8478
|
styles: e.styles,
|
|
8479
8479
|
lineFontDefaults: e.lineFontDefaults,
|
|
8480
|
-
globalLineDefaults:
|
|
8480
|
+
globalLineDefaults: ua({ textbox: e })
|
|
8481
8481
|
}), n = !1;
|
|
8482
8482
|
return t.lineFontDefaultsChanged && (e.lineFontDefaults = t.lineFontDefaults, n = !0), t.stylesChanged && (e.styles = t.styles, e.dirty = !0, n = !0), n;
|
|
8483
|
-
},
|
|
8483
|
+
}, _a = ({ lineFontDefaults: e }) => {
|
|
8484
8484
|
if (!e) return;
|
|
8485
8485
|
let t = {};
|
|
8486
8486
|
for (let n in e) {
|
|
@@ -8491,7 +8491,7 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8491
8491
|
i && (t[r] = { ...i });
|
|
8492
8492
|
}
|
|
8493
8493
|
return t;
|
|
8494
|
-
},
|
|
8494
|
+
}, va = ({ lineFontDefaults: e, scale: t }) => {
|
|
8495
8495
|
if (!e || !Number.isFinite(t) || Math.abs(t - 1) < .01) return;
|
|
8496
8496
|
let n = {}, r = !1, i = !1;
|
|
8497
8497
|
for (let a in e) {
|
|
@@ -8508,18 +8508,18 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8508
8508
|
n[o] = c, r = !0;
|
|
8509
8509
|
}
|
|
8510
8510
|
if (!(!r || !i)) return n;
|
|
8511
|
-
},
|
|
8511
|
+
}, ya = ({ textbox: e, text: t }) => {
|
|
8512
8512
|
let { textLines: n } = e, r = Array.isArray(n) && n.length > 0 ? n.length : Math.max(t.split("\n").length, 1), i = 0;
|
|
8513
8513
|
for (let t = 0; t < r; t += 1) {
|
|
8514
8514
|
let n = e.getLineWidth(t);
|
|
8515
8515
|
n > i && (i = n);
|
|
8516
8516
|
}
|
|
8517
8517
|
return i;
|
|
8518
|
-
},
|
|
8519
|
-
let r = e.width ?? e.calcTextWidth() ?? 0, i = e.height ?? e.calcTextHeight() ?? 0, a = e.paddingTop ?? 0, o = e.paddingRight ?? 0, s = e.paddingBottom ?? 0, c = e.paddingLeft ?? 0, l = -r / 2 + (c - o) / 2, u = -i / 2 + (a - s) / 2, d = new m(l +
|
|
8518
|
+
}, ba = ({ origin: e, size: t }) => e === "left" || e === "top" || e === 0 ? 0 : e === "right" || e === "bottom" || e === 1 ? t : t / 2, xa = ({ textbox: e, originX: t = e.originX ?? "center", originY: n = e.originY ?? "center" }) => {
|
|
8519
|
+
let r = e.width ?? e.calcTextWidth() ?? 0, i = e.height ?? e.calcTextHeight() ?? 0, a = e.paddingTop ?? 0, o = e.paddingRight ?? 0, s = e.paddingBottom ?? 0, c = e.paddingLeft ?? 0, l = -r / 2 + (c - o) / 2, u = -i / 2 + (a - s) / 2, d = new m(l + ba({
|
|
8520
8520
|
origin: t,
|
|
8521
8521
|
size: r
|
|
8522
|
-
}), u +
|
|
8522
|
+
}), u + ba({
|
|
8523
8523
|
origin: n,
|
|
8524
8524
|
size: i
|
|
8525
8525
|
})), f = e.getPointByOrigin("center", "center"), p = e, h = typeof p.calcTransformMatrix == "function" ? p.calcTransformMatrix() : null, g = Array.isArray(h) ? new m(d.x * h[0] + d.y * h[2] + f.x, d.x * h[1] + d.y * h[3] + f.y) : new m(f.x + d.x, f.y + d.y);
|
|
@@ -8529,13 +8529,13 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8529
8529
|
originX: t,
|
|
8530
8530
|
originY: n
|
|
8531
8531
|
};
|
|
8532
|
-
},
|
|
8532
|
+
}, Sa = ({ textbox: e, montageLeft: t, montageRight: n }) => {
|
|
8533
8533
|
e.setCoords();
|
|
8534
8534
|
let r = e.getBoundingRect(), i = r.left ?? 0, a = i + (r.width ?? 0), o = n - t;
|
|
8535
8535
|
if (o > 0 && (r.width ?? 0) >= o - .01) return !1;
|
|
8536
8536
|
let s = 0;
|
|
8537
8537
|
return i < t ? s = t - i : a > n && (s = n - a), Math.abs(s) <= .01 ? !1 : (e.set({ left: (e.left ?? 0) + s }), !0);
|
|
8538
|
-
},
|
|
8538
|
+
}, Ca = ({ rawValue: e, calculatedValue: t }) => typeof e == "number" ? e : typeof t == "number" ? t : 0, wa = ({ stylesList: e }) => {
|
|
8539
8539
|
let t = e.length;
|
|
8540
8540
|
if (!t) return !1;
|
|
8541
8541
|
for (let n = 0; n < t; n += 1) {
|
|
@@ -8545,19 +8545,19 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8545
8545
|
if (r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0 || s !== void 0 || c !== void 0) return !0;
|
|
8546
8546
|
}
|
|
8547
8547
|
return !1;
|
|
8548
|
-
},
|
|
8549
|
-
let { width: t, height: n, calcTextWidth: r, calcTextHeight: i } = e, a = typeof r == "function" ? r.call(e) : void 0, o = typeof i == "function" ? i.call(e) : void 0, s =
|
|
8548
|
+
}, Ta = ({ textbox: e }) => {
|
|
8549
|
+
let { width: t, height: n, calcTextWidth: r, calcTextHeight: i } = e, a = typeof r == "function" ? r.call(e) : void 0, o = typeof i == "function" ? i.call(e) : void 0, s = Ca({
|
|
8550
8550
|
rawValue: t,
|
|
8551
8551
|
calculatedValue: a
|
|
8552
|
-
}), c =
|
|
8552
|
+
}), c = Ca({
|
|
8553
8553
|
rawValue: n,
|
|
8554
8554
|
calculatedValue: o
|
|
8555
8555
|
}), l = Number.isFinite(s) ? Math.round(s) : null, u = Number.isFinite(c) ? Math.round(c) : null, d = {};
|
|
8556
8556
|
return l !== null && l !== s && (d.width = Math.max(0, l)), u !== null && u !== c && (d.height = Math.max(0, u)), Object.keys(d).length ? (e.set(d), !0) : !1;
|
|
8557
|
-
},
|
|
8557
|
+
}, Ea = ({ text: e }) => Math.max((typeof e == "string" ? e : "").split("\n").length, 1), Da = ({ textbox: e, fallbackLineCount: t }) => {
|
|
8558
8558
|
let { textLines: n } = e;
|
|
8559
8559
|
return Array.isArray(n) && n.length > 0 ? n.length : t;
|
|
8560
|
-
},
|
|
8560
|
+
}, Oa = ({ textbox: e, shouldRoundDimensions: t }) => {
|
|
8561
8561
|
let n = e.shouldRoundDimensionsOnInit;
|
|
8562
8562
|
e.shouldRoundDimensionsOnInit = t;
|
|
8563
8563
|
try {
|
|
@@ -8565,35 +8565,35 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8565
8565
|
} finally {
|
|
8566
8566
|
e.shouldRoundDimensionsOnInit = n;
|
|
8567
8567
|
}
|
|
8568
|
-
},
|
|
8568
|
+
}, ka = ({ textbox: e, canvasManager: t }) => {
|
|
8569
8569
|
let { width: n } = t.getMontageAreaSceneBounds(), r = Math.abs(e.scaleX ?? 1) || 1, i = e.paddingLeft ?? 0, a = e.paddingRight ?? 0, o = e.strokeWidth ?? 0;
|
|
8570
8570
|
return Math.max(1, n / r - i - a - o);
|
|
8571
|
-
},
|
|
8571
|
+
}, Aa = ({ textbox: e, canvasManager: t, base: n, committedWidth: r, shouldScaleFontSize: i, shouldRoundDimensions: a }) => {
|
|
8572
8572
|
if (!i || e.autoExpand === !1) return;
|
|
8573
|
-
let o = n.explicitLineCount ??
|
|
8574
|
-
if ((n.renderedLineCount ?? o) > o ||
|
|
8573
|
+
let o = n.explicitLineCount ?? Ea({ text: e.text });
|
|
8574
|
+
if ((n.renderedLineCount ?? o) > o || Da({
|
|
8575
8575
|
textbox: e,
|
|
8576
8576
|
fallbackLineCount: o
|
|
8577
8577
|
}) <= o) return;
|
|
8578
|
-
let s = e.width ?? r, c =
|
|
8578
|
+
let s = e.width ?? r, c = ka({
|
|
8579
8579
|
textbox: e,
|
|
8580
8580
|
canvasManager: t
|
|
8581
8581
|
});
|
|
8582
8582
|
if (c <= s + .01) return;
|
|
8583
|
-
e.set({ width: c }),
|
|
8583
|
+
e.set({ width: c }), Oa({
|
|
8584
8584
|
textbox: e,
|
|
8585
8585
|
shouldRoundDimensions: a
|
|
8586
8586
|
});
|
|
8587
|
-
let l = typeof e.text == "string" ? e.text : "", u = Math.min(c, Math.max(s, Math.ceil(
|
|
8587
|
+
let l = typeof e.text == "string" ? e.text : "", u = Math.min(c, Math.max(s, Math.ceil(ya({
|
|
8588
8588
|
textbox: e,
|
|
8589
8589
|
text: l
|
|
8590
8590
|
}))));
|
|
8591
|
-
e.set({ width: u }),
|
|
8591
|
+
e.set({ width: u }), Oa({
|
|
8592
8592
|
textbox: e,
|
|
8593
8593
|
shouldRoundDimensions: a
|
|
8594
8594
|
});
|
|
8595
|
-
},
|
|
8596
|
-
let t = e.width ?? e.calcTextWidth(), n = e.fontSize ?? 16, r =
|
|
8595
|
+
}, ja = ({ textbox: e }) => {
|
|
8596
|
+
let t = e.width ?? e.calcTextWidth(), n = e.fontSize ?? 16, r = Ea({ text: e.text }), i = Da({
|
|
8597
8597
|
textbox: e,
|
|
8598
8598
|
fallbackLineCount: r
|
|
8599
8599
|
}), { styles: a = {} } = e, { lineFontDefaults: o } = e, { paddingTop: s = 0, paddingRight: c = 0, paddingBottom: l = 0, paddingLeft: u = 0 } = e, { radiusTopLeft: d = 0, radiusTopRight: f = 0, radiusBottomRight: p = 0, radiusBottomLeft: m = 0 } = e;
|
|
@@ -8615,9 +8615,9 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8615
8615
|
bottomLeft: m
|
|
8616
8616
|
},
|
|
8617
8617
|
styles: JSON.parse(JSON.stringify(a)),
|
|
8618
|
-
lineFontDefaults:
|
|
8618
|
+
lineFontDefaults: _a({ lineFontDefaults: o })
|
|
8619
8619
|
};
|
|
8620
|
-
},
|
|
8620
|
+
}, Ma = ({ base: e }) => {
|
|
8621
8621
|
let t = 1 / Math.max(1, e.width), n = [e.fontSize];
|
|
8622
8622
|
Object.values(e.styles).forEach((e) => {
|
|
8623
8623
|
Object.values(e).forEach((e) => {
|
|
@@ -8634,7 +8634,7 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8634
8634
|
fontScale: r,
|
|
8635
8635
|
proportionalScale: Math.max(t, r)
|
|
8636
8636
|
};
|
|
8637
|
-
},
|
|
8637
|
+
}, Na = ({ textbox: e, base: t, scale: n, shouldScaleFontSize: r = !0, shouldScalePadding: i = !0, shouldScaleRadii: a = !0 }) => {
|
|
8638
8638
|
let { fontSize: o, padding: s, radii: c, styles: l, lineFontDefaults: u } = t, d = Math.max(Math.min(8, o), o * n), f = Object.keys(l).length > 0, p;
|
|
8639
8639
|
if (r && f) {
|
|
8640
8640
|
let e = {};
|
|
@@ -8653,7 +8653,7 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8653
8653
|
}), Object.keys(e).length && (p = e);
|
|
8654
8654
|
}
|
|
8655
8655
|
let m;
|
|
8656
|
-
r && (m =
|
|
8656
|
+
r && (m = va({
|
|
8657
8657
|
lineFontDefaults: u,
|
|
8658
8658
|
scale: n
|
|
8659
8659
|
}));
|
|
@@ -8679,9 +8679,9 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8679
8679
|
radiusBottomRight: g.bottomRight,
|
|
8680
8680
|
radiusBottomLeft: g.bottomLeft
|
|
8681
8681
|
});
|
|
8682
|
-
},
|
|
8683
|
-
let { width: f } = n, p = Math.max(1, f * r), h = d ? Math.max(1, Math.round(p)) : p, g = e.width ?? f, _ = Math.abs(h - g) >
|
|
8684
|
-
u && _ && (e.autoExpand = !1),
|
|
8682
|
+
}, Pa = ({ textbox: e, canvasManager: t, base: n, widthScale: r, heightScale: i, placement: a, anchorPlacement: o, shouldScaleFontSize: s, shouldScalePadding: c, shouldScaleRadii: l, shouldDisableAutoExpandOnHorizontalChange: u = !1, shouldRoundDimensions: d = !0 }) => {
|
|
8683
|
+
let { width: f } = n, p = Math.max(1, f * r), h = d ? Math.max(1, Math.round(p)) : p, g = e.width ?? f, _ = Math.abs(h - g) > Ji;
|
|
8684
|
+
u && _ && (e.autoExpand = !1), Na({
|
|
8685
8685
|
textbox: e,
|
|
8686
8686
|
base: n,
|
|
8687
8687
|
scale: i,
|
|
@@ -8692,10 +8692,10 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8692
8692
|
width: h,
|
|
8693
8693
|
scaleX: 1,
|
|
8694
8694
|
scaleY: 1
|
|
8695
|
-
}),
|
|
8695
|
+
}), Oa({
|
|
8696
8696
|
textbox: e,
|
|
8697
8697
|
shouldRoundDimensions: d
|
|
8698
|
-
}),
|
|
8698
|
+
}), Aa({
|
|
8699
8699
|
textbox: e,
|
|
8700
8700
|
canvasManager: t,
|
|
8701
8701
|
base: n,
|
|
@@ -8703,7 +8703,7 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8703
8703
|
shouldScaleFontSize: s,
|
|
8704
8704
|
shouldRoundDimensions: d
|
|
8705
8705
|
});
|
|
8706
|
-
let v = d ?
|
|
8706
|
+
let v = d ? Ta({ textbox: e }) : !1;
|
|
8707
8707
|
return v && (e.dirty = !0), o ? (e.set({
|
|
8708
8708
|
originX: a.originX,
|
|
8709
8709
|
originY: a.originY
|
|
@@ -8720,7 +8720,7 @@ var ma = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8720
8720
|
};
|
|
8721
8721
|
//#endregion
|
|
8722
8722
|
//#region src/editor/shape-manager/mutation/shape-rehydration.ts
|
|
8723
|
-
function
|
|
8723
|
+
function Fa({ group: e }) {
|
|
8724
8724
|
let t = Math.abs(e.scaleX ?? 1) || 1, n = Math.abs(e.scaleY ?? 1) || 1, r = Math.max(1, e.shapeBaseWidth ?? e.width ?? 1), i = Math.max(1, e.shapeBaseHeight ?? e.height ?? 1);
|
|
8725
8725
|
return {
|
|
8726
8726
|
currentDimensions: {
|
|
@@ -8737,17 +8737,17 @@ function Pa({ group: e }) {
|
|
|
8737
8737
|
}
|
|
8738
8738
|
};
|
|
8739
8739
|
}
|
|
8740
|
-
function
|
|
8740
|
+
function Ia({ group: e, text: t, textScale: n }) {
|
|
8741
8741
|
let r = Number.isFinite(n) && n > 0 ? n : 1;
|
|
8742
|
-
Math.abs(r - 1) <= 1e-4 || (
|
|
8742
|
+
Math.abs(r - 1) <= 1e-4 || (Na({
|
|
8743
8743
|
textbox: t,
|
|
8744
|
-
base:
|
|
8744
|
+
base: ja({ textbox: t }),
|
|
8745
8745
|
scale: r
|
|
8746
8746
|
}), e.shapePaddingTop = Math.max(0, (e.shapePaddingTop ?? 0) * r), e.shapePaddingRight = Math.max(0, (e.shapePaddingRight ?? 0) * r), e.shapePaddingBottom = Math.max(0, (e.shapePaddingBottom ?? 0) * r), e.shapePaddingLeft = Math.max(0, (e.shapePaddingLeft ?? 0) * r));
|
|
8747
8747
|
}
|
|
8748
8748
|
//#endregion
|
|
8749
8749
|
//#region src/editor/shape-manager/mutation/shape-update-pipeline.ts
|
|
8750
|
-
var
|
|
8750
|
+
var La = {
|
|
8751
8751
|
angle: 0,
|
|
8752
8752
|
skewX: 0,
|
|
8753
8753
|
skewY: 0,
|
|
@@ -8760,7 +8760,7 @@ var Ia = {
|
|
|
8760
8760
|
top: 0,
|
|
8761
8761
|
originX: "left",
|
|
8762
8762
|
originY: "top"
|
|
8763
|
-
},
|
|
8763
|
+
}, Ra = class {
|
|
8764
8764
|
constructor({ runtime: e }) {
|
|
8765
8765
|
this.runtime = e;
|
|
8766
8766
|
}
|
|
@@ -9058,7 +9058,7 @@ var Ia = {
|
|
|
9058
9058
|
width: Math.max(1, e.width ?? t),
|
|
9059
9059
|
align: n
|
|
9060
9060
|
});
|
|
9061
|
-
return s.set(
|
|
9061
|
+
return s.set(La), this.runtime.applyTextUpdates({
|
|
9062
9062
|
textNode: s,
|
|
9063
9063
|
text: r,
|
|
9064
9064
|
textStyle: i,
|
|
@@ -9120,9 +9120,9 @@ var Ia = {
|
|
|
9120
9120
|
shouldPreserveCurrentWidth: r
|
|
9121
9121
|
};
|
|
9122
9122
|
}
|
|
9123
|
-
},
|
|
9123
|
+
}, za = class {
|
|
9124
9124
|
constructor({ runtime: e }) {
|
|
9125
|
-
this.runtime = e, this.updatePipeline = new
|
|
9125
|
+
this.runtime = e, this.updatePipeline = new Ra({ runtime: e });
|
|
9126
9126
|
}
|
|
9127
9127
|
async update({ target: e, presetKey: t, options: n = {} } = {}) {
|
|
9128
9128
|
let r = await this.updatePipeline.prepare({
|
|
@@ -9298,8 +9298,8 @@ var Ia = {
|
|
|
9298
9298
|
if (!r) return !1;
|
|
9299
9299
|
let { shape: i, text: a } = V({ group: r });
|
|
9300
9300
|
if (!i || !a) return !1;
|
|
9301
|
-
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } =
|
|
9302
|
-
return
|
|
9301
|
+
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } = Fa({ group: r });
|
|
9302
|
+
return Ia({
|
|
9303
9303
|
group: r,
|
|
9304
9304
|
text: a,
|
|
9305
9305
|
textScale: t
|
|
@@ -9368,7 +9368,7 @@ var Ia = {
|
|
|
9368
9368
|
}
|
|
9369
9369
|
_applyPreparedTextState({ preparedUpdate: e }) {
|
|
9370
9370
|
let { current: t, text: n } = e;
|
|
9371
|
-
this.runtime.detachShapeGroupAutoLayout({ group: t.group }), t.text.set(
|
|
9371
|
+
this.runtime.detachShapeGroupAutoLayout({ group: t.group }), t.text.set(La), this.runtime.applyTextUpdates({
|
|
9372
9372
|
textNode: t.text,
|
|
9373
9373
|
text: n.value,
|
|
9374
9374
|
textStyle: n.style,
|
|
@@ -9422,9 +9422,9 @@ var Ia = {
|
|
|
9422
9422
|
let { current: t, next: n, layout: r, placement: i } = e;
|
|
9423
9423
|
n.shouldFitReplacementToPreset && (t.group.shapeManualBaseWidth = Math.max(1, t.group.shapeBaseWidth ?? r.width), t.group.shapeManualBaseHeight = Math.max(1, t.group.shapeBaseHeight ?? r.height)), t.text.isEditing && this.runtime.editingPlacements.set(t.group, i);
|
|
9424
9424
|
}
|
|
9425
|
-
},
|
|
9425
|
+
}, Ba = class {
|
|
9426
9426
|
constructor({ editor: e }) {
|
|
9427
|
-
this.editor = e, nt(), this.scalingController = new
|
|
9427
|
+
this.editor = e, nt(), this.scalingController = new Hi({ canvas: e.canvas }), this.editingController = new Ui({ canvas: e.canvas }), this.editingPlacements = /* @__PURE__ */ new WeakMap(), this.lifecycleController = new qi({ canvas: e.canvas }), this.layoutController = new Ki({ editor: this.editor }), this.mutationController = new za({ runtime: {
|
|
9428
9428
|
editor: this.editor,
|
|
9429
9429
|
lifecycleController: this.lifecycleController,
|
|
9430
9430
|
editingPlacements: this.editingPlacements,
|
|
@@ -9448,7 +9448,7 @@ var Ia = {
|
|
|
9448
9448
|
beginMutation: () => this._beginMutation(),
|
|
9449
9449
|
endMutation: (e) => this._endMutation(e),
|
|
9450
9450
|
isOnCanvas: (e) => this._isOnCanvas(e)
|
|
9451
|
-
} }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this.eventController = new
|
|
9451
|
+
} }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this.eventController = new Gi({ runtime: {
|
|
9452
9452
|
editor: this.editor,
|
|
9453
9453
|
scalingController: this.scalingController,
|
|
9454
9454
|
editingController: this.editingController,
|
|
@@ -9982,7 +9982,7 @@ var Ia = {
|
|
|
9982
9982
|
}
|
|
9983
9983
|
return null;
|
|
9984
9984
|
}
|
|
9985
|
-
},
|
|
9985
|
+
}, Va = ({ rootObject: t, enableEvented: n = !0 }) => {
|
|
9986
9986
|
let r = [{
|
|
9987
9987
|
object: t,
|
|
9988
9988
|
enableEvented: n
|
|
@@ -9996,7 +9996,7 @@ var Ia = {
|
|
|
9996
9996
|
enableEvented: o
|
|
9997
9997
|
});
|
|
9998
9998
|
}
|
|
9999
|
-
},
|
|
9999
|
+
}, Ha = class {
|
|
10000
10000
|
constructor({ editor: e }) {
|
|
10001
10001
|
this.editor = e, this.clipboard = null;
|
|
10002
10002
|
}
|
|
@@ -10160,7 +10160,7 @@ var Ia = {
|
|
|
10160
10160
|
if (!n || n.locked) return !1;
|
|
10161
10161
|
try {
|
|
10162
10162
|
let e = await n.clone(Jt);
|
|
10163
|
-
return
|
|
10163
|
+
return Va({ rootObject: e }), e.set({
|
|
10164
10164
|
left: e.left + 10,
|
|
10165
10165
|
top: e.top + 10
|
|
10166
10166
|
}), this._materializeCloneGeometry({ clonedObject: e }), this._addClonedObjectToCanvas(e), t.fire("editor:object-duplicated", {
|
|
@@ -10248,7 +10248,7 @@ var Ia = {
|
|
|
10248
10248
|
if (!this.clipboard) return !1;
|
|
10249
10249
|
try {
|
|
10250
10250
|
let t = await this.clipboard.clone(Jt);
|
|
10251
|
-
return e.discardActiveObject(),
|
|
10251
|
+
return e.discardActiveObject(), Va({ rootObject: t }), t.set({
|
|
10252
10252
|
left: t.left + 10,
|
|
10253
10253
|
top: t.top + 10
|
|
10254
10254
|
}), this._materializeCloneGeometry({ clonedObject: t }), this._addClonedObjectToCanvas(t), e.fire("editor:object-pasted", {
|
|
@@ -10267,7 +10267,7 @@ var Ia = {
|
|
|
10267
10267
|
}), !1;
|
|
10268
10268
|
}
|
|
10269
10269
|
}
|
|
10270
|
-
},
|
|
10270
|
+
}, Ua = class t {
|
|
10271
10271
|
constructor({ editor: e }) {
|
|
10272
10272
|
this.editor = e;
|
|
10273
10273
|
}
|
|
@@ -10332,7 +10332,7 @@ var Ia = {
|
|
|
10332
10332
|
!(n instanceof v) || !n.isEditing || n.exitEditing();
|
|
10333
10333
|
}
|
|
10334
10334
|
}
|
|
10335
|
-
},
|
|
10335
|
+
}, Wa = class {
|
|
10336
10336
|
constructor({ editor: e }) {
|
|
10337
10337
|
this.editor = e;
|
|
10338
10338
|
}
|
|
@@ -10404,7 +10404,7 @@ var Ia = {
|
|
|
10404
10404
|
i.resumeHistory(), n || i.saveState();
|
|
10405
10405
|
}
|
|
10406
10406
|
}
|
|
10407
|
-
},
|
|
10407
|
+
}, Ga = class t {
|
|
10408
10408
|
constructor({ editor: e }) {
|
|
10409
10409
|
this.lastSelection = [], this.isCtrlSelectionBoxActive = !1, this.isSelectionMergeInProgress = !1, this.editor = e, this.selectionKey = this._resolveSelectionKey(), this.handleTextEditingEnteredBound = this._handleTextEditingEntered.bind(this), this.handleTextEditingExitedBound = this._handleTextEditingExited.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.handleSelectionMergeBound = this._handleSelectionMerge.bind(this), this.handleSelectionChangeBound = this._handleSelectionChange.bind(this), this.handleSelectionClearedBound = this._handleSelectionCleared.bind(this), this.handleSelectionBoxStartBound = this._handleSelectionBoxStart.bind(this), this.handleSelectionBoxEndBound = this._handleSelectionBoxEnd.bind(this), this._applySelectionKey({ selectionKey: this.selectionKey }), this._bindEvents();
|
|
10410
10410
|
}
|
|
@@ -10598,7 +10598,7 @@ var Ia = {
|
|
|
10598
10598
|
let { options: e } = this.editor, { selectionKey: t } = e;
|
|
10599
10599
|
return t === void 0 ? ["ctrlKey", "metaKey"] : t;
|
|
10600
10600
|
}
|
|
10601
|
-
},
|
|
10601
|
+
}, Ka = class e {
|
|
10602
10602
|
constructor({ editor: e }) {
|
|
10603
10603
|
this.editor = e;
|
|
10604
10604
|
}
|
|
@@ -10638,7 +10638,7 @@ var Ia = {
|
|
|
10638
10638
|
};
|
|
10639
10639
|
return i.fire("editor:objects-deleted", l), l;
|
|
10640
10640
|
}
|
|
10641
|
-
},
|
|
10641
|
+
}, X = {
|
|
10642
10642
|
IMAGE_MANAGER: {
|
|
10643
10643
|
INVALID_CONTENT_TYPE: "INVALID_CONTENT_TYPE",
|
|
10644
10644
|
INVALID_SOURCE_TYPE: "INVALID_SOURCE_TYPE",
|
|
@@ -10681,7 +10681,7 @@ var Ia = {
|
|
|
10681
10681
|
INVALID_TARGET: "TEMPLATE_INVALID_TARGET",
|
|
10682
10682
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
10683
10683
|
}
|
|
10684
|
-
},
|
|
10684
|
+
}, qa = class e {
|
|
10685
10685
|
constructor({ editor: e }) {
|
|
10686
10686
|
this._buffer = [], this.editor = e;
|
|
10687
10687
|
}
|
|
@@ -10739,9 +10739,9 @@ var Ia = {
|
|
|
10739
10739
|
}), this.editor.canvas.fire("editor:warning", s);
|
|
10740
10740
|
}
|
|
10741
10741
|
static isValidErrorCode(e) {
|
|
10742
|
-
return e ? Object.values(
|
|
10742
|
+
return e ? Object.values(X).some((t) => Object.values(t).includes(e)) : !1;
|
|
10743
10743
|
}
|
|
10744
|
-
},
|
|
10744
|
+
}, Ja = 48, Ya = class e {
|
|
10745
10745
|
constructor({ editor: e }) {
|
|
10746
10746
|
this.currentBounds = null, this.editor = e;
|
|
10747
10747
|
}
|
|
@@ -10845,7 +10845,7 @@ var Ia = {
|
|
|
10845
10845
|
};
|
|
10846
10846
|
}
|
|
10847
10847
|
static _getScrollDistance({ contentSize: e, viewportSize: t }) {
|
|
10848
|
-
let n = Math.max(1, t -
|
|
10848
|
+
let n = Math.max(1, t - Ja * 2);
|
|
10849
10849
|
return Math.max(0, e - n);
|
|
10850
10850
|
}
|
|
10851
10851
|
static _createLockedAxisState({ contentSize: e, current: t, viewportSize: n }) {
|
|
@@ -10877,32 +10877,32 @@ var Ia = {
|
|
|
10877
10877
|
updateBounds() {
|
|
10878
10878
|
this.currentBounds = this.calculatePanBounds();
|
|
10879
10879
|
}
|
|
10880
|
-
},
|
|
10880
|
+
}, Xa = ({ textbox: e }) => {
|
|
10881
10881
|
if (!e.isEditing) return null;
|
|
10882
10882
|
let t = e.selectionStart ?? 0, n = e.selectionEnd ?? t;
|
|
10883
10883
|
return t === n ? null : {
|
|
10884
10884
|
start: Math.min(t, n),
|
|
10885
10885
|
end: Math.max(t, n)
|
|
10886
10886
|
};
|
|
10887
|
-
},
|
|
10887
|
+
}, Za = ({ textbox: e }) => {
|
|
10888
10888
|
let t = e.text?.length ?? 0;
|
|
10889
10889
|
return t <= 0 ? null : {
|
|
10890
10890
|
start: 0,
|
|
10891
10891
|
end: t
|
|
10892
10892
|
};
|
|
10893
|
-
},
|
|
10893
|
+
}, Qa = ({ textbox: e, range: t }) => {
|
|
10894
10894
|
if (!t) return !1;
|
|
10895
10895
|
let n = e.text?.length ?? 0;
|
|
10896
10896
|
return n <= 0 ? !1 : t.start <= 0 && t.end >= n;
|
|
10897
|
-
},
|
|
10897
|
+
}, $a = ({ textbox: e, styles: t, range: n }) => {
|
|
10898
10898
|
if (!t || !Object.keys(t).length) return !1;
|
|
10899
10899
|
let { start: r, end: i } = n;
|
|
10900
10900
|
return i <= r ? !1 : (e.setSelectionStyles(t, r, i), !0);
|
|
10901
|
-
},
|
|
10901
|
+
}, eo = ({ textbox: e, range: t, property: n }) => {
|
|
10902
10902
|
if (!t) return;
|
|
10903
10903
|
let r = e.getSelectionStyles(t.start, t.end, !0);
|
|
10904
10904
|
if (r.length) return r[0]?.[n];
|
|
10905
|
-
},
|
|
10905
|
+
}, to = ({ strokeColor: e, width: t }) => t <= 0 ? null : e ?? "#000000", no = ({ width: e = 0 }) => e ? Math.max(0, e) : 0, ro = ({ value: e }) => typeof e == "string" ? e.toLocaleUpperCase() : "", Z = ({ value: e, min: t, max: n }) => Math.min(Math.max(e, t), n), io = class e extends v {
|
|
10906
10906
|
static {
|
|
10907
10907
|
this.type = "background-textbox";
|
|
10908
10908
|
}
|
|
@@ -10939,7 +10939,7 @@ var Ia = {
|
|
|
10939
10939
|
];
|
|
10940
10940
|
}
|
|
10941
10941
|
constructor(e, t = {}) {
|
|
10942
|
-
if (super(e, t), this.backgroundOpacity = t.backgroundOpacity ?? 1, this.lineFontDefaults = t.lineFontDefaults ?? void 0, this.paddingTop = t.paddingTop ?? 0, this.paddingRight = t.paddingRight ?? 0, this.paddingBottom = t.paddingBottom ?? 0, this.paddingLeft = t.paddingLeft ?? 0, this.radiusTopLeft = t.radiusTopLeft ?? 0, this.radiusTopRight = t.radiusTopRight ?? 0, this.radiusBottomRight = t.radiusBottomRight ?? 0, this.radiusBottomLeft = t.radiusBottomLeft ?? 0,
|
|
10942
|
+
if (super(e, t), this.backgroundOpacity = t.backgroundOpacity ?? 1, this.lineFontDefaults = t.lineFontDefaults ?? void 0, this.paddingTop = t.paddingTop ?? 0, this.paddingRight = t.paddingRight ?? 0, this.paddingBottom = t.paddingBottom ?? 0, this.paddingLeft = t.paddingLeft ?? 0, this.radiusTopLeft = t.radiusTopLeft ?? 0, this.radiusTopRight = t.radiusTopRight ?? 0, this.radiusBottomRight = t.radiusBottomRight ?? 0, this.radiusBottomLeft = t.radiusBottomLeft ?? 0, ga({ textbox: this })) {
|
|
10943
10943
|
this.initDimensions(), this.dirty = !0;
|
|
10944
10944
|
return;
|
|
10945
10945
|
}
|
|
@@ -10978,7 +10978,7 @@ var Ia = {
|
|
|
10978
10978
|
});
|
|
10979
10979
|
}
|
|
10980
10980
|
toObject(e = []) {
|
|
10981
|
-
let t = super.toObject(e), { lineFontDefaults: n, styles: r } =
|
|
10981
|
+
let t = super.toObject(e), { lineFontDefaults: n, styles: r } = ma({ textbox: this });
|
|
10982
10982
|
return {
|
|
10983
10983
|
...t,
|
|
10984
10984
|
backgroundOpacity: this.backgroundOpacity,
|
|
@@ -11046,7 +11046,7 @@ var Ia = {
|
|
|
11046
11046
|
this._removeShadow(e);
|
|
11047
11047
|
}
|
|
11048
11048
|
_getDecorationColorAt(e, t) {
|
|
11049
|
-
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r =
|
|
11049
|
+
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r = no({ width: typeof n == "number" && Number.isFinite(n) ? n : 0 }), i = this.getValueOfPropertyAt(e, t, "stroke"), a = i == null ? null : to({
|
|
11050
11050
|
strokeColor: i,
|
|
11051
11051
|
width: r
|
|
11052
11052
|
});
|
|
@@ -11062,22 +11062,22 @@ var Ia = {
|
|
|
11062
11062
|
_getCornerRadii({ width: e, height: t }) {
|
|
11063
11063
|
let n = e / 2, r = t / 2, i = Math.min(n, r);
|
|
11064
11064
|
return {
|
|
11065
|
-
bottomLeft:
|
|
11065
|
+
bottomLeft: Z({
|
|
11066
11066
|
value: this.radiusBottomLeft ?? 0,
|
|
11067
11067
|
min: 0,
|
|
11068
11068
|
max: i
|
|
11069
11069
|
}),
|
|
11070
|
-
bottomRight:
|
|
11070
|
+
bottomRight: Z({
|
|
11071
11071
|
value: this.radiusBottomRight ?? 0,
|
|
11072
11072
|
min: 0,
|
|
11073
11073
|
max: i
|
|
11074
11074
|
}),
|
|
11075
|
-
topLeft:
|
|
11075
|
+
topLeft: Z({
|
|
11076
11076
|
value: this.radiusTopLeft ?? 0,
|
|
11077
11077
|
min: 0,
|
|
11078
11078
|
max: i
|
|
11079
11079
|
}),
|
|
11080
|
-
topRight:
|
|
11080
|
+
topRight: Z({
|
|
11081
11081
|
value: this.radiusTopRight ?? 0,
|
|
11082
11082
|
min: 0,
|
|
11083
11083
|
max: i
|
|
@@ -11095,7 +11095,7 @@ var Ia = {
|
|
|
11095
11095
|
_getEffectiveBackgroundFill() {
|
|
11096
11096
|
let e = this.backgroundColor;
|
|
11097
11097
|
if (!e) return null;
|
|
11098
|
-
let t =
|
|
11098
|
+
let t = Z({
|
|
11099
11099
|
value: this.backgroundOpacity ?? 1,
|
|
11100
11100
|
min: 0,
|
|
11101
11101
|
max: 1
|
|
@@ -11108,19 +11108,19 @@ var Ia = {
|
|
|
11108
11108
|
return r.setAlpha(t), r.toRgba();
|
|
11109
11109
|
}
|
|
11110
11110
|
static _renderRoundedRect({ ctx: e, height: t, left: n, radii: r, top: i, width: a }) {
|
|
11111
|
-
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f =
|
|
11111
|
+
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f = Z({
|
|
11112
11112
|
value: c,
|
|
11113
11113
|
min: 0,
|
|
11114
11114
|
max: a
|
|
11115
|
-
}), p =
|
|
11115
|
+
}), p = Z({
|
|
11116
11116
|
value: l,
|
|
11117
11117
|
min: 0,
|
|
11118
11118
|
max: a
|
|
11119
|
-
}), m =
|
|
11119
|
+
}), m = Z({
|
|
11120
11120
|
value: u,
|
|
11121
11121
|
min: 0,
|
|
11122
11122
|
max: a
|
|
11123
|
-
}), h =
|
|
11123
|
+
}), h = Z({
|
|
11124
11124
|
value: d,
|
|
11125
11125
|
min: 0,
|
|
11126
11126
|
max: a
|
|
@@ -11197,16 +11197,16 @@ var Ia = {
|
|
|
11197
11197
|
};
|
|
11198
11198
|
}
|
|
11199
11199
|
_createSelectionContext({ textbox: e, currentText: t, selectionRangeOverride: n }) {
|
|
11200
|
-
let r = n === void 0 ?
|
|
11200
|
+
let r = n === void 0 ? Xa({ textbox: e }) : Xi({
|
|
11201
11201
|
text: t,
|
|
11202
11202
|
range: n
|
|
11203
|
-
}), i = r ?
|
|
11203
|
+
}), i = r ? Zi({
|
|
11204
11204
|
textbox: e,
|
|
11205
11205
|
range: r
|
|
11206
|
-
}) : null, a =
|
|
11206
|
+
}) : null, a = Qa({
|
|
11207
11207
|
textbox: e,
|
|
11208
11208
|
range: r
|
|
11209
|
-
}), o =
|
|
11209
|
+
}), o = Qa({
|
|
11210
11210
|
textbox: e,
|
|
11211
11211
|
range: i
|
|
11212
11212
|
}), s = !r || a;
|
|
@@ -11294,17 +11294,17 @@ var Ia = {
|
|
|
11294
11294
|
t.resolvedStrokeColor = i.stroke, t.resolvedStrokeWidth = i.strokeWidth, r.selectionRange && (t.selectionStyles.stroke = i.stroke, t.selectionStyles.strokeWidth = i.strokeWidth), r.shouldUpdateWholeObject && (t.updates.stroke = i.stroke, t.updates.strokeWidth = i.strokeWidth, r.shouldApplyWholeTextStyles && (t.wholeTextStyles.stroke = i.stroke, t.wholeTextStyles.strokeWidth = i.strokeWidth));
|
|
11295
11295
|
}
|
|
11296
11296
|
_resolveStrokeUpdate({ textbox: e, selectionRange: t, strokeColor: n, strokeWidth: r }) {
|
|
11297
|
-
let i = t ?
|
|
11297
|
+
let i = t ? eo({
|
|
11298
11298
|
textbox: e,
|
|
11299
11299
|
range: t,
|
|
11300
11300
|
property: "strokeWidth"
|
|
11301
|
-
}) : void 0, a = t ?
|
|
11301
|
+
}) : void 0, a = t ? eo({
|
|
11302
11302
|
textbox: e,
|
|
11303
11303
|
range: t,
|
|
11304
11304
|
property: "stroke"
|
|
11305
|
-
}) : void 0, o = typeof i == "number" ? i : void 0, s = typeof a == "string" ? a : void 0, c = typeof e.stroke == "string" ? e.stroke : void 0, l =
|
|
11305
|
+
}) : void 0, o = typeof i == "number" ? i : void 0, s = typeof a == "string" ? a : void 0, c = typeof e.stroke == "string" ? e.stroke : void 0, l = no({ width: r ?? o ?? e.strokeWidth ?? 0 });
|
|
11306
11306
|
return {
|
|
11307
|
-
stroke:
|
|
11307
|
+
stroke: to({
|
|
11308
11308
|
strokeColor: n ?? s ?? c,
|
|
11309
11309
|
width: l
|
|
11310
11310
|
}) ?? null,
|
|
@@ -11316,14 +11316,14 @@ var Ia = {
|
|
|
11316
11316
|
}
|
|
11317
11317
|
_applyTextContentUpdate({ textbox: e, style: t, updates: n, currentText: r }) {
|
|
11318
11318
|
let i = e.textCaseRaw ?? r, a = !!e.uppercase, o = t.text !== void 0, s = o ? t.text ?? "" : i, c = t.uppercase ?? a, l = c !== a, u = e.text ?? "";
|
|
11319
|
-
return o || l ? (n.text = c ?
|
|
11319
|
+
return o || l ? (n.text = c ? ro({ value: s }) : s, e.textCaseRaw = s) : e.textCaseRaw === void 0 && (e.textCaseRaw = i), e.uppercase = c, {
|
|
11320
11320
|
hasTextUpdate: o,
|
|
11321
11321
|
uppercaseChanged: l,
|
|
11322
11322
|
previousRenderedText: u
|
|
11323
11323
|
};
|
|
11324
11324
|
}
|
|
11325
11325
|
_resolveContentPlacement({ textbox: e, style: t, updates: n, placement: r, styleMaps: i, contentUpdate: a }) {
|
|
11326
|
-
let o =
|
|
11326
|
+
let o = wa({ stylesList: [
|
|
11327
11327
|
n,
|
|
11328
11328
|
i.selectionStyles,
|
|
11329
11329
|
i.lineSelectionStyles,
|
|
@@ -11339,7 +11339,7 @@ var Ia = {
|
|
|
11339
11339
|
t.paddingBottom,
|
|
11340
11340
|
t.paddingLeft
|
|
11341
11341
|
].some((e) => e !== void 0), l = Object.prototype.hasOwnProperty.call(n, "width");
|
|
11342
|
-
return c && !s && !a.hasTextUpdate && !a.uppercaseChanged && !o && !l ?
|
|
11342
|
+
return c && !s && !a.hasTextUpdate && !a.uppercaseChanged && !o && !l ? xa({
|
|
11343
11343
|
textbox: e,
|
|
11344
11344
|
originX: r.originX,
|
|
11345
11345
|
originY: r.originY
|
|
@@ -11372,24 +11372,24 @@ var Ia = {
|
|
|
11372
11372
|
}
|
|
11373
11373
|
_applyWholeTextStyles({ textbox: e, selection: t, styleMaps: n }) {
|
|
11374
11374
|
if (t.selectionRange || Object.keys(n.wholeTextStyles).length === 0) return;
|
|
11375
|
-
let r =
|
|
11376
|
-
r &&
|
|
11375
|
+
let r = Za({ textbox: e });
|
|
11376
|
+
r && $a({
|
|
11377
11377
|
textbox: e,
|
|
11378
11378
|
styles: n.wholeTextStyles,
|
|
11379
11379
|
range: r
|
|
11380
|
-
}) && (e.dirty = !0,
|
|
11380
|
+
}) && (e.dirty = !0, wa({ stylesList: [n.wholeTextStyles] }) && (e.initDimensions(), e.dirty = !0));
|
|
11381
11381
|
}
|
|
11382
11382
|
_applySelectionStyles({ textbox: e, selection: t, styleMaps: n }) {
|
|
11383
11383
|
if (!t.selectionRange) return;
|
|
11384
|
-
let r =
|
|
11384
|
+
let r = $a({
|
|
11385
11385
|
textbox: e,
|
|
11386
11386
|
styles: n.selectionStyles,
|
|
11387
11387
|
range: t.selectionRange
|
|
11388
|
-
}), i = t.fontSelectionRange ?
|
|
11388
|
+
}), i = t.fontSelectionRange ? $a({
|
|
11389
11389
|
textbox: e,
|
|
11390
11390
|
styles: n.lineSelectionStyles,
|
|
11391
11391
|
range: t.fontSelectionRange
|
|
11392
|
-
}) : !1, a =
|
|
11392
|
+
}) : !1, a = wa({ stylesList: [
|
|
11393
11393
|
n.selectionStyles,
|
|
11394
11394
|
n.lineSelectionStyles,
|
|
11395
11395
|
n.wholeTextStyles
|
|
@@ -11411,9 +11411,9 @@ var Ia = {
|
|
|
11411
11411
|
_applyFontLineDefaultUpdates({ textbox: e, style: t, selection: n }) {
|
|
11412
11412
|
if (!n.fontSelectionRange || t.fontFamily === void 0 && t.fontSize === void 0) return;
|
|
11413
11413
|
let r = {};
|
|
11414
|
-
t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize),
|
|
11414
|
+
t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize), sa({
|
|
11415
11415
|
textbox: e,
|
|
11416
|
-
lineIndices:
|
|
11416
|
+
lineIndices: Qi({
|
|
11417
11417
|
textbox: e,
|
|
11418
11418
|
range: n.fontSelectionRange
|
|
11419
11419
|
}),
|
|
@@ -11423,9 +11423,9 @@ var Ia = {
|
|
|
11423
11423
|
_applyDecorationLineDefaultUpdates({ textbox: e, style: t, selection: n, styleMaps: r }) {
|
|
11424
11424
|
if (!n.selectionRange || !(t.bold !== void 0 || t.italic !== void 0 || t.underline !== void 0 || t.strikethrough !== void 0 || t.color !== void 0 || t.strokeColor !== void 0 || t.strokeWidth !== void 0)) return;
|
|
11425
11425
|
let i = {};
|
|
11426
|
-
r.resolvedFontWeight !== void 0 && (i.fontWeight = r.resolvedFontWeight), r.resolvedFontStyle !== void 0 && (i.fontStyle = r.resolvedFontStyle), t.underline !== void 0 && (i.underline = t.underline), t.strikethrough !== void 0 && (i.linethrough = t.strikethrough), t.color !== void 0 && (i.fill = t.color), (t.strokeColor !== void 0 || t.strokeWidth !== void 0) && (r.resolvedStrokeColor === null && (i.stroke = null), r.resolvedStrokeColor !== null && r.resolvedStrokeColor !== void 0 && (i.stroke = r.resolvedStrokeColor), r.resolvedStrokeWidth !== void 0 && (i.strokeWidth = r.resolvedStrokeWidth)),
|
|
11426
|
+
r.resolvedFontWeight !== void 0 && (i.fontWeight = r.resolvedFontWeight), r.resolvedFontStyle !== void 0 && (i.fontStyle = r.resolvedFontStyle), t.underline !== void 0 && (i.underline = t.underline), t.strikethrough !== void 0 && (i.linethrough = t.strikethrough), t.color !== void 0 && (i.fill = t.color), (t.strokeColor !== void 0 || t.strokeWidth !== void 0) && (r.resolvedStrokeColor === null && (i.stroke = null), r.resolvedStrokeColor !== null && r.resolvedStrokeColor !== void 0 && (i.stroke = r.resolvedStrokeColor), r.resolvedStrokeWidth !== void 0 && (i.strokeWidth = r.resolvedStrokeWidth)), sa({
|
|
11427
11427
|
textbox: e,
|
|
11428
|
-
lineIndices:
|
|
11428
|
+
lineIndices: $i({
|
|
11429
11429
|
textbox: e,
|
|
11430
11430
|
range: n.selectionRange
|
|
11431
11431
|
}),
|
|
@@ -11478,7 +11478,7 @@ var Ia = {
|
|
|
11478
11478
|
return (t.autoExpand ?? e.autoExpand) !== !1 && !Object.prototype.hasOwnProperty.call(n.updates, "width") && r;
|
|
11479
11479
|
}
|
|
11480
11480
|
_shouldRefreshDimensions({ contentUpdate: e, styleMaps: t }) {
|
|
11481
|
-
return e.hasTextUpdate || e.uppercaseChanged ||
|
|
11481
|
+
return e.hasTextUpdate || e.uppercaseChanged || wa({ stylesList: [
|
|
11482
11482
|
t.updates,
|
|
11483
11483
|
t.selectionStyles,
|
|
11484
11484
|
t.lineSelectionStyles,
|
|
@@ -11599,7 +11599,7 @@ var mo = class {
|
|
|
11599
11599
|
}
|
|
11600
11600
|
if (Math.abs(j - r.lastAllowedScaleX) <= uo && Math.abs(M - r.lastAllowedScaleY) <= uo) return;
|
|
11601
11601
|
}
|
|
11602
|
-
let { appliedWidth: N, dimensionsRounded: P } =
|
|
11602
|
+
let { appliedWidth: N, dimensionsRounded: P } = Pa({
|
|
11603
11603
|
textbox: n,
|
|
11604
11604
|
canvasManager: this.canvasManager,
|
|
11605
11605
|
base: r.startBase,
|
|
@@ -11654,7 +11654,7 @@ var mo = class {
|
|
|
11654
11654
|
N = e, P = e;
|
|
11655
11655
|
}
|
|
11656
11656
|
} else l && (N = Math.max(i.minimumWidthScale, i.lastAllowedScaleX * h)), u && (P = Math.max(i.minimumFontScale, i.lastAllowedScaleY * g));
|
|
11657
|
-
let { appliedWidth: te, dimensionsRounded: ne } =
|
|
11657
|
+
let { appliedWidth: te, dimensionsRounded: ne } = Pa({
|
|
11658
11658
|
textbox: n,
|
|
11659
11659
|
canvasManager: this.canvasManager,
|
|
11660
11660
|
base: a,
|
|
@@ -11739,8 +11739,8 @@ var mo = class {
|
|
|
11739
11739
|
if (!fo(e) || po(e)) return !1;
|
|
11740
11740
|
let n = Math.abs(e.scaleX ?? 1) || 1, r = Math.abs(e.scaleY ?? 1) || 1;
|
|
11741
11741
|
if (!(Math.abs(n - 1) > .01 || Math.abs(r - 1) > .01)) return !1;
|
|
11742
|
-
let i =
|
|
11743
|
-
return
|
|
11742
|
+
let i = ja({ textbox: e }), a = this.canvasManager.getObjectPlacement({ object: e });
|
|
11743
|
+
return Pa({
|
|
11744
11744
|
textbox: e,
|
|
11745
11745
|
canvasManager: this.canvasManager,
|
|
11746
11746
|
base: i,
|
|
@@ -11756,7 +11756,7 @@ var mo = class {
|
|
|
11756
11756
|
_ensureScalingState({ textbox: e, transform: t }) {
|
|
11757
11757
|
let n = this.scalingState.get(e);
|
|
11758
11758
|
if (!n) {
|
|
11759
|
-
let r =
|
|
11759
|
+
let r = ja({ textbox: e }), i = this.canvasManager.getObjectPlacement({ object: e }), a = Ma({ base: r }), o = t.original?.originX ?? t.originX ?? e.originX ?? "center", s = t.original?.originY ?? t.originY ?? e.originY ?? "center";
|
|
11760
11760
|
n = {
|
|
11761
11761
|
startBase: r,
|
|
11762
11762
|
startObjectPlacement: i,
|
|
@@ -11789,7 +11789,7 @@ var mo = class {
|
|
|
11789
11789
|
topRight: e.radiusTopRight ?? 0,
|
|
11790
11790
|
bottomRight: e.radiusBottomRight ?? 0,
|
|
11791
11791
|
bottomLeft: e.radiusBottomLeft ?? 0
|
|
11792
|
-
}, v = Math.abs(n - o) >
|
|
11792
|
+
}, v = Math.abs(n - o) > Ji, y = Math.abs(h - r) > Ji, b = Math.abs(g.top - i.top) > .01 || Math.abs(g.right - i.right) > .01 || Math.abs(g.bottom - i.bottom) > .01 || Math.abs(g.left - i.left) > .01, x = Math.abs(_.topLeft - a.topLeft) > .01 || Math.abs(_.topRight - a.topRight) > .01 || Math.abs(_.bottomRight - a.bottomRight) > .01 || Math.abs(_.bottomLeft - a.bottomLeft) > .01, S = t.lastAllowedScaleX, C = t.lastAllowedScaleY;
|
|
11793
11793
|
if (c) {
|
|
11794
11794
|
let e = h / Math.max(1, m);
|
|
11795
11795
|
S = e, C = e;
|
|
@@ -11823,7 +11823,7 @@ var mo = class {
|
|
|
11823
11823
|
if (!e._isTextbox(n)) return;
|
|
11824
11824
|
let r = e._isShapeOwnedTextbox(n), { text: i = "", uppercase: a, autoExpand: o } = n, s = !!a, c = o !== !1, l = i.toLocaleLowerCase(), u = r ? null : this.editingPlacementState?.get(n) ?? this.editor.canvasManager.getObjectPlacement({ object: n });
|
|
11825
11825
|
if (s) {
|
|
11826
|
-
let e =
|
|
11826
|
+
let e = ro({ value: l });
|
|
11827
11827
|
e !== i && n.set({ text: e }), n.textCaseRaw = l;
|
|
11828
11828
|
} else n.textCaseRaw = i;
|
|
11829
11829
|
if (!r && o === void 0 && (n.autoExpand = !0), r) {
|
|
@@ -11842,7 +11842,7 @@ var mo = class {
|
|
|
11842
11842
|
let r = e._isShapeOwnedTextbox(n);
|
|
11843
11843
|
this.editingPlacementState?.delete(n), delete n.__lineDefaultsPrevText;
|
|
11844
11844
|
let i = n.text ?? "";
|
|
11845
|
-
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (
|
|
11845
|
+
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (Ta({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
|
|
11846
11846
|
lockMovementX: !1,
|
|
11847
11847
|
lockMovementY: !1
|
|
11848
11848
|
}));
|
|
@@ -11892,7 +11892,7 @@ var mo = class {
|
|
|
11892
11892
|
addText({ id: t = `background-textbox-${D()}`, text: n = "Новый текст", autoExpand: r = !0, fontFamily: i, fontSize: a = 48, bold: o = !1, italic: s = !1, underline: c = !1, uppercase: l = !1, strikethrough: u = !1, align: d = "left", color: f = "#000000", strokeColor: p, strokeWidth: m = 0, opacity: h = 1, backgroundColor: g, backgroundOpacity: _ = 1, paddingTop: v = 0, paddingRight: y = 0, paddingBottom: b = 0, paddingLeft: x = 0, radiusTopLeft: S = 0, radiusTopRight: C = 0, radiusBottomRight: w = 0, radiusBottomLeft: T = 0, ...E } = {}, { withoutSelection: O = !1, withoutSave: k = !1, withoutAdding: A = !1, emitLifecycleEvents: j = !0 } = {}) {
|
|
11893
11893
|
let { canvasManager: M, historyManager: N } = this.editor, { canvas: P } = this;
|
|
11894
11894
|
N.suspendHistory();
|
|
11895
|
-
let F = i ?? this._getDefaultFontFamily(), ee =
|
|
11895
|
+
let F = i ?? this._getDefaultFontFamily(), ee = no({ width: m }), te = to({
|
|
11896
11896
|
strokeColor: p,
|
|
11897
11897
|
width: ee
|
|
11898
11898
|
}), ne = {
|
|
@@ -11925,10 +11925,10 @@ var mo = class {
|
|
|
11925
11925
|
I.autoExpand = re;
|
|
11926
11926
|
let ie = E.left !== void 0 || E.top !== void 0;
|
|
11927
11927
|
if (I.textCaseRaw = I.text ?? "", l) {
|
|
11928
|
-
let e =
|
|
11928
|
+
let e = ro({ value: I.textCaseRaw });
|
|
11929
11929
|
e !== I.text && I.set({ text: e });
|
|
11930
11930
|
}
|
|
11931
|
-
|
|
11931
|
+
Ta({ textbox: I }) && (I.dirty = !0);
|
|
11932
11932
|
let ae;
|
|
11933
11933
|
ie && (ae = M.resolveObjectPlacement({
|
|
11934
11934
|
object: I,
|
|
@@ -12037,7 +12037,7 @@ var mo = class {
|
|
|
12037
12037
|
let t = e.width ?? 0, n = e.height ?? 0;
|
|
12038
12038
|
e.initDimensions(), o = Math.abs((e.width ?? 0) - t) > .01 || Math.abs((e.height ?? 0) - n) > .01;
|
|
12039
12039
|
}
|
|
12040
|
-
a || (s =
|
|
12040
|
+
a || (s = Ta({ textbox: e }));
|
|
12041
12041
|
let c = !1;
|
|
12042
12042
|
return !a && t && (this.editor.canvasManager.applyObjectPlacement({
|
|
12043
12043
|
object: e,
|
|
@@ -12045,7 +12045,7 @@ var mo = class {
|
|
|
12045
12045
|
}), c = !0), (a || o || s) && (e.dirty = !0), (a || o || s || c) && e.setCoords(), a || o || s;
|
|
12046
12046
|
}
|
|
12047
12047
|
_restoreTextboxContentPlacement({ textbox: e, contentPlacement: t }) {
|
|
12048
|
-
let n =
|
|
12048
|
+
let n = xa({
|
|
12049
12049
|
textbox: e,
|
|
12050
12050
|
originX: t.originX,
|
|
12051
12051
|
originY: t.originY
|
|
@@ -12063,7 +12063,7 @@ var mo = class {
|
|
|
12063
12063
|
e.on("object:scaling", this.scalingController.handleObjectScaling), e.on("object:resizing", this._handleObjectResizing), e.on("object:modified", this.scalingController.handleObjectModified), e.on("mouse:move", this.scalingController.handleMouseMove), e.on("text:editing:entered", this._handleTextEditingEntered), e.on("text:editing:exited", this._handleTextEditingExited), e.on("text:changed", this._handleTextChanged);
|
|
12064
12064
|
}
|
|
12065
12065
|
syncLineStylesWithText({ textbox: e, previousText: t, currentText: n }) {
|
|
12066
|
-
let r = n ?? e.text ?? "", i =
|
|
12066
|
+
let r = n ?? e.text ?? "", i = ha({
|
|
12067
12067
|
textbox: e,
|
|
12068
12068
|
previousText: t ?? e.__lineDefaultsPrevText ?? r,
|
|
12069
12069
|
currentText: r
|
|
@@ -12081,16 +12081,16 @@ var mo = class {
|
|
|
12081
12081
|
if (!Number.isFinite(f) || f <= 0) return !1;
|
|
12082
12082
|
let p = a.split("\n").length, m = !1;
|
|
12083
12083
|
Math.abs((e.width ?? 0) - f) > .01 && (e.set({ width: f }), m = !0), e.initDimensions();
|
|
12084
|
-
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(
|
|
12084
|
+
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(ya({
|
|
12085
12085
|
textbox: e,
|
|
12086
12086
|
text: a
|
|
12087
12087
|
})), v = Math.min(e.minWidth ?? 1, f), y = Math.min(f, Math.max(_, v));
|
|
12088
|
-
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0),
|
|
12088
|
+
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0), Ta({ textbox: e }) && (m = !0), t && r.applyObjectPlacement({
|
|
12089
12089
|
object: e,
|
|
12090
12090
|
placement: t
|
|
12091
12091
|
});
|
|
12092
12092
|
let b = !1;
|
|
12093
|
-
return n && (b =
|
|
12093
|
+
return n && (b = Sa({
|
|
12094
12094
|
textbox: e,
|
|
12095
12095
|
montageLeft: o,
|
|
12096
12096
|
montageRight: o + s
|
|
@@ -12196,7 +12196,7 @@ var mo = class {
|
|
|
12196
12196
|
if (!p.length) return s.emitWarning({
|
|
12197
12197
|
origin: "TemplateManager",
|
|
12198
12198
|
method: "serializeSelection",
|
|
12199
|
-
code:
|
|
12199
|
+
code: X.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
12200
12200
|
message: "Нет объектов для сериализации шаблона"
|
|
12201
12201
|
}), null;
|
|
12202
12202
|
let m = t._getBounds(o), h = t._getMontageSize({
|
|
@@ -12225,14 +12225,14 @@ var mo = class {
|
|
|
12225
12225
|
if (!l?.length) return a.emitWarning({
|
|
12226
12226
|
origin: "TemplateManager",
|
|
12227
12227
|
method: "applyTemplate",
|
|
12228
|
-
code:
|
|
12228
|
+
code: X.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
12229
12229
|
message: "Шаблон не содержит объектов"
|
|
12230
12230
|
}), null;
|
|
12231
12231
|
let f = t._getBounds(r);
|
|
12232
12232
|
if (!f) return a.emitWarning({
|
|
12233
12233
|
origin: "TemplateManager",
|
|
12234
12234
|
method: "applyTemplate",
|
|
12235
|
-
code:
|
|
12235
|
+
code: X.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
12236
12236
|
message: "Не удалось определить границы монтажной области"
|
|
12237
12237
|
}), null;
|
|
12238
12238
|
let p = t._getMontageSize({
|
|
@@ -12256,7 +12256,7 @@ var mo = class {
|
|
|
12256
12256
|
if (!r.length) return a.emitWarning({
|
|
12257
12257
|
origin: "TemplateManager",
|
|
12258
12258
|
method: "applyTemplate",
|
|
12259
|
-
code:
|
|
12259
|
+
code: X.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
12260
12260
|
message: "Не удалось создать объекты шаблона"
|
|
12261
12261
|
}), null;
|
|
12262
12262
|
let { backgroundObject: i, contentObjects: u } = t._extractBackgroundObject(r);
|
|
@@ -12278,7 +12278,7 @@ var mo = class {
|
|
|
12278
12278
|
}), c.commitStandaloneTextScale({ target: e }), s.commitRehydratedShapeLayout({
|
|
12279
12279
|
target: e,
|
|
12280
12280
|
textScale: h
|
|
12281
|
-
}), on({ object: e }),
|
|
12281
|
+
}), on({ object: e }), Va({ rootObject: e }), n.add(e), e));
|
|
12282
12282
|
return !d.length && !v ? null : (_ = d.length > 0 || v, d.length && t._activateObjects({
|
|
12283
12283
|
canvas: n,
|
|
12284
12284
|
objects: d
|
|
@@ -12291,7 +12291,7 @@ var mo = class {
|
|
|
12291
12291
|
return a.emitError({
|
|
12292
12292
|
origin: "TemplateManager",
|
|
12293
12293
|
method: "applyTemplate",
|
|
12294
|
-
code:
|
|
12294
|
+
code: X.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
12295
12295
|
message: "Ошибка применения шаблона",
|
|
12296
12296
|
data: {
|
|
12297
12297
|
templateId: d,
|
|
@@ -12723,7 +12723,7 @@ var mo = class {
|
|
|
12723
12723
|
r.emitWarning({
|
|
12724
12724
|
origin: "TemplateManager",
|
|
12725
12725
|
method: "applyTemplate",
|
|
12726
|
-
code:
|
|
12726
|
+
code: X.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
12727
12727
|
message: "Не удалось применить фон из шаблона",
|
|
12728
12728
|
data: e
|
|
12729
12729
|
});
|
|
@@ -14436,75 +14436,112 @@ function As({ frame: e, scaleX: t = e.scaleX ?? 1, scaleY: n = e.scaleY ?? 1 })
|
|
|
14436
14436
|
}
|
|
14437
14437
|
//#endregion
|
|
14438
14438
|
//#region src/editor/crop-manager/interaction/crop-controls.ts
|
|
14439
|
-
var js = [
|
|
14439
|
+
var js = .001, Ms = [
|
|
14440
14440
|
"tl",
|
|
14441
14441
|
"tr",
|
|
14442
14442
|
"bl",
|
|
14443
14443
|
"br"
|
|
14444
|
-
],
|
|
14444
|
+
], Ns = [
|
|
14445
14445
|
"ml",
|
|
14446
14446
|
"mr",
|
|
14447
14447
|
"mt",
|
|
14448
14448
|
"mb"
|
|
14449
14449
|
];
|
|
14450
|
-
function
|
|
14450
|
+
function Ps({ transform: e }) {
|
|
14451
14451
|
let { originX: t, originY: n } = e;
|
|
14452
14452
|
return (t === "center" || t === .5) && (n === "center" || n === .5);
|
|
14453
14453
|
}
|
|
14454
|
-
function
|
|
14455
|
-
let r = e, { target: i } = r, { scaleX: a = 1, scaleY: o = 1 } = i
|
|
14456
|
-
|
|
14454
|
+
function Fs({ transform: e, x: t, y: n }) {
|
|
14455
|
+
let r = e, { target: i } = r, { scaleX: a = 1, scaleY: o = 1 } = i;
|
|
14456
|
+
if (Rs({
|
|
14457
|
+
transform: r,
|
|
14458
|
+
x: t,
|
|
14459
|
+
y: n
|
|
14460
|
+
})) return zs({ transform: r }), !0;
|
|
14461
|
+
let s = x.getLocalPoint(r, r.originX, r.originY, t, n);
|
|
14462
|
+
return Vs({ transform: r }), Gs({
|
|
14457
14463
|
transform: r,
|
|
14458
14464
|
localPoint: s
|
|
14459
14465
|
}), a !== i.scaleX || o !== i.scaleY;
|
|
14460
14466
|
}
|
|
14461
|
-
function
|
|
14462
|
-
let r = e, { target: i } = r, { scaleX: a = 1, scaleY: o = 1 } = i
|
|
14463
|
-
|
|
14467
|
+
function Is({ transform: e, x: t, y: n }) {
|
|
14468
|
+
let r = e, { target: i } = r, { scaleX: a = 1, scaleY: o = 1 } = i;
|
|
14469
|
+
if (Rs({
|
|
14470
|
+
transform: r,
|
|
14471
|
+
x: t,
|
|
14472
|
+
y: n
|
|
14473
|
+
})) return zs({ transform: r }), !0;
|
|
14474
|
+
let s = x.getLocalPoint(r, r.originX, r.originY, t, n);
|
|
14475
|
+
return Vs({ transform: r }), Js({
|
|
14464
14476
|
transform: r,
|
|
14465
14477
|
localPoint: s
|
|
14466
14478
|
}), a !== i.scaleX || o !== i.scaleY;
|
|
14467
14479
|
}
|
|
14468
|
-
function
|
|
14469
|
-
let i = e, { target: a } = i, o = t === "x" ? a.scaleX ?? 1 : a.scaleY ?? 1
|
|
14470
|
-
|
|
14480
|
+
function Ls({ transform: e, axis: t, x: n, y: r }) {
|
|
14481
|
+
let i = e, { target: a } = i, o = t === "x" ? a.scaleX ?? 1 : a.scaleY ?? 1;
|
|
14482
|
+
if (Rs({
|
|
14483
|
+
transform: i,
|
|
14484
|
+
x: n,
|
|
14485
|
+
y: r
|
|
14486
|
+
})) return Bs({
|
|
14487
|
+
transform: i,
|
|
14488
|
+
axis: t
|
|
14489
|
+
}), !0;
|
|
14490
|
+
let s = x.getLocalPoint(i, i.originX, i.originY, n, r);
|
|
14491
|
+
return Vs({ transform: i }), Ks({
|
|
14471
14492
|
transform: i,
|
|
14472
14493
|
axis: t,
|
|
14473
14494
|
localPoint: s
|
|
14474
14495
|
}), t === "x" ? o !== a.scaleX : o !== a.scaleY;
|
|
14475
14496
|
}
|
|
14476
|
-
function
|
|
14477
|
-
|
|
14497
|
+
function Rs({ transform: e, x: t, y: n }) {
|
|
14498
|
+
return Math.abs(t - e.ex) <= js && Math.abs(n - e.ey) <= js;
|
|
14499
|
+
}
|
|
14500
|
+
function zs({ transform: e }) {
|
|
14501
|
+
e.target.set({
|
|
14502
|
+
scaleX: e.original.scaleX,
|
|
14503
|
+
scaleY: e.original.scaleY
|
|
14504
|
+
});
|
|
14505
|
+
}
|
|
14506
|
+
function Bs({ transform: e, axis: t }) {
|
|
14507
|
+
if (t === "x") {
|
|
14508
|
+
e.target.set("scaleX", e.original.scaleX);
|
|
14509
|
+
return;
|
|
14510
|
+
}
|
|
14511
|
+
e.target.set("scaleY", e.original.scaleY);
|
|
14512
|
+
}
|
|
14513
|
+
function Vs({ transform: e }) {
|
|
14514
|
+
let { signX: t, signY: n } = Hs({ controlKey: e.corner });
|
|
14478
14515
|
e.signX === void 0 && (e.signX = t), e.signY === void 0 && (e.signY = n);
|
|
14479
14516
|
}
|
|
14480
|
-
function
|
|
14517
|
+
function Hs({ controlKey: e }) {
|
|
14481
14518
|
return {
|
|
14482
|
-
signX:
|
|
14483
|
-
signY:
|
|
14519
|
+
signX: Us({ controlKey: e }),
|
|
14520
|
+
signY: Ws({ controlKey: e })
|
|
14484
14521
|
};
|
|
14485
14522
|
}
|
|
14486
|
-
function
|
|
14523
|
+
function Us({ controlKey: e }) {
|
|
14487
14524
|
return e === "tl" || e === "bl" || e === "ml" ? -1 : 1;
|
|
14488
14525
|
}
|
|
14489
|
-
function
|
|
14526
|
+
function Ws({ controlKey: e }) {
|
|
14490
14527
|
return e === "tl" || e === "tr" || e === "mt" ? -1 : 1;
|
|
14491
14528
|
}
|
|
14492
|
-
function
|
|
14493
|
-
let { target: n } = e, r =
|
|
14529
|
+
function Gs({ transform: e, localPoint: t }) {
|
|
14530
|
+
let { target: n } = e, r = qs({
|
|
14494
14531
|
transform: e,
|
|
14495
14532
|
axis: "x",
|
|
14496
14533
|
localPoint: t
|
|
14497
|
-
}), i =
|
|
14534
|
+
}), i = qs({
|
|
14498
14535
|
transform: e,
|
|
14499
14536
|
axis: "y",
|
|
14500
14537
|
localPoint: t
|
|
14501
14538
|
});
|
|
14502
14539
|
n.lockScalingX || n.set("scaleX", r), n.lockScalingY || n.set("scaleY", i);
|
|
14503
14540
|
}
|
|
14504
|
-
function
|
|
14541
|
+
function Ks({ transform: e, axis: t, localPoint: n }) {
|
|
14505
14542
|
let { target: r } = e;
|
|
14506
14543
|
if (t === "x" && r.lockScalingX || t === "y" && r.lockScalingY) return;
|
|
14507
|
-
let i =
|
|
14544
|
+
let i = qs({
|
|
14508
14545
|
transform: e,
|
|
14509
14546
|
axis: t,
|
|
14510
14547
|
localPoint: n
|
|
@@ -14515,57 +14552,64 @@ function Hs({ transform: e, axis: t, localPoint: n }) {
|
|
|
14515
14552
|
}
|
|
14516
14553
|
r.set("scaleY", i);
|
|
14517
14554
|
}
|
|
14518
|
-
function
|
|
14519
|
-
let { target: r } = e, i = r
|
|
14520
|
-
if (
|
|
14555
|
+
function qs({ transform: e, axis: t, localPoint: n }) {
|
|
14556
|
+
let { target: r } = e, i = Zs({ target: r }), a = $s({ target: r }), o = t === "x" ? r.scaleX ?? 1 : r.scaleY ?? 1, s = t === "x" ? n.x : n.y, c = t === "x" ? i.x : i.y, l = t === "x" ? a.minScaleX : a.minScaleY, u = t === "x" ? a.maxScaleX : a.maxScaleY;
|
|
14557
|
+
if (ec({
|
|
14521
14558
|
transform: e,
|
|
14522
14559
|
axis: t,
|
|
14523
14560
|
localPoint: n
|
|
14524
14561
|
})) return l;
|
|
14525
14562
|
let d = Math.abs((s || 0) * o / c);
|
|
14526
|
-
return
|
|
14563
|
+
return Ps({ transform: e }) && (d *= 2), ic({
|
|
14527
14564
|
value: d,
|
|
14528
14565
|
min: l,
|
|
14529
14566
|
max: u
|
|
14530
14567
|
});
|
|
14531
14568
|
}
|
|
14532
|
-
function
|
|
14569
|
+
function Js({ transform: e, localPoint: t }) {
|
|
14533
14570
|
let { target: n } = e;
|
|
14534
14571
|
if (n.lockScalingX || n.lockScalingY) return;
|
|
14535
|
-
let r =
|
|
14572
|
+
let r = Qs({
|
|
14536
14573
|
target: n,
|
|
14537
14574
|
transform: e,
|
|
14538
|
-
scale:
|
|
14575
|
+
scale: Ys({
|
|
14539
14576
|
transform: e,
|
|
14540
14577
|
localPoint: t,
|
|
14541
|
-
dimensions: n
|
|
14578
|
+
dimensions: Zs({ target: n })
|
|
14542
14579
|
}),
|
|
14543
|
-
forceMinimum:
|
|
14580
|
+
forceMinimum: tc({
|
|
14544
14581
|
transform: e,
|
|
14545
14582
|
localPoint: t
|
|
14546
14583
|
})
|
|
14547
14584
|
});
|
|
14548
14585
|
n.set("scaleX", r.scaleX), n.set("scaleY", r.scaleY);
|
|
14549
14586
|
}
|
|
14550
|
-
function
|
|
14587
|
+
function Ys({ transform: e, localPoint: t, dimensions: n }) {
|
|
14551
14588
|
let r = "gestureScale" in e && typeof e.gestureScale == "number" ? e.gestureScale : null;
|
|
14552
14589
|
if (r !== null) return r;
|
|
14553
|
-
let i = Math.abs(t.x) + Math.abs(t.y), a =
|
|
14590
|
+
let i = Math.abs(t.x) + Math.abs(t.y), a = Xs({
|
|
14554
14591
|
transform: e,
|
|
14555
14592
|
dimensions: n
|
|
14556
14593
|
}), o = a > 0 ? i / a : 1;
|
|
14557
|
-
return
|
|
14594
|
+
return Ps({ transform: e }) && (o *= 2), o;
|
|
14558
14595
|
}
|
|
14559
|
-
function
|
|
14596
|
+
function Xs({ transform: e, dimensions: t }) {
|
|
14560
14597
|
let { target: n, original: r } = e, i = n.scaleX ?? 1, a = n.scaleY ?? 1;
|
|
14561
14598
|
return Math.abs(t.x * r.scaleX / i) + Math.abs(t.y * r.scaleY / a);
|
|
14562
14599
|
}
|
|
14563
|
-
function
|
|
14600
|
+
function Zs({ target: e }) {
|
|
14601
|
+
let t = Math.abs(e.scaleX ?? 1), n = Math.abs(e.scaleY ?? 1);
|
|
14602
|
+
return {
|
|
14603
|
+
x: Math.max(1, e.width * t),
|
|
14604
|
+
y: Math.max(1, e.height * n)
|
|
14605
|
+
};
|
|
14606
|
+
}
|
|
14607
|
+
function Qs({ target: e, transform: t, scale: n, forceMinimum: r }) {
|
|
14564
14608
|
let i = As({
|
|
14565
14609
|
frame: e,
|
|
14566
14610
|
scaleX: t.original.scaleX,
|
|
14567
14611
|
scaleY: t.original.scaleY
|
|
14568
|
-
}), a = Math.max(ds / i.width, fs / i.height), o = Math.min(ps / i.width, ms / i.height), s = r ? a :
|
|
14612
|
+
}), a = Math.max(ds / i.width, fs / i.height), o = Math.min(ps / i.width, ms / i.height), s = r ? a : ic({
|
|
14569
14613
|
value: n,
|
|
14570
14614
|
min: a,
|
|
14571
14615
|
max: o
|
|
@@ -14575,7 +14619,7 @@ function qs({ target: e, transform: t, scale: n, forceMinimum: r }) {
|
|
|
14575
14619
|
scaleY: t.original.scaleY * s
|
|
14576
14620
|
};
|
|
14577
14621
|
}
|
|
14578
|
-
function
|
|
14622
|
+
function $s({ target: e }) {
|
|
14579
14623
|
let t = e, n = Math.abs(t.cropSourceScaleX ?? 1) || 1, r = Math.abs(t.cropSourceScaleY ?? 1) || 1, i = Math.max(1, e.width), a = Math.max(1, e.height);
|
|
14580
14624
|
return {
|
|
14581
14625
|
minScaleX: ds * n / i,
|
|
@@ -14584,64 +14628,64 @@ function Js({ target: e }) {
|
|
|
14584
14628
|
maxScaleY: ms * r / a
|
|
14585
14629
|
};
|
|
14586
14630
|
}
|
|
14587
|
-
function
|
|
14631
|
+
function ec({ transform: e, axis: t, localPoint: n }) {
|
|
14588
14632
|
let { target: r } = e;
|
|
14589
14633
|
if (!r.lockScalingFlip) return !1;
|
|
14590
14634
|
let i = t === "x" ? e.signX ?? 1 : e.signY ?? 1, a = t === "x" ? n.x : n.y;
|
|
14591
14635
|
return i !== Math.sign(a || i);
|
|
14592
14636
|
}
|
|
14593
|
-
function
|
|
14594
|
-
return
|
|
14637
|
+
function tc({ transform: e, localPoint: t }) {
|
|
14638
|
+
return ec({
|
|
14595
14639
|
transform: e,
|
|
14596
14640
|
axis: "x",
|
|
14597
14641
|
localPoint: t
|
|
14598
|
-
}) ||
|
|
14642
|
+
}) || ec({
|
|
14599
14643
|
transform: e,
|
|
14600
14644
|
axis: "y",
|
|
14601
14645
|
localPoint: t
|
|
14602
14646
|
});
|
|
14603
14647
|
}
|
|
14604
|
-
function
|
|
14605
|
-
let e = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((e, t, n, r) =>
|
|
14648
|
+
function nc() {
|
|
14649
|
+
let e = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((e, t, n, r) => Fs({
|
|
14606
14650
|
transform: t,
|
|
14607
14651
|
x: n,
|
|
14608
14652
|
y: r
|
|
14609
|
-
}))), t = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((e, t, n, r) =>
|
|
14653
|
+
}))), t = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((e, t, n, r) => Is({
|
|
14610
14654
|
transform: t,
|
|
14611
14655
|
x: n,
|
|
14612
14656
|
y: r
|
|
14613
14657
|
})));
|
|
14614
14658
|
return (n, r, i, a) => n.shiftKey ? e(n, r, i, a) : t(n, r, i, a);
|
|
14615
14659
|
}
|
|
14616
|
-
function
|
|
14617
|
-
return x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((t, n, r, i) =>
|
|
14660
|
+
function rc({ axis: e }) {
|
|
14661
|
+
return x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((t, n, r, i) => Ls({
|
|
14618
14662
|
transform: n,
|
|
14619
14663
|
axis: e,
|
|
14620
14664
|
x: r,
|
|
14621
14665
|
y: i
|
|
14622
14666
|
})));
|
|
14623
14667
|
}
|
|
14624
|
-
function
|
|
14668
|
+
function ic({ value: e, min: t, max: n }) {
|
|
14625
14669
|
return Math.max(t, Math.min(n, e));
|
|
14626
14670
|
}
|
|
14627
|
-
function
|
|
14671
|
+
function ac({ control: e, actionHandler: t }) {
|
|
14628
14672
|
let n = new r({
|
|
14629
14673
|
...e,
|
|
14630
14674
|
actionHandler: t
|
|
14631
14675
|
});
|
|
14632
14676
|
return n.cropResizeControl = !0, n;
|
|
14633
14677
|
}
|
|
14634
|
-
function
|
|
14635
|
-
let t = { ...e.controls }, n = !1, r =
|
|
14636
|
-
|
|
14678
|
+
function oc({ target: e }) {
|
|
14679
|
+
let t = { ...e.controls }, n = !1, r = nc(), i = rc({ axis: "x" }), a = rc({ axis: "y" });
|
|
14680
|
+
Ms.forEach((i) => {
|
|
14637
14681
|
let a = e.controls[i];
|
|
14638
|
-
a && (a.cropResizeControl || (t[i] =
|
|
14682
|
+
a && (a.cropResizeControl || (t[i] = ac({
|
|
14639
14683
|
control: a,
|
|
14640
14684
|
actionHandler: r
|
|
14641
14685
|
}), n = !0));
|
|
14642
|
-
}),
|
|
14686
|
+
}), Ns.forEach((r) => {
|
|
14643
14687
|
let o = e.controls[r];
|
|
14644
|
-
o && (o.cropResizeControl || (t[r] =
|
|
14688
|
+
o && (o.cropResizeControl || (t[r] = ac({
|
|
14645
14689
|
control: o,
|
|
14646
14690
|
actionHandler: r === "ml" || r === "mr" ? i : a
|
|
14647
14691
|
}), n = !0));
|
|
@@ -14649,13 +14693,13 @@ function tc({ target: e }) {
|
|
|
14649
14693
|
}
|
|
14650
14694
|
//#endregion
|
|
14651
14695
|
//#region src/editor/crop-manager/domain/crop-frame.ts
|
|
14652
|
-
var
|
|
14696
|
+
var sc = "rgba(47, 128, 237, 0.42)", cc = class extends _ {
|
|
14653
14697
|
constructor(e) {
|
|
14654
14698
|
let { showGrid: t, sourceScaleX: n = 1, sourceScaleY: r = 1, ...i } = e;
|
|
14655
14699
|
super(i), this._showGrid = t, this.cropSourceScaleX = n, this.cropSourceScaleY = r;
|
|
14656
14700
|
}
|
|
14657
14701
|
_render(e) {
|
|
14658
|
-
super._render(e), this._showGrid &&
|
|
14702
|
+
super._render(e), this._showGrid && uc({
|
|
14659
14703
|
ctx: e,
|
|
14660
14704
|
width: this.width,
|
|
14661
14705
|
height: this.height
|
|
@@ -14665,8 +14709,8 @@ var nc = "rgba(47, 128, 237, 0.42)", rc = class extends _ {
|
|
|
14665
14709
|
return As({ frame: this });
|
|
14666
14710
|
}
|
|
14667
14711
|
};
|
|
14668
|
-
function
|
|
14669
|
-
let r = e.getCenterPoint(), i = e.scaleX ?? 1, a = e.scaleY ?? 1, o = new
|
|
14712
|
+
function lc({ source: e, cropSize: t, showGrid: n }) {
|
|
14713
|
+
let r = e.getCenterPoint(), i = e.scaleX ?? 1, a = e.scaleY ?? 1, o = new cc({
|
|
14670
14714
|
id: `crop-frame-${D()}`,
|
|
14671
14715
|
left: r.x,
|
|
14672
14716
|
top: r.y,
|
|
@@ -14695,18 +14739,18 @@ function ic({ source: e, cropSize: t, showGrid: n }) {
|
|
|
14695
14739
|
sourceScaleX: i,
|
|
14696
14740
|
sourceScaleY: a
|
|
14697
14741
|
});
|
|
14698
|
-
return o.setControlsVisibility({ mtr: !1 }),
|
|
14742
|
+
return o.setControlsVisibility({ mtr: !1 }), oc({ target: o }), o;
|
|
14699
14743
|
}
|
|
14700
|
-
function
|
|
14744
|
+
function uc({ ctx: e, width: t, height: n }) {
|
|
14701
14745
|
if (!(t <= 0 || n <= 0)) {
|
|
14702
|
-
e.save(), e.strokeStyle =
|
|
14746
|
+
e.save(), e.strokeStyle = sc, e.lineWidth = 1, e.setLineDash([]);
|
|
14703
14747
|
for (let r = 1; r <= 2; r += 1) {
|
|
14704
14748
|
let i = -t / 2 + t * r / 3, a = -n / 2 + n * r / 3;
|
|
14705
|
-
|
|
14749
|
+
dc({
|
|
14706
14750
|
ctx: e,
|
|
14707
14751
|
x: i,
|
|
14708
14752
|
height: n
|
|
14709
|
-
}),
|
|
14753
|
+
}), fc({
|
|
14710
14754
|
ctx: e,
|
|
14711
14755
|
y: a,
|
|
14712
14756
|
width: t
|
|
@@ -14715,21 +14759,21 @@ function ac({ ctx: e, width: t, height: n }) {
|
|
|
14715
14759
|
e.restore();
|
|
14716
14760
|
}
|
|
14717
14761
|
}
|
|
14718
|
-
function
|
|
14762
|
+
function dc({ ctx: e, x: t, height: n }) {
|
|
14719
14763
|
e.beginPath(), e.moveTo(t, -n / 2), e.lineTo(t, n / 2), e.stroke();
|
|
14720
14764
|
}
|
|
14721
|
-
function
|
|
14765
|
+
function fc({ ctx: e, y: t, width: n }) {
|
|
14722
14766
|
e.beginPath(), e.moveTo(-n / 2, t), e.lineTo(n / 2, t), e.stroke();
|
|
14723
14767
|
}
|
|
14724
14768
|
//#endregion
|
|
14725
14769
|
//#region src/editor/crop-manager/domain/crop-result.ts
|
|
14726
|
-
function
|
|
14727
|
-
return e.mode === "canvas" ?
|
|
14770
|
+
function pc({ session: e }) {
|
|
14771
|
+
return e.mode === "canvas" ? gc({ session: e }) : _c({
|
|
14728
14772
|
target: e.target,
|
|
14729
14773
|
frame: e.frame
|
|
14730
14774
|
});
|
|
14731
14775
|
}
|
|
14732
|
-
function
|
|
14776
|
+
function mc({ rect: e }) {
|
|
14733
14777
|
return {
|
|
14734
14778
|
left: Math.round(e.left),
|
|
14735
14779
|
top: Math.round(e.top),
|
|
@@ -14737,10 +14781,10 @@ function lc({ rect: e }) {
|
|
|
14737
14781
|
height: Math.round(e.height)
|
|
14738
14782
|
};
|
|
14739
14783
|
}
|
|
14740
|
-
function
|
|
14784
|
+
function hc({ rect: e }) {
|
|
14741
14785
|
return e.width >= hs && e.height >= hs;
|
|
14742
14786
|
}
|
|
14743
|
-
function
|
|
14787
|
+
function gc({ session: e }) {
|
|
14744
14788
|
let t = vs({
|
|
14745
14789
|
source: e.source,
|
|
14746
14790
|
frame: e.frame
|
|
@@ -14752,7 +14796,7 @@ function dc({ session: e }) {
|
|
|
14752
14796
|
height: t.height
|
|
14753
14797
|
};
|
|
14754
14798
|
}
|
|
14755
|
-
function
|
|
14799
|
+
function _c({ target: e, frame: t }) {
|
|
14756
14800
|
let n = vs({
|
|
14757
14801
|
source: e,
|
|
14758
14802
|
frame: t
|
|
@@ -14766,8 +14810,8 @@ function fc({ target: e, frame: t }) {
|
|
|
14766
14810
|
}
|
|
14767
14811
|
//#endregion
|
|
14768
14812
|
//#region src/editor/crop-manager/mutation/crop-apply.ts
|
|
14769
|
-
function
|
|
14770
|
-
return
|
|
14813
|
+
function vc({ editor: e, frame: t, rect: n }) {
|
|
14814
|
+
return hc({ rect: n }) ? (Ec({
|
|
14771
14815
|
editor: e,
|
|
14772
14816
|
frame: t,
|
|
14773
14817
|
offset: new m(-n.left, -n.top)
|
|
@@ -14777,9 +14821,9 @@ function pc({ editor: e, frame: t, rect: n }) {
|
|
|
14777
14821
|
rect: n
|
|
14778
14822
|
}) : null;
|
|
14779
14823
|
}
|
|
14780
|
-
function
|
|
14781
|
-
if (!
|
|
14782
|
-
let i =
|
|
14824
|
+
function yc({ editor: e, target: t, frame: n, rect: r }) {
|
|
14825
|
+
if (!hc({ rect: r })) return null;
|
|
14826
|
+
let i = bc({
|
|
14783
14827
|
target: t,
|
|
14784
14828
|
frame: n,
|
|
14785
14829
|
rect: r
|
|
@@ -14790,21 +14834,21 @@ function mc({ editor: e, target: t, frame: n, rect: r }) {
|
|
|
14790
14834
|
rect: i
|
|
14791
14835
|
}) : null;
|
|
14792
14836
|
}
|
|
14793
|
-
function
|
|
14837
|
+
function bc({ target: e, frame: t, rect: n }) {
|
|
14794
14838
|
let r = Math.max(hs, n.width), i = Math.max(hs, n.height), a = {
|
|
14795
14839
|
width: r,
|
|
14796
14840
|
height: i
|
|
14797
14841
|
};
|
|
14798
|
-
if (
|
|
14842
|
+
if (xc({
|
|
14799
14843
|
target: e,
|
|
14800
14844
|
rect: n
|
|
14801
|
-
}))
|
|
14845
|
+
})) Sc({
|
|
14802
14846
|
target: e,
|
|
14803
14847
|
size: a,
|
|
14804
14848
|
rect: n
|
|
14805
14849
|
});
|
|
14806
14850
|
else {
|
|
14807
|
-
let t =
|
|
14851
|
+
let t = Cc({
|
|
14808
14852
|
target: e,
|
|
14809
14853
|
size: a,
|
|
14810
14854
|
rect: n
|
|
@@ -14824,10 +14868,10 @@ function hc({ target: e, frame: t, rect: n }) {
|
|
|
14824
14868
|
height: i
|
|
14825
14869
|
};
|
|
14826
14870
|
}
|
|
14827
|
-
function
|
|
14871
|
+
function xc({ target: e, rect: t }) {
|
|
14828
14872
|
return t.left >= 0 && t.top >= 0 && t.left + t.width <= e.width && t.top + t.height <= e.height;
|
|
14829
14873
|
}
|
|
14830
|
-
function
|
|
14874
|
+
function Sc({ target: e, size: t, rect: n }) {
|
|
14831
14875
|
let r = (e.cropX ?? 0) + n.left, i = (e.cropY ?? 0) + n.top;
|
|
14832
14876
|
e.set({
|
|
14833
14877
|
cropX: r,
|
|
@@ -14836,25 +14880,25 @@ function _c({ target: e, size: t, rect: n }) {
|
|
|
14836
14880
|
height: t.height
|
|
14837
14881
|
});
|
|
14838
14882
|
}
|
|
14839
|
-
function
|
|
14840
|
-
let r = e.getElement(), i =
|
|
14883
|
+
function Cc({ target: e, size: t, rect: n }) {
|
|
14884
|
+
let r = e.getElement(), i = wc({ target: e });
|
|
14841
14885
|
if (!r || !i) return null;
|
|
14842
14886
|
let a = i.createElement("canvas");
|
|
14843
14887
|
a.width = Math.round(t.width), a.height = Math.round(t.height);
|
|
14844
14888
|
let o = a.getContext("2d");
|
|
14845
14889
|
if (!o) return null;
|
|
14846
|
-
let s =
|
|
14890
|
+
let s = Tc({
|
|
14847
14891
|
target: e,
|
|
14848
14892
|
size: t,
|
|
14849
14893
|
rect: n
|
|
14850
14894
|
});
|
|
14851
14895
|
return s && o.drawImage(r, s.sourceX, s.sourceY, s.sourceWidth, s.sourceHeight, s.destinationX, s.destinationY, s.sourceWidth, s.sourceHeight), a;
|
|
14852
14896
|
}
|
|
14853
|
-
function
|
|
14897
|
+
function wc({ target: e }) {
|
|
14854
14898
|
let t = e.canvas?.getElement();
|
|
14855
14899
|
return t?.ownerDocument ? t.ownerDocument : typeof document < "u" ? document : null;
|
|
14856
14900
|
}
|
|
14857
|
-
function
|
|
14901
|
+
function Tc({ target: e, size: t, rect: n }) {
|
|
14858
14902
|
let r = Math.max(0, n.left), i = Math.max(0, n.top), a = Math.min(e.width, n.left + t.width), o = Math.min(e.height, n.top + t.height), s = a - r, c = o - i;
|
|
14859
14903
|
return s <= 0 || c <= 0 ? null : {
|
|
14860
14904
|
sourceX: (e.cropX ?? 0) + r,
|
|
@@ -14865,7 +14909,7 @@ function bc({ target: e, size: t, rect: n }) {
|
|
|
14865
14909
|
destinationY: i - n.top
|
|
14866
14910
|
};
|
|
14867
14911
|
}
|
|
14868
|
-
function
|
|
14912
|
+
function Ec({ editor: e, frame: t, offset: n }) {
|
|
14869
14913
|
e.canvasManager.getObjects().forEach((e) => {
|
|
14870
14914
|
e !== t && (e.set({
|
|
14871
14915
|
left: (e.left ?? 0) + n.x,
|
|
@@ -14875,11 +14919,11 @@ function xc({ editor: e, frame: t, offset: n }) {
|
|
|
14875
14919
|
}
|
|
14876
14920
|
//#endregion
|
|
14877
14921
|
//#region src/editor/crop-manager/index.ts
|
|
14878
|
-
var
|
|
14922
|
+
var Dc = {
|
|
14879
14923
|
allowFrameOverflow: !0,
|
|
14880
14924
|
showGrid: !0,
|
|
14881
14925
|
cancelOnSelectionClear: !0
|
|
14882
|
-
},
|
|
14926
|
+
}, Oc = class {
|
|
14883
14927
|
constructor({ editor: e }) {
|
|
14884
14928
|
this._handleCropFrameChangedBound = () => {
|
|
14885
14929
|
this._handleCropFrameChanged();
|
|
@@ -14899,7 +14943,7 @@ var Sc = {
|
|
|
14899
14943
|
frame: e.frame,
|
|
14900
14944
|
options: e.options,
|
|
14901
14945
|
target: e.target,
|
|
14902
|
-
rect:
|
|
14946
|
+
rect: pc({ session: e })
|
|
14903
14947
|
} : null;
|
|
14904
14948
|
}
|
|
14905
14949
|
startCanvasCrop(e = {}) {
|
|
@@ -14997,13 +15041,13 @@ var Sc = {
|
|
|
14997
15041
|
}
|
|
14998
15042
|
_resolveSessionOptions({ options: e }) {
|
|
14999
15043
|
return {
|
|
15000
|
-
allowFrameOverflow: e.allowFrameOverflow ??
|
|
15001
|
-
showGrid: e.showGrid ??
|
|
15002
|
-
cancelOnSelectionClear: e.cancelOnSelectionClear ??
|
|
15044
|
+
allowFrameOverflow: e.allowFrameOverflow ?? Dc.allowFrameOverflow,
|
|
15045
|
+
showGrid: e.showGrid ?? Dc.showGrid,
|
|
15046
|
+
cancelOnSelectionClear: e.cancelOnSelectionClear ?? Dc.cancelOnSelectionClear
|
|
15003
15047
|
};
|
|
15004
15048
|
}
|
|
15005
15049
|
_createCropFrameForSource({ source: e, options: t, sessionOptions: n }) {
|
|
15006
|
-
return
|
|
15050
|
+
return lc({
|
|
15007
15051
|
source: e,
|
|
15008
15052
|
cropSize: gs({
|
|
15009
15053
|
sourceSize: _s({ source: e }),
|
|
@@ -15088,12 +15132,12 @@ var Sc = {
|
|
|
15088
15132
|
});
|
|
15089
15133
|
}
|
|
15090
15134
|
_applySessionCrop({ session: e }) {
|
|
15091
|
-
let t =
|
|
15092
|
-
return e.mode === "canvas" ?
|
|
15135
|
+
let t = mc({ rect: pc({ session: e }) });
|
|
15136
|
+
return e.mode === "canvas" ? vc({
|
|
15093
15137
|
editor: this.editor,
|
|
15094
15138
|
frame: e.frame,
|
|
15095
15139
|
rect: t
|
|
15096
|
-
}) :
|
|
15140
|
+
}) : yc({
|
|
15097
15141
|
editor: this.editor,
|
|
15098
15142
|
target: e.target,
|
|
15099
15143
|
frame: e.frame,
|
|
@@ -15141,7 +15185,7 @@ var Sc = {
|
|
|
15141
15185
|
this.editor.errorManager.emitError({
|
|
15142
15186
|
origin: "CropManager",
|
|
15143
15187
|
method: "startImageCrop",
|
|
15144
|
-
code:
|
|
15188
|
+
code: X.CROP_MANAGER.INVALID_IMAGE_TARGET,
|
|
15145
15189
|
message: "Для кропа изображения нужно выбрать raster image объект.",
|
|
15146
15190
|
data: {
|
|
15147
15191
|
targetType: e?.type,
|
|
@@ -15153,7 +15197,7 @@ var Sc = {
|
|
|
15153
15197
|
this.editor.errorManager.emitError({
|
|
15154
15198
|
origin: "CropManager",
|
|
15155
15199
|
method: "startImageCrop",
|
|
15156
|
-
code:
|
|
15200
|
+
code: X.CROP_MANAGER.LOCKED_IMAGE_TARGET,
|
|
15157
15201
|
message: "Заблокированное изображение нельзя обрезать.",
|
|
15158
15202
|
data: {
|
|
15159
15203
|
targetType: e.type,
|
|
@@ -15161,13 +15205,13 @@ var Sc = {
|
|
|
15161
15205
|
}
|
|
15162
15206
|
});
|
|
15163
15207
|
}
|
|
15164
|
-
},
|
|
15208
|
+
}, kc = class e {
|
|
15165
15209
|
constructor(e, t) {
|
|
15166
15210
|
this.options = t, this.containerId = e, this.editorId = `${e}-${D()}`, this.init();
|
|
15167
15211
|
}
|
|
15168
15212
|
async init() {
|
|
15169
15213
|
let { editorContainerWidth: e, editorContainerHeight: n, canvasWrapperWidth: r, canvasWrapperHeight: i, canvasCSSWidth: a, canvasCSSHeight: o, initialImage: s, initialState: c, scaleType: l, showRotationAngle: u, showObjectSizeOnScale: d, showViewportScrollbars: f, _onReadyCallback: p } = this.options;
|
|
15170
|
-
if (ve.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new ee(), this.workerManager = new ne(), this.errorManager = new
|
|
15214
|
+
if (ve.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new ee(), this.workerManager = new ne(), this.errorManager = new qa({ editor: this }), this.historyManager = new Ut({ editor: this }), this.toolbar = new at({ editor: this }), this.transformManager = new en({ editor: this }), this.zoomManager = new tn({ editor: this }), this.canvasManager = new $t({ editor: this }), this.imageManager = new Yt({ editor: this }), this.layerManager = new Bn({ editor: this }), this.shapeManager = new Ba({ editor: this }), this.interactionBlocker = new Rn({ editor: this }), this.backgroundManager = new zn({ editor: this }), this.clipboardManager = new Ha({ editor: this }), this.objectLockManager = new Ua({ editor: this }), this.groupingManager = new Wa({ editor: this }), this.selectionManager = new Ga({ editor: this }), this.deletionManager = new Ka({ editor: this }), this.panConstraintManager = new Ya({ editor: this }), this.snappingManager = new cs({ editor: this }), this.measurementManager = new us({ editor: this }), this.fontManager = new ye(this.options.fonts ?? []), this.textManager = new ho({ editor: this }), this.templateManager = new bo({ editor: this }), this.cropManager = new Oc({ editor: this }), u && (this.angleIndicator = new lt({ editor: this })), d && (this.objectSizeIndicator = new dt({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new F({
|
|
15171
15215
|
editor: this,
|
|
15172
15216
|
options: this.options
|
|
15173
15217
|
}), this.canvasManager.setEditorContainerWidth(e), this.canvasManager.setEditorContainerHeight(n), this.canvasManager.setCanvasWrapperWidth(r), this.canvasManager.setCanvasWrapperHeight(i), this.canvasManager.setCanvasCSSWidth(a), this.canvasManager.setCanvasCSSHeight(o), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), f && (this.viewportScrollbars = new _t({ editor: this })), await this.fontManager.loadFonts(), c) {
|
|
@@ -15275,7 +15319,7 @@ var Sc = {
|
|
|
15275
15319
|
"U+A640-A69F",
|
|
15276
15320
|
"U+FE2E-FE2F",
|
|
15277
15321
|
"U+2116"
|
|
15278
|
-
].join(", "),
|
|
15322
|
+
].join(", "), Ac = {
|
|
15279
15323
|
preserveObjectStacking: !0,
|
|
15280
15324
|
controlsAboveOverlay: !0,
|
|
15281
15325
|
centeredRotation: !0,
|
|
@@ -16133,20 +16177,20 @@ var Sc = {
|
|
|
16133
16177
|
};
|
|
16134
16178
|
//#endregion
|
|
16135
16179
|
//#region src/main.ts
|
|
16136
|
-
function
|
|
16180
|
+
function jc(e, t = {}) {
|
|
16137
16181
|
let n = {
|
|
16138
|
-
...
|
|
16182
|
+
...Ac,
|
|
16139
16183
|
...t
|
|
16140
16184
|
}, r = document.getElementById(e);
|
|
16141
16185
|
if (!r) return Promise.reject(/* @__PURE__ */ Error(`Контейнер с ID "${e}" не найден.`));
|
|
16142
16186
|
let i = document.createElement("canvas");
|
|
16143
16187
|
return i.id = `${e}-canvas`, r.appendChild(i), n.editorContainer = r, new Promise((t) => {
|
|
16144
16188
|
n._onReadyCallback = t;
|
|
16145
|
-
let r = new
|
|
16189
|
+
let r = new kc(i.id, n);
|
|
16146
16190
|
window[e] = r;
|
|
16147
16191
|
});
|
|
16148
16192
|
}
|
|
16149
16193
|
//#endregion
|
|
16150
|
-
export {
|
|
16194
|
+
export { jc as default };
|
|
16151
16195
|
|
|
16152
16196
|
//# sourceMappingURL=main.js.map
|