@anu3ev/fabric-image-editor 0.8.27 → 0.8.28
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 +441 -408
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2133,7 +2133,7 @@ var Je = class e extends l {
|
|
|
2133
2133
|
destroy() {
|
|
2134
2134
|
this.canvas && (this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:cleared", this._onSelectionCleared)), this.el?.parentNode && this.el.parentNode.removeChild(this.el), this.el = null, this.editor = null, this.canvas = null, this.options = null;
|
|
2135
2135
|
}
|
|
2136
|
-
}, nt = /* @__PURE__ */ "id.backgroundId.customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeReplaceBoxWidth.shapeReplaceBoxHeight.shapeTextAutoExpand.
|
|
2136
|
+
}, nt = /* @__PURE__ */ "id.backgroundId.customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeReplaceBoxWidth.shapeReplaceBoxHeight.shapeTextAutoExpand.shapeAlignHorizontal.shapeAlignVertical.shapePaddingTop.shapePaddingRight.shapePaddingBottom.shapePaddingLeft.shapeFill.shapeStroke.shapeStrokeWidth.shapeStrokeDashArray.shapeOpacity.shapeRounding.shapeNodeType".split(".");
|
|
2137
2137
|
//#endregion
|
|
2138
2138
|
//#region src/editor/history-manager/diff-normalization.ts
|
|
2139
2139
|
function rt({ state: e }) {
|
|
@@ -2571,7 +2571,7 @@ var Dt = class {
|
|
|
2571
2571
|
}
|
|
2572
2572
|
}
|
|
2573
2573
|
}
|
|
2574
|
-
}, Ot = .1, kt = 4096, At = 4096, jt = "application/image-editor:", Mt = /* @__PURE__ */ "id.customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeReplaceBoxWidth.shapeReplaceBoxHeight.shapeTextAutoExpand.
|
|
2574
|
+
}, Ot = .1, kt = 4096, At = 4096, jt = "application/image-editor:", Mt = /* @__PURE__ */ "id.customData.backgroundType.format.contentType.width.height.originX.originY.locked.editable.evented.selectable.lockMovementX.lockMovementY.lockRotation.lockScalingX.lockScalingY.lockSkewingX.lockSkewingY.styles.lineFontDefaults.textCaseRaw.uppercase.autoExpand.linethrough.underline.fontStyle.fontWeight.backgroundOpacity.paddingTop.paddingRight.paddingBottom.paddingLeft.radiusTopLeft.radiusTopRight.radiusBottomRight.radiusBottomLeft.shapeComposite.shapePresetKey.shapeBaseWidth.shapeBaseHeight.shapeManualBaseWidth.shapeManualBaseHeight.shapeReplaceBoxWidth.shapeReplaceBoxHeight.shapeTextAutoExpand.shapeAlignHorizontal.shapeAlignVertical.shapePaddingTop.shapePaddingRight.shapePaddingBottom.shapePaddingLeft.shapeFill.shapeStroke.shapeStrokeWidth.shapeStrokeDashArray.shapeOpacity.shapeRounding.shapeNodeType".split("."), Nt = class e {
|
|
2575
2575
|
constructor({ editor: e }) {
|
|
2576
2576
|
this.editor = e, this.options = e.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
|
|
2577
2577
|
}
|
|
@@ -5168,7 +5168,7 @@ var Or = ({ text: e, width: t, height: n, alignV: r, padding: i, wrapPolicy: a,
|
|
|
5168
5168
|
});
|
|
5169
5169
|
};
|
|
5170
5170
|
function Ar({ group: e, shape: t, text: n, alignH: r, alignV: i, resolvedLayout: a }) {
|
|
5171
|
-
let o = Math.max(q, e.shapeManualBaseWidth ?? a.width), s = Math.max(q, e.shapeManualBaseHeight ?? a.height), { width: c, height: l, appliedUserPadding: u, frame: d, splitByGrapheme: f, textTop: p
|
|
5171
|
+
let o = Math.max(q, e.shapeManualBaseWidth ?? a.width), s = Math.max(q, e.shapeManualBaseHeight ?? a.height), { width: c, height: l, appliedUserPadding: u, frame: d, splitByGrapheme: f, textTop: p } = a;
|
|
5172
5172
|
kn({
|
|
5173
5173
|
shape: t,
|
|
5174
5174
|
width: c,
|
|
@@ -5191,7 +5191,7 @@ function Ar({ group: e, shape: t, text: n, alignH: r, alignV: i, resolvedLayout:
|
|
|
5191
5191
|
originX: "left",
|
|
5192
5192
|
originY: "top",
|
|
5193
5193
|
splitByGrapheme: f
|
|
5194
|
-
}), n.initDimensions(), n.setCoords(), t.setCoords(), e.shapeBaseWidth = c, e.shapeBaseHeight = l, e.shapeManualBaseWidth = o, e.shapeManualBaseHeight = s, e.shapePaddingTop = u.top, e.shapePaddingRight = u.right, e.shapePaddingBottom = u.bottom, e.shapePaddingLeft = u.left, e.
|
|
5194
|
+
}), n.initDimensions(), n.setCoords(), t.setCoords(), e.shapeBaseWidth = c, e.shapeBaseHeight = l, e.shapeManualBaseWidth = o, e.shapeManualBaseHeight = s, e.shapePaddingTop = u.top, e.shapePaddingRight = u.right, e.shapePaddingBottom = u.bottom, e.shapePaddingLeft = u.left, e.shapeAlignHorizontal = r, e.shapeAlignVertical = i, e.set({
|
|
5195
5195
|
width: c,
|
|
5196
5196
|
height: l,
|
|
5197
5197
|
scaleX: 1,
|
|
@@ -5622,8 +5622,8 @@ var ni = ({ group: e, shape: t, text: n, layout: r, alignH: i, scaleX: a, scaleY
|
|
|
5622
5622
|
scaleEpsilon: c
|
|
5623
5623
|
});
|
|
5624
5624
|
}, X = 1e-4, ri = .5;
|
|
5625
|
-
function ii({ isProportionalScaling: e }) {
|
|
5626
|
-
if (e) return "words-only";
|
|
5625
|
+
function ii({ isProportionalScaling: e, startTextSplitByGrapheme: t }) {
|
|
5626
|
+
if (e && !t) return "words-only";
|
|
5627
5627
|
}
|
|
5628
5628
|
function ai({ width: e, height: t }) {
|
|
5629
5629
|
return `${Math.round(Math.max(1, e) * 1e6) / 1e6}:${Math.round(Math.max(1, t) * 1e6) / 1e6}`;
|
|
@@ -5772,7 +5772,10 @@ function hi({ group: e, text: t, constraintPadding: n, startDimensions: r, appli
|
|
|
5772
5772
|
};
|
|
5773
5773
|
}
|
|
5774
5774
|
function gi({ group: e, text: t, state: n, appliedScaleX: r, appliedScaleY: i, minimumHeight: a }) {
|
|
5775
|
-
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 = ii({
|
|
5775
|
+
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 = ii({
|
|
5776
|
+
isProportionalScaling: n.isProportionalScaling,
|
|
5777
|
+
startTextSplitByGrapheme: n.startTextSplitByGrapheme
|
|
5778
|
+
});
|
|
5776
5779
|
return kr({
|
|
5777
5780
|
text: t,
|
|
5778
5781
|
width: o,
|
|
@@ -5800,75 +5803,87 @@ function _i({ group: e, transform: t }) {
|
|
|
5800
5803
|
canScaleHeight: r
|
|
5801
5804
|
};
|
|
5802
5805
|
}
|
|
5803
|
-
function vi({
|
|
5804
|
-
let
|
|
5805
|
-
|
|
5806
|
-
let o = _i({
|
|
5807
|
-
group: t,
|
|
5808
|
-
transform: i
|
|
5809
|
-
}), s = Kr({
|
|
5810
|
-
transform: i,
|
|
5806
|
+
function vi({ group: e, transform: t }) {
|
|
5807
|
+
let n = Kr({
|
|
5808
|
+
transform: t,
|
|
5811
5809
|
key: "scaleX"
|
|
5812
|
-
}),
|
|
5813
|
-
transform:
|
|
5810
|
+
}), r = Kr({
|
|
5811
|
+
transform: t,
|
|
5814
5812
|
key: "scaleY"
|
|
5815
|
-
}),
|
|
5816
|
-
transform:
|
|
5813
|
+
}), i = Kr({
|
|
5814
|
+
transform: t,
|
|
5817
5815
|
key: "left"
|
|
5818
|
-
}),
|
|
5819
|
-
transform:
|
|
5816
|
+
}), a = Kr({
|
|
5817
|
+
transform: t,
|
|
5820
5818
|
key: "top"
|
|
5821
|
-
}),
|
|
5822
|
-
group:
|
|
5823
|
-
originX:
|
|
5824
|
-
originY:
|
|
5825
|
-
}),
|
|
5819
|
+
}), o = qr({ value: t?.original?.originX ?? t?.originX }), s = Jr({ value: t?.original?.originY ?? t?.originY }), c = Xr({
|
|
5820
|
+
group: e,
|
|
5821
|
+
originX: o,
|
|
5822
|
+
originY: s
|
|
5823
|
+
}), l = typeof t?.corner == "string" ? t.corner : null;
|
|
5824
|
+
return {
|
|
5825
|
+
startScaleX: Math.abs(n ?? e.scaleX ?? 1) || 1,
|
|
5826
|
+
startScaleY: Math.abs(r ?? e.scaleY ?? 1) || 1,
|
|
5827
|
+
startLeft: i ?? e.left ?? 0,
|
|
5828
|
+
startTop: a ?? e.top ?? 0,
|
|
5829
|
+
startTransformOriginX: o,
|
|
5830
|
+
startTransformOriginY: s,
|
|
5831
|
+
startTransformCorner: l,
|
|
5832
|
+
scalingAnchorX: c?.x ?? null,
|
|
5833
|
+
scalingAnchorY: c?.y ?? null
|
|
5834
|
+
};
|
|
5835
|
+
}
|
|
5836
|
+
function yi({ group: e, text: t, constraintPadding: n, transform: r }) {
|
|
5837
|
+
let i = _i({
|
|
5838
|
+
group: e,
|
|
5839
|
+
transform: r
|
|
5840
|
+
}), a = vi({
|
|
5841
|
+
group: e,
|
|
5842
|
+
transform: r
|
|
5843
|
+
}), o = !i.canScaleWidth && i.canScaleHeight, s = {
|
|
5826
5844
|
measurementsByKey: /* @__PURE__ */ new Map(),
|
|
5827
5845
|
splitByGraphemeByFrameWidth: /* @__PURE__ */ new Map(),
|
|
5828
5846
|
minimumTextFrameWidth: null
|
|
5829
|
-
},
|
|
5830
|
-
group:
|
|
5831
|
-
text:
|
|
5832
|
-
width:
|
|
5833
|
-
padding:
|
|
5834
|
-
measurementCache:
|
|
5847
|
+
}, c = /* @__PURE__ */ new Map(), l = mi({
|
|
5848
|
+
group: e,
|
|
5849
|
+
text: t,
|
|
5850
|
+
width: i.startWidth,
|
|
5851
|
+
padding: n,
|
|
5852
|
+
measurementCache: s
|
|
5835
5853
|
});
|
|
5836
|
-
return
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
startManualBaseHeight: o.startManualBaseHeight,
|
|
5841
|
-
canScaleWidth: o.canScaleWidth,
|
|
5842
|
-
canScaleHeight: o.canScaleHeight,
|
|
5843
|
-
cannotScaleDownAtStart: S >= o.startHeight - X,
|
|
5854
|
+
return {
|
|
5855
|
+
...i,
|
|
5856
|
+
cannotScaleDownAtStart: l >= i.startHeight - X,
|
|
5857
|
+
startTextSplitByGrapheme: !!t.splitByGrapheme,
|
|
5844
5858
|
isProportionalScaling: !1,
|
|
5845
5859
|
blockedScaleAttempt: !1,
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
startScaleY: f,
|
|
5850
|
-
startTransformOriginX: h,
|
|
5851
|
-
startTransformOriginY: g,
|
|
5852
|
-
startTransformCorner: _,
|
|
5853
|
-
scalingAnchorX: v?.x ?? null,
|
|
5854
|
-
scalingAnchorY: v?.y ?? null,
|
|
5855
|
-
scalingAnchorOriginX: h,
|
|
5856
|
-
scalingAnchorOriginY: g,
|
|
5860
|
+
...a,
|
|
5861
|
+
scalingAnchorOriginX: a.startTransformOriginX,
|
|
5862
|
+
scalingAnchorOriginY: a.startTransformOriginY,
|
|
5857
5863
|
crossedOppositeCorner: !1,
|
|
5858
|
-
lastAllowedFlipX: !!
|
|
5859
|
-
lastAllowedFlipY: !!
|
|
5860
|
-
lastAllowedScaleX:
|
|
5861
|
-
lastAllowedScaleY:
|
|
5862
|
-
lastAllowedLeft:
|
|
5863
|
-
lastAllowedTop:
|
|
5864
|
+
lastAllowedFlipX: !!e.flipX,
|
|
5865
|
+
lastAllowedFlipY: !!e.flipY,
|
|
5866
|
+
lastAllowedScaleX: a.startScaleX,
|
|
5867
|
+
lastAllowedScaleY: a.startScaleY,
|
|
5868
|
+
lastAllowedLeft: a.startLeft,
|
|
5869
|
+
lastAllowedTop: a.startTop,
|
|
5864
5870
|
scaleDirectionX: null,
|
|
5865
5871
|
scaleDirectionY: null,
|
|
5866
|
-
fixedWidthMinimumTextFitHeight:
|
|
5867
|
-
previewTextMeasurementCache:
|
|
5868
|
-
proportionalTextConstraintCache:
|
|
5869
|
-
}
|
|
5872
|
+
fixedWidthMinimumTextFitHeight: o ? l : null,
|
|
5873
|
+
previewTextMeasurementCache: s,
|
|
5874
|
+
proportionalTextConstraintCache: c
|
|
5875
|
+
};
|
|
5870
5876
|
}
|
|
5871
|
-
function
|
|
5877
|
+
function bi({ scalingState: e, group: t, text: n, constraintPadding: r, transform: i }) {
|
|
5878
|
+
let a = e.get(t);
|
|
5879
|
+
return a || (a = yi({
|
|
5880
|
+
group: t,
|
|
5881
|
+
text: n,
|
|
5882
|
+
constraintPadding: r,
|
|
5883
|
+
transform: i
|
|
5884
|
+
}), e.set(t, a), a);
|
|
5885
|
+
}
|
|
5886
|
+
function xi({ group: e, text: t, constraintPadding: n, startDimensions: r, scaleX: i, scaleY: a, wrapPolicy: o }) {
|
|
5872
5887
|
let { previewWidth: s, previewHeight: c } = hi({
|
|
5873
5888
|
group: e,
|
|
5874
5889
|
text: t,
|
|
@@ -5885,7 +5900,7 @@ function yi({ group: e, text: t, constraintPadding: n, startDimensions: r, scale
|
|
|
5885
5900
|
hasDimensionChange: d || f
|
|
5886
5901
|
};
|
|
5887
5902
|
}
|
|
5888
|
-
function
|
|
5903
|
+
function Si({ startManualBaseWidth: e, startManualBaseHeight: t, canScaleWidth: n, canScaleHeight: r, finalWidth: i, finalHeight: a }) {
|
|
5889
5904
|
let o = e;
|
|
5890
5905
|
n && (o = i);
|
|
5891
5906
|
let s = t;
|
|
@@ -5894,8 +5909,8 @@ function bi({ startManualBaseWidth: e, startManualBaseHeight: t, canScaleWidth:
|
|
|
5894
5909
|
height: s
|
|
5895
5910
|
};
|
|
5896
5911
|
}
|
|
5897
|
-
function
|
|
5898
|
-
let p =
|
|
5912
|
+
function Ci({ 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 }) {
|
|
5913
|
+
let p = Si({
|
|
5899
5914
|
startManualBaseWidth: s,
|
|
5900
5915
|
startManualBaseHeight: c,
|
|
5901
5916
|
canScaleWidth: l,
|
|
@@ -5950,7 +5965,7 @@ function xi({ group: e, shape: t, text: n, width: r, height: i, alignH: a, align
|
|
|
5950
5965
|
}
|
|
5951
5966
|
//#endregion
|
|
5952
5967
|
//#region src/editor/shape-manager/scaling/active-selection-scaling-controller.ts
|
|
5953
|
-
var
|
|
5968
|
+
var wi = class {
|
|
5954
5969
|
constructor({ canvas: e, shapeScalingState: t }) {
|
|
5955
5970
|
this.canvas = e, this.shapeScalingState = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.scalingSessions = /* @__PURE__ */ new WeakMap(), this.groupLayoutScales = /* @__PURE__ */ new WeakMap();
|
|
5956
5971
|
}
|
|
@@ -6009,7 +6024,10 @@ var Si = class {
|
|
|
6009
6024
|
startDimensions: a,
|
|
6010
6025
|
appliedScaleX: c.scaleX,
|
|
6011
6026
|
appliedScaleY: c.scaleY,
|
|
6012
|
-
wrapPolicy: ii({
|
|
6027
|
+
wrapPolicy: ii({
|
|
6028
|
+
isProportionalScaling: a.isProportionalScaling,
|
|
6029
|
+
startTextSplitByGrapheme: a.startTextSplitByGrapheme
|
|
6030
|
+
}),
|
|
6013
6031
|
measurementCache: a.previewTextMeasurementCache
|
|
6014
6032
|
}).previewHeight;
|
|
6015
6033
|
ni({
|
|
@@ -6045,7 +6063,7 @@ var Si = class {
|
|
|
6045
6063
|
}), c = r ? Y({ 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 = Z({ group: e }), m = this.groupLayoutScales.get(e) ?? {
|
|
6046
6064
|
scaleX: t,
|
|
6047
6065
|
scaleY: n
|
|
6048
|
-
}, { width: h, height: g, hasWidthChange: _, hasDimensionChange: v } =
|
|
6066
|
+
}, { width: h, height: g, hasWidthChange: _, hasDimensionChange: v } = xi({
|
|
6049
6067
|
group: e,
|
|
6050
6068
|
text: a,
|
|
6051
6069
|
constraintPadding: p,
|
|
@@ -6056,9 +6074,12 @@ var Si = class {
|
|
|
6056
6074
|
},
|
|
6057
6075
|
scaleX: m.scaleX,
|
|
6058
6076
|
scaleY: m.scaleY,
|
|
6059
|
-
wrapPolicy: ii({
|
|
6077
|
+
wrapPolicy: ii({
|
|
6078
|
+
isProportionalScaling: o?.isProportionalScaling,
|
|
6079
|
+
startTextSplitByGrapheme: o?.startTextSplitByGrapheme
|
|
6080
|
+
})
|
|
6060
6081
|
});
|
|
6061
|
-
return v ? (
|
|
6082
|
+
return v ? (Ci({
|
|
6062
6083
|
group: e,
|
|
6063
6084
|
shape: i,
|
|
6064
6085
|
text: a,
|
|
@@ -6071,7 +6092,10 @@ var Si = class {
|
|
|
6071
6092
|
canScaleWidth: l,
|
|
6072
6093
|
canScaleHeight: u,
|
|
6073
6094
|
hasWidthChange: _,
|
|
6074
|
-
wrapPolicy: ii({
|
|
6095
|
+
wrapPolicy: ii({
|
|
6096
|
+
isProportionalScaling: o?.isProportionalScaling,
|
|
6097
|
+
startTextSplitByGrapheme: o?.startTextSplitByGrapheme
|
|
6098
|
+
})
|
|
6075
6099
|
}), this.shapeScalingState.delete(e), this.groupLayoutScales.delete(e), e.shapeScalingNoopTransform = !1, !0) : (this.shapeScalingState.delete(e), this.groupLayoutScales.delete(e), e.shapeScalingNoopTransform = !1, !1);
|
|
6076
6100
|
}
|
|
6077
6101
|
resolveCommittedScale({ selection: e }) {
|
|
@@ -6095,7 +6119,7 @@ var Si = class {
|
|
|
6095
6119
|
if (!U(r)) continue;
|
|
6096
6120
|
let { shape: e, text: i } = H({ group: r });
|
|
6097
6121
|
if (!e || !i) continue;
|
|
6098
|
-
let a = Z({ group: r }), o =
|
|
6122
|
+
let a = Z({ group: r }), o = bi({
|
|
6099
6123
|
scalingState: this.shapeScalingState,
|
|
6100
6124
|
group: r,
|
|
6101
6125
|
text: i,
|
|
@@ -6445,7 +6469,7 @@ var Si = class {
|
|
|
6445
6469
|
scaleY: r
|
|
6446
6470
|
}), c && o !== null && s !== null && e.setPositionByOrigin(c, o, s), e.setCoords();
|
|
6447
6471
|
}
|
|
6448
|
-
},
|
|
6472
|
+
}, Ti = class {
|
|
6449
6473
|
constructor({ canvas: t }) {
|
|
6450
6474
|
this.handleObjectScaling = (t) => {
|
|
6451
6475
|
let { target: n, transform: r } = t;
|
|
@@ -6464,7 +6488,7 @@ var Si = class {
|
|
|
6464
6488
|
lockScalingFlip: !0,
|
|
6465
6489
|
centeredScaling: !1
|
|
6466
6490
|
});
|
|
6467
|
-
let s = Z({ group: i }), c =
|
|
6491
|
+
let s = Z({ group: i }), c = bi({
|
|
6468
6492
|
scalingState: this.scalingState,
|
|
6469
6493
|
group: i,
|
|
6470
6494
|
text: o,
|
|
@@ -6748,7 +6772,7 @@ var Si = class {
|
|
|
6748
6772
|
state: r
|
|
6749
6773
|
}) && (y = Math.max(1 / s, i / s));
|
|
6750
6774
|
}
|
|
6751
|
-
let { width: b, height: x, hasWidthChange: S, hasDimensionChange: C } =
|
|
6775
|
+
let { width: b, height: x, hasWidthChange: S, hasDimensionChange: C } = xi({
|
|
6752
6776
|
group: n,
|
|
6753
6777
|
text: d,
|
|
6754
6778
|
constraintPadding: m,
|
|
@@ -6762,7 +6786,10 @@ var Si = class {
|
|
|
6762
6786
|
},
|
|
6763
6787
|
scaleX: v,
|
|
6764
6788
|
scaleY: y,
|
|
6765
|
-
wrapPolicy: ii({
|
|
6789
|
+
wrapPolicy: ii({
|
|
6790
|
+
isProportionalScaling: r?.isProportionalScaling,
|
|
6791
|
+
startTextSplitByGrapheme: r?.startTextSplitByGrapheme
|
|
6792
|
+
})
|
|
6766
6793
|
});
|
|
6767
6794
|
if (!C && r) {
|
|
6768
6795
|
this._restoreShapeStateWithoutResize({
|
|
@@ -6781,7 +6808,7 @@ var Si = class {
|
|
|
6781
6808
|
r && n.set({
|
|
6782
6809
|
left: r.lastAllowedLeft,
|
|
6783
6810
|
top: r.lastAllowedTop
|
|
6784
|
-
}),
|
|
6811
|
+
}), Ci({
|
|
6785
6812
|
group: n,
|
|
6786
6813
|
shape: u,
|
|
6787
6814
|
text: d,
|
|
@@ -6794,12 +6821,15 @@ var Si = class {
|
|
|
6794
6821
|
canScaleWidth: g,
|
|
6795
6822
|
canScaleHeight: _,
|
|
6796
6823
|
hasWidthChange: S,
|
|
6797
|
-
wrapPolicy: ii({
|
|
6824
|
+
wrapPolicy: ii({
|
|
6825
|
+
isProportionalScaling: r?.isProportionalScaling,
|
|
6826
|
+
startTextSplitByGrapheme: r?.startTextSplitByGrapheme
|
|
6827
|
+
})
|
|
6798
6828
|
}), r && this._restoreScalingAnchorPosition({
|
|
6799
6829
|
group: n,
|
|
6800
6830
|
state: r
|
|
6801
6831
|
}), n.setCoords(), d.setCoords(), u.setCoords(), this.scalingState.delete(n), n.shapeScalingNoopTransform = !1, this.canvas.requestRenderAll();
|
|
6802
|
-
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.activeSelectionScalingController = new
|
|
6832
|
+
}, this.canvas = t, this.scalingState = /* @__PURE__ */ new WeakMap(), this.activeSelectionScalingController = new wi({
|
|
6803
6833
|
canvas: t,
|
|
6804
6834
|
shapeScalingState: this.scalingState
|
|
6805
6835
|
});
|
|
@@ -7062,7 +7092,10 @@ var Si = class {
|
|
|
7062
7092
|
group: e,
|
|
7063
7093
|
width: l,
|
|
7064
7094
|
height: u
|
|
7065
|
-
}), f = o ?? "center", p = s ?? "middle", m = ii({
|
|
7095
|
+
}), f = o ?? "center", p = s ?? "middle", m = ii({
|
|
7096
|
+
isProportionalScaling: r.isProportionalScaling,
|
|
7097
|
+
startTextSplitByGrapheme: r.startTextSplitByGrapheme
|
|
7098
|
+
}), h = ({ width: t, height: n }) => di({
|
|
7066
7099
|
group: e,
|
|
7067
7100
|
width: t,
|
|
7068
7101
|
height: n
|
|
@@ -7103,7 +7136,7 @@ var Si = class {
|
|
|
7103
7136
|
state: r
|
|
7104
7137
|
});
|
|
7105
7138
|
}
|
|
7106
|
-
},
|
|
7139
|
+
}, Ei = class {
|
|
7107
7140
|
constructor({ canvas: e }) {
|
|
7108
7141
|
this.handleMouseDown = (e) => {
|
|
7109
7142
|
let { target: t, e: n, subTargets: r = [] } = e, i = Xe({
|
|
@@ -7227,7 +7260,7 @@ var Si = class {
|
|
|
7227
7260
|
let t = this.canvas;
|
|
7228
7261
|
t.findTarget = e.findTarget, this.editingTargetResolverState = void 0;
|
|
7229
7262
|
}
|
|
7230
|
-
},
|
|
7263
|
+
}, Di = 1e-4, Oi = class {
|
|
7231
7264
|
constructor({ runtime: t }) {
|
|
7232
7265
|
this._handleObjectScaling = (e) => {
|
|
7233
7266
|
this.runtime.collectShapeGroupsFromTarget({
|
|
@@ -7312,7 +7345,7 @@ var Si = class {
|
|
|
7312
7345
|
let r = t.getObjects(), i = r.filter((e) => U(e));
|
|
7313
7346
|
if (!i.length) return;
|
|
7314
7347
|
let { scaleX: a, scaleY: o } = this.runtime.scalingController.resolveActiveSelectionCommittedScale({ selection: t });
|
|
7315
|
-
if (!(Math.abs(a - 1) >
|
|
7348
|
+
if (!(Math.abs(a - 1) > Di || Math.abs(o - 1) > Di)) {
|
|
7316
7349
|
this.runtime.scalingController.clearActiveSelectionState({ selection: t });
|
|
7317
7350
|
return;
|
|
7318
7351
|
}
|
|
@@ -7330,7 +7363,7 @@ var Si = class {
|
|
|
7330
7363
|
}), e.setCoords());
|
|
7331
7364
|
}), this.runtime.scalingController.clearActiveSelectionState({ selection: t }), s.setActiveObject(new e(r, { canvas: s })), s.requestRenderAll();
|
|
7332
7365
|
}
|
|
7333
|
-
},
|
|
7366
|
+
}, ki = class {
|
|
7334
7367
|
constructor({ editor: e }) {
|
|
7335
7368
|
this.editor = e;
|
|
7336
7369
|
}
|
|
@@ -7448,7 +7481,7 @@ var Si = class {
|
|
|
7448
7481
|
let b = Math.max(1, a ?? m.height), x = v({
|
|
7449
7482
|
width: y,
|
|
7450
7483
|
height: b
|
|
7451
|
-
}), S =
|
|
7484
|
+
}), S = r ?? this.editor.canvasManager.getObjectPlacement({ object: e });
|
|
7452
7485
|
jr({
|
|
7453
7486
|
group: e,
|
|
7454
7487
|
shape: t,
|
|
@@ -7458,7 +7491,7 @@ var Si = class {
|
|
|
7458
7491
|
alignH: o ?? e.shapeAlignHorizontal ?? "center",
|
|
7459
7492
|
alignV: s ?? e.shapeAlignVertical ?? "middle",
|
|
7460
7493
|
padding: g,
|
|
7461
|
-
wrapPolicy:
|
|
7494
|
+
wrapPolicy: u,
|
|
7462
7495
|
shapeTextAutoExpandEnabled: _,
|
|
7463
7496
|
internalShapeTextInset: x,
|
|
7464
7497
|
resolveInternalShapeTextInset: v,
|
|
@@ -7468,7 +7501,7 @@ var Si = class {
|
|
|
7468
7501
|
changedPadding: p
|
|
7469
7502
|
}), this.editor.canvasManager.applyObjectPlacement({
|
|
7470
7503
|
object: e,
|
|
7471
|
-
placement:
|
|
7504
|
+
placement: S
|
|
7472
7505
|
});
|
|
7473
7506
|
}
|
|
7474
7507
|
_resolveAutoExpandShapeWidth({ text: e, currentWidth: t, minimumWidth: n, padding: r, resolvePaddingForWidth: i }) {
|
|
@@ -7482,7 +7515,7 @@ var Si = class {
|
|
|
7482
7515
|
resolvePaddingForWidth: i
|
|
7483
7516
|
}) : Math.max(1, t, n);
|
|
7484
7517
|
}
|
|
7485
|
-
},
|
|
7518
|
+
}, Ai = class e {
|
|
7486
7519
|
constructor({ canvas: e }) {
|
|
7487
7520
|
this.canvas = e, this.textEditingSnapshots = /* @__PURE__ */ new WeakMap(), this.pendingTextUpdates = /* @__PURE__ */ new WeakMap(), this.resizeStartSnapshots = /* @__PURE__ */ new Map(), this.pendingResizeUpdates = /* @__PURE__ */ new WeakMap();
|
|
7488
7521
|
}
|
|
@@ -7678,7 +7711,7 @@ var Si = class {
|
|
|
7678
7711
|
}
|
|
7679
7712
|
}), I;
|
|
7680
7713
|
}
|
|
7681
|
-
},
|
|
7714
|
+
}, ji = .01, Mi = ({ textbox: e }) => {
|
|
7682
7715
|
let t = e.text ?? "";
|
|
7683
7716
|
if (!t.length) return [];
|
|
7684
7717
|
let n = t.split("\n"), r = [], i = 0;
|
|
@@ -7690,7 +7723,7 @@ var Si = class {
|
|
|
7690
7723
|
});
|
|
7691
7724
|
}
|
|
7692
7725
|
return r;
|
|
7693
|
-
},
|
|
7726
|
+
}, Ni = ({ range: e, text: t }) => {
|
|
7694
7727
|
if (!e) return null;
|
|
7695
7728
|
let n = t.length;
|
|
7696
7729
|
if (n <= 0) return null;
|
|
@@ -7699,8 +7732,8 @@ var Si = class {
|
|
|
7699
7732
|
start: l,
|
|
7700
7733
|
end: u
|
|
7701
7734
|
};
|
|
7702
|
-
},
|
|
7703
|
-
let n =
|
|
7735
|
+
}, Pi = ({ textbox: e, range: t }) => {
|
|
7736
|
+
let n = Mi({ textbox: e });
|
|
7704
7737
|
if (!n.length) return t;
|
|
7705
7738
|
let { start: r } = t, { end: i } = t;
|
|
7706
7739
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -7713,7 +7746,7 @@ var Si = class {
|
|
|
7713
7746
|
start: r,
|
|
7714
7747
|
end: i
|
|
7715
7748
|
};
|
|
7716
|
-
},
|
|
7749
|
+
}, Fi = ({ textbox: e, range: t }) => {
|
|
7717
7750
|
let n = e.text ?? "";
|
|
7718
7751
|
if (!n.length) return [];
|
|
7719
7752
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7722,7 +7755,7 @@ var Si = class {
|
|
|
7722
7755
|
i > n && r < c && o.push(e), s = c + 1;
|
|
7723
7756
|
}
|
|
7724
7757
|
return o;
|
|
7725
|
-
},
|
|
7758
|
+
}, Ii = ({ textbox: e, range: t }) => {
|
|
7726
7759
|
let n = e.text ?? "";
|
|
7727
7760
|
if (!n.length) return [];
|
|
7728
7761
|
let { start: r, end: i } = t, a = n.split("\n"), o = [], s = 0;
|
|
@@ -7731,21 +7764,21 @@ var Si = class {
|
|
|
7731
7764
|
r <= n && i >= c && o.push(e), s = c + 1;
|
|
7732
7765
|
}
|
|
7733
7766
|
return o;
|
|
7734
|
-
},
|
|
7767
|
+
}, Li = ({ previous: e, next: t }) => {
|
|
7735
7768
|
let n = Math.min(e.length, t.length);
|
|
7736
7769
|
for (let r = 0; r < n; r += 1) if (e[r] !== t[r]) return r;
|
|
7737
7770
|
return n;
|
|
7738
|
-
},
|
|
7771
|
+
}, Ri = ({ text: e, charIndex: t }) => {
|
|
7739
7772
|
let n = Math.max(0, Math.min(t, e.length)), r = 0;
|
|
7740
7773
|
for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1);
|
|
7741
7774
|
return r;
|
|
7742
|
-
},
|
|
7775
|
+
}, zi = ({ text: e, lineIndex: t }) => {
|
|
7743
7776
|
if (t <= 0) return 0;
|
|
7744
7777
|
let n = 0;
|
|
7745
7778
|
for (let r = 0; r < e.length; r += 1) if (e[r] === "\n" && (n += 1, n === t)) return r + 1;
|
|
7746
7779
|
return e.length;
|
|
7747
|
-
},
|
|
7748
|
-
let a =
|
|
7780
|
+
}, Bi = ({ deltaLines: e, diffIndex: t, lineFontDefaults: n, lineIndexOld: r, previousText: i }) => {
|
|
7781
|
+
let a = zi({
|
|
7749
7782
|
text: i,
|
|
7750
7783
|
lineIndex: r
|
|
7751
7784
|
}), o = r + 1;
|
|
@@ -7764,7 +7797,7 @@ var Si = class {
|
|
|
7764
7797
|
lineFontDefaults: s,
|
|
7765
7798
|
changed: !0
|
|
7766
7799
|
};
|
|
7767
|
-
},
|
|
7800
|
+
}, Vi = ({ deltaLines: e, diffIndex: t, lineFontDefaults: n, lineIndexOld: r, previousLines: i, previousText: a }) => {
|
|
7768
7801
|
let o = Math.abs(e), s = r;
|
|
7769
7802
|
a[t] === "\n" && (i[r] ?? "").length > 0 && (s = r + 1);
|
|
7770
7803
|
let c = s + o - 1, l = {}, u = [];
|
|
@@ -7787,7 +7820,7 @@ var Si = class {
|
|
|
7787
7820
|
lineDefaults: u
|
|
7788
7821
|
}
|
|
7789
7822
|
};
|
|
7790
|
-
},
|
|
7823
|
+
}, Hi = ({ lineFontDefaults: e, previousText: t, currentText: n }) => {
|
|
7791
7824
|
if (!e || !Object.keys(e).length) return {
|
|
7792
7825
|
lineFontDefaults: e,
|
|
7793
7826
|
changed: !1
|
|
@@ -7797,20 +7830,20 @@ var Si = class {
|
|
|
7797
7830
|
lineFontDefaults: e,
|
|
7798
7831
|
changed: !1
|
|
7799
7832
|
};
|
|
7800
|
-
let a =
|
|
7833
|
+
let a = Li({
|
|
7801
7834
|
previous: t,
|
|
7802
7835
|
next: n
|
|
7803
|
-
}), o =
|
|
7836
|
+
}), o = Ri({
|
|
7804
7837
|
text: t,
|
|
7805
7838
|
charIndex: a
|
|
7806
7839
|
});
|
|
7807
|
-
return i > 0 ?
|
|
7840
|
+
return i > 0 ? Bi({
|
|
7808
7841
|
deltaLines: i,
|
|
7809
7842
|
diffIndex: a,
|
|
7810
7843
|
lineFontDefaults: e,
|
|
7811
7844
|
lineIndexOld: o,
|
|
7812
7845
|
previousText: t
|
|
7813
|
-
}) :
|
|
7846
|
+
}) : Vi({
|
|
7814
7847
|
deltaLines: i,
|
|
7815
7848
|
diffIndex: a,
|
|
7816
7849
|
lineFontDefaults: e,
|
|
@@ -7818,10 +7851,10 @@ var Si = class {
|
|
|
7818
7851
|
previousLines: r,
|
|
7819
7852
|
previousText: t
|
|
7820
7853
|
});
|
|
7821
|
-
},
|
|
7854
|
+
}, Ui = ({ lineDefaults: e }) => {
|
|
7822
7855
|
let t = {};
|
|
7823
7856
|
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;
|
|
7824
|
-
},
|
|
7857
|
+
}, Wi = ({ textbox: e, lineIndices: t, updates: n }) => {
|
|
7825
7858
|
if (!t.length) return !1;
|
|
7826
7859
|
let { fill: r, fontFamily: i, fontSize: a, fontStyle: o, fontWeight: s, linethrough: c, stroke: l, strokeWidth: u, underline: d } = n;
|
|
7827
7860
|
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;
|
|
@@ -7833,12 +7866,12 @@ var Si = class {
|
|
|
7833
7866
|
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);
|
|
7834
7867
|
}
|
|
7835
7868
|
return m && (e.lineFontDefaults = p), m;
|
|
7836
|
-
},
|
|
7869
|
+
}, Gi = ({ lineStyles: e, lineDefaults: t }) => {
|
|
7837
7870
|
if (!e) return {
|
|
7838
7871
|
lineStyles: e,
|
|
7839
7872
|
changed: !1
|
|
7840
7873
|
};
|
|
7841
|
-
let n =
|
|
7874
|
+
let n = Ui({ lineDefaults: t }), r = Object.keys(n);
|
|
7842
7875
|
if (!r.length) return {
|
|
7843
7876
|
lineStyles: e,
|
|
7844
7877
|
changed: !1
|
|
@@ -7862,7 +7895,7 @@ var Si = class {
|
|
|
7862
7895
|
lineStyles: e,
|
|
7863
7896
|
changed: !1
|
|
7864
7897
|
};
|
|
7865
|
-
},
|
|
7898
|
+
}, Ki = ({ cleanup: e, lineCount: t, styles: n }) => {
|
|
7866
7899
|
if (!e) return {
|
|
7867
7900
|
styles: n,
|
|
7868
7901
|
changed: !1
|
|
@@ -7882,7 +7915,7 @@ var Si = class {
|
|
|
7882
7915
|
for (let t = 0; t < e.lineDefaults.length; t += 1) {
|
|
7883
7916
|
let n = e.lineDefaults[t];
|
|
7884
7917
|
if (!n) continue;
|
|
7885
|
-
let a =
|
|
7918
|
+
let a = Gi({
|
|
7886
7919
|
lineStyles: r,
|
|
7887
7920
|
lineDefaults: n
|
|
7888
7921
|
});
|
|
@@ -7897,19 +7930,19 @@ var Si = class {
|
|
|
7897
7930
|
styles: a,
|
|
7898
7931
|
changed: !0
|
|
7899
7932
|
};
|
|
7900
|
-
},
|
|
7933
|
+
}, qi = ({ textbox: e }) => {
|
|
7901
7934
|
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;
|
|
7902
7935
|
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;
|
|
7903
|
-
},
|
|
7936
|
+
}, Ji = ({ sourceDefaults: e, globalLineDefaults: t }) => {
|
|
7904
7937
|
let n = {};
|
|
7905
7938
|
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;
|
|
7906
|
-
},
|
|
7939
|
+
}, Yi = ({ lineText: e, lineStyles: t, lineDefaults: n }) => {
|
|
7907
7940
|
let r = e.length;
|
|
7908
7941
|
if (r === 0) return {
|
|
7909
7942
|
lineStyles: t,
|
|
7910
7943
|
changed: !1
|
|
7911
7944
|
};
|
|
7912
|
-
let i =
|
|
7945
|
+
let i = Ui({ lineDefaults: n }), a = Object.keys(i);
|
|
7913
7946
|
if (!a.length) return {
|
|
7914
7947
|
lineStyles: t,
|
|
7915
7948
|
changed: !1
|
|
@@ -7935,8 +7968,8 @@ var Si = class {
|
|
|
7935
7968
|
lineStyles: o,
|
|
7936
7969
|
changed: s
|
|
7937
7970
|
};
|
|
7938
|
-
},
|
|
7939
|
-
let a = n, o = !1, s = !1, c = i, l = !1, u = !1, d, f =
|
|
7971
|
+
}, Xi = ({ deletedLineDefaultsCleanup: e, globalLineDefaults: t, lineFontDefaults: n, lines: r, styles: i }) => {
|
|
7972
|
+
let a = n, o = !1, s = !1, c = i, l = !1, u = !1, d, f = Ki({
|
|
7940
7973
|
styles: c ?? {},
|
|
7941
7974
|
lineCount: r.length,
|
|
7942
7975
|
cleanup: e
|
|
@@ -7947,7 +7980,7 @@ var Si = class {
|
|
|
7947
7980
|
if (i && (d = i), n.length !== 0) {
|
|
7948
7981
|
let t = i;
|
|
7949
7982
|
if (!t && d && (t = { ...d }, a || (a = {}, s = !0), s ||= (a = { ...a }, !0), a[e] = t, o = !0), t) {
|
|
7950
|
-
let r =
|
|
7983
|
+
let r = Yi({
|
|
7951
7984
|
lineText: n,
|
|
7952
7985
|
lineStyles: c ? c[e] : void 0,
|
|
7953
7986
|
lineDefaults: t
|
|
@@ -7956,12 +7989,12 @@ var Si = class {
|
|
|
7956
7989
|
}
|
|
7957
7990
|
continue;
|
|
7958
7991
|
}
|
|
7959
|
-
let f =
|
|
7992
|
+
let f = Ji({
|
|
7960
7993
|
sourceDefaults: i ?? d,
|
|
7961
7994
|
globalLineDefaults: t
|
|
7962
7995
|
});
|
|
7963
7996
|
!i && Object.keys(f).length && (a || (a = {}, s = !0), s ||= (a = { ...a }, !0), a[e] = f, o = !0, d = f), i && (d = i);
|
|
7964
|
-
let p =
|
|
7997
|
+
let p = Ui({ lineDefaults: f }), m = Object.keys(p).length > 0;
|
|
7965
7998
|
(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);
|
|
7966
7999
|
}
|
|
7967
8000
|
return {
|
|
@@ -7971,8 +8004,8 @@ var Si = class {
|
|
|
7971
8004
|
stylesChanged: l
|
|
7972
8005
|
};
|
|
7973
8006
|
};
|
|
7974
|
-
function
|
|
7975
|
-
let t = (e.text ?? "").split("\n"), n =
|
|
8007
|
+
function Zi({ textbox: e }) {
|
|
8008
|
+
let t = (e.text ?? "").split("\n"), n = qi({ textbox: e }), r = Xi({
|
|
7976
8009
|
lines: t,
|
|
7977
8010
|
styles: e.styles,
|
|
7978
8011
|
lineFontDefaults: e.lineFontDefaults,
|
|
@@ -7984,7 +8017,7 @@ function Yi({ textbox: e }) {
|
|
|
7984
8017
|
if (!Number.isInteger(t) || t < 0) continue;
|
|
7985
8018
|
let o = r.styles[e];
|
|
7986
8019
|
if (!o) continue;
|
|
7987
|
-
let s =
|
|
8020
|
+
let s = Gi({
|
|
7988
8021
|
lineStyles: o,
|
|
7989
8022
|
lineDefaults: i?.[t] ?? n
|
|
7990
8023
|
});
|
|
@@ -7995,31 +8028,31 @@ function Yi({ textbox: e }) {
|
|
|
7995
8028
|
styles: a
|
|
7996
8029
|
};
|
|
7997
8030
|
}
|
|
7998
|
-
var
|
|
7999
|
-
let r =
|
|
8031
|
+
var Qi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
8032
|
+
let r = Hi({
|
|
8000
8033
|
lineFontDefaults: n.lineFontDefaults,
|
|
8001
8034
|
previousText: t,
|
|
8002
8035
|
currentText: e
|
|
8003
|
-
}), i =
|
|
8036
|
+
}), i = Xi({
|
|
8004
8037
|
lines: e.split("\n"),
|
|
8005
8038
|
styles: n.styles,
|
|
8006
8039
|
lineFontDefaults: r.lineFontDefaults,
|
|
8007
8040
|
deletedLineDefaultsCleanup: r.deletedLineDefaultsCleanup,
|
|
8008
|
-
globalLineDefaults:
|
|
8041
|
+
globalLineDefaults: qi({ textbox: n })
|
|
8009
8042
|
});
|
|
8010
8043
|
return {
|
|
8011
8044
|
...i,
|
|
8012
8045
|
lineFontDefaultsChanged: r.changed || i.lineFontDefaultsChanged
|
|
8013
8046
|
};
|
|
8014
|
-
},
|
|
8015
|
-
let t =
|
|
8047
|
+
}, $i = ({ textbox: e }) => {
|
|
8048
|
+
let t = Xi({
|
|
8016
8049
|
lines: (e.text ?? "").split("\n"),
|
|
8017
8050
|
styles: e.styles,
|
|
8018
8051
|
lineFontDefaults: e.lineFontDefaults,
|
|
8019
|
-
globalLineDefaults:
|
|
8052
|
+
globalLineDefaults: qi({ textbox: e })
|
|
8020
8053
|
}), n = !1;
|
|
8021
8054
|
return t.lineFontDefaultsChanged && (e.lineFontDefaults = t.lineFontDefaults, n = !0), t.stylesChanged && (e.styles = t.styles, e.dirty = !0, n = !0), n;
|
|
8022
|
-
},
|
|
8055
|
+
}, ea = ({ lineFontDefaults: e }) => {
|
|
8023
8056
|
if (!e) return;
|
|
8024
8057
|
let t = {};
|
|
8025
8058
|
for (let n in e) {
|
|
@@ -8030,7 +8063,7 @@ var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8030
8063
|
i && (t[r] = { ...i });
|
|
8031
8064
|
}
|
|
8032
8065
|
return t;
|
|
8033
|
-
},
|
|
8066
|
+
}, ta = ({ lineFontDefaults: e, scale: t }) => {
|
|
8034
8067
|
if (!e || !Number.isFinite(t) || Math.abs(t - 1) < .01) return;
|
|
8035
8068
|
let n = {}, r = !1, i = !1;
|
|
8036
8069
|
for (let a in e) {
|
|
@@ -8047,18 +8080,18 @@ var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8047
8080
|
n[o] = c, r = !0;
|
|
8048
8081
|
}
|
|
8049
8082
|
if (!(!r || !i)) return n;
|
|
8050
|
-
},
|
|
8083
|
+
}, na = ({ textbox: e, text: t }) => {
|
|
8051
8084
|
let { textLines: n } = e, r = Array.isArray(n) && n.length > 0 ? n.length : Math.max(t.split("\n").length, 1), i = 0;
|
|
8052
8085
|
for (let t = 0; t < r; t += 1) {
|
|
8053
8086
|
let n = e.getLineWidth(t);
|
|
8054
8087
|
n > i && (i = n);
|
|
8055
8088
|
}
|
|
8056
8089
|
return i;
|
|
8057
|
-
},
|
|
8058
|
-
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 +
|
|
8090
|
+
}, ra = ({ origin: e, size: t }) => e === "left" || e === "top" || e === 0 ? 0 : e === "right" || e === "bottom" || e === 1 ? t : t / 2, ia = ({ textbox: e, originX: t = e.originX ?? "center", originY: n = e.originY ?? "center" }) => {
|
|
8091
|
+
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 + ra({
|
|
8059
8092
|
origin: t,
|
|
8060
8093
|
size: r
|
|
8061
|
-
}), u +
|
|
8094
|
+
}), u + ra({
|
|
8062
8095
|
origin: n,
|
|
8063
8096
|
size: i
|
|
8064
8097
|
})), 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);
|
|
@@ -8068,13 +8101,13 @@ var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8068
8101
|
originX: t,
|
|
8069
8102
|
originY: n
|
|
8070
8103
|
};
|
|
8071
|
-
},
|
|
8104
|
+
}, aa = ({ textbox: e, montageLeft: t, montageRight: n }) => {
|
|
8072
8105
|
e.setCoords();
|
|
8073
8106
|
let r = e.getBoundingRect(), i = r.left ?? 0, a = i + (r.width ?? 0), o = n - t;
|
|
8074
8107
|
if (o > 0 && (r.width ?? 0) >= o - .01) return !1;
|
|
8075
8108
|
let s = 0;
|
|
8076
8109
|
return i < t ? s = t - i : a > n && (s = n - a), Math.abs(s) <= .01 ? !1 : (e.set({ left: (e.left ?? 0) + s }), !0);
|
|
8077
|
-
},
|
|
8110
|
+
}, oa = ({ rawValue: e, calculatedValue: t }) => typeof e == "number" ? e : typeof t == "number" ? t : 0, sa = ({ stylesList: e }) => {
|
|
8078
8111
|
let t = e.length;
|
|
8079
8112
|
if (!t) return !1;
|
|
8080
8113
|
for (let n = 0; n < t; n += 1) {
|
|
@@ -8084,16 +8117,16 @@ var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8084
8117
|
if (r !== void 0 || i !== void 0 || a !== void 0 || o !== void 0 || s !== void 0 || c !== void 0) return !0;
|
|
8085
8118
|
}
|
|
8086
8119
|
return !1;
|
|
8087
|
-
},
|
|
8088
|
-
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 =
|
|
8120
|
+
}, ca = ({ textbox: e }) => {
|
|
8121
|
+
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 = oa({
|
|
8089
8122
|
rawValue: t,
|
|
8090
8123
|
calculatedValue: a
|
|
8091
|
-
}), c =
|
|
8124
|
+
}), c = oa({
|
|
8092
8125
|
rawValue: n,
|
|
8093
8126
|
calculatedValue: o
|
|
8094
8127
|
}), l = Number.isFinite(s) ? Math.round(s) : null, u = Number.isFinite(c) ? Math.round(c) : null, d = {};
|
|
8095
8128
|
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;
|
|
8096
|
-
},
|
|
8129
|
+
}, la = ({ textbox: e }) => {
|
|
8097
8130
|
let t = e.width ?? e.calcTextWidth(), n = e.fontSize ?? 16, { styles: r = {} } = e, { lineFontDefaults: i } = e, { paddingTop: a = 0, paddingRight: o = 0, paddingBottom: s = 0, paddingLeft: c = 0 } = e, { radiusTopLeft: l = 0, radiusTopRight: u = 0, radiusBottomRight: d = 0, radiusBottomLeft: f = 0 } = e;
|
|
8098
8131
|
return {
|
|
8099
8132
|
width: t,
|
|
@@ -8111,9 +8144,9 @@ var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8111
8144
|
bottomLeft: f
|
|
8112
8145
|
},
|
|
8113
8146
|
styles: JSON.parse(JSON.stringify(r)),
|
|
8114
|
-
lineFontDefaults:
|
|
8147
|
+
lineFontDefaults: ea({ lineFontDefaults: i })
|
|
8115
8148
|
};
|
|
8116
|
-
},
|
|
8149
|
+
}, ua = ({ base: e }) => {
|
|
8117
8150
|
let t = 1 / Math.max(1, e.width), n = [e.fontSize];
|
|
8118
8151
|
Object.values(e.styles).forEach((e) => {
|
|
8119
8152
|
Object.values(e).forEach((e) => {
|
|
@@ -8130,7 +8163,7 @@ var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8130
8163
|
fontScale: r,
|
|
8131
8164
|
proportionalScale: Math.max(t, r)
|
|
8132
8165
|
};
|
|
8133
|
-
},
|
|
8166
|
+
}, da = ({ textbox: e, base: t, scale: n, shouldScaleFontSize: r = !0, shouldScalePadding: i = !0, shouldScaleRadii: a = !0 }) => {
|
|
8134
8167
|
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;
|
|
8135
8168
|
if (r && f) {
|
|
8136
8169
|
let e = {};
|
|
@@ -8149,7 +8182,7 @@ var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8149
8182
|
}), Object.keys(e).length && (p = e);
|
|
8150
8183
|
}
|
|
8151
8184
|
let m;
|
|
8152
|
-
r && (m =
|
|
8185
|
+
r && (m = ta({
|
|
8153
8186
|
lineFontDefaults: u,
|
|
8154
8187
|
scale: n
|
|
8155
8188
|
}));
|
|
@@ -8175,9 +8208,9 @@ var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8175
8208
|
radiusBottomRight: g.bottomRight,
|
|
8176
8209
|
radiusBottomLeft: g.bottomLeft
|
|
8177
8210
|
});
|
|
8178
|
-
},
|
|
8179
|
-
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) >
|
|
8180
|
-
u && _ && (e.autoExpand = !1),
|
|
8211
|
+
}, fa = ({ 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 }) => {
|
|
8212
|
+
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;
|
|
8213
|
+
u && _ && (e.autoExpand = !1), da({
|
|
8181
8214
|
textbox: e,
|
|
8182
8215
|
base: n,
|
|
8183
8216
|
scale: i,
|
|
@@ -8196,7 +8229,7 @@ var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8196
8229
|
} finally {
|
|
8197
8230
|
e.shouldRoundDimensionsOnInit = v;
|
|
8198
8231
|
}
|
|
8199
|
-
let y = d ?
|
|
8232
|
+
let y = d ? ca({ textbox: e }) : !1;
|
|
8200
8233
|
return y && (e.dirty = !0), o ? (e.set({
|
|
8201
8234
|
originX: a.originX,
|
|
8202
8235
|
originY: a.originY
|
|
@@ -8213,7 +8246,7 @@ var Xi = ({ currentText: e, previousText: t, textbox: n }) => {
|
|
|
8213
8246
|
};
|
|
8214
8247
|
//#endregion
|
|
8215
8248
|
//#region src/editor/shape-manager/mutation/shape-rehydration.ts
|
|
8216
|
-
function
|
|
8249
|
+
function pa({ group: e }) {
|
|
8217
8250
|
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);
|
|
8218
8251
|
return {
|
|
8219
8252
|
currentDimensions: {
|
|
@@ -8230,17 +8263,17 @@ function da({ group: e }) {
|
|
|
8230
8263
|
}
|
|
8231
8264
|
};
|
|
8232
8265
|
}
|
|
8233
|
-
function
|
|
8266
|
+
function ma({ group: e, text: t, textScale: n }) {
|
|
8234
8267
|
let r = Number.isFinite(n) && n > 0 ? n : 1;
|
|
8235
|
-
Math.abs(r - 1) <= 1e-4 || (
|
|
8268
|
+
Math.abs(r - 1) <= 1e-4 || (da({
|
|
8236
8269
|
textbox: t,
|
|
8237
|
-
base:
|
|
8270
|
+
base: la({ textbox: t }),
|
|
8238
8271
|
scale: r
|
|
8239
8272
|
}), 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));
|
|
8240
8273
|
}
|
|
8241
8274
|
//#endregion
|
|
8242
8275
|
//#region src/editor/shape-manager/mutation/shape-update-pipeline.ts
|
|
8243
|
-
var
|
|
8276
|
+
var ha = {
|
|
8244
8277
|
angle: 0,
|
|
8245
8278
|
skewX: 0,
|
|
8246
8279
|
skewY: 0,
|
|
@@ -8253,7 +8286,7 @@ var pa = {
|
|
|
8253
8286
|
top: 0,
|
|
8254
8287
|
originX: "left",
|
|
8255
8288
|
originY: "top"
|
|
8256
|
-
},
|
|
8289
|
+
}, ga = class {
|
|
8257
8290
|
constructor({ runtime: e }) {
|
|
8258
8291
|
this.runtime = e;
|
|
8259
8292
|
}
|
|
@@ -8551,7 +8584,7 @@ var pa = {
|
|
|
8551
8584
|
width: Math.max(1, e.width ?? t),
|
|
8552
8585
|
align: n
|
|
8553
8586
|
});
|
|
8554
|
-
return s.set(
|
|
8587
|
+
return s.set(ha), this.runtime.applyTextUpdates({
|
|
8555
8588
|
textNode: s,
|
|
8556
8589
|
text: r,
|
|
8557
8590
|
textStyle: i,
|
|
@@ -8613,9 +8646,9 @@ var pa = {
|
|
|
8613
8646
|
shouldPreserveCurrentWidth: r
|
|
8614
8647
|
};
|
|
8615
8648
|
}
|
|
8616
|
-
},
|
|
8649
|
+
}, _a = class {
|
|
8617
8650
|
constructor({ runtime: e }) {
|
|
8618
|
-
this.runtime = e, this.updatePipeline = new
|
|
8651
|
+
this.runtime = e, this.updatePipeline = new ga({ runtime: e });
|
|
8619
8652
|
}
|
|
8620
8653
|
async update({ target: e, presetKey: t, options: n = {} } = {}) {
|
|
8621
8654
|
let r = await this.updatePipeline.prepare({
|
|
@@ -8791,8 +8824,8 @@ var pa = {
|
|
|
8791
8824
|
if (!r) return !1;
|
|
8792
8825
|
let { shape: i, text: a } = H({ group: r });
|
|
8793
8826
|
if (!i || !a) return !1;
|
|
8794
|
-
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } =
|
|
8795
|
-
return
|
|
8827
|
+
let o = this.runtime.editor.canvasManager.getObjectPlacement({ object: r }), { currentDimensions: s, manualDimensions: c, replaceBoxDimensions: l } = pa({ group: r });
|
|
8828
|
+
return ma({
|
|
8796
8829
|
group: r,
|
|
8797
8830
|
text: a,
|
|
8798
8831
|
textScale: t
|
|
@@ -8861,7 +8894,7 @@ var pa = {
|
|
|
8861
8894
|
}
|
|
8862
8895
|
_applyPreparedTextState({ preparedUpdate: e }) {
|
|
8863
8896
|
let { current: t, text: n } = e;
|
|
8864
|
-
this.runtime.detachShapeGroupAutoLayout({ group: t.group }), t.text.set(
|
|
8897
|
+
this.runtime.detachShapeGroupAutoLayout({ group: t.group }), t.text.set(ha), this.runtime.applyTextUpdates({
|
|
8865
8898
|
textNode: t.text,
|
|
8866
8899
|
text: n.value,
|
|
8867
8900
|
textStyle: n.style,
|
|
@@ -8915,9 +8948,9 @@ var pa = {
|
|
|
8915
8948
|
let { current: t, next: n, layout: r, placement: i } = e;
|
|
8916
8949
|
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);
|
|
8917
8950
|
}
|
|
8918
|
-
},
|
|
8951
|
+
}, va = class {
|
|
8919
8952
|
constructor({ editor: e }) {
|
|
8920
|
-
this.editor = e, Ye(), this.scalingController = new
|
|
8953
|
+
this.editor = e, Ye(), this.scalingController = new Ti({ canvas: e.canvas }), this.editingController = new Ei({ canvas: e.canvas }), this.editingPlacements = /* @__PURE__ */ new WeakMap(), this.lifecycleController = new Ai({ canvas: e.canvas }), this.layoutController = new ki({ editor: this.editor }), this.mutationController = new _a({ runtime: {
|
|
8921
8954
|
editor: this.editor,
|
|
8922
8955
|
lifecycleController: this.lifecycleController,
|
|
8923
8956
|
editingPlacements: this.editingPlacements,
|
|
@@ -8941,7 +8974,7 @@ var pa = {
|
|
|
8941
8974
|
beginMutation: () => this._beginMutation(),
|
|
8942
8975
|
endMutation: (e) => this._endMutation(e),
|
|
8943
8976
|
isOnCanvas: (e) => this._isOnCanvas(e)
|
|
8944
|
-
} }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this.eventController = new
|
|
8977
|
+
} }), this.internalTextUpdates = /* @__PURE__ */ new WeakSet(), this.eventController = new Oi({ runtime: {
|
|
8945
8978
|
editor: this.editor,
|
|
8946
8979
|
scalingController: this.scalingController,
|
|
8947
8980
|
editingController: this.editingController,
|
|
@@ -9475,7 +9508,7 @@ var pa = {
|
|
|
9475
9508
|
}
|
|
9476
9509
|
return null;
|
|
9477
9510
|
}
|
|
9478
|
-
},
|
|
9511
|
+
}, ya = ({ rootObject: t, enableEvented: n = !0 }) => {
|
|
9479
9512
|
let r = [{
|
|
9480
9513
|
object: t,
|
|
9481
9514
|
enableEvented: n
|
|
@@ -9489,7 +9522,7 @@ var pa = {
|
|
|
9489
9522
|
enableEvented: o
|
|
9490
9523
|
});
|
|
9491
9524
|
}
|
|
9492
|
-
},
|
|
9525
|
+
}, ba = class {
|
|
9493
9526
|
constructor({ editor: e }) {
|
|
9494
9527
|
this.editor = e, this.clipboard = null;
|
|
9495
9528
|
}
|
|
@@ -9653,7 +9686,7 @@ var pa = {
|
|
|
9653
9686
|
if (!n || n.locked) return !1;
|
|
9654
9687
|
try {
|
|
9655
9688
|
let e = await n.clone(Mt);
|
|
9656
|
-
return
|
|
9689
|
+
return ya({ rootObject: e }), e.set({
|
|
9657
9690
|
left: e.left + 10,
|
|
9658
9691
|
top: e.top + 10
|
|
9659
9692
|
}), this._materializeCloneGeometry({ clonedObject: e }), this._addClonedObjectToCanvas(e), t.fire("editor:object-duplicated", {
|
|
@@ -9741,7 +9774,7 @@ var pa = {
|
|
|
9741
9774
|
if (!this.clipboard) return !1;
|
|
9742
9775
|
try {
|
|
9743
9776
|
let t = await this.clipboard.clone(Mt);
|
|
9744
|
-
return e.discardActiveObject(),
|
|
9777
|
+
return e.discardActiveObject(), ya({ rootObject: t }), t.set({
|
|
9745
9778
|
left: t.left + 10,
|
|
9746
9779
|
top: t.top + 10
|
|
9747
9780
|
}), this._materializeCloneGeometry({ clonedObject: t }), this._addClonedObjectToCanvas(t), e.fire("editor:object-pasted", {
|
|
@@ -9760,7 +9793,7 @@ var pa = {
|
|
|
9760
9793
|
}), !1;
|
|
9761
9794
|
}
|
|
9762
9795
|
}
|
|
9763
|
-
},
|
|
9796
|
+
}, xa = class t {
|
|
9764
9797
|
constructor({ editor: e }) {
|
|
9765
9798
|
this.editor = e;
|
|
9766
9799
|
}
|
|
@@ -9825,7 +9858,7 @@ var pa = {
|
|
|
9825
9858
|
!(n instanceof v) || !n.isEditing || n.exitEditing();
|
|
9826
9859
|
}
|
|
9827
9860
|
}
|
|
9828
|
-
},
|
|
9861
|
+
}, Sa = class {
|
|
9829
9862
|
constructor({ editor: e }) {
|
|
9830
9863
|
this.editor = e;
|
|
9831
9864
|
}
|
|
@@ -9897,7 +9930,7 @@ var pa = {
|
|
|
9897
9930
|
i.resumeHistory(), n || i.saveState();
|
|
9898
9931
|
}
|
|
9899
9932
|
}
|
|
9900
|
-
},
|
|
9933
|
+
}, Ca = class t {
|
|
9901
9934
|
constructor({ editor: e }) {
|
|
9902
9935
|
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();
|
|
9903
9936
|
}
|
|
@@ -10091,7 +10124,7 @@ var pa = {
|
|
|
10091
10124
|
let { options: e } = this.editor, { selectionKey: t } = e;
|
|
10092
10125
|
return t === void 0 ? ["ctrlKey", "metaKey"] : t;
|
|
10093
10126
|
}
|
|
10094
|
-
},
|
|
10127
|
+
}, wa = class e {
|
|
10095
10128
|
constructor({ editor: e }) {
|
|
10096
10129
|
this.editor = e;
|
|
10097
10130
|
}
|
|
@@ -10131,7 +10164,7 @@ var pa = {
|
|
|
10131
10164
|
};
|
|
10132
10165
|
return i.fire("editor:objects-deleted", l), l;
|
|
10133
10166
|
}
|
|
10134
|
-
},
|
|
10167
|
+
}, Ta = {
|
|
10135
10168
|
IMAGE_MANAGER: {
|
|
10136
10169
|
INVALID_CONTENT_TYPE: "INVALID_CONTENT_TYPE",
|
|
10137
10170
|
INVALID_SOURCE_TYPE: "INVALID_SOURCE_TYPE",
|
|
@@ -10170,7 +10203,7 @@ var pa = {
|
|
|
10170
10203
|
INVALID_TARGET: "TEMPLATE_INVALID_TARGET",
|
|
10171
10204
|
APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
|
|
10172
10205
|
}
|
|
10173
|
-
},
|
|
10206
|
+
}, Ea = class e {
|
|
10174
10207
|
constructor({ editor: e }) {
|
|
10175
10208
|
this._buffer = [], this.editor = e;
|
|
10176
10209
|
}
|
|
@@ -10228,9 +10261,9 @@ var pa = {
|
|
|
10228
10261
|
}), this.editor.canvas.fire("editor:warning", s);
|
|
10229
10262
|
}
|
|
10230
10263
|
static isValidErrorCode(e) {
|
|
10231
|
-
return e ? Object.values(
|
|
10264
|
+
return e ? Object.values(Ta).some((t) => Object.values(t).includes(e)) : !1;
|
|
10232
10265
|
}
|
|
10233
|
-
},
|
|
10266
|
+
}, Da = class {
|
|
10234
10267
|
constructor({ editor: e }) {
|
|
10235
10268
|
this.currentBounds = null, this.editor = e;
|
|
10236
10269
|
}
|
|
@@ -10279,32 +10312,32 @@ var pa = {
|
|
|
10279
10312
|
updateBounds() {
|
|
10280
10313
|
this.currentBounds = this.calculatePanBounds();
|
|
10281
10314
|
}
|
|
10282
|
-
},
|
|
10315
|
+
}, Oa = ({ textbox: e }) => {
|
|
10283
10316
|
if (!e.isEditing) return null;
|
|
10284
10317
|
let t = e.selectionStart ?? 0, n = e.selectionEnd ?? t;
|
|
10285
10318
|
return t === n ? null : {
|
|
10286
10319
|
start: Math.min(t, n),
|
|
10287
10320
|
end: Math.max(t, n)
|
|
10288
10321
|
};
|
|
10289
|
-
},
|
|
10322
|
+
}, ka = ({ textbox: e }) => {
|
|
10290
10323
|
let t = e.text?.length ?? 0;
|
|
10291
10324
|
return t <= 0 ? null : {
|
|
10292
10325
|
start: 0,
|
|
10293
10326
|
end: t
|
|
10294
10327
|
};
|
|
10295
|
-
},
|
|
10328
|
+
}, Aa = ({ textbox: e, range: t }) => {
|
|
10296
10329
|
if (!t) return !1;
|
|
10297
10330
|
let n = e.text?.length ?? 0;
|
|
10298
10331
|
return n <= 0 ? !1 : t.start <= 0 && t.end >= n;
|
|
10299
|
-
},
|
|
10332
|
+
}, ja = ({ textbox: e, styles: t, range: n }) => {
|
|
10300
10333
|
if (!t || !Object.keys(t).length) return !1;
|
|
10301
10334
|
let { start: r, end: i } = n;
|
|
10302
10335
|
return i <= r ? !1 : (e.setSelectionStyles(t, r, i), !0);
|
|
10303
|
-
},
|
|
10336
|
+
}, Ma = ({ textbox: e, range: t, property: n }) => {
|
|
10304
10337
|
if (!t) return;
|
|
10305
10338
|
let r = e.getSelectionStyles(t.start, t.end, !0);
|
|
10306
10339
|
if (r.length) return r[0]?.[n];
|
|
10307
|
-
},
|
|
10340
|
+
}, Na = ({ strokeColor: e, width: t }) => t <= 0 ? null : e ?? "#000000", Pa = ({ width: e = 0 }) => e ? Math.max(0, e) : 0, Fa = ({ value: e }) => typeof e == "string" ? e.toLocaleUpperCase() : "", Ia = ({ value: e, min: t, max: n }) => Math.min(Math.max(e, t), n), La = class e extends v {
|
|
10308
10341
|
static {
|
|
10309
10342
|
this.type = "background-textbox";
|
|
10310
10343
|
}
|
|
@@ -10341,7 +10374,7 @@ var pa = {
|
|
|
10341
10374
|
];
|
|
10342
10375
|
}
|
|
10343
10376
|
constructor(e, t = {}) {
|
|
10344
|
-
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,
|
|
10377
|
+
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, $i({ textbox: this })) {
|
|
10345
10378
|
this.initDimensions(), this.dirty = !0;
|
|
10346
10379
|
return;
|
|
10347
10380
|
}
|
|
@@ -10380,7 +10413,7 @@ var pa = {
|
|
|
10380
10413
|
});
|
|
10381
10414
|
}
|
|
10382
10415
|
toObject(e = []) {
|
|
10383
|
-
let t = super.toObject(e), { lineFontDefaults: n, styles: r } =
|
|
10416
|
+
let t = super.toObject(e), { lineFontDefaults: n, styles: r } = Zi({ textbox: this });
|
|
10384
10417
|
return {
|
|
10385
10418
|
...t,
|
|
10386
10419
|
backgroundOpacity: this.backgroundOpacity,
|
|
@@ -10448,7 +10481,7 @@ var pa = {
|
|
|
10448
10481
|
this._removeShadow(e);
|
|
10449
10482
|
}
|
|
10450
10483
|
_getDecorationColorAt(e, t) {
|
|
10451
|
-
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r =
|
|
10484
|
+
let n = this.getValueOfPropertyAt(e, t, "strokeWidth"), r = Pa({ width: typeof n == "number" && Number.isFinite(n) ? n : 0 }), i = this.getValueOfPropertyAt(e, t, "stroke"), a = i == null ? null : Na({
|
|
10452
10485
|
strokeColor: i,
|
|
10453
10486
|
width: r
|
|
10454
10487
|
});
|
|
@@ -10464,22 +10497,22 @@ var pa = {
|
|
|
10464
10497
|
_getCornerRadii({ width: e, height: t }) {
|
|
10465
10498
|
let n = e / 2, r = t / 2, i = Math.min(n, r);
|
|
10466
10499
|
return {
|
|
10467
|
-
bottomLeft:
|
|
10500
|
+
bottomLeft: Ia({
|
|
10468
10501
|
value: this.radiusBottomLeft ?? 0,
|
|
10469
10502
|
min: 0,
|
|
10470
10503
|
max: i
|
|
10471
10504
|
}),
|
|
10472
|
-
bottomRight:
|
|
10505
|
+
bottomRight: Ia({
|
|
10473
10506
|
value: this.radiusBottomRight ?? 0,
|
|
10474
10507
|
min: 0,
|
|
10475
10508
|
max: i
|
|
10476
10509
|
}),
|
|
10477
|
-
topLeft:
|
|
10510
|
+
topLeft: Ia({
|
|
10478
10511
|
value: this.radiusTopLeft ?? 0,
|
|
10479
10512
|
min: 0,
|
|
10480
10513
|
max: i
|
|
10481
10514
|
}),
|
|
10482
|
-
topRight:
|
|
10515
|
+
topRight: Ia({
|
|
10483
10516
|
value: this.radiusTopRight ?? 0,
|
|
10484
10517
|
min: 0,
|
|
10485
10518
|
max: i
|
|
@@ -10497,7 +10530,7 @@ var pa = {
|
|
|
10497
10530
|
_getEffectiveBackgroundFill() {
|
|
10498
10531
|
let e = this.backgroundColor;
|
|
10499
10532
|
if (!e) return null;
|
|
10500
|
-
let t =
|
|
10533
|
+
let t = Ia({
|
|
10501
10534
|
value: this.backgroundOpacity ?? 1,
|
|
10502
10535
|
min: 0,
|
|
10503
10536
|
max: 1
|
|
@@ -10510,19 +10543,19 @@ var pa = {
|
|
|
10510
10543
|
return r.setAlpha(t), r.toRgba();
|
|
10511
10544
|
}
|
|
10512
10545
|
static _renderRoundedRect({ ctx: e, height: t, left: n, radii: r, top: i, width: a }) {
|
|
10513
|
-
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f =
|
|
10546
|
+
let o = n + a, s = i + t, { topLeft: c, topRight: l, bottomRight: u, bottomLeft: d } = r, f = Ia({
|
|
10514
10547
|
value: c,
|
|
10515
10548
|
min: 0,
|
|
10516
10549
|
max: a
|
|
10517
|
-
}), p =
|
|
10550
|
+
}), p = Ia({
|
|
10518
10551
|
value: l,
|
|
10519
10552
|
min: 0,
|
|
10520
10553
|
max: a
|
|
10521
|
-
}), m =
|
|
10554
|
+
}), m = Ia({
|
|
10522
10555
|
value: u,
|
|
10523
10556
|
min: 0,
|
|
10524
10557
|
max: a
|
|
10525
|
-
}), h =
|
|
10558
|
+
}), h = Ia({
|
|
10526
10559
|
value: d,
|
|
10527
10560
|
min: 0,
|
|
10528
10561
|
max: a
|
|
@@ -10533,9 +10566,9 @@ var pa = {
|
|
|
10533
10566
|
let { width: e = 0, height: t = 0 } = this, n = Math.round(e), r = Math.round(t);
|
|
10534
10567
|
n !== e && (this.width = Math.max(0, n)), r !== t && (this.height = Math.max(0, r));
|
|
10535
10568
|
}
|
|
10536
|
-
},
|
|
10537
|
-
b?.setClass && b.setClass(
|
|
10538
|
-
},
|
|
10569
|
+
}, Ra = () => {
|
|
10570
|
+
b?.setClass && b.setClass(La, "background-textbox");
|
|
10571
|
+
}, za = class {
|
|
10539
10572
|
constructor({ runtime: e }) {
|
|
10540
10573
|
this.runtime = e;
|
|
10541
10574
|
}
|
|
@@ -10599,16 +10632,16 @@ var pa = {
|
|
|
10599
10632
|
};
|
|
10600
10633
|
}
|
|
10601
10634
|
_createSelectionContext({ textbox: e, currentText: t, selectionRangeOverride: n }) {
|
|
10602
|
-
let r = n === void 0 ?
|
|
10635
|
+
let r = n === void 0 ? Oa({ textbox: e }) : Ni({
|
|
10603
10636
|
text: t,
|
|
10604
10637
|
range: n
|
|
10605
|
-
}), i = r ?
|
|
10638
|
+
}), i = r ? Pi({
|
|
10606
10639
|
textbox: e,
|
|
10607
10640
|
range: r
|
|
10608
|
-
}) : null, a =
|
|
10641
|
+
}) : null, a = Aa({
|
|
10609
10642
|
textbox: e,
|
|
10610
10643
|
range: r
|
|
10611
|
-
}), o =
|
|
10644
|
+
}), o = Aa({
|
|
10612
10645
|
textbox: e,
|
|
10613
10646
|
range: i
|
|
10614
10647
|
}), s = !r || a;
|
|
@@ -10696,17 +10729,17 @@ var pa = {
|
|
|
10696
10729
|
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));
|
|
10697
10730
|
}
|
|
10698
10731
|
_resolveStrokeUpdate({ textbox: e, selectionRange: t, strokeColor: n, strokeWidth: r }) {
|
|
10699
|
-
let i = t ?
|
|
10732
|
+
let i = t ? Ma({
|
|
10700
10733
|
textbox: e,
|
|
10701
10734
|
range: t,
|
|
10702
10735
|
property: "strokeWidth"
|
|
10703
|
-
}) : void 0, a = t ?
|
|
10736
|
+
}) : void 0, a = t ? Ma({
|
|
10704
10737
|
textbox: e,
|
|
10705
10738
|
range: t,
|
|
10706
10739
|
property: "stroke"
|
|
10707
|
-
}) : 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 =
|
|
10740
|
+
}) : 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 = Pa({ width: r ?? o ?? e.strokeWidth ?? 0 });
|
|
10708
10741
|
return {
|
|
10709
|
-
stroke:
|
|
10742
|
+
stroke: Na({
|
|
10710
10743
|
strokeColor: n ?? s ?? c,
|
|
10711
10744
|
width: l
|
|
10712
10745
|
}) ?? null,
|
|
@@ -10718,14 +10751,14 @@ var pa = {
|
|
|
10718
10751
|
}
|
|
10719
10752
|
_applyTextContentUpdate({ textbox: e, style: t, updates: n, currentText: r }) {
|
|
10720
10753
|
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 ?? "";
|
|
10721
|
-
return o || l ? (n.text = c ?
|
|
10754
|
+
return o || l ? (n.text = c ? Fa({ value: s }) : s, e.textCaseRaw = s) : e.textCaseRaw === void 0 && (e.textCaseRaw = i), e.uppercase = c, {
|
|
10722
10755
|
hasTextUpdate: o,
|
|
10723
10756
|
uppercaseChanged: l,
|
|
10724
10757
|
previousRenderedText: u
|
|
10725
10758
|
};
|
|
10726
10759
|
}
|
|
10727
10760
|
_resolveContentPlacement({ textbox: e, style: t, updates: n, placement: r, styleMaps: i, contentUpdate: a }) {
|
|
10728
|
-
let o =
|
|
10761
|
+
let o = sa({ stylesList: [
|
|
10729
10762
|
n,
|
|
10730
10763
|
i.selectionStyles,
|
|
10731
10764
|
i.lineSelectionStyles,
|
|
@@ -10741,7 +10774,7 @@ var pa = {
|
|
|
10741
10774
|
t.paddingBottom,
|
|
10742
10775
|
t.paddingLeft
|
|
10743
10776
|
].some((e) => e !== void 0), l = Object.prototype.hasOwnProperty.call(n, "width");
|
|
10744
|
-
return c && !s && !a.hasTextUpdate && !a.uppercaseChanged && !o && !l ?
|
|
10777
|
+
return c && !s && !a.hasTextUpdate && !a.uppercaseChanged && !o && !l ? ia({
|
|
10745
10778
|
textbox: e,
|
|
10746
10779
|
originX: r.originX,
|
|
10747
10780
|
originY: r.originY
|
|
@@ -10774,24 +10807,24 @@ var pa = {
|
|
|
10774
10807
|
}
|
|
10775
10808
|
_applyWholeTextStyles({ textbox: e, selection: t, styleMaps: n }) {
|
|
10776
10809
|
if (t.selectionRange || Object.keys(n.wholeTextStyles).length === 0) return;
|
|
10777
|
-
let r =
|
|
10778
|
-
r &&
|
|
10810
|
+
let r = ka({ textbox: e });
|
|
10811
|
+
r && ja({
|
|
10779
10812
|
textbox: e,
|
|
10780
10813
|
styles: n.wholeTextStyles,
|
|
10781
10814
|
range: r
|
|
10782
|
-
}) && (e.dirty = !0,
|
|
10815
|
+
}) && (e.dirty = !0, sa({ stylesList: [n.wholeTextStyles] }) && (e.initDimensions(), e.dirty = !0));
|
|
10783
10816
|
}
|
|
10784
10817
|
_applySelectionStyles({ textbox: e, selection: t, styleMaps: n }) {
|
|
10785
10818
|
if (!t.selectionRange) return;
|
|
10786
|
-
let r =
|
|
10819
|
+
let r = ja({
|
|
10787
10820
|
textbox: e,
|
|
10788
10821
|
styles: n.selectionStyles,
|
|
10789
10822
|
range: t.selectionRange
|
|
10790
|
-
}), i = t.fontSelectionRange ?
|
|
10823
|
+
}), i = t.fontSelectionRange ? ja({
|
|
10791
10824
|
textbox: e,
|
|
10792
10825
|
styles: n.lineSelectionStyles,
|
|
10793
10826
|
range: t.fontSelectionRange
|
|
10794
|
-
}) : !1, a =
|
|
10827
|
+
}) : !1, a = sa({ stylesList: [
|
|
10795
10828
|
n.selectionStyles,
|
|
10796
10829
|
n.lineSelectionStyles,
|
|
10797
10830
|
n.wholeTextStyles
|
|
@@ -10813,9 +10846,9 @@ var pa = {
|
|
|
10813
10846
|
_applyFontLineDefaultUpdates({ textbox: e, style: t, selection: n }) {
|
|
10814
10847
|
if (!n.fontSelectionRange || t.fontFamily === void 0 && t.fontSize === void 0) return;
|
|
10815
10848
|
let r = {};
|
|
10816
|
-
t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize),
|
|
10849
|
+
t.fontFamily !== void 0 && (r.fontFamily = t.fontFamily), t.fontSize !== void 0 && (r.fontSize = t.fontSize), Wi({
|
|
10817
10850
|
textbox: e,
|
|
10818
|
-
lineIndices:
|
|
10851
|
+
lineIndices: Fi({
|
|
10819
10852
|
textbox: e,
|
|
10820
10853
|
range: n.fontSelectionRange
|
|
10821
10854
|
}),
|
|
@@ -10825,9 +10858,9 @@ var pa = {
|
|
|
10825
10858
|
_applyDecorationLineDefaultUpdates({ textbox: e, style: t, selection: n, styleMaps: r }) {
|
|
10826
10859
|
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;
|
|
10827
10860
|
let i = {};
|
|
10828
|
-
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)),
|
|
10861
|
+
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)), Wi({
|
|
10829
10862
|
textbox: e,
|
|
10830
|
-
lineIndices:
|
|
10863
|
+
lineIndices: Ii({
|
|
10831
10864
|
textbox: e,
|
|
10832
10865
|
range: n.selectionRange
|
|
10833
10866
|
}),
|
|
@@ -10880,7 +10913,7 @@ var pa = {
|
|
|
10880
10913
|
return (t.autoExpand ?? e.autoExpand) !== !1 && !Object.prototype.hasOwnProperty.call(n.updates, "width") && r;
|
|
10881
10914
|
}
|
|
10882
10915
|
_shouldRefreshDimensions({ contentUpdate: e, styleMaps: t }) {
|
|
10883
|
-
return e.hasTextUpdate || e.uppercaseChanged ||
|
|
10916
|
+
return e.hasTextUpdate || e.uppercaseChanged || sa({ stylesList: [
|
|
10884
10917
|
t.updates,
|
|
10885
10918
|
t.selectionStyles,
|
|
10886
10919
|
t.lineSelectionStyles,
|
|
@@ -10924,18 +10957,18 @@ var pa = {
|
|
|
10924
10957
|
};
|
|
10925
10958
|
this.runtime.canvas.fire("editor:text-updated", m);
|
|
10926
10959
|
}
|
|
10927
|
-
},
|
|
10960
|
+
}, Ba = ({ transform: e }) => {
|
|
10928
10961
|
let { corner: t = "", action: n = "" } = e;
|
|
10929
10962
|
return {
|
|
10930
10963
|
isCornerHandle: t === "tl" || t === "tr" || t === "bl" || t === "br" || n === "scale",
|
|
10931
10964
|
isHorizontalHandle: t === "ml" || t === "mr" || n === "scaleX",
|
|
10932
10965
|
isVerticalHandle: t === "mt" || t === "mb" || n === "scaleY"
|
|
10933
10966
|
};
|
|
10934
|
-
},
|
|
10967
|
+
}, Va = ({ textbox: e, transform: t, appliedWidth: n }) => {
|
|
10935
10968
|
t.scaleX = 1, t.scaleY = 1;
|
|
10936
10969
|
let r = t.original;
|
|
10937
10970
|
r && (r.scaleX = 1, r.scaleY = 1, r.width = n, r.height = e.height, r.left = e.left, r.top = e.top);
|
|
10938
|
-
},
|
|
10971
|
+
}, Ha = ({ textbox: e, transform: t, scenePoint: n }) => {
|
|
10939
10972
|
let { x: r, y: i } = e._getTransformedDimensions();
|
|
10940
10973
|
if (r <= 0 || i <= 0) return null;
|
|
10941
10974
|
let a = x.getLocalPoint(t, t.originX, t.originY, n.x, n.y), o = t, s = typeof o.signX == "number" && a.x * o.signX <= 0, c = typeof o.signY == "number" && a.y * o.signY <= 0, l = Math.abs(a.x / r), u = Math.abs(a.y / i);
|
|
@@ -10945,27 +10978,27 @@ var pa = {
|
|
|
10945
10978
|
stepScaleX: l,
|
|
10946
10979
|
stepScaleY: u
|
|
10947
10980
|
};
|
|
10948
|
-
},
|
|
10949
|
-
function
|
|
10981
|
+
}, Ua = 1e-4;
|
|
10982
|
+
function Wa(e) {
|
|
10950
10983
|
return !!e && e instanceof v;
|
|
10951
10984
|
}
|
|
10952
|
-
function
|
|
10953
|
-
if (!
|
|
10985
|
+
function Ga(e) {
|
|
10986
|
+
if (!Wa(e)) return !1;
|
|
10954
10987
|
let t = e.group;
|
|
10955
10988
|
return e.shapeNodeType === "text" && t?.shapeComposite === !0;
|
|
10956
10989
|
}
|
|
10957
|
-
var
|
|
10990
|
+
var Ka = class {
|
|
10958
10991
|
constructor({ canvas: t, canvasManager: n, persistScaledTextbox: r }) {
|
|
10959
10992
|
this.handleMouseMove = (e) => {
|
|
10960
10993
|
let t = this.canvas._currentTransform;
|
|
10961
10994
|
if (!t) return;
|
|
10962
10995
|
let { target: n } = t;
|
|
10963
|
-
if (!
|
|
10996
|
+
if (!Wa(n) || Ga(n)) return;
|
|
10964
10997
|
let r = this.scalingState.get(n);
|
|
10965
10998
|
if (!r || !e.e) return;
|
|
10966
|
-
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } =
|
|
10999
|
+
let { isCornerHandle: i, isHorizontalHandle: a, isVerticalHandle: o } = Ba({ transform: t });
|
|
10967
11000
|
if (!a && !o && !i) return;
|
|
10968
|
-
let s =
|
|
11001
|
+
let s = Ha({
|
|
10969
11002
|
textbox: n,
|
|
10970
11003
|
transform: t,
|
|
10971
11004
|
scenePoint: this.canvas.getScenePoint(e.e)
|
|
@@ -10988,20 +11021,20 @@ var Wa = class {
|
|
|
10988
11021
|
}, j = r.lastAllowedScaleX, M = r.lastAllowedScaleY;
|
|
10989
11022
|
if (i) {
|
|
10990
11023
|
let e = Math.max(r.minimumProportionalScale, r.lastAllowedScaleX * Math.sqrt(u * d)), t = c || l ? r.minimumProportionalScale : e;
|
|
10991
|
-
if (Math.abs(t - r.lastAllowedScaleX) <=
|
|
11024
|
+
if (Math.abs(t - r.lastAllowedScaleX) <= Ua) return;
|
|
10992
11025
|
j = t, M = t;
|
|
10993
11026
|
} else {
|
|
10994
11027
|
if (a) {
|
|
10995
11028
|
let e = r.lastAllowedScaleX * u, t = c ? r.minimumWidthScale : Math.max(r.minimumWidthScale, e);
|
|
10996
|
-
Math.abs(t - r.lastAllowedScaleX) >
|
|
11029
|
+
Math.abs(t - r.lastAllowedScaleX) > Ua && (j = t);
|
|
10997
11030
|
}
|
|
10998
11031
|
if (o) {
|
|
10999
11032
|
let e = r.lastAllowedScaleY * d, t = l ? r.minimumFontScale : Math.max(r.minimumFontScale, e);
|
|
11000
|
-
Math.abs(t - r.lastAllowedScaleY) >
|
|
11033
|
+
Math.abs(t - r.lastAllowedScaleY) > Ua && (M = t);
|
|
11001
11034
|
}
|
|
11002
|
-
if (Math.abs(j - r.lastAllowedScaleX) <=
|
|
11035
|
+
if (Math.abs(j - r.lastAllowedScaleX) <= Ua && Math.abs(M - r.lastAllowedScaleY) <= Ua) return;
|
|
11003
11036
|
}
|
|
11004
|
-
let { appliedWidth: N, dimensionsRounded: P } =
|
|
11037
|
+
let { appliedWidth: N, dimensionsRounded: P } = fa({
|
|
11005
11038
|
textbox: n,
|
|
11006
11039
|
canvasManager: this.canvasManager,
|
|
11007
11040
|
base: r.startBase,
|
|
@@ -11015,7 +11048,7 @@ var Wa = class {
|
|
|
11015
11048
|
shouldDisableAutoExpandOnHorizontalChange: a,
|
|
11016
11049
|
shouldRoundDimensions: !i
|
|
11017
11050
|
});
|
|
11018
|
-
|
|
11051
|
+
Va({
|
|
11019
11052
|
textbox: n,
|
|
11020
11053
|
transform: t,
|
|
11021
11054
|
appliedWidth: N
|
|
@@ -11036,12 +11069,12 @@ var Wa = class {
|
|
|
11036
11069
|
}), this.canvas.requestRenderAll();
|
|
11037
11070
|
}, this.handleObjectScaling = (t) => {
|
|
11038
11071
|
let { target: n, transform: r } = t;
|
|
11039
|
-
if (n instanceof e || !
|
|
11072
|
+
if (n instanceof e || !Wa(n) || Ga(n) || !r) return;
|
|
11040
11073
|
n.isScaling = !0;
|
|
11041
11074
|
let i = this._ensureScalingState({
|
|
11042
11075
|
textbox: n,
|
|
11043
11076
|
transform: r
|
|
11044
|
-
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } =
|
|
11077
|
+
}), { startBase: a } = i, { width: o, fontSize: s } = a, { isCornerHandle: c, isHorizontalHandle: l, isVerticalHandle: u } = Ba({ transform: r }), d = r.corner ?? "", f = c || u;
|
|
11045
11078
|
if (!l && !u && !c) return;
|
|
11046
11079
|
let p = n.scaleX ?? r.scaleX ?? 1, m = n.scaleY ?? r.scaleY ?? 1, h = Math.abs(p) || 1, g = Math.abs(m) || 1, _ = r.originX ?? n.originX ?? "center", v = r.originY ?? n.originY ?? "center", y = this.canvasManager.getObjectPlacement({
|
|
11047
11080
|
object: n,
|
|
@@ -11056,7 +11089,7 @@ var Wa = class {
|
|
|
11056
11089
|
N = e, P = e;
|
|
11057
11090
|
}
|
|
11058
11091
|
} else l && (N = Math.max(i.minimumWidthScale, i.lastAllowedScaleX * h)), u && (P = Math.max(i.minimumFontScale, i.lastAllowedScaleY * g));
|
|
11059
|
-
let { appliedWidth: ee, dimensionsRounded: te } =
|
|
11092
|
+
let { appliedWidth: ee, dimensionsRounded: te } = fa({
|
|
11060
11093
|
textbox: n,
|
|
11061
11094
|
canvasManager: this.canvasManager,
|
|
11062
11095
|
base: a,
|
|
@@ -11070,7 +11103,7 @@ var Wa = class {
|
|
|
11070
11103
|
shouldDisableAutoExpandOnHorizontalChange: l,
|
|
11071
11104
|
shouldRoundDimensions: !c
|
|
11072
11105
|
});
|
|
11073
|
-
|
|
11106
|
+
Va({
|
|
11074
11107
|
textbox: n,
|
|
11075
11108
|
transform: r,
|
|
11076
11109
|
appliedWidth: ee
|
|
@@ -11103,7 +11136,7 @@ var Wa = class {
|
|
|
11103
11136
|
let { target: n } = t;
|
|
11104
11137
|
if (n instanceof e) {
|
|
11105
11138
|
let t = n.getObjects();
|
|
11106
|
-
if (!t.some((e) =>
|
|
11139
|
+
if (!t.some((e) => Wa(e))) return;
|
|
11107
11140
|
let { scaleX: r = 1, scaleY: i = 1 } = n;
|
|
11108
11141
|
if (Math.abs(r - 1) < .01 && Math.abs(i - 1) < .01) return;
|
|
11109
11142
|
this.canvas.discardActiveObject(), t.forEach((e) => {
|
|
@@ -11113,7 +11146,7 @@ var Wa = class {
|
|
|
11113
11146
|
this.canvas.setActiveObject(a), this.canvas.requestRenderAll();
|
|
11114
11147
|
return;
|
|
11115
11148
|
}
|
|
11116
|
-
if (!
|
|
11149
|
+
if (!Wa(n) || Ga(n)) return;
|
|
11117
11150
|
n.isScaling = !1;
|
|
11118
11151
|
let r = this.scalingState.get(n);
|
|
11119
11152
|
if (this.scalingState.delete(n), !r?.hasScalingChange) return;
|
|
@@ -11138,11 +11171,11 @@ var Wa = class {
|
|
|
11138
11171
|
}, this.canvas = t, this.canvasManager = n, this.persistScaledTextbox = r, this.scalingState = /* @__PURE__ */ new WeakMap();
|
|
11139
11172
|
}
|
|
11140
11173
|
commitStandaloneTextScale({ target: e, shouldDisableAutoExpandOnHorizontalChange: t = !1 }) {
|
|
11141
|
-
if (!
|
|
11174
|
+
if (!Wa(e) || Ga(e)) return !1;
|
|
11142
11175
|
let n = Math.abs(e.scaleX ?? 1) || 1, r = Math.abs(e.scaleY ?? 1) || 1;
|
|
11143
11176
|
if (!(Math.abs(n - 1) > .01 || Math.abs(r - 1) > .01)) return !1;
|
|
11144
|
-
let i =
|
|
11145
|
-
return
|
|
11177
|
+
let i = la({ textbox: e }), a = this.canvasManager.getObjectPlacement({ object: e });
|
|
11178
|
+
return fa({
|
|
11146
11179
|
textbox: e,
|
|
11147
11180
|
canvasManager: this.canvasManager,
|
|
11148
11181
|
base: i,
|
|
@@ -11158,7 +11191,7 @@ var Wa = class {
|
|
|
11158
11191
|
_ensureScalingState({ textbox: e, transform: t }) {
|
|
11159
11192
|
let n = this.scalingState.get(e);
|
|
11160
11193
|
if (!n) {
|
|
11161
|
-
let r =
|
|
11194
|
+
let r = la({ textbox: e }), i = this.canvasManager.getObjectPlacement({ object: e }), a = ua({ base: r }), o = t.original?.originX ?? t.originX ?? e.originX ?? "center", s = t.original?.originY ?? t.originY ?? e.originY ?? "center";
|
|
11162
11195
|
n = {
|
|
11163
11196
|
startBase: r,
|
|
11164
11197
|
startObjectPlacement: i,
|
|
@@ -11191,7 +11224,7 @@ var Wa = class {
|
|
|
11191
11224
|
topRight: e.radiusTopRight ?? 0,
|
|
11192
11225
|
bottomRight: e.radiusBottomRight ?? 0,
|
|
11193
11226
|
bottomLeft: e.radiusBottomLeft ?? 0
|
|
11194
|
-
}, v = Math.abs(n - o) >
|
|
11227
|
+
}, 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;
|
|
11195
11228
|
if (c) {
|
|
11196
11229
|
let e = h / Math.max(1, m);
|
|
11197
11230
|
S = e, C = e;
|
|
@@ -11212,7 +11245,7 @@ var Wa = class {
|
|
|
11212
11245
|
originY: a
|
|
11213
11246
|
});
|
|
11214
11247
|
}
|
|
11215
|
-
},
|
|
11248
|
+
}, qa = class e {
|
|
11216
11249
|
constructor({ editor: t }) {
|
|
11217
11250
|
this._handleTextEditingEntered = (t) => {
|
|
11218
11251
|
this.isTextEditingActive = !0;
|
|
@@ -11225,7 +11258,7 @@ var Wa = class {
|
|
|
11225
11258
|
if (!e._isTextbox(n)) return;
|
|
11226
11259
|
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 });
|
|
11227
11260
|
if (s) {
|
|
11228
|
-
let e =
|
|
11261
|
+
let e = Fa({ value: l });
|
|
11229
11262
|
e !== i && n.set({ text: e }), n.textCaseRaw = l;
|
|
11230
11263
|
} else n.textCaseRaw = i;
|
|
11231
11264
|
if (!r && o === void 0 && (n.autoExpand = !0), r) {
|
|
@@ -11244,7 +11277,7 @@ var Wa = class {
|
|
|
11244
11277
|
let r = e._isShapeOwnedTextbox(n);
|
|
11245
11278
|
this.editingPlacementState?.delete(n), delete n.__lineDefaultsPrevText;
|
|
11246
11279
|
let i = n.text ?? "";
|
|
11247
|
-
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (
|
|
11280
|
+
n.uppercase ? n.textCaseRaw = n.textCaseRaw ?? i.toLocaleLowerCase() : n.textCaseRaw = i, r || (ca({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
|
|
11248
11281
|
lockMovementX: !1,
|
|
11249
11282
|
lockMovementY: !1
|
|
11250
11283
|
}));
|
|
@@ -11271,7 +11304,7 @@ var Wa = class {
|
|
|
11271
11304
|
transform: r,
|
|
11272
11305
|
event: i ?? null
|
|
11273
11306
|
});
|
|
11274
|
-
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new
|
|
11307
|
+
}, this.editor = t, this.canvas = t.canvas, this.fonts = t.options.fonts ?? [], this.scalingController = new Ka({
|
|
11275
11308
|
canvas: t.canvas,
|
|
11276
11309
|
canvasManager: t.canvasManager,
|
|
11277
11310
|
persistScaledTextbox: ({ target: e, style: t }) => {
|
|
@@ -11280,7 +11313,7 @@ var Wa = class {
|
|
|
11280
11313
|
style: t
|
|
11281
11314
|
});
|
|
11282
11315
|
}
|
|
11283
|
-
}), this.updateController = new
|
|
11316
|
+
}), this.updateController = new za({ runtime: {
|
|
11284
11317
|
canvas: this.canvas,
|
|
11285
11318
|
canvasManager: t.canvasManager,
|
|
11286
11319
|
historyManager: t.historyManager,
|
|
@@ -11289,12 +11322,12 @@ var Wa = class {
|
|
|
11289
11322
|
restoreTextboxContentPlacement: (e) => this._restoreTextboxContentPlacement(e),
|
|
11290
11323
|
syncLineStylesWithText: (e) => this.syncLineStylesWithText(e),
|
|
11291
11324
|
getSnapshot: (t) => e._getSnapshot(t)
|
|
11292
|
-
} }), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(),
|
|
11325
|
+
} }), this.editingPlacementState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), Ra();
|
|
11293
11326
|
}
|
|
11294
11327
|
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 } = {}) {
|
|
11295
11328
|
let { canvasManager: M, historyManager: N } = this.editor, { canvas: P } = this;
|
|
11296
11329
|
N.suspendHistory();
|
|
11297
|
-
let F = i ?? this._getDefaultFontFamily(), I =
|
|
11330
|
+
let F = i ?? this._getDefaultFontFamily(), I = Pa({ width: m }), ee = Na({
|
|
11298
11331
|
strokeColor: p,
|
|
11299
11332
|
width: I
|
|
11300
11333
|
}), te = {
|
|
@@ -11323,14 +11356,14 @@ var Wa = class {
|
|
|
11323
11356
|
radiusBottomRight: w,
|
|
11324
11357
|
radiusBottomLeft: T,
|
|
11325
11358
|
...E
|
|
11326
|
-
}, L = new
|
|
11359
|
+
}, L = new La(n, te), ne = r !== !1;
|
|
11327
11360
|
L.autoExpand = ne;
|
|
11328
11361
|
let re = E.left !== void 0 || E.top !== void 0;
|
|
11329
11362
|
if (L.textCaseRaw = L.text ?? "", l) {
|
|
11330
|
-
let e =
|
|
11363
|
+
let e = Fa({ value: L.textCaseRaw });
|
|
11331
11364
|
e !== L.text && L.set({ text: e });
|
|
11332
11365
|
}
|
|
11333
|
-
|
|
11366
|
+
ca({ textbox: L }) && (L.dirty = !0);
|
|
11334
11367
|
let ie;
|
|
11335
11368
|
re && (ie = M.resolveObjectPlacement({
|
|
11336
11369
|
object: L,
|
|
@@ -11439,7 +11472,7 @@ var Wa = class {
|
|
|
11439
11472
|
let t = e.width ?? 0, n = e.height ?? 0;
|
|
11440
11473
|
e.initDimensions(), o = Math.abs((e.width ?? 0) - t) > .01 || Math.abs((e.height ?? 0) - n) > .01;
|
|
11441
11474
|
}
|
|
11442
|
-
a || (s =
|
|
11475
|
+
a || (s = ca({ textbox: e }));
|
|
11443
11476
|
let c = !1;
|
|
11444
11477
|
return !a && t && (this.editor.canvasManager.applyObjectPlacement({
|
|
11445
11478
|
object: e,
|
|
@@ -11447,7 +11480,7 @@ var Wa = class {
|
|
|
11447
11480
|
}), c = !0), (a || o || s) && (e.dirty = !0), (a || o || s || c) && e.setCoords(), a || o || s;
|
|
11448
11481
|
}
|
|
11449
11482
|
_restoreTextboxContentPlacement({ textbox: e, contentPlacement: t }) {
|
|
11450
|
-
let n =
|
|
11483
|
+
let n = ia({
|
|
11451
11484
|
textbox: e,
|
|
11452
11485
|
originX: t.originX,
|
|
11453
11486
|
originY: t.originY
|
|
@@ -11465,7 +11498,7 @@ var Wa = class {
|
|
|
11465
11498
|
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);
|
|
11466
11499
|
}
|
|
11467
11500
|
syncLineStylesWithText({ textbox: e, previousText: t, currentText: n }) {
|
|
11468
|
-
let r = n ?? e.text ?? "", i =
|
|
11501
|
+
let r = n ?? e.text ?? "", i = Qi({
|
|
11469
11502
|
textbox: e,
|
|
11470
11503
|
previousText: t ?? e.__lineDefaultsPrevText ?? r,
|
|
11471
11504
|
currentText: r
|
|
@@ -11483,16 +11516,16 @@ var Wa = class {
|
|
|
11483
11516
|
if (!Number.isFinite(f) || f <= 0) return !1;
|
|
11484
11517
|
let p = a.split("\n").length, m = !1;
|
|
11485
11518
|
Math.abs((e.width ?? 0) - f) > .01 && (e.set({ width: f }), m = !0), e.initDimensions();
|
|
11486
|
-
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(
|
|
11519
|
+
let { textLines: h } = e, g = Array.isArray(h) && h.length > p, _ = Math.ceil(na({
|
|
11487
11520
|
textbox: e,
|
|
11488
11521
|
text: a
|
|
11489
11522
|
})), v = Math.min(e.minWidth ?? 1, f), y = Math.min(f, Math.max(_, v));
|
|
11490
|
-
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0),
|
|
11523
|
+
g && (y = f), Math.abs((e.width ?? 0) - y) > .01 && (e.set({ width: y }), e.initDimensions(), m = !0), ca({ textbox: e }) && (m = !0), t && r.applyObjectPlacement({
|
|
11491
11524
|
object: e,
|
|
11492
11525
|
placement: t
|
|
11493
11526
|
});
|
|
11494
11527
|
let b = !1;
|
|
11495
|
-
return n && (b =
|
|
11528
|
+
return n && (b = aa({
|
|
11496
11529
|
textbox: e,
|
|
11497
11530
|
montageLeft: o,
|
|
11498
11531
|
montageRight: o + s
|
|
@@ -11550,7 +11583,7 @@ var Wa = class {
|
|
|
11550
11583
|
_getDefaultFontFamily() {
|
|
11551
11584
|
return this.fonts[0]?.family ?? "Arial";
|
|
11552
11585
|
}
|
|
11553
|
-
},
|
|
11586
|
+
}, Ja = ({ x1: e, y1: t, x2: n, y2: r }) => (Math.atan2(r - t, n - e) * 180 / Math.PI + 360) % 360, Ya = (e) => {
|
|
11554
11587
|
if (!e || typeof e != "object") return null;
|
|
11555
11588
|
let { type: t, coords: n, colorStops: r } = e, i = Array.isArray(r) ? r : [], a = i[0], o = i[i.length - 1], s = typeof a?.color == "string" ? a.color : void 0, c = typeof o?.color == "string" ? o.color : s, l = typeof a?.offset == "number" ? a.offset * 100 : void 0, u = typeof o?.offset == "number" ? o.offset * 100 : void 0, d = i.map((e) => ({
|
|
11556
11589
|
color: typeof e.color == "string" ? e.color : "#000000",
|
|
@@ -11561,7 +11594,7 @@ var Wa = class {
|
|
|
11561
11594
|
let { x1: e, y1: t, x2: r, y2: i } = n;
|
|
11562
11595
|
if (typeof e == "number" && typeof t == "number" && typeof r == "number" && typeof i == "number") return {
|
|
11563
11596
|
type: "linear",
|
|
11564
|
-
angle:
|
|
11597
|
+
angle: Ja({
|
|
11565
11598
|
x1: e,
|
|
11566
11599
|
y1: t,
|
|
11567
11600
|
x2: r,
|
|
@@ -11589,7 +11622,7 @@ var Wa = class {
|
|
|
11589
11622
|
};
|
|
11590
11623
|
}
|
|
11591
11624
|
return null;
|
|
11592
|
-
},
|
|
11625
|
+
}, Xa = "_templateAnchorX", Za = "_templateAnchorY", Qa = class t {
|
|
11593
11626
|
constructor({ editor: e }) {
|
|
11594
11627
|
this.editor = e;
|
|
11595
11628
|
}
|
|
@@ -11598,7 +11631,7 @@ var Wa = class {
|
|
|
11598
11631
|
if (!p.length) return s.emitWarning({
|
|
11599
11632
|
origin: "TemplateManager",
|
|
11600
11633
|
method: "serializeSelection",
|
|
11601
|
-
code:
|
|
11634
|
+
code: Ta.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
|
|
11602
11635
|
message: "Нет объектов для сериализации шаблона"
|
|
11603
11636
|
}), null;
|
|
11604
11637
|
let m = t._getBounds(o), h = t._getMontageSize({
|
|
@@ -11627,14 +11660,14 @@ var Wa = class {
|
|
|
11627
11660
|
if (!l?.length) return a.emitWarning({
|
|
11628
11661
|
origin: "TemplateManager",
|
|
11629
11662
|
method: "applyTemplate",
|
|
11630
|
-
code:
|
|
11663
|
+
code: Ta.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
11631
11664
|
message: "Шаблон не содержит объектов"
|
|
11632
11665
|
}), null;
|
|
11633
11666
|
let f = t._getBounds(r);
|
|
11634
11667
|
if (!f) return a.emitWarning({
|
|
11635
11668
|
origin: "TemplateManager",
|
|
11636
11669
|
method: "applyTemplate",
|
|
11637
|
-
code:
|
|
11670
|
+
code: Ta.TEMPLATE_MANAGER.INVALID_TARGET,
|
|
11638
11671
|
message: "Не удалось определить границы монтажной области"
|
|
11639
11672
|
}), null;
|
|
11640
11673
|
let p = t._getMontageSize({
|
|
@@ -11658,7 +11691,7 @@ var Wa = class {
|
|
|
11658
11691
|
if (!r.length) return a.emitWarning({
|
|
11659
11692
|
origin: "TemplateManager",
|
|
11660
11693
|
method: "applyTemplate",
|
|
11661
|
-
code:
|
|
11694
|
+
code: Ta.TEMPLATE_MANAGER.INVALID_TEMPLATE,
|
|
11662
11695
|
message: "Не удалось создать объекты шаблона"
|
|
11663
11696
|
}), null;
|
|
11664
11697
|
let { backgroundObject: i, contentObjects: u } = t._extractBackgroundObject(r);
|
|
@@ -11680,7 +11713,7 @@ var Wa = class {
|
|
|
11680
11713
|
}), c.commitStandaloneTextScale({ target: e }), s.commitRehydratedShapeLayout({
|
|
11681
11714
|
target: e,
|
|
11682
11715
|
textScale: h
|
|
11683
|
-
}), Ut({ object: e }),
|
|
11716
|
+
}), Ut({ object: e }), ya({ rootObject: e }), n.add(e), e));
|
|
11684
11717
|
return !d.length && !v ? null : (_ = d.length > 0 || v, d.length && t._activateObjects({
|
|
11685
11718
|
canvas: n,
|
|
11686
11719
|
objects: d
|
|
@@ -11693,7 +11726,7 @@ var Wa = class {
|
|
|
11693
11726
|
return a.emitError({
|
|
11694
11727
|
origin: "TemplateManager",
|
|
11695
11728
|
method: "applyTemplate",
|
|
11696
|
-
code:
|
|
11729
|
+
code: Ta.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
11697
11730
|
message: "Ошибка применения шаблона",
|
|
11698
11731
|
data: {
|
|
11699
11732
|
templateId: d,
|
|
@@ -11971,8 +12004,8 @@ var Wa = class {
|
|
|
11971
12004
|
baseHeight: a,
|
|
11972
12005
|
scale: n,
|
|
11973
12006
|
useRelativePositions: o,
|
|
11974
|
-
anchorX: t._resolveAnchor(s,
|
|
11975
|
-
anchorY: t._resolveAnchor(s,
|
|
12007
|
+
anchorX: t._resolveAnchor(s, Xa),
|
|
12008
|
+
anchorY: t._resolveAnchor(s, Za)
|
|
11976
12009
|
})
|
|
11977
12010
|
}), h = f * n, g = p * n, _ = e.originX ?? "center", v = e.originY ?? "center";
|
|
11978
12011
|
e.set({
|
|
@@ -12047,7 +12080,7 @@ var Wa = class {
|
|
|
12047
12080
|
});
|
|
12048
12081
|
if (!i || !a) return;
|
|
12049
12082
|
e.setCoords();
|
|
12050
|
-
let o = e, s = t._resolveAnchor(o,
|
|
12083
|
+
let o = e, s = t._resolveAnchor(o, Xa), c = typeof e.left == "number" ? e.left : null, l = e.originX ?? "center", u = e.originY ?? "center", d = e.getPointByOrigin(l, u), f = t._getBoundingRect(e), p = f.left + f.width / 2, m = f.left + f.width;
|
|
12051
12084
|
e.set("width", i), e.initDimensions();
|
|
12052
12085
|
let h = t._getLongestLineWidth({
|
|
12053
12086
|
textbox: e,
|
|
@@ -12076,10 +12109,10 @@ var Wa = class {
|
|
|
12076
12109
|
x: (p.left - o) / d,
|
|
12077
12110
|
y: (p.top - s) / f
|
|
12078
12111
|
}, h = (u.left - o) / d, g = (u.top - s) / f, _ = h + u.width / d, v = g + u.height / f;
|
|
12079
|
-
return a[
|
|
12112
|
+
return a[Xa] = t._detectAnchor({
|
|
12080
12113
|
start: h,
|
|
12081
12114
|
end: _
|
|
12082
|
-
}), a[
|
|
12115
|
+
}), a[Za] = t._detectAnchor({
|
|
12083
12116
|
start: g,
|
|
12084
12117
|
end: v
|
|
12085
12118
|
}), a.left = m.x, a.top = m.y, a;
|
|
@@ -12104,7 +12137,7 @@ var Wa = class {
|
|
|
12104
12137
|
withoutSave: !0
|
|
12105
12138
|
}), !0;
|
|
12106
12139
|
if (a === "gradient") {
|
|
12107
|
-
let e =
|
|
12140
|
+
let e = Ya(r);
|
|
12108
12141
|
if (e) return n.setGradientBackground({
|
|
12109
12142
|
gradient: e,
|
|
12110
12143
|
customData: o,
|
|
@@ -12125,7 +12158,7 @@ var Wa = class {
|
|
|
12125
12158
|
r.emitWarning({
|
|
12126
12159
|
origin: "TemplateManager",
|
|
12127
12160
|
method: "applyTemplate",
|
|
12128
|
-
code:
|
|
12161
|
+
code: Ta.TEMPLATE_MANAGER.APPLY_FAILED,
|
|
12129
12162
|
message: "Не удалось применить фон из шаблона",
|
|
12130
12163
|
data: e
|
|
12131
12164
|
});
|
|
@@ -12161,29 +12194,29 @@ var Wa = class {
|
|
|
12161
12194
|
enlivenObjectEnlivables(e) {
|
|
12162
12195
|
return w.enlivenObjectEnlivables(e);
|
|
12163
12196
|
}
|
|
12164
|
-
},
|
|
12165
|
-
let n =
|
|
12197
|
+
}, $a = "#3D8BF4", eo = .5, to = ({ distance: e }) => Number.isFinite(e) ? Math.round(Math.max(0, e)) : 0, no = ({ firstDistance: e, secondDistance: t }) => {
|
|
12198
|
+
let n = to({ distance: e }), r = to({ distance: t });
|
|
12166
12199
|
return {
|
|
12167
12200
|
firstDisplayDistance: n,
|
|
12168
12201
|
secondDisplayDistance: r,
|
|
12169
12202
|
displayDistanceDiff: Math.abs(n - r),
|
|
12170
12203
|
commonDisplayDistance: Math.max(n, r)
|
|
12171
12204
|
};
|
|
12172
|
-
},
|
|
12205
|
+
}, ro = ({ firstStart: e, firstEnd: t, secondStart: n, secondEnd: r }) => Math.min(t, r) - Math.max(e, n), io = ({ step: e }) => {
|
|
12173
12206
|
let t = Math.abs(e).toString(), n = t.indexOf(".");
|
|
12174
12207
|
return n === -1 ? 0 : t.slice(n + 1).length;
|
|
12175
|
-
},
|
|
12208
|
+
}, ao = ({ value: e, step: t }) => {
|
|
12176
12209
|
if (t === 0) return e;
|
|
12177
|
-
let n =
|
|
12210
|
+
let n = io({ step: t }), r = Math.round(e / t) * t;
|
|
12178
12211
|
return Number(r.toFixed(n));
|
|
12179
|
-
},
|
|
12212
|
+
}, oo = ({ value: e, step: t }) => {
|
|
12180
12213
|
if (t === 0) return !0;
|
|
12181
|
-
let n =
|
|
12214
|
+
let n = ao({
|
|
12182
12215
|
value: e,
|
|
12183
12216
|
step: t
|
|
12184
|
-
}), r = 10 ** -(
|
|
12217
|
+
}), r = 10 ** -(io({ step: t }) + 4);
|
|
12185
12218
|
return Math.abs(n - e) <= r;
|
|
12186
|
-
},
|
|
12219
|
+
}, so = ({ bounds: e, axis: t }) => {
|
|
12187
12220
|
let { left: n = 0, right: r = 0, top: i = 0, bottom: a = 0 } = e;
|
|
12188
12221
|
return t === "vertical" ? {
|
|
12189
12222
|
start: i,
|
|
@@ -12192,7 +12225,7 @@ var Wa = class {
|
|
|
12192
12225
|
start: n,
|
|
12193
12226
|
end: r
|
|
12194
12227
|
};
|
|
12195
|
-
},
|
|
12228
|
+
}, co = ({ items: e, axis: t }) => {
|
|
12196
12229
|
for (let n = 1; n < e.length; n += 1) {
|
|
12197
12230
|
let r = e[n], { bounds: i } = r, a = i[t], o = n - 1;
|
|
12198
12231
|
for (; o >= 0;) {
|
|
@@ -12202,10 +12235,10 @@ var Wa = class {
|
|
|
12202
12235
|
}
|
|
12203
12236
|
e[o + 1] = r;
|
|
12204
12237
|
}
|
|
12205
|
-
},
|
|
12238
|
+
}, lo = ({ items: e, index: t, axis: n, direction: r }) => {
|
|
12206
12239
|
let i = e[t];
|
|
12207
12240
|
if (!i) return null;
|
|
12208
|
-
let { bounds: a } = i, { start: o, end: s } =
|
|
12241
|
+
let { bounds: a } = i, { start: o, end: s } = so({
|
|
12209
12242
|
bounds: a,
|
|
12210
12243
|
axis: n
|
|
12211
12244
|
});
|
|
@@ -12213,7 +12246,7 @@ var Wa = class {
|
|
|
12213
12246
|
for (let r = t - 1; r >= 0; --r) {
|
|
12214
12247
|
let t = e[r];
|
|
12215
12248
|
if (!t) continue;
|
|
12216
|
-
let { bounds: i } = t, { end: a } =
|
|
12249
|
+
let { bounds: i } = t, { end: a } = so({
|
|
12217
12250
|
bounds: i,
|
|
12218
12251
|
axis: n
|
|
12219
12252
|
});
|
|
@@ -12224,26 +12257,26 @@ var Wa = class {
|
|
|
12224
12257
|
for (let r = t + 1; r < e.length; r += 1) {
|
|
12225
12258
|
let t = e[r];
|
|
12226
12259
|
if (!t) continue;
|
|
12227
|
-
let { bounds: i } = t, { start: a } =
|
|
12260
|
+
let { bounds: i } = t, { start: a } = so({
|
|
12228
12261
|
bounds: i,
|
|
12229
12262
|
axis: n
|
|
12230
12263
|
});
|
|
12231
12264
|
if (a - s >= 0) return r;
|
|
12232
12265
|
}
|
|
12233
12266
|
return null;
|
|
12234
|
-
},
|
|
12267
|
+
}, uo = ({ items: e }) => {
|
|
12235
12268
|
for (let t = 0; t < e.length; t += 1) {
|
|
12236
12269
|
let { isActive: n } = e[t];
|
|
12237
12270
|
if (n) return t;
|
|
12238
12271
|
}
|
|
12239
12272
|
return -1;
|
|
12240
|
-
},
|
|
12273
|
+
}, fo = ({ patternAxis: e, activeRangeStart: t, activeRangeEnd: n, tolerance: r = 0 }) => {
|
|
12241
12274
|
let i = Math.min(t, n), a = Math.max(t, n);
|
|
12242
12275
|
return e >= i - r && e <= a + r;
|
|
12243
|
-
},
|
|
12276
|
+
}, po = ({ patternStart: e, patternEnd: t, activeStart: n, activeEnd: r }) => t <= n ? "before" : e >= r ? "after" : null, mo = ({ baseOption: e, candidateOption: t }) => {
|
|
12244
12277
|
let { delta: n, guide: { distance: r } } = e, { delta: i, guide: { distance: a } } = t;
|
|
12245
12278
|
return n === i && r === a;
|
|
12246
|
-
},
|
|
12279
|
+
}, ho = ({ options: e }) => {
|
|
12247
12280
|
let t = e[0];
|
|
12248
12281
|
for (let n = 1; n < e.length; n += 1) {
|
|
12249
12282
|
let r = e[n];
|
|
@@ -12254,11 +12287,11 @@ var Wa = class {
|
|
|
12254
12287
|
r.diff === t.diff && Math.abs(r.delta) < Math.abs(t.delta) && (t = r);
|
|
12255
12288
|
}
|
|
12256
12289
|
return t;
|
|
12257
|
-
},
|
|
12290
|
+
}, go = ({ currentOption: e, nextOption: t }) => {
|
|
12258
12291
|
if (!e) return !0;
|
|
12259
12292
|
let { contextDistance: n, diff: r, delta: i } = e, { contextDistance: a, diff: o, delta: s } = t;
|
|
12260
12293
|
return a < n ? !0 : a > n ? !1 : o < r ? !0 : o > r ? !1 : Math.abs(s) < Math.abs(i);
|
|
12261
|
-
},
|
|
12294
|
+
}, _o = ({ options: e }) => {
|
|
12262
12295
|
let t = [], n = null, r = null;
|
|
12263
12296
|
for (let i of e) {
|
|
12264
12297
|
let { kind: e, side: a } = i;
|
|
@@ -12266,18 +12299,18 @@ var Wa = class {
|
|
|
12266
12299
|
t.push(i);
|
|
12267
12300
|
continue;
|
|
12268
12301
|
}
|
|
12269
|
-
a === "before" &&
|
|
12302
|
+
a === "before" && go({
|
|
12270
12303
|
currentOption: n,
|
|
12271
12304
|
nextOption: i
|
|
12272
|
-
}) && (n = i), a === "after" &&
|
|
12305
|
+
}) && (n = i), a === "after" && go({
|
|
12273
12306
|
currentOption: r,
|
|
12274
12307
|
nextOption: i
|
|
12275
12308
|
}) && (r = i);
|
|
12276
12309
|
}
|
|
12277
12310
|
return n && t.push(n), r && t.push(r), t;
|
|
12278
|
-
},
|
|
12311
|
+
}, vo = ({ options: e, side: t, baseOption: n }) => {
|
|
12279
12312
|
let r = null;
|
|
12280
|
-
for (let i of e) if (i.side === t &&
|
|
12313
|
+
for (let i of e) if (i.side === t && mo({
|
|
12281
12314
|
baseOption: n,
|
|
12282
12315
|
candidateOption: i
|
|
12283
12316
|
})) {
|
|
@@ -12288,63 +12321,63 @@ var Wa = class {
|
|
|
12288
12321
|
!r || i.diff !== r.diff || Math.abs(i.delta) < Math.abs(r.delta) && (r = i);
|
|
12289
12322
|
}
|
|
12290
12323
|
return r;
|
|
12291
|
-
},
|
|
12324
|
+
}, yo = ({ option: e }) => {
|
|
12292
12325
|
let { side: t, kind: n, guide: { distance: r } } = e;
|
|
12293
12326
|
return {
|
|
12294
12327
|
side: t,
|
|
12295
12328
|
kind: n,
|
|
12296
12329
|
distance: r
|
|
12297
12330
|
};
|
|
12298
|
-
},
|
|
12331
|
+
}, bo = ({ option: e, context: t }) => {
|
|
12299
12332
|
let { side: n, kind: r, distance: i } = t, { side: a, kind: o, guide: { distance: s } } = e;
|
|
12300
12333
|
return n !== a || r !== o ? !1 : Math.abs(s - i) <= 1;
|
|
12301
|
-
},
|
|
12334
|
+
}, xo = ({ options: e, context: t }) => {
|
|
12302
12335
|
if (!t) return null;
|
|
12303
|
-
for (let n of e) if (
|
|
12336
|
+
for (let n of e) if (bo({
|
|
12304
12337
|
option: n,
|
|
12305
12338
|
context: t
|
|
12306
12339
|
})) return n;
|
|
12307
12340
|
return null;
|
|
12308
|
-
},
|
|
12309
|
-
let i =
|
|
12341
|
+
}, So = ({ options: e, bestOption: t, previousContext: n, switchDistance: r = 0 }) => {
|
|
12342
|
+
let i = xo({
|
|
12310
12343
|
options: e,
|
|
12311
12344
|
context: n
|
|
12312
12345
|
});
|
|
12313
12346
|
if (!i) return t;
|
|
12314
12347
|
let a = Math.max(0, r);
|
|
12315
12348
|
return a === 0 || Math.abs(t.delta - i.delta) >= a ? t : i;
|
|
12316
|
-
},
|
|
12349
|
+
}, Co = ({ guides: e, seenGuideKeys: t, guide: n }) => {
|
|
12317
12350
|
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = n, u = `${r}:${i}:${a}:${o}:${s}:${c}:${l}`;
|
|
12318
12351
|
t.has(u) || (t.add(u), e.push(n));
|
|
12319
|
-
},
|
|
12352
|
+
}, wo = ({ options: e, previousContext: t = null, switchDistance: n = 0 }) => {
|
|
12320
12353
|
if (!e.length) return {
|
|
12321
12354
|
delta: 0,
|
|
12322
12355
|
guides: [],
|
|
12323
12356
|
context: null
|
|
12324
12357
|
};
|
|
12325
|
-
let r =
|
|
12358
|
+
let r = _o({ options: e }), i = [];
|
|
12326
12359
|
for (let e of r) e.kind === "reference" && i.push(e);
|
|
12327
|
-
let a = i.length > 0, o = a ? i : r, s =
|
|
12360
|
+
let a = i.length > 0, o = a ? i : r, s = So({
|
|
12328
12361
|
options: o,
|
|
12329
|
-
bestOption:
|
|
12362
|
+
bestOption: ho({ options: o }),
|
|
12330
12363
|
previousContext: t,
|
|
12331
12364
|
switchDistance: n
|
|
12332
|
-
}), c =
|
|
12365
|
+
}), c = vo({
|
|
12333
12366
|
options: o,
|
|
12334
12367
|
side: "before",
|
|
12335
12368
|
baseOption: s
|
|
12336
|
-
}), l =
|
|
12369
|
+
}), l = vo({
|
|
12337
12370
|
options: o,
|
|
12338
12371
|
side: "after",
|
|
12339
12372
|
baseOption: s
|
|
12340
|
-
}), u =
|
|
12373
|
+
}), u = vo({
|
|
12341
12374
|
options: a ? r : o,
|
|
12342
12375
|
side: "center",
|
|
12343
12376
|
baseOption: s
|
|
12344
12377
|
}), d = [];
|
|
12345
12378
|
c && l ? d.push(c, l) : (d.push(s), s.side === "before" && l && d.push(l), s.side === "after" && c && d.push(c), s.side === "center" && (c && !l && d.push(c), l && !c && d.push(l)), a && s.side === "before" && !l && u && d.push(u), a && s.side === "after" && !c && u && d.push(u)), !d.length && u && d.push(u);
|
|
12346
12379
|
let f = [], p = /* @__PURE__ */ new Set();
|
|
12347
|
-
for (let e of d)
|
|
12380
|
+
for (let e of d) Co({
|
|
12348
12381
|
guides: f,
|
|
12349
12382
|
seenGuideKeys: p,
|
|
12350
12383
|
guide: e.guide
|
|
@@ -12352,15 +12385,15 @@ var Wa = class {
|
|
|
12352
12385
|
return {
|
|
12353
12386
|
delta: s.delta,
|
|
12354
12387
|
guides: f,
|
|
12355
|
-
context:
|
|
12388
|
+
context: yo({ option: s })
|
|
12356
12389
|
};
|
|
12357
|
-
},
|
|
12358
|
-
let s = n - (e - r), c =
|
|
12390
|
+
}, To = ({ activeStart: e, activeEnd: t, targetGap: n, beforeEdge: r, afterEdge: i, threshold: a, step: o }) => {
|
|
12391
|
+
let s = n - (e - r), c = ao({
|
|
12359
12392
|
value: s,
|
|
12360
12393
|
step: o
|
|
12361
12394
|
}), l = Math.max(1, Math.ceil(a / Math.max(o, 1))), u = null;
|
|
12362
12395
|
for (let d = -l; d <= l; d += 1) {
|
|
12363
|
-
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } =
|
|
12396
|
+
let l = c + d * o, f = e + l, p = t + l, m = f - r, h = i - p, { displayDistanceDiff: g, commonDisplayDistance: _ } = no({
|
|
12364
12397
|
firstDistance: m,
|
|
12365
12398
|
secondDistance: h
|
|
12366
12399
|
});
|
|
@@ -12375,13 +12408,13 @@ var Wa = class {
|
|
|
12375
12408
|
});
|
|
12376
12409
|
}
|
|
12377
12410
|
return u;
|
|
12378
|
-
},
|
|
12379
|
-
let { secondDisplayDistance: n, displayDistanceDiff: r } =
|
|
12411
|
+
}, Eo = ({ currentGap: e, referenceGap: t }) => {
|
|
12412
|
+
let { secondDisplayDistance: n, displayDistanceDiff: r } = no({
|
|
12380
12413
|
firstDistance: e,
|
|
12381
12414
|
secondDistance: t
|
|
12382
12415
|
});
|
|
12383
12416
|
return r > 1 ? null : n;
|
|
12384
|
-
},
|
|
12417
|
+
}, Do = ({ anchors: e, positions: t, threshold: n }) => {
|
|
12385
12418
|
let r = 0, i = n + 1, a = null;
|
|
12386
12419
|
for (let o of t) for (let t of e) {
|
|
12387
12420
|
let e = Math.abs(t - o);
|
|
@@ -12391,8 +12424,8 @@ var Wa = class {
|
|
|
12391
12424
|
delta: r,
|
|
12392
12425
|
guidePosition: a
|
|
12393
12426
|
};
|
|
12394
|
-
},
|
|
12395
|
-
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l =
|
|
12427
|
+
}, Oo = ({ activeBounds: e, threshold: t, anchors: n }) => {
|
|
12428
|
+
let { left: r, right: i, centerX: a, top: o, bottom: s, centerY: c } = e, l = Do({
|
|
12396
12429
|
anchors: n.vertical,
|
|
12397
12430
|
positions: [
|
|
12398
12431
|
r,
|
|
@@ -12400,7 +12433,7 @@ var Wa = class {
|
|
|
12400
12433
|
i
|
|
12401
12434
|
],
|
|
12402
12435
|
threshold: t
|
|
12403
|
-
}), u =
|
|
12436
|
+
}), u = Do({
|
|
12404
12437
|
anchors: n.horizontal,
|
|
12405
12438
|
positions: [
|
|
12406
12439
|
o,
|
|
@@ -12420,11 +12453,11 @@ var Wa = class {
|
|
|
12420
12453
|
deltaY: u.delta,
|
|
12421
12454
|
guides: d
|
|
12422
12455
|
};
|
|
12423
|
-
},
|
|
12456
|
+
}, ko = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
12424
12457
|
let { centerX: o, top: s, bottom: c, left: l, right: u } = e, d = [];
|
|
12425
12458
|
for (let e of t) {
|
|
12426
12459
|
let { left: t, right: n } = e;
|
|
12427
|
-
|
|
12460
|
+
ro({
|
|
12428
12461
|
firstStart: t,
|
|
12429
12462
|
firstEnd: n,
|
|
12430
12463
|
secondStart: l,
|
|
@@ -12444,22 +12477,22 @@ var Wa = class {
|
|
|
12444
12477
|
f.push({
|
|
12445
12478
|
bounds: e,
|
|
12446
12479
|
isActive: !0
|
|
12447
|
-
}),
|
|
12480
|
+
}), co({
|
|
12448
12481
|
items: f,
|
|
12449
12482
|
axis: "top"
|
|
12450
12483
|
});
|
|
12451
|
-
let p =
|
|
12484
|
+
let p = uo({ items: f });
|
|
12452
12485
|
if (p === -1) return {
|
|
12453
12486
|
delta: 0,
|
|
12454
12487
|
guides: [],
|
|
12455
12488
|
context: null
|
|
12456
12489
|
};
|
|
12457
|
-
let m = [], h = c - s, g =
|
|
12490
|
+
let m = [], h = c - s, g = lo({
|
|
12458
12491
|
items: f,
|
|
12459
12492
|
index: p,
|
|
12460
12493
|
axis: "vertical",
|
|
12461
12494
|
direction: "prev"
|
|
12462
|
-
}), _ =
|
|
12495
|
+
}), _ = lo({
|
|
12463
12496
|
items: f,
|
|
12464
12497
|
index: p,
|
|
12465
12498
|
axis: "vertical",
|
|
@@ -12468,19 +12501,19 @@ var Wa = class {
|
|
|
12468
12501
|
if (v && y) {
|
|
12469
12502
|
let { bounds: e } = v, { bounds: t } = y, { bottom: r } = e, { top: i } = t, a = i - r - h;
|
|
12470
12503
|
if (a >= 0) {
|
|
12471
|
-
let e =
|
|
12504
|
+
let e = ao({
|
|
12472
12505
|
value: a / 2,
|
|
12473
12506
|
step: 1
|
|
12474
12507
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
12475
12508
|
if (Math.max(u, d) <= n) {
|
|
12476
|
-
let t =
|
|
12509
|
+
let t = To({
|
|
12477
12510
|
activeStart: s,
|
|
12478
12511
|
activeEnd: c,
|
|
12479
12512
|
targetGap: e,
|
|
12480
12513
|
beforeEdge: r,
|
|
12481
12514
|
afterEdge: i,
|
|
12482
12515
|
threshold: n,
|
|
12483
|
-
step:
|
|
12516
|
+
step: eo
|
|
12484
12517
|
});
|
|
12485
12518
|
if (t) {
|
|
12486
12519
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -12517,16 +12550,16 @@ var Wa = class {
|
|
|
12517
12550
|
}
|
|
12518
12551
|
for (let e of r) {
|
|
12519
12552
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
12520
|
-
if (!
|
|
12553
|
+
if (!oo({
|
|
12521
12554
|
value: a,
|
|
12522
12555
|
step: .5
|
|
12523
|
-
}) || !
|
|
12556
|
+
}) || !fo({
|
|
12524
12557
|
patternAxis: t,
|
|
12525
12558
|
activeRangeStart: l,
|
|
12526
12559
|
activeRangeEnd: u,
|
|
12527
12560
|
tolerance: n
|
|
12528
12561
|
})) continue;
|
|
12529
|
-
let d =
|
|
12562
|
+
let d = po({
|
|
12530
12563
|
patternStart: r,
|
|
12531
12564
|
patternEnd: i,
|
|
12532
12565
|
activeStart: s,
|
|
@@ -12534,12 +12567,12 @@ var Wa = class {
|
|
|
12534
12567
|
});
|
|
12535
12568
|
if (d) {
|
|
12536
12569
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
12537
|
-
let e =
|
|
12570
|
+
let e = ao({
|
|
12538
12571
|
value: a - b,
|
|
12539
12572
|
step: 1
|
|
12540
12573
|
}), t = s + e, { bottom: c } = S, l = t - c, u = Math.abs(l - a);
|
|
12541
12574
|
if (u > n) continue;
|
|
12542
|
-
let d =
|
|
12575
|
+
let d = Eo({
|
|
12543
12576
|
currentGap: l,
|
|
12544
12577
|
referenceGap: a
|
|
12545
12578
|
});
|
|
@@ -12563,12 +12596,12 @@ var Wa = class {
|
|
|
12563
12596
|
});
|
|
12564
12597
|
}
|
|
12565
12598
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
12566
|
-
let e =
|
|
12599
|
+
let e = ao({
|
|
12567
12600
|
value: x - a,
|
|
12568
12601
|
step: 1
|
|
12569
12602
|
}), t = c + e, { top: s } = C, l = s - t, u = Math.abs(l - a);
|
|
12570
12603
|
if (u > n) continue;
|
|
12571
|
-
let d =
|
|
12604
|
+
let d = Eo({
|
|
12572
12605
|
currentGap: l,
|
|
12573
12606
|
referenceGap: a
|
|
12574
12607
|
});
|
|
@@ -12593,16 +12626,16 @@ var Wa = class {
|
|
|
12593
12626
|
}
|
|
12594
12627
|
}
|
|
12595
12628
|
}
|
|
12596
|
-
return
|
|
12629
|
+
return wo({
|
|
12597
12630
|
options: m,
|
|
12598
12631
|
previousContext: i,
|
|
12599
12632
|
switchDistance: a
|
|
12600
12633
|
});
|
|
12601
|
-
},
|
|
12634
|
+
}, Ao = ({ activeBounds: e, candidates: t, threshold: n, patterns: r, previousContext: i = null, switchDistance: a = 0 }) => {
|
|
12602
12635
|
let { centerY: o, left: s, right: c, top: l, bottom: u } = e, d = [];
|
|
12603
12636
|
for (let e of t) {
|
|
12604
12637
|
let { top: t, bottom: n } = e;
|
|
12605
|
-
|
|
12638
|
+
ro({
|
|
12606
12639
|
firstStart: t,
|
|
12607
12640
|
firstEnd: n,
|
|
12608
12641
|
secondStart: l,
|
|
@@ -12622,22 +12655,22 @@ var Wa = class {
|
|
|
12622
12655
|
f.push({
|
|
12623
12656
|
bounds: e,
|
|
12624
12657
|
isActive: !0
|
|
12625
|
-
}),
|
|
12658
|
+
}), co({
|
|
12626
12659
|
items: f,
|
|
12627
12660
|
axis: "left"
|
|
12628
12661
|
});
|
|
12629
|
-
let p =
|
|
12662
|
+
let p = uo({ items: f });
|
|
12630
12663
|
if (p === -1) return {
|
|
12631
12664
|
delta: 0,
|
|
12632
12665
|
guides: [],
|
|
12633
12666
|
context: null
|
|
12634
12667
|
};
|
|
12635
|
-
let m = [], h = c - s, g =
|
|
12668
|
+
let m = [], h = c - s, g = lo({
|
|
12636
12669
|
items: f,
|
|
12637
12670
|
index: p,
|
|
12638
12671
|
axis: "horizontal",
|
|
12639
12672
|
direction: "prev"
|
|
12640
|
-
}), _ =
|
|
12673
|
+
}), _ = lo({
|
|
12641
12674
|
items: f,
|
|
12642
12675
|
index: p,
|
|
12643
12676
|
axis: "horizontal",
|
|
@@ -12646,19 +12679,19 @@ var Wa = class {
|
|
|
12646
12679
|
if (v && y) {
|
|
12647
12680
|
let { bounds: e } = v, { bounds: t } = y, { right: r } = e, { left: i } = t, a = i - r - h;
|
|
12648
12681
|
if (a >= 0) {
|
|
12649
|
-
let e =
|
|
12682
|
+
let e = ao({
|
|
12650
12683
|
value: a / 2,
|
|
12651
12684
|
step: 1
|
|
12652
12685
|
}), t = s - r, l = i - c, u = Math.abs(t - e), d = Math.abs(l - e);
|
|
12653
12686
|
if (Math.max(u, d) <= n) {
|
|
12654
|
-
let t =
|
|
12687
|
+
let t = To({
|
|
12655
12688
|
activeStart: s,
|
|
12656
12689
|
activeEnd: c,
|
|
12657
12690
|
targetGap: e,
|
|
12658
12691
|
beforeEdge: r,
|
|
12659
12692
|
afterEdge: i,
|
|
12660
12693
|
threshold: n,
|
|
12661
|
-
step:
|
|
12694
|
+
step: eo
|
|
12662
12695
|
});
|
|
12663
12696
|
if (t) {
|
|
12664
12697
|
let { delta: e, distance: n, diff: i, activeStart: a, activeEnd: s } = t, c = {
|
|
@@ -12695,16 +12728,16 @@ var Wa = class {
|
|
|
12695
12728
|
}
|
|
12696
12729
|
for (let e of r) {
|
|
12697
12730
|
let { axis: t, start: r, end: i, distance: a } = e;
|
|
12698
|
-
if (!
|
|
12731
|
+
if (!oo({
|
|
12699
12732
|
value: a,
|
|
12700
12733
|
step: .5
|
|
12701
|
-
}) || !
|
|
12734
|
+
}) || !fo({
|
|
12702
12735
|
patternAxis: t,
|
|
12703
12736
|
activeRangeStart: l,
|
|
12704
12737
|
activeRangeEnd: u,
|
|
12705
12738
|
tolerance: n
|
|
12706
12739
|
})) continue;
|
|
12707
|
-
let d =
|
|
12740
|
+
let d = po({
|
|
12708
12741
|
patternStart: r,
|
|
12709
12742
|
patternEnd: i,
|
|
12710
12743
|
activeStart: s,
|
|
@@ -12712,12 +12745,12 @@ var Wa = class {
|
|
|
12712
12745
|
});
|
|
12713
12746
|
if (d) {
|
|
12714
12747
|
if (b !== null && S && d === "before" && Math.abs(b - a) <= n) {
|
|
12715
|
-
let e =
|
|
12748
|
+
let e = ao({
|
|
12716
12749
|
value: a - b,
|
|
12717
12750
|
step: 1
|
|
12718
12751
|
}), t = s + e, { right: c } = S, l = t - c, u = Math.abs(l - a);
|
|
12719
12752
|
if (u > n) continue;
|
|
12720
|
-
let d =
|
|
12753
|
+
let d = Eo({
|
|
12721
12754
|
currentGap: l,
|
|
12722
12755
|
referenceGap: a
|
|
12723
12756
|
});
|
|
@@ -12741,12 +12774,12 @@ var Wa = class {
|
|
|
12741
12774
|
});
|
|
12742
12775
|
}
|
|
12743
12776
|
if (x !== null && C && d === "after" && Math.abs(x - a) <= n) {
|
|
12744
|
-
let e =
|
|
12777
|
+
let e = ao({
|
|
12745
12778
|
value: x - a,
|
|
12746
12779
|
step: 1
|
|
12747
12780
|
}), t = c + e, { left: s } = C, l = s - t, u = Math.abs(l - a);
|
|
12748
12781
|
if (u > n) continue;
|
|
12749
|
-
let d =
|
|
12782
|
+
let d = Eo({
|
|
12750
12783
|
currentGap: l,
|
|
12751
12784
|
referenceGap: a
|
|
12752
12785
|
});
|
|
@@ -12771,20 +12804,20 @@ var Wa = class {
|
|
|
12771
12804
|
}
|
|
12772
12805
|
}
|
|
12773
12806
|
}
|
|
12774
|
-
return
|
|
12807
|
+
return wo({
|
|
12775
12808
|
options: m,
|
|
12776
12809
|
previousContext: i,
|
|
12777
12810
|
switchDistance: a
|
|
12778
12811
|
});
|
|
12779
|
-
},
|
|
12780
|
-
let { vertical: o = null, horizontal: s = null } = i ?? {}, c =
|
|
12812
|
+
}, jo = ({ activeBounds: e, candidates: t, threshold: n, spacingPatterns: r, previousContexts: i, switchDistance: a = 0 }) => {
|
|
12813
|
+
let { vertical: o = null, horizontal: s = null } = i ?? {}, c = ko({
|
|
12781
12814
|
activeBounds: e,
|
|
12782
12815
|
candidates: t,
|
|
12783
12816
|
threshold: n,
|
|
12784
12817
|
patterns: r.vertical,
|
|
12785
12818
|
previousContext: o,
|
|
12786
12819
|
switchDistance: a
|
|
12787
|
-
}), l =
|
|
12820
|
+
}), l = Ao({
|
|
12788
12821
|
activeBounds: e,
|
|
12789
12822
|
candidates: t,
|
|
12790
12823
|
threshold: n,
|
|
@@ -12803,14 +12836,14 @@ var Wa = class {
|
|
|
12803
12836
|
horizontal: l.context
|
|
12804
12837
|
}
|
|
12805
12838
|
};
|
|
12806
|
-
},
|
|
12839
|
+
}, Mo = ({ context: e, x: t, y: n, width: r, height: i, radius: a }) => {
|
|
12807
12840
|
let o = Math.min(a, r / 2, i / 2);
|
|
12808
12841
|
e.moveTo(t + o, n), e.lineTo(t + r - o, n), e.quadraticCurveTo(t + r, n, t + r, n + o), e.lineTo(t + r, n + i - o), e.quadraticCurveTo(t + r, n + i, t + r - o, n + i), e.lineTo(t + o, n + i), e.quadraticCurveTo(t, n + i, t, n + i - o), e.lineTo(t, n + o), e.quadraticCurveTo(t, n, t + o, n), e.closePath();
|
|
12809
|
-
},
|
|
12842
|
+
}, No = ({ context: e, type: t, axis: n, start: r, end: i, text: a, zoom: o, color: s, textColor: c = "#ffffff", fontFamily: l = "sans-serif", lineWidth: u = 1, padding: d = 4, radius: f = 4, offsetAlongAxis: p = 0, offsetPerpendicular: m = 0 }) => {
|
|
12810
12843
|
let h = o || 1, g = 12 / h, _ = d / h, v = f / h, y = (r + i) / 2 + p, b = t === "vertical" ? n + m : y, x = t === "vertical" ? y : n + m;
|
|
12811
12844
|
e.save(), e.setLineDash([]), e.fillStyle = s, e.strokeStyle = s, e.lineWidth = u / h, e.font = `${g}px ${l}`, e.textAlign = "center", e.textBaseline = "middle";
|
|
12812
12845
|
let S = e.measureText(a).width + _ * 2, C = g + _ * 2, w = b - S / 2, T = x - C / 2;
|
|
12813
|
-
e.beginPath(),
|
|
12846
|
+
e.beginPath(), Mo({
|
|
12814
12847
|
context: e,
|
|
12815
12848
|
x: w,
|
|
12816
12849
|
y: T,
|
|
@@ -12818,11 +12851,11 @@ var Wa = class {
|
|
|
12818
12851
|
height: C,
|
|
12819
12852
|
radius: v
|
|
12820
12853
|
}), e.fill(), e.fillStyle = c, e.fillText(a, b, x), e.restore();
|
|
12821
|
-
},
|
|
12822
|
-
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u =
|
|
12854
|
+
}, Po = ({ context: e, guide: t, zoom: n }) => {
|
|
12855
|
+
let { type: r, axis: i, refStart: a, refEnd: o, activeStart: s, activeEnd: c, distance: l } = t, u = to({ distance: l }).toString();
|
|
12823
12856
|
e.beginPath(), r === "vertical" ? (e.moveTo(i, a), e.lineTo(i, o), e.moveTo(i, s), e.lineTo(i, c)) : (e.moveTo(a, i), e.lineTo(o, i), e.moveTo(s, i), e.lineTo(c, i)), e.stroke();
|
|
12824
|
-
let d =
|
|
12825
|
-
|
|
12857
|
+
let d = $a;
|
|
12858
|
+
No({
|
|
12826
12859
|
context: e,
|
|
12827
12860
|
type: r,
|
|
12828
12861
|
axis: i,
|
|
@@ -12832,7 +12865,7 @@ var Wa = class {
|
|
|
12832
12865
|
zoom: n,
|
|
12833
12866
|
color: d,
|
|
12834
12867
|
lineWidth: 1
|
|
12835
|
-
}),
|
|
12868
|
+
}), No({
|
|
12836
12869
|
context: e,
|
|
12837
12870
|
type: r,
|
|
12838
12871
|
axis: i,
|
|
@@ -12843,10 +12876,10 @@ var Wa = class {
|
|
|
12843
12876
|
color: d,
|
|
12844
12877
|
lineWidth: 1
|
|
12845
12878
|
});
|
|
12846
|
-
},
|
|
12879
|
+
}, Fo = ({ anchors: e, bounds: t }) => {
|
|
12847
12880
|
let { left: n, right: r, centerX: i, top: a, bottom: o, centerY: s } = t;
|
|
12848
12881
|
e.vertical.push(n, i, r), e.horizontal.push(a, s, o);
|
|
12849
|
-
},
|
|
12882
|
+
}, Io = ({ bounds: e, type: t, primaryStart: n, primaryEnd: r }) => {
|
|
12850
12883
|
let i = [], a = n === "top" ? "left" : "top", o = r === "bottom" ? "right" : "bottom", s = [...e].sort((e, t) => e[n] - t[n]);
|
|
12851
12884
|
for (let e = 0; e < s.length; e += 1) {
|
|
12852
12885
|
let c = s[e], l = null, u = Infinity;
|
|
@@ -12867,35 +12900,35 @@ var Wa = class {
|
|
|
12867
12900
|
});
|
|
12868
12901
|
}
|
|
12869
12902
|
return i;
|
|
12870
|
-
},
|
|
12871
|
-
vertical:
|
|
12903
|
+
}, Lo = ({ bounds: e }) => ({
|
|
12904
|
+
vertical: Io({
|
|
12872
12905
|
bounds: e,
|
|
12873
12906
|
axis: "centerX",
|
|
12874
12907
|
type: "vertical",
|
|
12875
12908
|
primaryStart: "top",
|
|
12876
12909
|
primaryEnd: "bottom"
|
|
12877
12910
|
}),
|
|
12878
|
-
horizontal:
|
|
12911
|
+
horizontal: Io({
|
|
12879
12912
|
bounds: e,
|
|
12880
12913
|
axis: "centerY",
|
|
12881
12914
|
type: "horizontal",
|
|
12882
12915
|
primaryStart: "left",
|
|
12883
12916
|
primaryEnd: "right"
|
|
12884
12917
|
})
|
|
12885
|
-
}),
|
|
12918
|
+
}), Ro = [
|
|
12886
12919
|
"montage-area",
|
|
12887
12920
|
"background",
|
|
12888
12921
|
"interaction-blocker"
|
|
12889
|
-
],
|
|
12922
|
+
], zo = ({ activeObject: t }) => {
|
|
12890
12923
|
let n = /* @__PURE__ */ new Set();
|
|
12891
12924
|
return t ? (n.add(t), t instanceof e && t.getObjects().forEach((e) => n.add(e)), n) : n;
|
|
12892
|
-
},
|
|
12925
|
+
}, Bo = ({ object: e, excluded: t, ignoredIds: n = Ro }) => {
|
|
12893
12926
|
if (t.has(e)) return !0;
|
|
12894
12927
|
let { visible: r = !0 } = e;
|
|
12895
12928
|
if (!r) return !0;
|
|
12896
12929
|
let { id: i } = e;
|
|
12897
12930
|
return !!(i && n.includes(i));
|
|
12898
|
-
},
|
|
12931
|
+
}, Vo = class e {
|
|
12899
12932
|
constructor({ editor: e }) {
|
|
12900
12933
|
this.anchors = {
|
|
12901
12934
|
vertical: [],
|
|
@@ -12948,7 +12981,7 @@ var Wa = class {
|
|
|
12948
12981
|
this._clearSpacingContexts(), this._clearGuides();
|
|
12949
12982
|
return;
|
|
12950
12983
|
}
|
|
12951
|
-
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } =
|
|
12984
|
+
let { canvas: o } = this, s = o.getZoom() || 1, c = 5 / s, { deltaX: l, deltaY: u } = Oo({
|
|
12952
12985
|
activeBounds: a,
|
|
12953
12986
|
threshold: c,
|
|
12954
12987
|
anchors: this.anchors
|
|
@@ -12960,7 +12993,7 @@ var Wa = class {
|
|
|
12960
12993
|
top: t + u
|
|
12961
12994
|
}), n.setCoords(), a = G({ object: n }) ?? a;
|
|
12962
12995
|
}
|
|
12963
|
-
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p =
|
|
12996
|
+
let d = this._resolveCurrentTargetBounds({ activeObject: n }), f = this.spacingContexts.vertical || this.spacingContexts.horizontal ? 10 / s : c, p = jo({
|
|
12964
12997
|
activeBounds: a,
|
|
12965
12998
|
candidates: d,
|
|
12966
12999
|
threshold: f,
|
|
@@ -12981,11 +13014,11 @@ var Wa = class {
|
|
|
12981
13014
|
target: n,
|
|
12982
13015
|
transform: i
|
|
12983
13016
|
});
|
|
12984
|
-
let h = G({ object: n }) ?? a, g =
|
|
13017
|
+
let h = G({ object: n }) ?? a, g = Oo({
|
|
12985
13018
|
activeBounds: h,
|
|
12986
13019
|
threshold: c,
|
|
12987
13020
|
anchors: this.anchors
|
|
12988
|
-
}), _ =
|
|
13021
|
+
}), _ = jo({
|
|
12989
13022
|
activeBounds: h,
|
|
12990
13023
|
candidates: d,
|
|
12991
13024
|
threshold: c,
|
|
@@ -13216,9 +13249,9 @@ var Wa = class {
|
|
|
13216
13249
|
let { canvas: e, guideBounds: t } = this, n = e.getSelectionContext();
|
|
13217
13250
|
if (!n) return;
|
|
13218
13251
|
let { left: r, right: i, top: a, bottom: o } = t ?? this._calculateViewportBounds(), { viewportTransform: s } = e, c = e.getZoom() || 1;
|
|
13219
|
-
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle =
|
|
13252
|
+
n.save(), Array.isArray(s) && n.transform(...s), n.lineWidth = 1 / c, n.strokeStyle = $a, n.setLineDash([4, 4]);
|
|
13220
13253
|
for (let e of this.activeGuides) n.beginPath(), e.type === "vertical" ? (n.moveTo(e.position, a), n.lineTo(e.position, o)) : (n.moveTo(r, e.position), n.lineTo(i, e.position)), n.stroke();
|
|
13221
|
-
for (let e of this.activeSpacingGuides)
|
|
13254
|
+
for (let e of this.activeSpacingGuides) Po({
|
|
13222
13255
|
context: n,
|
|
13223
13256
|
guide: e,
|
|
13224
13257
|
zoom: c
|
|
@@ -13429,14 +13462,14 @@ var Wa = class {
|
|
|
13429
13462
|
}, r = [];
|
|
13430
13463
|
for (let e of t) {
|
|
13431
13464
|
let t = G({ object: e });
|
|
13432
|
-
t && (
|
|
13465
|
+
t && (Fo({
|
|
13433
13466
|
anchors: n,
|
|
13434
13467
|
bounds: t
|
|
13435
13468
|
}), r.push(t));
|
|
13436
13469
|
}
|
|
13437
13470
|
let { montageArea: i } = this.editor, a = G({ object: i });
|
|
13438
13471
|
if (a) {
|
|
13439
|
-
|
|
13472
|
+
Fo({
|
|
13440
13473
|
anchors: n,
|
|
13441
13474
|
bounds: a
|
|
13442
13475
|
});
|
|
@@ -13448,12 +13481,12 @@ var Wa = class {
|
|
|
13448
13481
|
bottom: i
|
|
13449
13482
|
};
|
|
13450
13483
|
} else this.guideBounds = this._calculateViewportBounds();
|
|
13451
|
-
this.anchors = n, this.spacingPatterns =
|
|
13484
|
+
this.anchors = n, this.spacingPatterns = Lo({ bounds: r }), this.cachedTargetBounds = r;
|
|
13452
13485
|
}
|
|
13453
13486
|
_collectTargets({ activeObject: e }) {
|
|
13454
|
-
let t =
|
|
13487
|
+
let t = zo({ activeObject: e }), n = [];
|
|
13455
13488
|
return this.canvas.forEachObject((e) => {
|
|
13456
|
-
|
|
13489
|
+
Bo({
|
|
13457
13490
|
object: e,
|
|
13458
13491
|
excluded: t
|
|
13459
13492
|
}) || n.push(e);
|
|
@@ -13476,7 +13509,7 @@ var Wa = class {
|
|
|
13476
13509
|
bottom: (r - s) / a
|
|
13477
13510
|
};
|
|
13478
13511
|
}
|
|
13479
|
-
},
|
|
13512
|
+
}, Ho = "#3D8BF4", Uo = class e {
|
|
13480
13513
|
constructor({ editor: e }) {
|
|
13481
13514
|
this.activeGuides = [], this.isAltPressed = !1, this.pendingEvent = null, this.frameRequest = null, this.isToolbarHidden = !1, this.isTargetMontageArea = !1, this.lastMouseEvent = null, this.editor = e, this.canvas = e.canvas, this._onMouseMove = this._handleMouseMove.bind(this), this._onBeforeRender = this._handleBeforeRender.bind(this), this._onAfterRender = this._handleAfterRender.bind(this), this._onSelectionCleared = this._handleSelectionCleared.bind(this), this._onKeyDown = this._handleKeyDown.bind(this), this._onKeyUp = this._handleKeyUp.bind(this), this._onWindowBlur = this._handleWindowBlur.bind(this), this._bindEvents();
|
|
13482
13515
|
}
|
|
@@ -13569,8 +13602,8 @@ var Wa = class {
|
|
|
13569
13602
|
this.isTargetMontageArea = l, this.activeGuides = d, this._hideToolbar(), n.requestRenderAll();
|
|
13570
13603
|
}
|
|
13571
13604
|
static _resolveTarget({ event: e, activeObject: t }) {
|
|
13572
|
-
let { target: n } = e, r =
|
|
13573
|
-
return n && !
|
|
13605
|
+
let { target: n } = e, r = zo({ activeObject: t });
|
|
13606
|
+
return n && !Bo({
|
|
13574
13607
|
object: n,
|
|
13575
13608
|
excluded: r
|
|
13576
13609
|
}) ? n : null;
|
|
@@ -13687,18 +13720,18 @@ var Wa = class {
|
|
|
13687
13720
|
let { canvas: e } = this, t = e.getSelectionContext();
|
|
13688
13721
|
if (!t) return;
|
|
13689
13722
|
let { viewportTransform: n } = e, r = e.getZoom() || 1, i = this.activeGuides.some((e) => e.type === "vertical"), a = this.activeGuides.some((e) => e.type === "horizontal"), o = i && a && !this.isTargetMontageArea, s = o ? 12 / r : 0;
|
|
13690
|
-
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle =
|
|
13723
|
+
t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle = Ho, t.setLineDash([]);
|
|
13691
13724
|
for (let e of this.activeGuides) {
|
|
13692
13725
|
let { type: n, axis: i, start: a, end: c, distance: l } = e, u = Math.abs(c - a), d = o ? (a <= c ? -1 : 1) * (u / 2 + s) : 0;
|
|
13693
|
-
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(),
|
|
13726
|
+
t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(), No({
|
|
13694
13727
|
context: t,
|
|
13695
13728
|
type: n,
|
|
13696
13729
|
axis: i,
|
|
13697
13730
|
start: a,
|
|
13698
13731
|
end: c,
|
|
13699
|
-
text:
|
|
13732
|
+
text: to({ distance: l }).toString(),
|
|
13700
13733
|
zoom: r,
|
|
13701
|
-
color:
|
|
13734
|
+
color: Ho,
|
|
13702
13735
|
lineWidth: 1,
|
|
13703
13736
|
offsetAlongAxis: d,
|
|
13704
13737
|
offsetPerpendicular: 0
|
|
@@ -13716,13 +13749,13 @@ var Wa = class {
|
|
|
13716
13749
|
let { toolbar: e } = this.editor;
|
|
13717
13750
|
e?.showAfterTemporary?.(), this.isToolbarHidden = !1;
|
|
13718
13751
|
}
|
|
13719
|
-
},
|
|
13752
|
+
}, Wo = class e {
|
|
13720
13753
|
constructor(e, t) {
|
|
13721
13754
|
this.options = t, this.containerId = e, this.editorId = `${e}-${D()}`, this.init();
|
|
13722
13755
|
}
|
|
13723
13756
|
async init() {
|
|
13724
13757
|
let { editorContainerWidth: e, editorContainerHeight: n, canvasWrapperWidth: r, canvasWrapperHeight: i, canvasCSSWidth: a, canvasCSSHeight: o, initialImage: s, initialState: c, scaleType: l, showRotationAngle: u, _onReadyCallback: d } = this.options;
|
|
13725
|
-
if (de.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new
|
|
13758
|
+
if (de.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new A(), this.workerManager = new M(), this.errorManager = new Ea({ editor: this }), this.historyManager = new Dt({ editor: this }), this.toolbar = new Qe({ editor: this }), this.transformManager = new Rt({ editor: this }), this.zoomManager = new zt({ editor: this }), this.canvasManager = new Lt({ editor: this }), this.imageManager = new Nt({ editor: this }), this.layerManager = new wn({ editor: this }), this.shapeManager = new va({ editor: this }), this.interactionBlocker = new Sn({ editor: this }), this.backgroundManager = new Cn({ editor: this }), this.clipboardManager = new ba({ editor: this }), this.objectLockManager = new xa({ editor: this }), this.groupingManager = new Sa({ editor: this }), this.selectionManager = new Ca({ editor: this }), this.deletionManager = new wa({ editor: this }), this.panConstraintManager = new Da({ editor: this }), this.snappingManager = new Vo({ editor: this }), this.measurementManager = new Uo({ editor: this }), this.fontManager = new fe(this.options.fonts ?? []), this.textManager = new qa({ editor: this }), this.templateManager = new Qa({ editor: this }), u && (this.angleIndicator = new tt({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new k({
|
|
13726
13759
|
editor: this,
|
|
13727
13760
|
options: this.options
|
|
13728
13761
|
}), 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(), await this.fontManager.loadFonts(), c) {
|
|
@@ -13830,7 +13863,7 @@ var Wa = class {
|
|
|
13830
13863
|
"U+A640-A69F",
|
|
13831
13864
|
"U+FE2E-FE2F",
|
|
13832
13865
|
"U+2116"
|
|
13833
|
-
].join(", "),
|
|
13866
|
+
].join(", "), Go = {
|
|
13834
13867
|
preserveObjectStacking: !0,
|
|
13835
13868
|
controlsAboveOverlay: !0,
|
|
13836
13869
|
centeredRotation: !0,
|
|
@@ -14686,20 +14719,20 @@ var Wa = class {
|
|
|
14686
14719
|
};
|
|
14687
14720
|
//#endregion
|
|
14688
14721
|
//#region src/main.ts
|
|
14689
|
-
function
|
|
14722
|
+
function Ko(e, t = {}) {
|
|
14690
14723
|
let n = {
|
|
14691
|
-
...
|
|
14724
|
+
...Go,
|
|
14692
14725
|
...t
|
|
14693
14726
|
}, r = document.getElementById(e);
|
|
14694
14727
|
if (!r) return Promise.reject(/* @__PURE__ */ Error(`Контейнер с ID "${e}" не найден.`));
|
|
14695
14728
|
let i = document.createElement("canvas");
|
|
14696
14729
|
return i.id = `${e}-canvas`, r.appendChild(i), n.editorContainer = r, new Promise((t) => {
|
|
14697
14730
|
n._onReadyCallback = t;
|
|
14698
|
-
let r = new
|
|
14731
|
+
let r = new Wo(i.id, n);
|
|
14699
14732
|
window[e] = r;
|
|
14700
14733
|
});
|
|
14701
14734
|
}
|
|
14702
14735
|
//#endregion
|
|
14703
|
-
export {
|
|
14736
|
+
export { Ko as default };
|
|
14704
14737
|
|
|
14705
14738
|
//# sourceMappingURL=main.js.map
|