@univerjs/drawing-ui 0.10.12 → 0.10.13
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/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1006 -733
- package/lib/index.js +1006 -733
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
package/lib/index.js
CHANGED
|
@@ -1,179 +1,452 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as
|
|
5
|
-
import { useDependency as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { DropdownMenu as
|
|
8
|
-
import {
|
|
9
|
-
import { getDrawingShapeKeyByDrawingSearch as L, SetDrawingSelectedOperation as
|
|
10
|
-
import { Group as
|
|
11
|
-
import { switchMap as
|
|
1
|
+
var Ot = Object.defineProperty;
|
|
2
|
+
var Dt = (i, r, e) => r in i ? Ot(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
|
|
3
|
+
var J = (i, r, e) => Dt(i, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { CommandType as me, ICommandService as ce, LocaleService as te, Inject as Ae, Disposable as He, DrawingTypeEnum as q, UniverInstanceType as Oe, checkIfMove as at, toDisposable as fe, IUniverInstanceService as Fe, ImageSourceType as Ye, Injector as Tt, IConfigService as Et, Plugin as Pt, merge as Nt, ArrangeTypeEnum as _e, generateRandomId as Bt, debounce as Ce } from "@univerjs/core";
|
|
5
|
+
import { useDependency as A, ComponentManager as xt, IMessageService as Ut, IGalleryService as jt, IDialogService as At } from "@univerjs/ui";
|
|
6
|
+
import { jsx as v, jsxs as P, Fragment as Ht } from "react/jsx-runtime";
|
|
7
|
+
import { DropdownMenu as Lt, clsx as Q, borderClassName as kt, MessageType as Xe, Select as st, Button as se, InputNumber as he, Checkbox as $t } from "@univerjs/design";
|
|
8
|
+
import { useRef as ot, createElement as F, forwardRef as ee, useState as j, useEffect as we } from "react";
|
|
9
|
+
import { getDrawingShapeKeyByDrawingSearch as L, SetDrawingSelectedOperation as De, IDrawingManagerService as re, ImageSourceType as Vt, IImageIoService as ct } from "@univerjs/drawing";
|
|
10
|
+
import { Group as pe, DRAWING_OBJECT_LAYER_INDEX as Te, RENDER_CLASS_TYPE as Je, IRenderManagerService as ue, Shape as Gt, Rect as lt, Canvas as Wt, Image as We, precisionTo as Se, CURSOR_TYPE as Ee, Vector2 as $e, degToRad as qe, getGroupState as Zt, transformObjectOutOfGroup as Ft } from "@univerjs/engine-render";
|
|
11
|
+
import { switchMap as zt, of as Kt } from "rxjs";
|
|
12
12
|
var D = /* @__PURE__ */ ((i) => (i.default = "0", i.left = "1", i.center = "2", i.right = "3", i.top = "4", i.middle = "5", i.bottom = "6", i.horizon = "7", i.vertical = "8", i))(D || {});
|
|
13
|
-
const
|
|
13
|
+
const ze = {
|
|
14
14
|
id: "sheet.operation.set-image-align",
|
|
15
|
-
type:
|
|
15
|
+
type: me.OPERATION,
|
|
16
16
|
handler: (i, r) => !0
|
|
17
|
-
},
|
|
17
|
+
}, Ze = {
|
|
18
18
|
id: "sheet.operation.open-image-crop",
|
|
19
|
-
type:
|
|
19
|
+
type: me.OPERATION,
|
|
20
20
|
handler: (i, r) => !0
|
|
21
|
-
},
|
|
21
|
+
}, oe = {
|
|
22
22
|
id: "sheet.operation.close-image-crop",
|
|
23
|
-
type:
|
|
23
|
+
type: me.OPERATION,
|
|
24
24
|
handler: (i, r) => !0
|
|
25
25
|
};
|
|
26
|
-
var
|
|
27
|
-
const
|
|
26
|
+
var x = /* @__PURE__ */ ((i) => (i.FREE = "0", i.R1_1 = "1", i.R16_9 = "2", i.R9_16 = "3", i.R5_4 = "4", i.R4_5 = "5", i.R4_3 = "6", i.R3_4 = "7", i.R3_2 = "8", i.R2_3 = "9", i))(x || {});
|
|
27
|
+
const Pe = {
|
|
28
28
|
id: "sheet.operation.Auto-image-crop",
|
|
29
|
-
type:
|
|
29
|
+
type: me.OPERATION,
|
|
30
30
|
handler: (i, r) => !0
|
|
31
|
-
},
|
|
31
|
+
}, ut = {
|
|
32
32
|
id: "sheet.operation.image-reset-size",
|
|
33
|
-
type:
|
|
33
|
+
type: me.OPERATION,
|
|
34
34
|
handler: (i, r) => !0
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return dt(t, "".concat(e), { defIds: t.defIds, idSuffix: c.current }, V({ ref: r, className: o }, a), s);
|
|
54
|
-
});
|
|
55
|
-
function dt(i, r, t, e, n) {
|
|
56
|
-
return K(i.tag, V(V({ key: r }, Qt(i, t, n)), e), (er(i, t).children || []).map(function(s, a) {
|
|
57
|
-
return dt(s, "".concat(r, "-").concat(i.tag, "-").concat(a), t, void 0, n);
|
|
58
|
-
}));
|
|
35
|
+
}, Yt = "drawing-ui.config", Qe = {}, Xt = "COMPONENT_IMAGE_POPUP_MENU";
|
|
36
|
+
function z({ ref: i, ...r }) {
|
|
37
|
+
const { icon: e, id: t, className: n, extend: s, ...a } = r, o = `univerjs-icon univerjs-icon-${t} ${n || ""}`.trim(), c = ot(`_${Qt()}`);
|
|
38
|
+
return gt(e, `${t}`, {
|
|
39
|
+
defIds: e.defIds,
|
|
40
|
+
idSuffix: c.current
|
|
41
|
+
}, {
|
|
42
|
+
ref: i,
|
|
43
|
+
className: o,
|
|
44
|
+
...a
|
|
45
|
+
}, s);
|
|
46
|
+
}
|
|
47
|
+
function gt(i, r, e, t, n) {
|
|
48
|
+
return F(i.tag, {
|
|
49
|
+
key: r,
|
|
50
|
+
...Jt(i, e, n),
|
|
51
|
+
...t
|
|
52
|
+
}, (qt(i, e).children || []).map((s, a) => gt(s, `${r}-${i.tag}-${a}`, e, void 0, n)));
|
|
59
53
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
a === "mask" && typeof o == "string" && (e[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(r.idSuffix, ")")));
|
|
54
|
+
function Jt(i, r, e) {
|
|
55
|
+
const t = { ...i.attrs };
|
|
56
|
+
e != null && e.colorChannel1 && t.fill === "colorChannel1" && (t.fill = e.colorChannel1), i.tag === "mask" && t.id && (t.id = t.id + r.idSuffix), Object.entries(t).forEach(([s, a]) => {
|
|
57
|
+
s === "mask" && typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, `url(#$1${r.idSuffix})`));
|
|
65
58
|
});
|
|
66
|
-
|
|
67
|
-
return !n || n.length === 0 || (i.tag === "use" &&
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})), e;
|
|
59
|
+
const { defIds: n } = r;
|
|
60
|
+
return !n || n.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + r.idSuffix), Object.entries(t).forEach(([s, a]) => {
|
|
61
|
+
typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, `url(#$1${r.idSuffix})`));
|
|
62
|
+
})), t;
|
|
71
63
|
}
|
|
72
|
-
function
|
|
73
|
-
var t
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
function qt(i, r) {
|
|
65
|
+
var t;
|
|
66
|
+
const { defIds: e } = r;
|
|
67
|
+
return !e || e.length === 0 ? i : i.tag === "defs" && ((t = i.children) != null && t.length) ? {
|
|
68
|
+
...i,
|
|
69
|
+
children: i.children.map((n) => typeof n.attrs.id == "string" && e && e.includes(n.attrs.id) ? {
|
|
70
|
+
...n,
|
|
71
|
+
attrs: {
|
|
72
|
+
...n.attrs,
|
|
73
|
+
id: n.attrs.id + r.idSuffix
|
|
74
|
+
}
|
|
75
|
+
} : n)
|
|
76
|
+
} : i;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function Qt() {
|
|
79
79
|
return Math.random().toString(36).substring(2, 8);
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
z.displayName = "UniverIcon";
|
|
82
|
+
const er = {
|
|
83
|
+
tag: "svg",
|
|
84
|
+
attrs: {
|
|
85
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
86
|
+
fill: "none",
|
|
87
|
+
viewBox: "0 0 17 16",
|
|
88
|
+
width: "1em",
|
|
89
|
+
height: "1em"
|
|
90
|
+
},
|
|
91
|
+
children: [
|
|
92
|
+
{
|
|
93
|
+
tag: "path",
|
|
94
|
+
attrs: {
|
|
95
|
+
fill: "currentColor",
|
|
96
|
+
d: "M14.0045 4.4334C14.8881 4.4334 15.6045 3.71705 15.6045 2.8334C15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334C2.10449 3.71705 2.82084 4.4334 3.70449 4.4334H14.0045ZM14.4045 2.8334C14.4045 3.05431 14.2254 3.2334 14.0045 3.2334H3.70449C3.48358 3.2334 3.30449 3.05431 3.30449 2.8334C3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334Z",
|
|
97
|
+
fillRule: "evenodd",
|
|
98
|
+
clipRule: "evenodd"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
tag: "path",
|
|
103
|
+
attrs: {
|
|
104
|
+
fill: "currentColor",
|
|
105
|
+
d: "M14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999C15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999C2.25439 7.88356 2.97074 8.5999 3.85439 8.5999H14.1544ZM14.5544 6.9999C14.5544 7.22082 14.3753 7.3999 14.1544 7.3999H3.85439C3.63348 7.3999 3.45439 7.22082 3.45439 6.9999C3.45439 6.77899 3.63348 6.5999 3.85439 6.5999H14.1544C14.3753 6.5999 14.5544 6.77899 14.5544 6.9999Z",
|
|
106
|
+
fillRule: "evenodd",
|
|
107
|
+
clipRule: "evenodd"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
tag: "path",
|
|
112
|
+
attrs: {
|
|
113
|
+
fill: "currentColor",
|
|
114
|
+
d: "M8.57975 14.5902L6.58023 12.5907C6.34591 12.3564 6.34591 11.9765 6.58023 11.7421C6.81454 11.5078 7.19444 11.5078 7.42876 11.7421L8.40449 12.7179V10.1664C8.40449 9.83504 8.67312 9.56641 9.00449 9.56641C9.33586 9.56641 9.60449 9.83504 9.60449 10.1664V12.7179L10.5802 11.7421C10.8145 11.5078 11.1944 11.5078 11.4288 11.7421C11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
tag: "path",
|
|
119
|
+
attrs: {
|
|
120
|
+
fill: "currentColor",
|
|
121
|
+
d: "M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946C8.64077 14.6502 8.70566 14.6923 8.77482 14.7209C8.84557 14.7502 8.92314 14.7664 9.00449 14.7664C9.08585 14.7664 9.16342 14.7502 9.23416 14.7209C9.30332 14.6923 9.36821 14.6502 9.42482 14.5946"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}, dt = ee(function(r, e) {
|
|
126
|
+
return F(z, Object.assign({}, r, {
|
|
92
127
|
id: "bottom-icon",
|
|
93
|
-
ref:
|
|
94
|
-
icon:
|
|
128
|
+
ref: e,
|
|
129
|
+
icon: er
|
|
95
130
|
}));
|
|
96
131
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
132
|
+
dt.displayName = "BottomIcon";
|
|
133
|
+
const tr = {
|
|
134
|
+
tag: "svg",
|
|
135
|
+
attrs: {
|
|
136
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
137
|
+
fill: "none",
|
|
138
|
+
viewBox: "0 0 16 16",
|
|
139
|
+
width: "1em",
|
|
140
|
+
height: "1em"
|
|
141
|
+
},
|
|
142
|
+
children: [
|
|
143
|
+
{
|
|
144
|
+
tag: "path",
|
|
145
|
+
attrs: {
|
|
146
|
+
fill: "currentColor",
|
|
147
|
+
d: "M5.97705 7.51296C5.97705 7.18159 6.24568 6.91296 6.57705 6.91296H8.48632C8.81769 6.91296 9.08632 7.18159 9.08632 7.51296C9.08632 7.84433 8.81769 8.11296 8.48632 8.11296H6.57705C6.24568 8.11296 5.97705 7.84433 5.97705 7.51296Z"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
tag: "path",
|
|
152
|
+
attrs: {
|
|
153
|
+
fill: "currentColor",
|
|
154
|
+
d: "M6.57705 9.41028C6.24568 9.41028 5.97705 9.67891 5.97705 10.0103C5.97705 10.3416 6.24568 10.6103 6.57705 10.6103H10.8199C11.1512 10.6103 11.4199 10.3416 11.4199 10.0103C11.4199 9.67891 11.1512 9.41028 10.8199 9.41028H6.57705Z"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
tag: "path",
|
|
159
|
+
attrs: {
|
|
160
|
+
fill: "currentColor",
|
|
161
|
+
d: "M3.51074 2.37063C3.51074 1.48697 4.22709 0.77063 5.11074 0.77063H9.80318L9.81294 0.770708C9.97168 0.768161 10.1311 0.82824 10.2511 0.95055L14.4317 5.21408C14.5165 5.30049 14.5697 5.406 14.5917 5.51645C14.6041 5.5644 14.6106 5.61467 14.6106 5.66648V11.6406C14.6106 12.5243 13.8943 13.2406 13.0106 13.2406H5.11074C4.22709 13.2406 3.51074 12.5243 3.51074 11.6406V2.37063ZM10.4032 4.66648V2.81964L12.6063 5.06648H10.8032C10.5823 5.06648 10.4032 4.88739 10.4032 4.66648ZM5.11074 1.97063C4.88983 1.97063 4.71074 2.14972 4.71074 2.37063V11.6406C4.71074 11.8615 4.88983 12.0406 5.11074 12.0406H13.0106C13.2316 12.0406 13.4106 11.8615 13.4106 11.6406V6.26648H10.8032C9.91953 6.26648 9.20318 5.55013 9.20318 4.66648V1.97063H5.11074Z",
|
|
162
|
+
fillRule: "evenodd",
|
|
163
|
+
clipRule: "evenodd"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
tag: "path",
|
|
168
|
+
attrs: {
|
|
169
|
+
fill: "currentColor",
|
|
170
|
+
d: "M2.58916 6.6741C2.58916 6.34273 2.32053 6.0741 1.98916 6.0741C1.65779 6.0741 1.38916 6.34273 1.38916 6.6741V12.6294C1.38916 14.0653 2.55322 15.2294 3.98916 15.2294H9.41408C9.74545 15.2294 10.0141 14.9607 10.0141 14.6294C10.0141 14.298 9.74545 14.0294 9.41408 14.0294H3.98916C3.21596 14.0294 2.58916 13.4026 2.58916 12.6294V6.6741Z"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}, ht = ee(function(r, e) {
|
|
175
|
+
return F(z, Object.assign({}, r, {
|
|
100
176
|
id: "create-copy-icon",
|
|
101
|
-
ref:
|
|
102
|
-
icon:
|
|
177
|
+
ref: e,
|
|
178
|
+
icon: tr
|
|
103
179
|
}));
|
|
104
180
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
181
|
+
ht.displayName = "CreateCopyIcon";
|
|
182
|
+
const rr = {
|
|
183
|
+
tag: "svg",
|
|
184
|
+
attrs: {
|
|
185
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
186
|
+
fill: "none",
|
|
187
|
+
viewBox: "0 0 17 16",
|
|
188
|
+
width: "1em",
|
|
189
|
+
height: "1em"
|
|
190
|
+
},
|
|
191
|
+
children: [{
|
|
192
|
+
tag: "path",
|
|
193
|
+
attrs: {
|
|
194
|
+
fill: "currentColor",
|
|
195
|
+
d: "M7.38125 1.16211C6.49759 1.16211 5.78125 1.87845 5.78125 2.76211V5.6377H2.87783C1.99418 5.6377 1.27783 6.35404 1.27783 7.2377V13.2377C1.27783 14.1214 1.99418 14.8377 2.87783 14.8377H8.87783C9.76149 14.8377 10.4778 14.1214 10.4778 13.2377V10.3621H13.3813C14.2649 10.3621 14.9813 9.64577 14.9813 8.76211V2.76211C14.9813 1.87845 14.2649 1.16211 13.3813 1.16211H7.38125ZM10.4778 9.16211H13.3813C13.6022 9.16211 13.7812 8.98302 13.7812 8.76211V2.76211C13.7812 2.5412 13.6022 2.36211 13.3813 2.36211H7.38125C7.16034 2.36211 6.98125 2.5412 6.98125 2.76211V5.6377H8.87783C9.76149 5.6377 10.4778 6.35404 10.4778 7.2377V9.16211ZM6.98125 6.8377H8.87783C9.09875 6.8377 9.27783 7.01678 9.27783 7.2377V9.16211H7.38125C7.16034 9.16211 6.98125 8.98302 6.98125 8.76211V6.8377ZM5.78125 6.8377V8.76211C5.78125 9.64577 6.49759 10.3621 7.38125 10.3621H9.27783V13.2377C9.27783 13.4586 9.09875 13.6377 8.87783 13.6377H2.87783C2.65692 13.6377 2.47783 13.4586 2.47783 13.2377V7.2377C2.47783 7.01678 2.65692 6.8377 2.87783 6.8377H5.78125Z",
|
|
196
|
+
fillRule: "evenodd",
|
|
197
|
+
clipRule: "evenodd"
|
|
198
|
+
}
|
|
199
|
+
}]
|
|
200
|
+
}, ft = ee(function(r, e) {
|
|
201
|
+
return F(z, Object.assign({}, r, {
|
|
108
202
|
id: "group-icon",
|
|
109
|
-
ref:
|
|
110
|
-
icon:
|
|
203
|
+
ref: e,
|
|
204
|
+
icon: rr
|
|
111
205
|
}));
|
|
112
206
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
207
|
+
ft.displayName = "GroupIcon";
|
|
208
|
+
const nr = {
|
|
209
|
+
tag: "svg",
|
|
210
|
+
attrs: {
|
|
211
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
212
|
+
fill: "none",
|
|
213
|
+
viewBox: "0 0 16 16",
|
|
214
|
+
width: "1em",
|
|
215
|
+
height: "1em"
|
|
216
|
+
},
|
|
217
|
+
children: [{
|
|
218
|
+
tag: "path",
|
|
219
|
+
attrs: {
|
|
220
|
+
fill: "currentColor",
|
|
221
|
+
d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",
|
|
222
|
+
fillRule: "evenodd",
|
|
223
|
+
clipRule: "evenodd"
|
|
224
|
+
}
|
|
225
|
+
}]
|
|
226
|
+
}, pt = ee(function(r, e) {
|
|
227
|
+
return F(z, Object.assign({}, r, {
|
|
116
228
|
id: "more-down-icon",
|
|
117
|
-
ref:
|
|
118
|
-
icon:
|
|
229
|
+
ref: e,
|
|
230
|
+
icon: nr
|
|
119
231
|
}));
|
|
120
232
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
233
|
+
pt.displayName = "MoreDownIcon";
|
|
234
|
+
const ir = {
|
|
235
|
+
tag: "svg",
|
|
236
|
+
attrs: {
|
|
237
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
238
|
+
fill: "none",
|
|
239
|
+
viewBox: "0 0 16 16",
|
|
240
|
+
width: "1em",
|
|
241
|
+
height: "1em"
|
|
242
|
+
},
|
|
243
|
+
children: [{
|
|
244
|
+
tag: "path",
|
|
245
|
+
attrs: {
|
|
246
|
+
fill: "currentColor",
|
|
247
|
+
d: "M1.25 2.96401C1.25 3.84767 1.96634 4.56401 2.85 4.56401H13.15C14.0337 4.56401 14.75 3.84767 14.75 2.96401C14.75 2.08036 14.0337 1.36401 13.15 1.36401H2.85C1.96635 1.36401 1.25 2.08036 1.25 2.96401ZM2.85 3.36401C2.62909 3.36401 2.45 3.18493 2.45 2.96401C2.45 2.7431 2.62909 2.56401 2.85 2.56401H13.15C13.3709 2.56401 13.55 2.7431 13.55 2.96401C13.55 3.18493 13.3709 3.36401 13.15 3.36401H2.85Z",
|
|
248
|
+
fillRule: "evenodd",
|
|
249
|
+
clipRule: "evenodd"
|
|
250
|
+
}
|
|
251
|
+
}, {
|
|
252
|
+
tag: "path",
|
|
253
|
+
attrs: {
|
|
254
|
+
fill: "currentColor",
|
|
255
|
+
d: "M5.57564 11.6118C5.80995 11.3774 6.18985 11.3774 6.42417 11.6118L7.3999 12.5875V6.36951C7.3999 6.03814 7.66853 5.76951 7.9999 5.76951C8.33127 5.76951 8.5999 6.03814 8.5999 6.36951V12.5875L9.57564 11.6118C9.80995 11.3774 10.1899 11.3774 10.4242 11.6118C10.6585 11.8461 10.6585 12.226 10.4242 12.4603L8.4324 14.452C8.32324 14.5655 8.16982 14.6362 7.9999 14.6362C7.82998 14.6362 7.67655 14.5655 7.56739 14.452L5.57564 12.4603C5.34132 12.226 5.34132 11.8461 5.57564 11.6118Z"
|
|
256
|
+
}
|
|
257
|
+
}]
|
|
258
|
+
}, mt = ee(function(r, e) {
|
|
259
|
+
return F(z, Object.assign({}, r, {
|
|
124
260
|
id: "move-down-icon",
|
|
125
|
-
ref:
|
|
126
|
-
icon:
|
|
261
|
+
ref: e,
|
|
262
|
+
icon: ir
|
|
127
263
|
}));
|
|
128
264
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
265
|
+
mt.displayName = "MoveDownIcon";
|
|
266
|
+
const ar = {
|
|
267
|
+
tag: "svg",
|
|
268
|
+
attrs: {
|
|
269
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
270
|
+
fill: "none",
|
|
271
|
+
viewBox: "0 0 16 16",
|
|
272
|
+
width: "1em",
|
|
273
|
+
height: "1em"
|
|
274
|
+
},
|
|
275
|
+
children: [{
|
|
276
|
+
tag: "path",
|
|
277
|
+
attrs: {
|
|
278
|
+
fill: "currentColor",
|
|
279
|
+
d: "M1.25 13.036C1.25 12.1523 1.96634 11.436 2.85 11.436H13.15C14.0337 11.436 14.75 12.1523 14.75 13.036C14.75 13.9196 14.0337 14.636 13.15 14.636H2.85C1.96635 14.636 1.25 13.9196 1.25 13.036ZM2.85 12.636C2.62909 12.636 2.45 12.8151 2.45 13.036C2.45 13.2569 2.62909 13.436 2.85 13.436H13.15C13.3709 13.436 13.55 13.2569 13.55 13.036C13.55 12.8151 13.3709 12.636 13.15 12.636H2.85Z",
|
|
280
|
+
fillRule: "evenodd",
|
|
281
|
+
clipRule: "evenodd"
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
tag: "path",
|
|
285
|
+
attrs: {
|
|
286
|
+
fill: "currentColor",
|
|
287
|
+
d: "M5.57564 4.38825C5.80995 4.62256 6.18985 4.62256 6.42417 4.38825L7.3999 3.41251V9.63049C7.3999 9.96186 7.66853 10.2305 7.9999 10.2305C8.33127 10.2305 8.5999 9.96186 8.5999 9.63049V3.41251L9.57564 4.38825C9.80995 4.62256 10.1899 4.62256 10.4242 4.38825C10.6585 4.15393 10.6585 3.77403 10.4242 3.53972L8.4324 1.54796C8.32324 1.43445 8.16982 1.36382 7.9999 1.36382C7.82998 1.36382 7.67655 1.43446 7.56739 1.54797L5.57564 3.53972C5.34132 3.77403 5.34132 4.15393 5.57564 4.38825Z"
|
|
288
|
+
}
|
|
289
|
+
}]
|
|
290
|
+
}, wt = ee(function(r, e) {
|
|
291
|
+
return F(z, Object.assign({}, r, {
|
|
132
292
|
id: "move-up-icon",
|
|
133
|
-
ref:
|
|
134
|
-
icon:
|
|
293
|
+
ref: e,
|
|
294
|
+
icon: ar
|
|
135
295
|
}));
|
|
136
296
|
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
297
|
+
wt.displayName = "MoveUpIcon";
|
|
298
|
+
const sr = {
|
|
299
|
+
tag: "svg",
|
|
300
|
+
attrs: {
|
|
301
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
302
|
+
fill: "none",
|
|
303
|
+
viewBox: "0 0 17 16",
|
|
304
|
+
width: "1em",
|
|
305
|
+
height: "1em"
|
|
306
|
+
},
|
|
307
|
+
children: [
|
|
308
|
+
{
|
|
309
|
+
tag: "path",
|
|
310
|
+
attrs: {
|
|
311
|
+
fill: "currentColor",
|
|
312
|
+
d: "M7.82994 1.40913C7.88746 1.35161 7.95376 1.30821 8.02453 1.27893C8.09527 1.24959 8.17285 1.2334 8.2542 1.2334C8.33555 1.2334 8.41313 1.24959 8.48387 1.27893C8.55464 1.30821 8.62094 1.35161 8.67846 1.40913L10.6785 3.40913C10.9128 3.64345 10.9128 4.02335 10.6785 4.25766C10.4441 4.49198 10.0642 4.49198 9.82994 4.25766L8.8542 3.28193V5.8334C8.8542 6.16477 8.58557 6.4334 8.2542 6.4334C7.92283 6.4334 7.6542 6.16477 7.6542 5.8334V3.28193L6.67846 4.25766C6.44415 4.49198 6.06425 4.49198 5.82994 4.25766C5.59562 4.02335 5.59562 3.64345 5.82994 3.40913L7.82994 1.40913Z"
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
tag: "path",
|
|
317
|
+
attrs: {
|
|
318
|
+
fill: "currentColor",
|
|
319
|
+
d: "M1.50439 9C1.50439 8.11634 2.22074 7.4 3.10439 7.4H13.4044C14.288 7.4 15.0044 8.11634 15.0044 9C15.0044 9.88366 14.2881 10.6 13.4044 10.6H3.1044C2.22074 10.6 1.50439 9.88366 1.50439 9ZM3.10439 8.6C2.88348 8.6 2.70439 8.77909 2.70439 9C2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9C13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439Z",
|
|
320
|
+
fillRule: "evenodd",
|
|
321
|
+
clipRule: "evenodd"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
tag: "path",
|
|
326
|
+
attrs: {
|
|
327
|
+
fill: "currentColor",
|
|
328
|
+
d: "M1.6543 13.1665C1.6543 12.2828 2.37064 11.5665 3.2543 11.5665H13.5543C14.438 11.5665 15.1543 12.2828 15.1543 13.1665C15.1543 14.0502 14.438 14.7665 13.5543 14.7665H3.2543C2.37064 14.7665 1.6543 14.0502 1.6543 13.1665ZM3.2543 12.7665C3.03338 12.7665 2.8543 12.9456 2.8543 13.1665C2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665C13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543Z",
|
|
329
|
+
fillRule: "evenodd",
|
|
330
|
+
clipRule: "evenodd"
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
]
|
|
334
|
+
}, vt = ee(function(r, e) {
|
|
335
|
+
return F(z, Object.assign({}, r, {
|
|
140
336
|
id: "topmost-icon",
|
|
141
|
-
ref:
|
|
142
|
-
icon:
|
|
337
|
+
ref: e,
|
|
338
|
+
icon: sr
|
|
143
339
|
}));
|
|
144
340
|
});
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
341
|
+
vt.displayName = "TopmostIcon";
|
|
342
|
+
const or = {
|
|
343
|
+
tag: "svg",
|
|
344
|
+
attrs: {
|
|
345
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
346
|
+
fill: "none",
|
|
347
|
+
viewBox: "0 0 17 16",
|
|
348
|
+
width: "1em",
|
|
349
|
+
height: "1em"
|
|
350
|
+
},
|
|
351
|
+
children: [{
|
|
352
|
+
tag: "path",
|
|
353
|
+
attrs: {
|
|
354
|
+
fill: "currentColor",
|
|
355
|
+
d: "M7.46855 2.83731C7.46855 2.61639 7.64764 2.4373 7.86855 2.4373H13.8603C14.0812 2.4373 14.2603 2.61639 14.2603 2.8373V9.5049C14.2603 9.72581 14.0812 9.90489 13.8603 9.90489H12.866C12.5346 9.90489 12.266 10.1735 12.266 10.5049C12.266 10.8363 12.5346 11.1049 12.866 11.1049H13.8603C14.7439 11.1049 15.4603 10.3886 15.4603 9.5049V2.8373C15.4603 1.95365 14.7439 1.2373 13.8603 1.2373H7.86855C6.9849 1.2373 6.26855 1.95365 6.26855 2.83731V3.48688C6.26855 3.81825 6.53718 4.08688 6.86855 4.08688C7.19993 4.08688 7.46855 3.81825 7.46855 3.48688V2.83731Z"
|
|
356
|
+
}
|
|
357
|
+
}, {
|
|
358
|
+
tag: "path",
|
|
359
|
+
attrs: {
|
|
360
|
+
fill: "currentColor",
|
|
361
|
+
d: "M3.19888 5.56299C2.31522 5.56299 1.59888 6.27933 1.59888 7.16299V13.163C1.59888 14.0466 2.31522 14.763 3.19888 14.763H9.19888C10.0825 14.763 10.7989 14.0466 10.7989 13.163V7.16299C10.7989 6.27933 10.0825 5.56299 9.19888 5.56299H3.19888ZM2.79888 7.16299C2.79888 6.94207 2.97796 6.76299 3.19888 6.76299H9.19888C9.41979 6.76299 9.59888 6.94207 9.59888 7.16299V13.163C9.59888 13.3839 9.41979 13.563 9.19888 13.563H3.19888C2.97796 13.563 2.79888 13.3839 2.79888 13.163V7.16299Z",
|
|
362
|
+
fillRule: "evenodd",
|
|
363
|
+
clipRule: "evenodd"
|
|
364
|
+
}
|
|
365
|
+
}]
|
|
366
|
+
}, _t = ee(function(r, e) {
|
|
367
|
+
return F(z, Object.assign({}, r, {
|
|
148
368
|
id: "ungroup-icon",
|
|
149
|
-
ref:
|
|
150
|
-
icon:
|
|
369
|
+
ref: e,
|
|
370
|
+
icon: or
|
|
151
371
|
}));
|
|
152
372
|
});
|
|
153
|
-
|
|
154
|
-
|
|
373
|
+
_t.displayName = "UngroupIcon";
|
|
374
|
+
const cr = {
|
|
375
|
+
tag: "svg",
|
|
376
|
+
attrs: {
|
|
377
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
378
|
+
fill: "none",
|
|
379
|
+
viewBox: "0 0 16 16",
|
|
380
|
+
width: "1em",
|
|
381
|
+
height: "1em"
|
|
382
|
+
},
|
|
383
|
+
children: [
|
|
384
|
+
{
|
|
385
|
+
tag: "path",
|
|
386
|
+
attrs: {
|
|
387
|
+
fill: "colorChannel1",
|
|
388
|
+
d: "M11.0363 12.2367V14.0367C11.0363 14.3681 11.3049 14.6367 11.6363 14.6367C11.9676 14.6367 12.2363 14.3681 12.2363 14.0367V12.2367H14.0364C14.3677 12.2367 14.6364 11.9681 14.6364 11.6367C14.6364 11.3054 14.3677 11.0367 14.0364 11.0367H12.2363V9.23672C12.2363 8.90535 11.9676 8.63672 11.6363 8.63672C11.3049 8.63672 11.0363 8.90535 11.0363 9.23672V11.0367H9.23635C8.90498 11.0367 8.63635 11.3054 8.63635 11.6367C8.63635 11.9681 8.90498 12.2367 9.23635 12.2367H11.0363Z"
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
tag: "path",
|
|
393
|
+
attrs: {
|
|
394
|
+
fill: "currentColor",
|
|
395
|
+
d: "M2.56365 1.36377C1.90091 1.36377 1.36365 1.90103 1.36365 2.56377V6.16377C1.36365 6.82651 1.90091 7.36377 2.56365 7.36377H6.16365C6.82639 7.36377 7.36365 6.82651 7.36365 6.16377V2.56377C7.36365 1.90103 6.82639 1.36377 6.16365 1.36377H2.56365ZM6.16365 2.56377H2.56365L2.56365 6.16377H6.16365V2.56377Z",
|
|
396
|
+
fillRule: "evenodd",
|
|
397
|
+
clipRule: "evenodd"
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
tag: "path",
|
|
402
|
+
attrs: {
|
|
403
|
+
fill: "currentColor",
|
|
404
|
+
d: "M2.56365 8.63647C1.90091 8.63647 1.36365 9.17373 1.36365 9.83647V13.4365C1.36365 14.0992 1.90091 14.6365 2.56365 14.6365H6.16365C6.82639 14.6365 7.36365 14.0992 7.36365 13.4365V9.83647C7.36365 9.17373 6.82639 8.63647 6.16365 8.63647H2.56365ZM6.16365 9.83647H2.56365L2.56365 13.4365H6.16365V9.83647Z",
|
|
405
|
+
fillRule: "evenodd",
|
|
406
|
+
clipRule: "evenodd"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
tag: "path",
|
|
411
|
+
attrs: {
|
|
412
|
+
fill: "currentColor",
|
|
413
|
+
d: "M9.83635 7.36377C9.17361 7.36377 8.63635 6.82651 8.63635 6.16377V2.56377C8.63635 1.90103 9.17361 1.36377 9.83635 1.36377H13.4364C14.0991 1.36377 14.6364 1.90103 14.6364 2.56377V6.16377C14.6364 6.82651 14.0991 7.36377 13.4364 7.36377H9.83635ZM9.83635 6.16377V2.56377L13.4364 2.56377V6.16377H9.83635Z",
|
|
414
|
+
fillRule: "evenodd",
|
|
415
|
+
clipRule: "evenodd"
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
]
|
|
419
|
+
}, Ct = ee(function(r, e) {
|
|
420
|
+
return F(z, Object.assign({}, r, {
|
|
421
|
+
id: "autofill-double-icon",
|
|
422
|
+
ref: e,
|
|
423
|
+
icon: cr
|
|
424
|
+
}));
|
|
425
|
+
});
|
|
426
|
+
Ct.displayName = "AutofillDoubleIcon";
|
|
427
|
+
function lr(i) {
|
|
155
428
|
var h;
|
|
156
|
-
const { popup: r } = i,
|
|
157
|
-
if (!
|
|
158
|
-
const
|
|
429
|
+
const { popup: r } = i, e = (h = r == null ? void 0 : r.extraProps) == null ? void 0 : h.menuItems;
|
|
430
|
+
if (!e) return null;
|
|
431
|
+
const t = A(ce), n = A(te), [s, a] = j(!1), [o, c] = j(!1), u = () => {
|
|
159
432
|
c(!0);
|
|
160
433
|
}, l = () => {
|
|
161
434
|
c(!1);
|
|
162
435
|
}, g = (p) => {
|
|
163
436
|
a(p);
|
|
164
437
|
}, d = (p) => {
|
|
165
|
-
|
|
166
|
-
}, f = s || o,
|
|
167
|
-
return /* @__PURE__ */
|
|
438
|
+
t.executeCommand(p.commandId, p.commandParams), a(!1);
|
|
439
|
+
}, f = s || o, w = e.filter((p) => !p.disable);
|
|
440
|
+
return /* @__PURE__ */ v(
|
|
168
441
|
"div",
|
|
169
442
|
{
|
|
170
443
|
onMouseEnter: u,
|
|
171
444
|
onMouseLeave: l,
|
|
172
|
-
children: /* @__PURE__ */
|
|
173
|
-
|
|
445
|
+
children: /* @__PURE__ */ v(
|
|
446
|
+
Lt,
|
|
174
447
|
{
|
|
175
448
|
align: "start",
|
|
176
|
-
items:
|
|
449
|
+
items: w.map((p) => ({
|
|
177
450
|
type: "item",
|
|
178
451
|
children: n.t(p.label),
|
|
179
452
|
onSelect: () => d(p)
|
|
@@ -183,18 +456,18 @@ function gr(i) {
|
|
|
183
456
|
children: /* @__PURE__ */ P(
|
|
184
457
|
"div",
|
|
185
458
|
{
|
|
186
|
-
className:
|
|
459
|
+
className: Q("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", kt, {
|
|
187
460
|
"univer-bg-gray-100 dark:!univer-bg-gray-800": s,
|
|
188
461
|
"univer-bg-white dark:!univer-bg-gray-900": !s
|
|
189
462
|
}),
|
|
190
463
|
children: [
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
|
|
464
|
+
/* @__PURE__ */ v(
|
|
465
|
+
Ct,
|
|
193
466
|
{
|
|
194
467
|
className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white"
|
|
195
468
|
}
|
|
196
469
|
),
|
|
197
|
-
f && /* @__PURE__ */
|
|
470
|
+
f && /* @__PURE__ */ v(pt, { className: "dark:!univer-text-white" })
|
|
198
471
|
]
|
|
199
472
|
}
|
|
200
473
|
)
|
|
@@ -203,47 +476,47 @@ function gr(i) {
|
|
|
203
476
|
}
|
|
204
477
|
);
|
|
205
478
|
}
|
|
206
|
-
var
|
|
207
|
-
for (var n =
|
|
479
|
+
var ur = Object.getOwnPropertyDescriptor, gr = (i, r, e, t) => {
|
|
480
|
+
for (var n = t > 1 ? void 0 : t ? ur(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
208
481
|
(a = i[s]) && (n = a(n) || n);
|
|
209
482
|
return n;
|
|
210
|
-
},
|
|
211
|
-
let
|
|
483
|
+
}, et = (i, r) => (e, t) => r(e, t, i);
|
|
484
|
+
let Ne = class extends He {
|
|
212
485
|
constructor(i, r) {
|
|
213
486
|
super(), this._componentManager = i, this._commandService = r, this._init();
|
|
214
487
|
}
|
|
215
488
|
_initCustomComponents() {
|
|
216
489
|
const i = this._componentManager;
|
|
217
|
-
this.disposeWithMe(i.register(
|
|
490
|
+
this.disposeWithMe(i.register(Xt, lr));
|
|
218
491
|
}
|
|
219
492
|
_initCommands() {
|
|
220
493
|
[
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
494
|
+
Ze,
|
|
495
|
+
oe,
|
|
496
|
+
ut,
|
|
497
|
+
ze,
|
|
498
|
+
Pe
|
|
226
499
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
227
500
|
}
|
|
228
501
|
_init() {
|
|
229
502
|
this._initCommands(), this._initCustomComponents();
|
|
230
503
|
}
|
|
231
504
|
};
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
],
|
|
236
|
-
function
|
|
237
|
-
const
|
|
238
|
-
return i.forEach((
|
|
239
|
-
const { oKey: n, left: s, top: a, height: o, width: c, angle: u } =
|
|
505
|
+
Ne = gr([
|
|
506
|
+
et(0, Ae(xt)),
|
|
507
|
+
et(1, ce)
|
|
508
|
+
], Ne);
|
|
509
|
+
function Le(i, r) {
|
|
510
|
+
const e = [];
|
|
511
|
+
return i.forEach((t) => {
|
|
512
|
+
const { oKey: n, left: s, top: a, height: o, width: c, angle: u } = t, l = r.getDrawingOKey(n);
|
|
240
513
|
if (l == null)
|
|
241
|
-
return
|
|
242
|
-
const { unitId: g, subUnitId: d, drawingId: f, drawingType:
|
|
514
|
+
return e.push(null), !0;
|
|
515
|
+
const { unitId: g, subUnitId: d, drawingId: f, drawingType: w } = l, h = {
|
|
243
516
|
unitId: g,
|
|
244
517
|
subUnitId: d,
|
|
245
518
|
drawingId: f,
|
|
246
|
-
drawingType:
|
|
519
|
+
drawingType: w,
|
|
247
520
|
transform: {
|
|
248
521
|
left: s,
|
|
249
522
|
top: a,
|
|
@@ -252,22 +525,22 @@ function ke(i, r) {
|
|
|
252
525
|
angle: u
|
|
253
526
|
}
|
|
254
527
|
};
|
|
255
|
-
|
|
256
|
-
}),
|
|
528
|
+
w === q.DRAWING_IMAGE && (h.srcRect = t.srcRect), e.push(h);
|
|
529
|
+
}), e;
|
|
257
530
|
}
|
|
258
|
-
function
|
|
259
|
-
const n =
|
|
531
|
+
function tt(i, r, e, t) {
|
|
532
|
+
const n = t.getDrawingByParam(i);
|
|
260
533
|
if (n == null)
|
|
261
534
|
return;
|
|
262
|
-
const s = L(i), a =
|
|
263
|
-
if (a && !(a instanceof
|
|
535
|
+
const s = L(i), a = e.getObject(s);
|
|
536
|
+
if (a && !(a instanceof pe))
|
|
264
537
|
return;
|
|
265
538
|
if (a != null) {
|
|
266
539
|
a.addObject(r);
|
|
267
540
|
return;
|
|
268
541
|
}
|
|
269
|
-
const o = new
|
|
270
|
-
|
|
542
|
+
const o = new pe(s);
|
|
543
|
+
e.addObject(o, Te).attachTransformerTo(o), o.addObject(r);
|
|
271
544
|
const { transform: c } = n;
|
|
272
545
|
c && o.transformByState(
|
|
273
546
|
{
|
|
@@ -277,25 +550,25 @@ function rt(i, r, t, e) {
|
|
|
277
550
|
}
|
|
278
551
|
);
|
|
279
552
|
}
|
|
280
|
-
function
|
|
553
|
+
function St(i, r) {
|
|
281
554
|
var s;
|
|
282
|
-
const
|
|
283
|
-
if (
|
|
555
|
+
const e = r ? i.getUnit(r) : i.getFocusedUnit();
|
|
556
|
+
if (e == null)
|
|
284
557
|
return;
|
|
285
|
-
const
|
|
558
|
+
const t = e.getUnitId();
|
|
286
559
|
let n;
|
|
287
|
-
return
|
|
560
|
+
return e.type === Oe.UNIVER_SHEET ? n = (s = e.getActiveSheet()) == null ? void 0 : s.getSheetId() : (e.type === Oe.UNIVER_DOC || e.type === Oe.UNIVER_SLIDE) && (n = t), { unitId: t, subUnitId: n, current: e };
|
|
288
561
|
}
|
|
289
|
-
var
|
|
290
|
-
for (var n =
|
|
562
|
+
var dr = Object.getOwnPropertyDescriptor, hr = (i, r, e, t) => {
|
|
563
|
+
for (var n = t > 1 ? void 0 : t ? dr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
291
564
|
(a = i[s]) && (n = a(n) || n);
|
|
292
565
|
return n;
|
|
293
|
-
},
|
|
294
|
-
let Be = class extends
|
|
295
|
-
constructor(r,
|
|
566
|
+
}, be = (i, r) => (e, t) => r(e, t, i);
|
|
567
|
+
let Be = class extends He {
|
|
568
|
+
constructor(r, e, t, n) {
|
|
296
569
|
super();
|
|
297
|
-
|
|
298
|
-
this._currentUniverService = r, this._commandService =
|
|
570
|
+
J(this, "_sceneListenerOnDrawingMap", /* @__PURE__ */ new WeakSet());
|
|
571
|
+
this._currentUniverService = r, this._commandService = e, this._renderManagerService = t, this._drawingManagerService = n, this._initialize();
|
|
299
572
|
}
|
|
300
573
|
dispose() {
|
|
301
574
|
super.dispose();
|
|
@@ -304,14 +577,14 @@ let Be = class extends Le {
|
|
|
304
577
|
this._recoveryImages(), this._drawingAddListener(), this._drawingRemoveListener(), this._drawingUpdateListener(), this._commandExecutedListener(), this._drawingArrangeListener(), this._drawingGroupListener(), this._drawingRefreshListener(), this._drawingVisibleListener();
|
|
305
578
|
}
|
|
306
579
|
_recoveryImages() {
|
|
307
|
-
const r = this._drawingManagerService.drawingManagerData,
|
|
308
|
-
if (
|
|
580
|
+
const r = this._drawingManagerService.drawingManagerData, e = St(this._currentUniverService);
|
|
581
|
+
if (e == null)
|
|
309
582
|
return;
|
|
310
|
-
const { unitId:
|
|
583
|
+
const { unitId: t, subUnitId: n } = e;
|
|
311
584
|
Object.keys(r).forEach((s) => {
|
|
312
585
|
Object.keys(r[s]).forEach((a) => {
|
|
313
586
|
const o = r[s][a].data;
|
|
314
|
-
o == null || s !==
|
|
587
|
+
o == null || s !== t || a !== n || Object.keys(o).forEach((c) => {
|
|
315
588
|
o[c] && this._insertDrawing([{ unitId: s, subUnitId: a, drawingId: c }]);
|
|
316
589
|
});
|
|
317
590
|
});
|
|
@@ -320,11 +593,11 @@ let Be = class extends Le {
|
|
|
320
593
|
_commandExecutedListener() {
|
|
321
594
|
this.disposeWithMe(
|
|
322
595
|
this._commandService.onCommandExecuted((r) => {
|
|
323
|
-
if (r.id ===
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
596
|
+
if (r.id === ze.id) {
|
|
597
|
+
const e = r.params;
|
|
598
|
+
if (e == null)
|
|
326
599
|
return;
|
|
327
|
-
this._drawingAlign(
|
|
600
|
+
this._drawingAlign(e);
|
|
328
601
|
}
|
|
329
602
|
})
|
|
330
603
|
);
|
|
@@ -363,35 +636,35 @@ let Be = class extends Le {
|
|
|
363
636
|
_getSceneAndTransformerByDrawingSearch(r) {
|
|
364
637
|
if (r == null)
|
|
365
638
|
return;
|
|
366
|
-
const
|
|
367
|
-
if (
|
|
639
|
+
const e = this._renderManagerService.getRenderById(r), t = e == null ? void 0 : e.scene;
|
|
640
|
+
if (t == null)
|
|
368
641
|
return null;
|
|
369
|
-
const n =
|
|
370
|
-
return { scene:
|
|
642
|
+
const n = t.getTransformerByCreate();
|
|
643
|
+
return { scene: t, transformer: n };
|
|
371
644
|
}
|
|
372
645
|
_groupDrawings(r) {
|
|
373
|
-
r.forEach((
|
|
374
|
-
this._groupDrawing(
|
|
646
|
+
r.forEach((e) => {
|
|
647
|
+
this._groupDrawing(e);
|
|
375
648
|
});
|
|
376
649
|
}
|
|
377
650
|
_groupDrawing(r) {
|
|
378
|
-
const { parent:
|
|
651
|
+
const { parent: e, children: t } = r, { unitId: n, subUnitId: s, drawingId: a } = e, o = this._getSceneAndTransformerByDrawingSearch(e.unitId);
|
|
379
652
|
if (o == null)
|
|
380
653
|
return;
|
|
381
654
|
const { scene: c, transformer: u } = o;
|
|
382
|
-
this._commandService.syncExecuteCommand(
|
|
655
|
+
this._commandService.syncExecuteCommand(oe.id);
|
|
383
656
|
const l = [];
|
|
384
|
-
if (
|
|
385
|
-
const
|
|
657
|
+
if (t.forEach((f) => {
|
|
658
|
+
const w = L(f), h = c.getObjectIncludeInGroup(w);
|
|
386
659
|
if (h == null || l.includes(h))
|
|
387
660
|
return;
|
|
388
661
|
l.push(h);
|
|
389
662
|
const { transform: p } = f;
|
|
390
|
-
p != null && (h.classType ===
|
|
663
|
+
p != null && (h.classType === Je.GROUP ? h.transformByState({ left: p.left, top: p.top }) : h.transformByState(p));
|
|
391
664
|
}), l.length === 0)
|
|
392
665
|
return;
|
|
393
|
-
const g = L({ unitId: n, subUnitId: s, drawingId: a }), d = new
|
|
394
|
-
c.addObject(d,
|
|
666
|
+
const g = L({ unitId: n, subUnitId: s, drawingId: a }), d = new pe(g);
|
|
667
|
+
c.addObject(d, Te).attachTransformerTo(d), d.addObjects(...l), e.transform && d.transformByState({ left: e.transform.left, top: e.transform.top }), u.clearSelectedObjects(), u.setSelectedControl(d);
|
|
395
668
|
}
|
|
396
669
|
// private _regroupDrawings(drawings: IDrawingSearch[]) {
|
|
397
670
|
// const renderObject = this._getSceneAndTransformerByDrawingSearch(drawings[0].unitId);
|
|
@@ -428,64 +701,64 @@ let Be = class extends Le {
|
|
|
428
701
|
// transformer.setSelectedControl(firstGroup);
|
|
429
702
|
// }
|
|
430
703
|
_ungroupDrawings(r) {
|
|
431
|
-
r.forEach((
|
|
432
|
-
this._ungroupDrawing(
|
|
704
|
+
r.forEach((e) => {
|
|
705
|
+
this._ungroupDrawing(e);
|
|
433
706
|
});
|
|
434
707
|
}
|
|
435
708
|
_ungroupDrawing(r) {
|
|
436
|
-
const { parent:
|
|
709
|
+
const { parent: e, children: t } = r, n = this._getSceneAndTransformerByDrawingSearch(e.unitId);
|
|
437
710
|
if (n == null)
|
|
438
711
|
return;
|
|
439
712
|
const { scene: s, transformer: a } = n;
|
|
440
|
-
|
|
713
|
+
t.forEach((g) => {
|
|
441
714
|
const d = L(g), f = s.getObjectIncludeInGroup(d);
|
|
442
715
|
if (f == null)
|
|
443
716
|
return !0;
|
|
444
717
|
if (f == null)
|
|
445
718
|
return;
|
|
446
|
-
const { transform:
|
|
447
|
-
|
|
719
|
+
const { transform: w } = g;
|
|
720
|
+
w != null && (f.classType === Je.GROUP ? f.transformByState({ left: w.left, top: w.top }) : f.transformByState(w));
|
|
448
721
|
});
|
|
449
|
-
const o = L(
|
|
722
|
+
const o = L(e), c = s.getObject(o), { width: u, height: l } = c;
|
|
450
723
|
c.getObjects().forEach((g) => {
|
|
451
724
|
c.removeSelfObjectAndTransform(g.oKey, u, l);
|
|
452
725
|
}), c.dispose(), a.clearSelectedObjects();
|
|
453
726
|
}
|
|
454
727
|
_drawingAlign(r) {
|
|
455
|
-
const { alignType:
|
|
456
|
-
if (
|
|
728
|
+
const { alignType: e } = r, t = this._drawingManagerService.getFocusDrawings();
|
|
729
|
+
if (e === D.default)
|
|
457
730
|
return;
|
|
458
731
|
const n = [];
|
|
459
732
|
let s = Number.POSITIVE_INFINITY, a = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY, c = Number.NEGATIVE_INFINITY, u = 0;
|
|
460
|
-
|
|
461
|
-
const { unitId: g, subUnitId: d, drawingId: f, drawingType:
|
|
733
|
+
t.forEach((l) => {
|
|
734
|
+
const { unitId: g, subUnitId: d, drawingId: f, drawingType: w } = l, h = this._drawingManagerService.getDrawingByParam({ unitId: g, subUnitId: d, drawingId: f });
|
|
462
735
|
if (h == null || h.transform == null)
|
|
463
736
|
return;
|
|
464
737
|
n.push({
|
|
465
738
|
unitId: g,
|
|
466
739
|
subUnitId: d,
|
|
467
740
|
drawingId: f,
|
|
468
|
-
drawingType:
|
|
741
|
+
drawingType: w,
|
|
469
742
|
transform: h.transform
|
|
470
743
|
});
|
|
471
744
|
const { left: p = 0, top: C = 0, width: _ = 0, height: b = 0 } = h.transform;
|
|
472
745
|
s = Math.min(s, p), a = Math.min(a, C), o = Math.max(o, p + _), c = Math.max(c, C + b), u++;
|
|
473
|
-
}), u !== 0 && (this._sortDrawingTransform(n,
|
|
746
|
+
}), u !== 0 && (this._sortDrawingTransform(n, e), this._applyAlignType(n, e, s, a, o, c, u));
|
|
474
747
|
}
|
|
475
|
-
_applyAlignType(r,
|
|
476
|
-
const c = Math.round((s -
|
|
748
|
+
_applyAlignType(r, e, t, n, s, a, o) {
|
|
749
|
+
const c = Math.round((s - t) / o * 10) / 10, u = Math.round((a - n) / o * 10) / 10, l = [], g = this._getSceneAndTransformerByDrawingSearch(r[0].unitId);
|
|
477
750
|
if (g == null)
|
|
478
751
|
return;
|
|
479
752
|
const { scene: d, transformer: f } = g;
|
|
480
|
-
r.forEach((
|
|
481
|
-
const { unitId: p, subUnitId: C, drawingId: _, transform: b, drawingType: R } =
|
|
753
|
+
r.forEach((w, h) => {
|
|
754
|
+
const { unitId: p, subUnitId: C, drawingId: _, transform: b, drawingType: R } = w, { left: T = 0, top: S = 0, width: I = 0, height: y = 0 } = b;
|
|
482
755
|
let O = T, M = S;
|
|
483
|
-
switch (
|
|
756
|
+
switch (e) {
|
|
484
757
|
case D.left:
|
|
485
|
-
O =
|
|
758
|
+
O = t;
|
|
486
759
|
break;
|
|
487
760
|
case D.center:
|
|
488
|
-
O =
|
|
761
|
+
O = t + (s - t) / 2 - I / 2;
|
|
489
762
|
break;
|
|
490
763
|
case D.right:
|
|
491
764
|
O = s - I;
|
|
@@ -500,7 +773,7 @@ let Be = class extends Le {
|
|
|
500
773
|
M = a - y;
|
|
501
774
|
break;
|
|
502
775
|
case D.horizon:
|
|
503
|
-
O =
|
|
776
|
+
O = t + c * h;
|
|
504
777
|
break;
|
|
505
778
|
case D.vertical:
|
|
506
779
|
M = n + u * h;
|
|
@@ -518,9 +791,9 @@ let Be = class extends Le {
|
|
|
518
791
|
});
|
|
519
792
|
}), this._drawingManagerService.featurePluginUpdateNotification(l), f.refreshControls().changeNotification();
|
|
520
793
|
}
|
|
521
|
-
_sortDrawingTransform(r,
|
|
522
|
-
r.sort((
|
|
523
|
-
const s =
|
|
794
|
+
_sortDrawingTransform(r, e) {
|
|
795
|
+
r.sort((t, n) => {
|
|
796
|
+
const s = t.transform, a = n.transform, {
|
|
524
797
|
left: o = 0,
|
|
525
798
|
top: c = 0,
|
|
526
799
|
width: u = 0,
|
|
@@ -529,9 +802,9 @@ let Be = class extends Le {
|
|
|
529
802
|
left: g = 0,
|
|
530
803
|
top: d = 0,
|
|
531
804
|
width: f = 0,
|
|
532
|
-
height:
|
|
805
|
+
height: w = 0
|
|
533
806
|
} = a;
|
|
534
|
-
switch (
|
|
807
|
+
switch (e) {
|
|
535
808
|
case D.left:
|
|
536
809
|
return o - g;
|
|
537
810
|
case D.center:
|
|
@@ -541,13 +814,13 @@ let Be = class extends Le {
|
|
|
541
814
|
case D.top:
|
|
542
815
|
return c - d;
|
|
543
816
|
case D.middle:
|
|
544
|
-
return c + l / 2 - (d +
|
|
817
|
+
return c + l / 2 - (d + w / 2);
|
|
545
818
|
case D.bottom:
|
|
546
|
-
return c + l - (d +
|
|
819
|
+
return c + l - (d + w);
|
|
547
820
|
case D.horizon:
|
|
548
821
|
return o + u / 2 - (g + f / 2);
|
|
549
822
|
case D.vertical:
|
|
550
|
-
return c + l / 2 - (d +
|
|
823
|
+
return c + l / 2 - (d + w / 2);
|
|
551
824
|
default:
|
|
552
825
|
return 0;
|
|
553
826
|
}
|
|
@@ -561,15 +834,15 @@ let Be = class extends Le {
|
|
|
561
834
|
);
|
|
562
835
|
}
|
|
563
836
|
_drawingArrange(r) {
|
|
564
|
-
const { unitId:
|
|
837
|
+
const { unitId: e, subUnitId: t, drawingIds: n } = r, s = this._getSceneAndTransformerByDrawingSearch(e);
|
|
565
838
|
if (s == null)
|
|
566
839
|
return;
|
|
567
840
|
const { scene: a } = s;
|
|
568
841
|
n.forEach((o) => {
|
|
569
|
-
const c = L({ unitId:
|
|
842
|
+
const c = L({ unitId: e, subUnitId: t, drawingId: o }), u = a.fuzzyMathObjects(c, !0);
|
|
570
843
|
if (u == null || u.length === 0)
|
|
571
844
|
return;
|
|
572
|
-
const l = this._drawingManagerService.getDrawingOrder(
|
|
845
|
+
const l = this._drawingManagerService.getDrawingOrder(e, t).indexOf(o);
|
|
573
846
|
for (const g of u)
|
|
574
847
|
g.setProps({ zIndex: l }), g.makeDirty();
|
|
575
848
|
});
|
|
@@ -582,29 +855,29 @@ let Be = class extends Le {
|
|
|
582
855
|
);
|
|
583
856
|
}
|
|
584
857
|
_insertDrawing(r) {
|
|
585
|
-
const
|
|
586
|
-
r.forEach((
|
|
587
|
-
const { unitId: n } =
|
|
588
|
-
if (this._drawingManagerService.getDrawingByParam(
|
|
858
|
+
const e = [];
|
|
859
|
+
r.forEach((t) => {
|
|
860
|
+
const { unitId: n } = t;
|
|
861
|
+
if (this._drawingManagerService.getDrawingByParam(t) == null)
|
|
589
862
|
return;
|
|
590
863
|
const a = this._getSceneAndTransformerByDrawingSearch(n);
|
|
591
864
|
if (a == null)
|
|
592
865
|
return;
|
|
593
866
|
const { scene: o } = a;
|
|
594
|
-
|
|
595
|
-
}),
|
|
596
|
-
this._sceneListenerOnDrawingMap.has(
|
|
867
|
+
e.includes(o) || e.push(o);
|
|
868
|
+
}), e.forEach((t) => {
|
|
869
|
+
this._sceneListenerOnDrawingMap.has(t) || (this._addListenerOnDrawing(t), this._sceneListenerOnDrawingMap.add(t));
|
|
597
870
|
});
|
|
598
871
|
}
|
|
599
872
|
_drawingRemoveListener() {
|
|
600
873
|
this.disposeWithMe(
|
|
601
874
|
this._drawingManagerService.remove$.subscribe((r) => {
|
|
602
|
-
r.forEach((
|
|
875
|
+
r.forEach((e) => {
|
|
603
876
|
var l;
|
|
604
|
-
const { unitId:
|
|
877
|
+
const { unitId: t, subUnitId: n, drawingId: s } = e, a = this._getSceneAndTransformerByDrawingSearch(t);
|
|
605
878
|
if (a == null)
|
|
606
879
|
return;
|
|
607
|
-
const { scene: o } = a, c = L({ unitId:
|
|
880
|
+
const { scene: o } = a, c = L({ unitId: t, subUnitId: n, drawingId: s }), u = o.fuzzyMathObjects(c, !0);
|
|
608
881
|
if (u.length > 0) {
|
|
609
882
|
for (const g of u)
|
|
610
883
|
g.dispose();
|
|
@@ -617,21 +890,21 @@ let Be = class extends Le {
|
|
|
617
890
|
_drawingUpdateListener() {
|
|
618
891
|
this.disposeWithMe(
|
|
619
892
|
this._drawingManagerService.update$.subscribe((r) => {
|
|
620
|
-
r.forEach((
|
|
893
|
+
r.forEach((e) => {
|
|
621
894
|
var I;
|
|
622
|
-
const { unitId:
|
|
895
|
+
const { unitId: t, subUnitId: n, drawingId: s } = e, a = this._drawingManagerService.getDrawingByParam(e);
|
|
623
896
|
if (a == null)
|
|
624
897
|
return;
|
|
625
|
-
const { transform: o, drawingType: c } = a, u = this._getSceneAndTransformerByDrawingSearch(
|
|
898
|
+
const { transform: o, drawingType: c } = a, u = this._getSceneAndTransformerByDrawingSearch(t);
|
|
626
899
|
if (u == null)
|
|
627
900
|
return;
|
|
628
901
|
const { scene: l, transformer: g } = u;
|
|
629
902
|
if (o == null)
|
|
630
903
|
return !0;
|
|
631
|
-
const { left: d = 0, top: f = 0, width:
|
|
904
|
+
const { left: d = 0, top: f = 0, width: w = 0, height: h = 0, angle: p = 0, flipX: C = !1, flipY: _ = !1, skewX: b = 0, skewY: R = 0 } = o, T = L({ unitId: t, subUnitId: n, drawingId: s }), S = l.getObject(T);
|
|
632
905
|
if (S == null)
|
|
633
906
|
return !0;
|
|
634
|
-
S.transformByState({ left: d, top: f, width:
|
|
907
|
+
S.transformByState({ left: d, top: f, width: w, height: h, angle: p, flipX: C, flipY: _, skewX: b, skewY: R }), (I = l.getTransformer()) == null || I.debounceRefreshControls();
|
|
635
908
|
});
|
|
636
909
|
})
|
|
637
910
|
);
|
|
@@ -639,20 +912,20 @@ let Be = class extends Le {
|
|
|
639
912
|
_drawingRefreshListener() {
|
|
640
913
|
this.disposeWithMe(
|
|
641
914
|
this._drawingManagerService.refreshTransform$.subscribe((r) => {
|
|
642
|
-
r.forEach((
|
|
643
|
-
const { unitId:
|
|
915
|
+
r.forEach((e) => {
|
|
916
|
+
const { unitId: t, subUnitId: n, drawingId: s } = e, a = this._getSceneAndTransformerByDrawingSearch(t);
|
|
644
917
|
if (a == null)
|
|
645
918
|
return;
|
|
646
|
-
const o = this._drawingManagerService.getDrawingByParam(
|
|
919
|
+
const o = this._drawingManagerService.getDrawingByParam(e);
|
|
647
920
|
if (o == null)
|
|
648
921
|
return;
|
|
649
|
-
const { transform: c } = o, { scene: u } = a, l = L({ unitId:
|
|
922
|
+
const { transform: c } = o, { scene: u } = a, l = L({ unitId: t, subUnitId: n, drawingId: s }), g = u.getObject(l);
|
|
650
923
|
if (g == null || c == null)
|
|
651
924
|
return !0;
|
|
652
925
|
const {
|
|
653
926
|
left: d = 0,
|
|
654
927
|
top: f = 0,
|
|
655
|
-
width:
|
|
928
|
+
width: w = 0,
|
|
656
929
|
height: h = 0,
|
|
657
930
|
angle: p = 0,
|
|
658
931
|
flipX: C = !1,
|
|
@@ -660,7 +933,7 @@ let Be = class extends Le {
|
|
|
660
933
|
skewX: b = 0,
|
|
661
934
|
skewY: R = 0
|
|
662
935
|
} = c;
|
|
663
|
-
g.transformByState({ left: d, top: f, width:
|
|
936
|
+
g.transformByState({ left: d, top: f, width: w, height: h, angle: p, flipX: C, flipY: _, skewX: b, skewY: R });
|
|
664
937
|
});
|
|
665
938
|
})
|
|
666
939
|
);
|
|
@@ -668,11 +941,11 @@ let Be = class extends Le {
|
|
|
668
941
|
_drawingVisibleListener() {
|
|
669
942
|
this.disposeWithMe(
|
|
670
943
|
this._drawingManagerService.visible$.subscribe((r) => {
|
|
671
|
-
r.forEach((
|
|
672
|
-
const { unitId:
|
|
944
|
+
r.forEach((e) => {
|
|
945
|
+
const { unitId: t, subUnitId: n, drawingId: s, visible: a } = e, o = this._getSceneAndTransformerByDrawingSearch(t);
|
|
673
946
|
if (o == null)
|
|
674
947
|
return;
|
|
675
|
-
const { scene: c } = o, u = L({ unitId:
|
|
948
|
+
const { scene: c } = o, u = L({ unitId: t, subUnitId: n, drawingId: s }), l = c.getObject(u);
|
|
676
949
|
if (l == null)
|
|
677
950
|
return !0;
|
|
678
951
|
a ? l.show() : l.hide();
|
|
@@ -680,12 +953,12 @@ let Be = class extends Le {
|
|
|
680
953
|
})
|
|
681
954
|
);
|
|
682
955
|
}
|
|
683
|
-
_filterUpdateParams(r,
|
|
684
|
-
return r.filter((
|
|
685
|
-
if (
|
|
956
|
+
_filterUpdateParams(r, e) {
|
|
957
|
+
return r.filter((t, n) => {
|
|
958
|
+
if (t == null)
|
|
686
959
|
return !1;
|
|
687
|
-
const { transform: s } =
|
|
688
|
-
return
|
|
960
|
+
const { transform: s } = t;
|
|
961
|
+
return at(s, e == null ? void 0 : e[n]);
|
|
689
962
|
});
|
|
690
963
|
}
|
|
691
964
|
// group?.getObjects().forEach((o) => {
|
|
@@ -696,17 +969,17 @@ let Be = class extends Le {
|
|
|
696
969
|
// }
|
|
697
970
|
// });
|
|
698
971
|
_addListenerOnDrawing(r) {
|
|
699
|
-
const
|
|
700
|
-
let
|
|
972
|
+
const e = r.getTransformerByCreate();
|
|
973
|
+
let t = null;
|
|
701
974
|
this.disposeWithMe(
|
|
702
|
-
|
|
703
|
-
|
|
975
|
+
fe(
|
|
976
|
+
e.changeStart$.subscribe((n) => {
|
|
704
977
|
const { objects: s } = n, a = Array.from(s.values()), o = [];
|
|
705
|
-
|
|
706
|
-
const { left: u, top: l, height: g, width: d, angle: f, oKey:
|
|
707
|
-
if (h || c instanceof
|
|
978
|
+
t = a.map((c) => {
|
|
979
|
+
const { left: u, top: l, height: g, width: d, angle: f, oKey: w, isInGroup: h } = c, p = this._drawingManagerService.getDrawingOKey(w);
|
|
980
|
+
if (h || c instanceof pe) {
|
|
708
981
|
let C = c.ancestorGroup;
|
|
709
|
-
if (C == null && c instanceof
|
|
982
|
+
if (C == null && c instanceof pe && (C = c), C == null)
|
|
710
983
|
return null;
|
|
711
984
|
const _ = this._drawingManagerService.getDrawingOKey(C.oKey);
|
|
712
985
|
if (_) {
|
|
@@ -720,93 +993,93 @@ let Be = class extends Le {
|
|
|
720
993
|
return o.push({ unitId: C, subUnitId: _, drawingId: b }), { left: u, top: l, height: g, width: d, angle: f };
|
|
721
994
|
}
|
|
722
995
|
return null;
|
|
723
|
-
}).filter((c) => c != null), o.length > 0 ? this._commandService.syncExecuteCommand(
|
|
996
|
+
}).filter((c) => c != null), o.length > 0 ? this._commandService.syncExecuteCommand(De.id, o) : this._commandService.syncExecuteCommand(De.id, []);
|
|
724
997
|
})
|
|
725
998
|
)
|
|
726
999
|
), this.disposeWithMe(
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
const { objects: s } = n, a = this._filterUpdateParams(
|
|
1000
|
+
fe(
|
|
1001
|
+
e.changeEnd$.subscribe((n) => {
|
|
1002
|
+
const { objects: s } = n, a = this._filterUpdateParams(Le(s, this._drawingManagerService), t);
|
|
730
1003
|
a.length > 0 && this._drawingManagerService.featurePluginUpdateNotification(a);
|
|
731
1004
|
})
|
|
732
1005
|
)
|
|
733
1006
|
);
|
|
734
1007
|
}
|
|
735
1008
|
};
|
|
736
|
-
Be =
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
1009
|
+
Be = hr([
|
|
1010
|
+
be(0, Fe),
|
|
1011
|
+
be(1, ce),
|
|
1012
|
+
be(2, ue),
|
|
1013
|
+
be(3, re)
|
|
741
1014
|
], Be);
|
|
742
|
-
class
|
|
743
|
-
constructor(
|
|
744
|
-
|
|
1015
|
+
class Ie extends Gt {
|
|
1016
|
+
constructor(e, t) {
|
|
1017
|
+
t == null && (t = {}), t.transformerConfig = {
|
|
745
1018
|
keepRatio: !1,
|
|
746
1019
|
isCropper: !0,
|
|
747
1020
|
anchorFill: "rgb(0, 0, 0)",
|
|
748
1021
|
anchorStroke: "rgb(255, 255, 255)",
|
|
749
1022
|
anchorSize: 24
|
|
750
1023
|
};
|
|
751
|
-
super(
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
1024
|
+
super(e, t);
|
|
1025
|
+
J(this, "_srcRect");
|
|
1026
|
+
J(this, "_prstGeom");
|
|
1027
|
+
J(this, "_applyTransform");
|
|
1028
|
+
J(this, "_dragPadding", 8);
|
|
1029
|
+
J(this, "_cacheCanvas");
|
|
1030
|
+
t != null && t.srcRect && (this._srcRect = t.srcRect), t != null && t.prstGeom && (this._prstGeom = t.prstGeom), t != null && t.applyTransform && (this._applyTransform = t.applyTransform), t != null && t.dragPadding && (this._dragPadding = t.dragPadding), this._applyProps();
|
|
758
1031
|
}
|
|
759
|
-
refreshSrcRect(
|
|
760
|
-
this._srcRect =
|
|
1032
|
+
refreshSrcRect(e, t) {
|
|
1033
|
+
this._srcRect = e, this._applyTransform = t, this._applyProps();
|
|
761
1034
|
}
|
|
762
1035
|
get srcRect() {
|
|
763
1036
|
return this._srcRect;
|
|
764
1037
|
}
|
|
765
1038
|
dispose() {
|
|
766
|
-
var
|
|
767
|
-
super.dispose(), (
|
|
1039
|
+
var e;
|
|
1040
|
+
super.dispose(), (e = this._cacheCanvas) == null || e.dispose(), this._srcRect = null;
|
|
768
1041
|
}
|
|
769
|
-
isHit(
|
|
770
|
-
const
|
|
771
|
-
return
|
|
1042
|
+
isHit(e) {
|
|
1043
|
+
const t = this.getInverseCoord(e);
|
|
1044
|
+
return t.x >= -this.strokeWidth / 2 && t.x <= this.width + this.strokeWidth / 2 && t.y >= -this.strokeWidth / 2 && t.y <= this.height + this.strokeWidth / 2 && !this._inSurround(t);
|
|
772
1045
|
}
|
|
773
|
-
_inSurround(
|
|
774
|
-
const
|
|
775
|
-
return
|
|
1046
|
+
_inSurround(e) {
|
|
1047
|
+
const t = this._dragPadding;
|
|
1048
|
+
return e.x >= t - this.strokeWidth / 2 && e.x <= this.width + this.strokeWidth / 2 - t && e.y >= t - this.strokeWidth / 2 && e.y <= this.height + this.strokeWidth / 2 - t;
|
|
776
1049
|
}
|
|
777
|
-
render(
|
|
778
|
-
return this.visible ? (
|
|
1050
|
+
render(e, t) {
|
|
1051
|
+
return this.visible ? (e.save(), this._draw(e), e.restore(), this.makeDirty(!1), this) : (this.makeDirty(!1), this);
|
|
779
1052
|
}
|
|
780
|
-
_draw(
|
|
1053
|
+
_draw(e) {
|
|
781
1054
|
var c, u;
|
|
782
1055
|
const n = this.getScene().getEngine(), { width: s, height: a } = n;
|
|
783
1056
|
this._initialCacheCanvas(), (c = this._cacheCanvas) == null || c.clear();
|
|
784
1057
|
const o = (u = this._cacheCanvas) == null ? void 0 : u.getContext();
|
|
785
|
-
o != null && (o.save(),
|
|
1058
|
+
o != null && (o.save(), lt.drawWith(o, {
|
|
786
1059
|
left: 0,
|
|
787
1060
|
top: 0,
|
|
788
1061
|
width: s,
|
|
789
1062
|
height: a,
|
|
790
1063
|
fill: "rgba(0, 0, 0, 0.5)"
|
|
791
|
-
}), o.setTransform(
|
|
1064
|
+
}), o.setTransform(e.getTransform()), this._clipForApplyObject(o), this._applyCache(e), o.restore());
|
|
792
1065
|
}
|
|
793
|
-
_clipForApplyObject(
|
|
794
|
-
let
|
|
795
|
-
if (this._prstGeom != null && (
|
|
1066
|
+
_clipForApplyObject(e) {
|
|
1067
|
+
let t = 0;
|
|
1068
|
+
if (this._prstGeom != null && (t = 1), e.globalCompositeOperation = "destination-out", e.beginPath(), t === 0) {
|
|
796
1069
|
const n = this.transform.getMatrix();
|
|
797
|
-
|
|
1070
|
+
e.transform(n[0], n[1], n[2], n[3], n[4], n[5]), e.rect(0, 0, this.width, this.height), e.fill();
|
|
798
1071
|
}
|
|
799
1072
|
}
|
|
800
1073
|
_applyProps() {
|
|
801
1074
|
if (this._applyTransform == null)
|
|
802
1075
|
return;
|
|
803
|
-
let
|
|
1076
|
+
let e = 0, t = 0, n = 0, s = 0;
|
|
804
1077
|
const { left: a = 0, top: o = 0, width: c = 0, height: u = 0, angle: l } = this._applyTransform;
|
|
805
1078
|
if (this._srcRect != null) {
|
|
806
|
-
const { left: f = 0, top:
|
|
807
|
-
|
|
1079
|
+
const { left: f = 0, top: w = 0, right: h = 0, bottom: p = 0 } = this._srcRect;
|
|
1080
|
+
e = f, t = w, n = h, s = p;
|
|
808
1081
|
}
|
|
809
|
-
const g = a +
|
|
1082
|
+
const g = a + e, d = o + t;
|
|
810
1083
|
this.transformByState({
|
|
811
1084
|
left: g,
|
|
812
1085
|
top: d,
|
|
@@ -815,35 +1088,35 @@ class ye extends $t {
|
|
|
815
1088
|
angle: l
|
|
816
1089
|
});
|
|
817
1090
|
}
|
|
818
|
-
_applyCache(
|
|
819
|
-
if (!
|
|
1091
|
+
_applyCache(e) {
|
|
1092
|
+
if (!e || this._cacheCanvas == null)
|
|
820
1093
|
return;
|
|
821
|
-
const
|
|
822
|
-
|
|
1094
|
+
const t = this._cacheCanvas.getContext();
|
|
1095
|
+
t.save(), e.save(), e.setTransform(1, 0, 0, 1, 0, 0), t.setTransform(1, 0, 0, 1, 0, 0), e.drawImage(this._cacheCanvas.getCanvasEle(), 0, 0), e.restore(), t.restore();
|
|
823
1096
|
}
|
|
824
1097
|
_initialCacheCanvas() {
|
|
825
1098
|
if (this._cacheCanvas != null)
|
|
826
1099
|
return;
|
|
827
|
-
const
|
|
828
|
-
if (
|
|
829
|
-
this._cacheCanvas = new
|
|
830
|
-
const
|
|
831
|
-
this._cacheCanvas.setSize(
|
|
1100
|
+
const e = this.getScene();
|
|
1101
|
+
if (e == null) return;
|
|
1102
|
+
this._cacheCanvas = new Wt();
|
|
1103
|
+
const t = e.getEngine();
|
|
1104
|
+
this._cacheCanvas.setSize(t.width, t.height), t.onTransformChange$.subscribeEvent(() => {
|
|
832
1105
|
var n;
|
|
833
|
-
(n = this._cacheCanvas) == null || n.setSize(
|
|
1106
|
+
(n = this._cacheCanvas) == null || n.setSize(t.width, t.height), this.makeDirty(!0);
|
|
834
1107
|
});
|
|
835
1108
|
}
|
|
836
1109
|
}
|
|
837
|
-
var
|
|
838
|
-
for (var n =
|
|
1110
|
+
var fr = Object.getOwnPropertyDescriptor, pr = (i, r, e, t) => {
|
|
1111
|
+
for (var n = t > 1 ? void 0 : t ? fr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
839
1112
|
(a = i[s]) && (n = a(n) || n);
|
|
840
1113
|
return n;
|
|
841
|
-
},
|
|
842
|
-
let
|
|
843
|
-
constructor(r,
|
|
1114
|
+
}, le = (i, r) => (e, t) => r(e, t, i);
|
|
1115
|
+
let xe = class extends He {
|
|
1116
|
+
constructor(r, e, t, n, s, a) {
|
|
844
1117
|
super();
|
|
845
|
-
|
|
846
|
-
this._commandService = r, this._drawingManagerService =
|
|
1118
|
+
J(this, "_sceneListenerOnImageMap", /* @__PURE__ */ new WeakSet());
|
|
1119
|
+
this._commandService = r, this._drawingManagerService = e, this._renderManagerService = t, this._univerInstanceService = n, this._messageService = s, this._localeService = a, this._init();
|
|
847
1120
|
}
|
|
848
1121
|
_init() {
|
|
849
1122
|
this._initOpenCrop(), this._initCloseCrop(), this._initAutoCrop();
|
|
@@ -851,81 +1124,81 @@ let je = class extends Le {
|
|
|
851
1124
|
_initAutoCrop() {
|
|
852
1125
|
this.disposeWithMe(
|
|
853
1126
|
this._commandService.onCommandExecuted((r) => {
|
|
854
|
-
if (r.id !==
|
|
1127
|
+
if (r.id !== Pe.id)
|
|
855
1128
|
return;
|
|
856
|
-
const
|
|
857
|
-
if (
|
|
1129
|
+
const e = r.params;
|
|
1130
|
+
if (e == null)
|
|
858
1131
|
return;
|
|
859
|
-
const { cropType:
|
|
1132
|
+
const { cropType: t } = e, n = this._drawingManagerService.getFocusDrawings();
|
|
860
1133
|
if (n.length !== 1)
|
|
861
1134
|
return;
|
|
862
1135
|
const s = n[0], { unitId: a, subUnitId: o, drawingId: c } = s, u = this._renderManagerService.getRenderById(a), l = u == null ? void 0 : u.scene;
|
|
863
1136
|
if (l == null)
|
|
864
1137
|
return !0;
|
|
865
|
-
this._searchCropObject(l) != null && this._commandService.syncExecuteCommand(
|
|
1138
|
+
this._searchCropObject(l) != null && this._commandService.syncExecuteCommand(oe.id, { isAuto: !0 });
|
|
866
1139
|
const d = L({ unitId: a, subUnitId: o, drawingId: c }), f = l.getObject(d);
|
|
867
|
-
if (!(f instanceof
|
|
1140
|
+
if (!(f instanceof We)) {
|
|
868
1141
|
this._messageService.show({
|
|
869
|
-
type:
|
|
1142
|
+
type: Xe.Error,
|
|
870
1143
|
content: this._localeService.t("image-cropper.error")
|
|
871
1144
|
});
|
|
872
1145
|
return;
|
|
873
1146
|
}
|
|
874
|
-
f != null && (this._updateCropperObject(
|
|
1147
|
+
f != null && (this._updateCropperObject(t, f), this._commandService.executeCommand(Ze.id, { unitId: a, subUnitId: o, drawingId: c }));
|
|
875
1148
|
})
|
|
876
1149
|
);
|
|
877
1150
|
}
|
|
878
|
-
_calculateSrcRectByRatio(r,
|
|
879
|
-
const o =
|
|
880
|
-
let u =
|
|
881
|
-
o > c ? u = n * c : l =
|
|
882
|
-
const g = (
|
|
1151
|
+
_calculateSrcRectByRatio(r, e, t, n, s, a) {
|
|
1152
|
+
const o = t / n, c = s / a;
|
|
1153
|
+
let u = t, l = n;
|
|
1154
|
+
o > c ? u = n * c : l = t / c;
|
|
1155
|
+
const g = (t - u) / 2, d = (n - l) / 2;
|
|
883
1156
|
return {
|
|
884
|
-
left:
|
|
885
|
-
top:
|
|
886
|
-
right:
|
|
887
|
-
bottom:
|
|
1157
|
+
left: Se(g, 1),
|
|
1158
|
+
top: Se(d, 1),
|
|
1159
|
+
right: Se(t - (g + u), 1),
|
|
1160
|
+
bottom: Se(n - (d + l), 1)
|
|
888
1161
|
};
|
|
889
1162
|
}
|
|
890
|
-
_updateCropperObject(r,
|
|
891
|
-
const { left:
|
|
1163
|
+
_updateCropperObject(r, e) {
|
|
1164
|
+
const { left: t, top: n, width: s, height: a } = e.calculateTransformWithSrcRect();
|
|
892
1165
|
let o;
|
|
893
1166
|
switch (r) {
|
|
894
|
-
case
|
|
895
|
-
o = this._calculateSrcRectByRatio(
|
|
1167
|
+
case x.R1_1:
|
|
1168
|
+
o = this._calculateSrcRectByRatio(t, n, s, a, 1, 1);
|
|
896
1169
|
break;
|
|
897
|
-
case
|
|
898
|
-
o = this._calculateSrcRectByRatio(
|
|
1170
|
+
case x.R16_9:
|
|
1171
|
+
o = this._calculateSrcRectByRatio(t, n, s, a, 16, 9);
|
|
899
1172
|
break;
|
|
900
|
-
case
|
|
901
|
-
o = this._calculateSrcRectByRatio(
|
|
1173
|
+
case x.R9_16:
|
|
1174
|
+
o = this._calculateSrcRectByRatio(t, n, s, a, 9, 16);
|
|
902
1175
|
break;
|
|
903
|
-
case
|
|
904
|
-
o = this._calculateSrcRectByRatio(
|
|
1176
|
+
case x.R5_4:
|
|
1177
|
+
o = this._calculateSrcRectByRatio(t, n, s, a, 5, 4);
|
|
905
1178
|
break;
|
|
906
|
-
case
|
|
907
|
-
o = this._calculateSrcRectByRatio(
|
|
1179
|
+
case x.R4_5:
|
|
1180
|
+
o = this._calculateSrcRectByRatio(t, n, s, a, 4, 5);
|
|
908
1181
|
break;
|
|
909
|
-
case
|
|
910
|
-
o = this._calculateSrcRectByRatio(
|
|
1182
|
+
case x.R4_3:
|
|
1183
|
+
o = this._calculateSrcRectByRatio(t, n, s, a, 4, 3);
|
|
911
1184
|
break;
|
|
912
|
-
case
|
|
913
|
-
o = this._calculateSrcRectByRatio(
|
|
1185
|
+
case x.R3_4:
|
|
1186
|
+
o = this._calculateSrcRectByRatio(t, n, s, a, 3, 4);
|
|
914
1187
|
break;
|
|
915
|
-
case
|
|
916
|
-
o = this._calculateSrcRectByRatio(
|
|
1188
|
+
case x.R3_2:
|
|
1189
|
+
o = this._calculateSrcRectByRatio(t, n, s, a, 3, 2);
|
|
917
1190
|
break;
|
|
918
|
-
case
|
|
919
|
-
o = this._calculateSrcRectByRatio(
|
|
1191
|
+
case x.R2_3:
|
|
1192
|
+
o = this._calculateSrcRectByRatio(t, n, s, a, 2, 3);
|
|
920
1193
|
break;
|
|
921
|
-
case
|
|
1194
|
+
case x.FREE:
|
|
922
1195
|
}
|
|
923
1196
|
if (o == null)
|
|
924
1197
|
return;
|
|
925
|
-
|
|
1198
|
+
e.setSrcRect(o);
|
|
926
1199
|
const { left: c = 0, top: u = 0, bottom: l = 0, right: g = 0 } = o;
|
|
927
|
-
|
|
928
|
-
left:
|
|
1200
|
+
e.transformByStateCloseCropper({
|
|
1201
|
+
left: t + c,
|
|
929
1202
|
top: n + u,
|
|
930
1203
|
width: s - g - c,
|
|
931
1204
|
height: a - l - u
|
|
@@ -934,52 +1207,52 @@ let je = class extends Le {
|
|
|
934
1207
|
_initOpenCrop() {
|
|
935
1208
|
this.disposeWithMe(
|
|
936
1209
|
this._commandService.onCommandExecuted((r) => {
|
|
937
|
-
if (r.id !==
|
|
1210
|
+
if (r.id !== Ze.id)
|
|
938
1211
|
return;
|
|
939
|
-
const
|
|
940
|
-
if (
|
|
1212
|
+
const e = r.params;
|
|
1213
|
+
if (e == null)
|
|
941
1214
|
return;
|
|
942
|
-
const { unitId:
|
|
1215
|
+
const { unitId: t, subUnitId: n, drawingId: s } = e, a = this._renderManagerService.getRenderById(t), o = a == null ? void 0 : a.scene;
|
|
943
1216
|
if (o == null)
|
|
944
1217
|
return !0;
|
|
945
|
-
if (this._sceneListenerOnImageMap.has(o) || (this._addListenerOnImage(o), this._sceneListenerOnImageMap.add(o)), this._drawingManagerService.getDrawingByParam({ unitId:
|
|
1218
|
+
if (this._sceneListenerOnImageMap.has(o) || (this._addListenerOnImage(o), this._sceneListenerOnImageMap.add(o)), this._drawingManagerService.getDrawingByParam({ unitId: t, subUnitId: n, drawingId: s }) == null)
|
|
946
1219
|
return;
|
|
947
|
-
const u = L({ unitId:
|
|
1220
|
+
const u = L({ unitId: t, subUnitId: n, drawingId: s }), l = o.getObject(u);
|
|
948
1221
|
if (l == null)
|
|
949
1222
|
return;
|
|
950
|
-
if (!(l instanceof
|
|
1223
|
+
if (!(l instanceof We)) {
|
|
951
1224
|
this._messageService.show({
|
|
952
|
-
type:
|
|
1225
|
+
type: Xe.Error,
|
|
953
1226
|
content: this._localeService.t("image-cropper.error")
|
|
954
1227
|
});
|
|
955
1228
|
return;
|
|
956
1229
|
}
|
|
957
1230
|
const g = o.getTransformer();
|
|
958
1231
|
g == null || g.clearControls();
|
|
959
|
-
const d = new
|
|
1232
|
+
const d = new Ie(`${u}-crop`, {
|
|
960
1233
|
srcRect: l.srcRect,
|
|
961
1234
|
prstGeom: l.prstGeom,
|
|
962
1235
|
applyTransform: l.calculateTransformWithSrcRect()
|
|
963
1236
|
});
|
|
964
|
-
o.addObject(d, l.getLayerIndex() + 1).attachTransformerTo(d), g == null || g.createControlForCopper(d), this._addHoverForImageCopper(d), l.openRenderByCropper(), g == null || g.refreshControls(), d.makeDirty(!0), this._commandService.syncExecuteCommand(
|
|
1237
|
+
o.addObject(d, l.getLayerIndex() + 1).attachTransformerTo(d), g == null || g.createControlForCopper(d), this._addHoverForImageCopper(d), l.openRenderByCropper(), g == null || g.refreshControls(), d.makeDirty(!0), this._commandService.syncExecuteCommand(De.id, [{ unitId: t, subUnitId: n, drawingId: s }]);
|
|
965
1238
|
})
|
|
966
1239
|
);
|
|
967
1240
|
}
|
|
968
1241
|
_searchCropObject(r) {
|
|
969
|
-
const
|
|
970
|
-
for (const
|
|
971
|
-
if (
|
|
972
|
-
return
|
|
1242
|
+
const e = r.getAllObjectsByOrder();
|
|
1243
|
+
for (const t of e)
|
|
1244
|
+
if (t instanceof Ie)
|
|
1245
|
+
return t;
|
|
973
1246
|
}
|
|
974
1247
|
_initCloseCrop() {
|
|
975
1248
|
this.disposeWithMe(
|
|
976
|
-
this._commandService.onCommandExecuted((
|
|
977
|
-
if (
|
|
1249
|
+
this._commandService.onCommandExecuted((e) => {
|
|
1250
|
+
if (e.id !== oe.id)
|
|
978
1251
|
return;
|
|
979
|
-
const
|
|
980
|
-
if (
|
|
1252
|
+
const t = this._univerInstanceService.getFocusedUnit();
|
|
1253
|
+
if (t == null)
|
|
981
1254
|
return;
|
|
982
|
-
const n =
|
|
1255
|
+
const n = t.getUnitId(), s = this._renderManagerService.getRenderById(n), a = s == null ? void 0 : s.scene;
|
|
983
1256
|
if (a == null)
|
|
984
1257
|
return !0;
|
|
985
1258
|
const o = this._searchCropObject(a);
|
|
@@ -992,14 +1265,14 @@ let je = class extends Le {
|
|
|
992
1265
|
u.detachFrom(o), u.clearCopperControl();
|
|
993
1266
|
const l = this._getSrcRectByTransformState(c, o), g = this._drawingManagerService.getDrawingOKey(c.oKey);
|
|
994
1267
|
if (g != null) {
|
|
995
|
-
const { left: d, top: f, height:
|
|
1268
|
+
const { left: d, top: f, height: w, width: h } = o;
|
|
996
1269
|
this._drawingManagerService.featurePluginUpdateNotification([{
|
|
997
1270
|
...g,
|
|
998
1271
|
transform: {
|
|
999
1272
|
...g.transform,
|
|
1000
1273
|
left: d,
|
|
1001
1274
|
top: f,
|
|
1002
|
-
height:
|
|
1275
|
+
height: w,
|
|
1003
1276
|
width: h
|
|
1004
1277
|
},
|
|
1005
1278
|
srcRect: l.srcRectAngle
|
|
@@ -1008,79 +1281,79 @@ let je = class extends Le {
|
|
|
1008
1281
|
c.setSrcRect({ ...l.srcRectAngle }), c.closeRenderByCropper(), c.makeDirty(!0), o == null || o.dispose();
|
|
1009
1282
|
})
|
|
1010
1283
|
);
|
|
1011
|
-
const r = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1012
|
-
|
|
1284
|
+
const r = this._univerInstanceService.getCurrentTypeOfUnit$(Oe.UNIVER_SHEET).pipe(
|
|
1285
|
+
zt((e) => e ? e.activeSheet$ : Kt(null))
|
|
1013
1286
|
);
|
|
1014
1287
|
this.disposeWithMe(r.subscribe(() => {
|
|
1015
|
-
this._commandService.syncExecuteCommand(
|
|
1288
|
+
this._commandService.syncExecuteCommand(oe.id);
|
|
1016
1289
|
}));
|
|
1017
1290
|
}
|
|
1018
1291
|
_getApplyObjectByCropObject(r) {
|
|
1019
|
-
const
|
|
1292
|
+
const e = r.oKey, t = e.slice(0, e.length - 5), n = r.getScene();
|
|
1020
1293
|
if (!n) return null;
|
|
1021
|
-
const s = n.getObject(
|
|
1294
|
+
const s = n.getObject(t);
|
|
1022
1295
|
return s == null ? null : s;
|
|
1023
1296
|
}
|
|
1024
1297
|
_addListenerOnImage(r) {
|
|
1025
|
-
const
|
|
1026
|
-
let
|
|
1298
|
+
const e = r.getTransformerByCreate();
|
|
1299
|
+
let t = null;
|
|
1027
1300
|
this.disposeWithMe(
|
|
1028
|
-
|
|
1301
|
+
e.changeStart$.subscribe((n) => {
|
|
1029
1302
|
const { objects: s } = n, a = s.values().next().value;
|
|
1030
|
-
if (a == null || !(a instanceof
|
|
1303
|
+
if (a == null || !(a instanceof Ie))
|
|
1031
1304
|
return;
|
|
1032
1305
|
const { left: o, top: c, height: u, width: l, angle: g } = a;
|
|
1033
|
-
|
|
1306
|
+
t = { left: o, top: c, height: u, width: l, angle: g }, e.clearCopperControl();
|
|
1034
1307
|
})
|
|
1035
1308
|
), this.disposeWithMe(
|
|
1036
|
-
|
|
1309
|
+
e.changeEnd$.subscribe((n) => {
|
|
1037
1310
|
const { objects: s } = n, a = s.values().next().value;
|
|
1038
|
-
if (a == null || !(a instanceof
|
|
1311
|
+
if (a == null || !(a instanceof Ie))
|
|
1039
1312
|
return;
|
|
1040
1313
|
const { left: o, top: c, height: u, width: l, angle: g } = a;
|
|
1041
|
-
if (!
|
|
1314
|
+
if (!at({ left: o, top: c, height: u, width: l, angle: g }, t))
|
|
1042
1315
|
return;
|
|
1043
1316
|
const d = this._getApplyObjectByCropObject(a);
|
|
1044
1317
|
if (d == null)
|
|
1045
1318
|
return;
|
|
1046
1319
|
const f = this._getSrcRectByTransformState(d, a);
|
|
1047
|
-
a.refreshSrcRect(f.srcRect, d.getState()),
|
|
1320
|
+
a.refreshSrcRect(f.srcRect, d.getState()), e.createControlForCopper(a);
|
|
1048
1321
|
})
|
|
1049
1322
|
), this._endCropListener(r);
|
|
1050
1323
|
}
|
|
1051
1324
|
_addHoverForImageCopper(r) {
|
|
1052
1325
|
this.disposeWithMe(
|
|
1053
1326
|
r.onPointerEnter$.subscribeEvent(() => {
|
|
1054
|
-
r.cursor =
|
|
1327
|
+
r.cursor = Ee.MOVE;
|
|
1055
1328
|
})
|
|
1056
1329
|
), this.disposeWithMe(
|
|
1057
1330
|
r.onPointerLeave$.subscribeEvent(() => {
|
|
1058
|
-
r.cursor =
|
|
1331
|
+
r.cursor = Ee.DEFAULT;
|
|
1059
1332
|
})
|
|
1060
1333
|
);
|
|
1061
1334
|
}
|
|
1062
1335
|
_endCropListener(r) {
|
|
1063
|
-
const
|
|
1336
|
+
const e = r.getTransformerByCreate();
|
|
1064
1337
|
this.disposeWithMe(
|
|
1065
|
-
|
|
1066
|
-
|
|
1338
|
+
e.clearControl$.subscribe((t) => {
|
|
1339
|
+
t === !0 && this._commandService.syncExecuteCommand(oe.id);
|
|
1067
1340
|
})
|
|
1068
1341
|
);
|
|
1069
1342
|
}
|
|
1070
|
-
_getSrcRectByTransformState(r,
|
|
1071
|
-
const { left:
|
|
1343
|
+
_getSrcRectByTransformState(r, e) {
|
|
1344
|
+
const { left: t, top: n, height: s, width: a, strokeWidth: o, angle: c } = e, { left: u, top: l, width: g, height: d, angle: f, strokeWidth: w } = r, h = t - u, p = n - l, C = {
|
|
1072
1345
|
left: h,
|
|
1073
1346
|
top: p,
|
|
1074
1347
|
right: g - h - a,
|
|
1075
1348
|
bottom: d - p - s
|
|
1076
1349
|
}, _ = { ...C };
|
|
1077
1350
|
if (f !== 0) {
|
|
1078
|
-
const b =
|
|
1079
|
-
O.rotateByPoint(
|
|
1351
|
+
const b = t + a / 2, R = n + s / 2, T = new $e(b, R), S = g / 2 + u, I = d / 2 + l, y = new $e(S, I), O = new $e(u, l);
|
|
1352
|
+
O.rotateByPoint(qe(f), y);
|
|
1080
1353
|
const M = O.clone();
|
|
1081
|
-
M.rotateByPoint(
|
|
1082
|
-
const N =
|
|
1083
|
-
_.left = N, _.top =
|
|
1354
|
+
M.rotateByPoint(qe(-f), T);
|
|
1355
|
+
const N = t - M.x, B = n - M.y;
|
|
1356
|
+
_.left = N, _.top = B, _.right = g - N - a, _.bottom = d - B - s;
|
|
1084
1357
|
}
|
|
1085
1358
|
return {
|
|
1086
1359
|
srcRect: C,
|
|
@@ -1088,28 +1361,28 @@ let je = class extends Le {
|
|
|
1088
1361
|
};
|
|
1089
1362
|
}
|
|
1090
1363
|
};
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
],
|
|
1099
|
-
var
|
|
1100
|
-
for (var n =
|
|
1364
|
+
xe = pr([
|
|
1365
|
+
le(0, ce),
|
|
1366
|
+
le(1, re),
|
|
1367
|
+
le(2, ue),
|
|
1368
|
+
le(3, Fe),
|
|
1369
|
+
le(4, Ut),
|
|
1370
|
+
le(5, Ae(te))
|
|
1371
|
+
], xe);
|
|
1372
|
+
var mr = Object.getOwnPropertyDescriptor, wr = (i, r, e, t) => {
|
|
1373
|
+
for (var n = t > 1 ? void 0 : t ? mr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
1101
1374
|
(a = i[s]) && (n = a(n) || n);
|
|
1102
1375
|
return n;
|
|
1103
|
-
},
|
|
1376
|
+
}, Ve = (i, r) => (e, t) => r(e, t, i);
|
|
1104
1377
|
let Ue = class {
|
|
1105
|
-
constructor(i, r,
|
|
1106
|
-
this._drawingManagerService = i, this._imageIoService = r, this._galleryService =
|
|
1378
|
+
constructor(i, r, e) {
|
|
1379
|
+
this._drawingManagerService = i, this._imageIoService = r, this._galleryService = e;
|
|
1107
1380
|
}
|
|
1108
1381
|
// eslint-disable-next-line max-lines-per-function
|
|
1109
1382
|
async renderImages(i, r) {
|
|
1110
1383
|
const {
|
|
1111
|
-
transform:
|
|
1112
|
-
drawingType:
|
|
1384
|
+
transform: e,
|
|
1385
|
+
drawingType: t,
|
|
1113
1386
|
source: n,
|
|
1114
1387
|
imageSourceType: s,
|
|
1115
1388
|
srcRect: a,
|
|
@@ -1121,43 +1394,43 @@ let Ue = class {
|
|
|
1121
1394
|
isMultiTransform: d,
|
|
1122
1395
|
transforms: f
|
|
1123
1396
|
} = i;
|
|
1124
|
-
if (
|
|
1397
|
+
if (t !== q.DRAWING_IMAGE || !this._drawingManagerService.getDrawingVisible() || e == null)
|
|
1125
1398
|
return;
|
|
1126
|
-
const
|
|
1127
|
-
for (const p of
|
|
1128
|
-
const { left: C, top: _, width: b, height: R, angle: T, flipX: S, flipY: I, skewX: y, skewY: O } = p, M =
|
|
1129
|
-
if (
|
|
1130
|
-
|
|
1399
|
+
const w = d && f ? f : [e], h = [];
|
|
1400
|
+
for (const p of w) {
|
|
1401
|
+
const { left: C, top: _, width: b, height: R, angle: T, flipX: S, flipY: I, skewX: y, skewY: O } = p, M = w.indexOf(p), N = L({ unitId: u, subUnitId: l, drawingId: g }, d ? M : void 0), B = r.getObject(N);
|
|
1402
|
+
if (B != null) {
|
|
1403
|
+
B.transformByState({ left: C, top: _, width: b, height: R, angle: T, flipX: S, flipY: I, skewX: y, skewY: O });
|
|
1131
1404
|
continue;
|
|
1132
1405
|
}
|
|
1133
|
-
const
|
|
1134
|
-
let
|
|
1135
|
-
if (
|
|
1136
|
-
|
|
1406
|
+
const W = this._drawingManagerService.getDrawingOrder(u, l), K = W.indexOf(g), Y = { ...p, zIndex: K === -1 ? W.length - 1 : K }, ve = this._imageIoService.getImageSourceCache(n, s);
|
|
1407
|
+
let ne = !1;
|
|
1408
|
+
if (ve != null)
|
|
1409
|
+
Y.image = ve;
|
|
1137
1410
|
else {
|
|
1138
|
-
if (s ===
|
|
1411
|
+
if (s === Vt.UUID)
|
|
1139
1412
|
try {
|
|
1140
|
-
|
|
1141
|
-
} catch (
|
|
1142
|
-
console.error(
|
|
1413
|
+
Y.url = await this._imageIoService.getImage(n);
|
|
1414
|
+
} catch (ke) {
|
|
1415
|
+
console.error(ke);
|
|
1143
1416
|
continue;
|
|
1144
1417
|
}
|
|
1145
1418
|
else
|
|
1146
|
-
|
|
1147
|
-
|
|
1419
|
+
Y.url = n;
|
|
1420
|
+
ne = !0;
|
|
1148
1421
|
}
|
|
1149
1422
|
if (r.getObject(N))
|
|
1150
1423
|
continue;
|
|
1151
|
-
|
|
1152
|
-
const
|
|
1153
|
-
|
|
1424
|
+
Y.printable = !0;
|
|
1425
|
+
const $ = new We(N, Y);
|
|
1426
|
+
ne && this._imageIoService.addImageSourceCache(n, s, $.getNative()), this._drawingManagerService.getDrawingVisible() && (r.addObject($, Te), this._drawingManagerService.getDrawingEditable() && r.attachTransformerTo($), c && tt({ drawingId: c, unitId: u, subUnitId: l }, $, r, this._drawingManagerService), o != null && $.setPrstGeom(o), a != null && $.setSrcRect(a), h.push($));
|
|
1154
1427
|
}
|
|
1155
1428
|
return h;
|
|
1156
1429
|
}
|
|
1157
1430
|
renderFloatDom(i, r) {
|
|
1158
1431
|
const {
|
|
1159
|
-
transform:
|
|
1160
|
-
drawingType:
|
|
1432
|
+
transform: e,
|
|
1433
|
+
drawingType: t,
|
|
1161
1434
|
groupId: n,
|
|
1162
1435
|
unitId: s,
|
|
1163
1436
|
subUnitId: a,
|
|
@@ -1165,33 +1438,33 @@ let Ue = class {
|
|
|
1165
1438
|
isMultiTransform: c,
|
|
1166
1439
|
transforms: u
|
|
1167
1440
|
} = i;
|
|
1168
|
-
if (
|
|
1441
|
+
if (t !== q.DRAWING_DOM || !this._drawingManagerService.getDrawingVisible() || e == null)
|
|
1169
1442
|
return;
|
|
1170
|
-
const l = c && u ? u : [
|
|
1443
|
+
const l = c && u ? u : [e], g = [];
|
|
1171
1444
|
for (const d of l) {
|
|
1172
|
-
const { left: f, top:
|
|
1445
|
+
const { left: f, top: w, width: h, height: p, angle: C, flipX: _, flipY: b, skewX: R, skewY: T } = d, S = l.indexOf(d), I = L({ unitId: s, subUnitId: a, drawingId: o }, c ? S : void 0), y = r.getObject(I);
|
|
1173
1446
|
if (y != null) {
|
|
1174
|
-
y.transformByState({ left: f, top:
|
|
1447
|
+
y.transformByState({ left: f, top: w, width: h, height: p, angle: C, flipX: _, flipY: b, skewX: R, skewY: T });
|
|
1175
1448
|
continue;
|
|
1176
1449
|
}
|
|
1177
1450
|
const O = this._drawingManagerService.getDrawingOrder(s, a), M = O.indexOf(o), N = { ...d, zIndex: M === -1 ? O.length - 1 : M };
|
|
1178
1451
|
if (r.getObject(I))
|
|
1179
1452
|
continue;
|
|
1180
1453
|
N.printable = !1;
|
|
1181
|
-
const
|
|
1182
|
-
this._drawingManagerService.getDrawingVisible() && (r.addObject(
|
|
1454
|
+
const B = new lt(I, N);
|
|
1455
|
+
this._drawingManagerService.getDrawingVisible() && (r.addObject(B, Te), this._drawingManagerService.getDrawingEditable() && i.allowTransform !== !1 && r.attachTransformerTo(B), n && tt({ drawingId: n, unitId: s, subUnitId: a }, B, r, this._drawingManagerService), g.push(B));
|
|
1183
1456
|
}
|
|
1184
1457
|
return g;
|
|
1185
1458
|
}
|
|
1186
1459
|
renderDrawing(i, r) {
|
|
1187
|
-
const
|
|
1188
|
-
if (
|
|
1189
|
-
switch (
|
|
1190
|
-
case
|
|
1191
|
-
return this.renderImages(
|
|
1460
|
+
const e = this._drawingManagerService.getDrawingByParam(i);
|
|
1461
|
+
if (e != null)
|
|
1462
|
+
switch (e.drawingType) {
|
|
1463
|
+
case q.DRAWING_IMAGE:
|
|
1464
|
+
return this.renderImages(e, r);
|
|
1192
1465
|
}
|
|
1193
1466
|
}
|
|
1194
|
-
previewImage(i, r,
|
|
1467
|
+
previewImage(i, r, e, t) {
|
|
1195
1468
|
this._galleryService.open({
|
|
1196
1469
|
images: [r],
|
|
1197
1470
|
onOpenChange: (n) => {
|
|
@@ -1199,32 +1472,32 @@ let Ue = class {
|
|
|
1199
1472
|
}
|
|
1200
1473
|
});
|
|
1201
1474
|
}
|
|
1202
|
-
_adjustImageSize(i, r,
|
|
1203
|
-
if (i <=
|
|
1475
|
+
_adjustImageSize(i, r, e, t) {
|
|
1476
|
+
if (i <= e && r <= t)
|
|
1204
1477
|
return {
|
|
1205
1478
|
width: i,
|
|
1206
1479
|
height: r
|
|
1207
1480
|
};
|
|
1208
|
-
const n =
|
|
1481
|
+
const n = e / i, s = t / r, a = Math.min(n, s);
|
|
1209
1482
|
return {
|
|
1210
1483
|
width: Math.floor(i * a),
|
|
1211
1484
|
height: Math.floor(r * a)
|
|
1212
1485
|
};
|
|
1213
1486
|
}
|
|
1214
1487
|
};
|
|
1215
|
-
Ue =
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1488
|
+
Ue = wr([
|
|
1489
|
+
Ve(0, re),
|
|
1490
|
+
Ve(1, ct),
|
|
1491
|
+
Ve(2, jt)
|
|
1219
1492
|
], Ue);
|
|
1220
|
-
var
|
|
1221
|
-
for (var n =
|
|
1493
|
+
var vr = Object.getOwnPropertyDescriptor, _r = (i, r, e, t) => {
|
|
1494
|
+
for (var n = t > 1 ? void 0 : t ? vr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
1222
1495
|
(a = i[s]) && (n = a(n) || n);
|
|
1223
1496
|
return n;
|
|
1224
|
-
},
|
|
1225
|
-
let
|
|
1226
|
-
constructor(i, r,
|
|
1227
|
-
super(), this._commandService = i, this._renderManagerService = r, this._drawingManagerService =
|
|
1497
|
+
}, ae = (i, r) => (e, t) => r(e, t, i);
|
|
1498
|
+
let je = class extends He {
|
|
1499
|
+
constructor(i, r, e, t, n, s, a) {
|
|
1500
|
+
super(), this._commandService = i, this._renderManagerService = r, this._drawingManagerService = e, this._dialogService = t, this._imageIoService = n, this._currentUniverService = s, this._drawingRenderService = a, this._initialize();
|
|
1228
1501
|
}
|
|
1229
1502
|
dispose() {
|
|
1230
1503
|
super.dispose();
|
|
@@ -1235,7 +1508,7 @@ let He = class extends Le {
|
|
|
1235
1508
|
_commandExecutedListener() {
|
|
1236
1509
|
this.disposeWithMe(
|
|
1237
1510
|
this._commandService.onCommandExecuted((i) => {
|
|
1238
|
-
if (i.id ===
|
|
1511
|
+
if (i.id === ut.id) {
|
|
1239
1512
|
const r = i.params;
|
|
1240
1513
|
if (r == null)
|
|
1241
1514
|
return;
|
|
@@ -1247,29 +1520,29 @@ let He = class extends Le {
|
|
|
1247
1520
|
_getSceneAndTransformerByDrawingSearch(i) {
|
|
1248
1521
|
if (i == null)
|
|
1249
1522
|
return;
|
|
1250
|
-
const r = this._renderManagerService.getRenderById(i),
|
|
1251
|
-
if (
|
|
1523
|
+
const r = this._renderManagerService.getRenderById(i), e = r == null ? void 0 : r.scene;
|
|
1524
|
+
if (e == null)
|
|
1252
1525
|
return null;
|
|
1253
|
-
const
|
|
1254
|
-
return { scene:
|
|
1526
|
+
const t = e.getTransformerByCreate();
|
|
1527
|
+
return { scene: e, transformer: t };
|
|
1255
1528
|
}
|
|
1256
1529
|
_resetImageSize(i) {
|
|
1257
|
-
const r = [],
|
|
1258
|
-
i.forEach((
|
|
1259
|
-
const { unitId: n, subUnitId: s, drawingId: a } =
|
|
1530
|
+
const r = [], e = [];
|
|
1531
|
+
i.forEach((t) => {
|
|
1532
|
+
const { unitId: n, subUnitId: s, drawingId: a } = t, o = this._getSceneAndTransformerByDrawingSearch(n);
|
|
1260
1533
|
if (o == null)
|
|
1261
1534
|
return;
|
|
1262
1535
|
const { scene: c } = o, u = L({ unitId: n, subUnitId: s, drawingId: a }), l = c.getObject(u);
|
|
1263
1536
|
if (l == null)
|
|
1264
1537
|
return !0;
|
|
1265
|
-
const g = this._drawingManagerService.getDrawingByParam(
|
|
1538
|
+
const g = this._drawingManagerService.getDrawingByParam(t);
|
|
1266
1539
|
if (g == null)
|
|
1267
1540
|
return !0;
|
|
1268
|
-
if (g.drawingType !==
|
|
1541
|
+
if (g.drawingType !== q.DRAWING_IMAGE)
|
|
1269
1542
|
return;
|
|
1270
1543
|
l.resetSize();
|
|
1271
1544
|
const { width: d, height: f } = l.getNativeSize();
|
|
1272
|
-
|
|
1545
|
+
e.includes(c) === !1 && e.push(c), r.push({
|
|
1273
1546
|
...g,
|
|
1274
1547
|
transform: {
|
|
1275
1548
|
...g.transform,
|
|
@@ -1280,9 +1553,9 @@ let He = class extends Le {
|
|
|
1280
1553
|
srcRect: null,
|
|
1281
1554
|
prstGeom: null
|
|
1282
1555
|
});
|
|
1283
|
-
}), this._drawingManagerService.featurePluginUpdateNotification(r),
|
|
1284
|
-
|
|
1285
|
-
}), this._commandService.syncExecuteCommand(
|
|
1556
|
+
}), this._drawingManagerService.featurePluginUpdateNotification(r), e.forEach((t) => {
|
|
1557
|
+
t.getTransformerByCreate().refreshControls().changeNotification();
|
|
1558
|
+
}), this._commandService.syncExecuteCommand(De.id, i);
|
|
1286
1559
|
}
|
|
1287
1560
|
_drawingAddListener() {
|
|
1288
1561
|
this.disposeWithMe(
|
|
@@ -1294,8 +1567,8 @@ let He = class extends Le {
|
|
|
1294
1567
|
_insertImages(i) {
|
|
1295
1568
|
i.forEach(async (r) => {
|
|
1296
1569
|
var c;
|
|
1297
|
-
const { unitId:
|
|
1298
|
-
if (n == null || s !==
|
|
1570
|
+
const { unitId: e, subUnitId: t } = r, n = this._getSceneAndTransformerByDrawingSearch(e), s = (c = St(this._currentUniverService, e)) == null ? void 0 : c.subUnitId;
|
|
1571
|
+
if (n == null || s !== t)
|
|
1299
1572
|
return;
|
|
1300
1573
|
const a = this._drawingManagerService.getDrawingByParam(r);
|
|
1301
1574
|
if (a == null)
|
|
@@ -1310,44 +1583,44 @@ let He = class extends Le {
|
|
|
1310
1583
|
this.disposeWithMe(
|
|
1311
1584
|
this._drawingManagerService.update$.subscribe((i) => {
|
|
1312
1585
|
i.forEach((r) => {
|
|
1313
|
-
const { unitId:
|
|
1586
|
+
const { unitId: e, subUnitId: t, drawingId: n } = r, s = this._drawingManagerService.getDrawingByParam(r);
|
|
1314
1587
|
if (s == null)
|
|
1315
1588
|
return;
|
|
1316
1589
|
const { transform: a, drawingType: o, srcRect: c, prstGeom: u, source: l, imageSourceType: g } = s;
|
|
1317
|
-
if (o !==
|
|
1590
|
+
if (o !== q.DRAWING_IMAGE)
|
|
1318
1591
|
return;
|
|
1319
|
-
const d = this._getSceneAndTransformerByDrawingSearch(
|
|
1592
|
+
const d = this._getSceneAndTransformerByDrawingSearch(e);
|
|
1320
1593
|
if (d == null)
|
|
1321
1594
|
return;
|
|
1322
|
-
const { scene: f, transformer:
|
|
1595
|
+
const { scene: f, transformer: w } = d;
|
|
1323
1596
|
if (a == null)
|
|
1324
1597
|
return !0;
|
|
1325
|
-
const h = L({ unitId:
|
|
1598
|
+
const h = L({ unitId: e, subUnitId: t, drawingId: n }), p = f.getObject(h);
|
|
1326
1599
|
if (p == null)
|
|
1327
1600
|
return !0;
|
|
1328
|
-
p.setSrcRect(c), p.setPrstGeom(u), l != null && l.length > 0 && (g ===
|
|
1601
|
+
p.setSrcRect(c), p.setPrstGeom(u), l != null && l.length > 0 && (g === Ye.BASE64 || g === Ye.URL) && p.changeSource(l);
|
|
1329
1602
|
});
|
|
1330
1603
|
})
|
|
1331
1604
|
);
|
|
1332
1605
|
}
|
|
1333
1606
|
_addHoverForImage(i) {
|
|
1334
1607
|
this.disposeWithMe(
|
|
1335
|
-
|
|
1608
|
+
fe(
|
|
1336
1609
|
i.onPointerEnter$.subscribeEvent(() => {
|
|
1337
|
-
i.cursor =
|
|
1610
|
+
i.cursor = Ee.GRAB;
|
|
1338
1611
|
})
|
|
1339
1612
|
)
|
|
1340
1613
|
), this.disposeWithMe(
|
|
1341
|
-
|
|
1614
|
+
fe(
|
|
1342
1615
|
i.onPointerLeave$.subscribeEvent(() => {
|
|
1343
|
-
i.cursor =
|
|
1616
|
+
i.cursor = Ee.DEFAULT;
|
|
1344
1617
|
})
|
|
1345
1618
|
)
|
|
1346
1619
|
);
|
|
1347
1620
|
}
|
|
1348
1621
|
_addDialogForImage(i) {
|
|
1349
1622
|
this.disposeWithMe(
|
|
1350
|
-
|
|
1623
|
+
fe(
|
|
1351
1624
|
i.onDblclick$.subscribeEvent(() => {
|
|
1352
1625
|
const r = `${i.oKey}-viewer-dialog`;
|
|
1353
1626
|
this._drawingRenderService.previewImage(r, i.getNative().src, i.getNativeSize().width, i.getNativeSize().height);
|
|
@@ -1356,70 +1629,70 @@ let He = class extends Le {
|
|
|
1356
1629
|
);
|
|
1357
1630
|
}
|
|
1358
1631
|
};
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
],
|
|
1368
|
-
var
|
|
1369
|
-
for (var n =
|
|
1632
|
+
je = _r([
|
|
1633
|
+
ae(0, ce),
|
|
1634
|
+
ae(1, ue),
|
|
1635
|
+
ae(2, re),
|
|
1636
|
+
ae(3, At),
|
|
1637
|
+
ae(4, ct),
|
|
1638
|
+
ae(5, Fe),
|
|
1639
|
+
ae(6, Ae(Ue))
|
|
1640
|
+
], je);
|
|
1641
|
+
var Cr = Object.getOwnPropertyDescriptor, Sr = (i, r, e, t) => {
|
|
1642
|
+
for (var n = t > 1 ? void 0 : t ? Cr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
1370
1643
|
(a = i[s]) && (n = a(n) || n);
|
|
1371
1644
|
return n;
|
|
1372
|
-
},
|
|
1373
|
-
const
|
|
1374
|
-
var
|
|
1375
|
-
let
|
|
1376
|
-
constructor(i =
|
|
1377
|
-
super(), this._config = i, this._injector = r, this._configService =
|
|
1378
|
-
const { menu:
|
|
1645
|
+
}, rt = (i, r) => (e, t) => r(e, t, i);
|
|
1646
|
+
const br = "UNIVER_DRAWING_UI_PLUGIN";
|
|
1647
|
+
var Ge;
|
|
1648
|
+
let nt = (Ge = class extends Pt {
|
|
1649
|
+
constructor(i = Qe, r, e) {
|
|
1650
|
+
super(), this._config = i, this._injector = r, this._configService = e;
|
|
1651
|
+
const { menu: t, ...n } = Nt(
|
|
1379
1652
|
{},
|
|
1380
|
-
|
|
1653
|
+
Qe,
|
|
1381
1654
|
this._config
|
|
1382
1655
|
);
|
|
1383
|
-
|
|
1656
|
+
t && this._configService.setConfig("menu", t, { merge: !0 }), this._configService.setConfig(Yt, n);
|
|
1384
1657
|
}
|
|
1385
1658
|
onStarting() {
|
|
1386
1659
|
this._initDependencies();
|
|
1387
1660
|
}
|
|
1388
1661
|
onRendered() {
|
|
1389
|
-
this._injector.get(Be), this._injector.get(
|
|
1662
|
+
this._injector.get(Be), this._injector.get(Ne), this._injector.get(xe), this._injector.get(je);
|
|
1390
1663
|
}
|
|
1391
1664
|
_initDependencies() {
|
|
1392
1665
|
[
|
|
1393
1666
|
[Ue],
|
|
1394
1667
|
[Be],
|
|
1668
|
+
[Ne],
|
|
1395
1669
|
[xe],
|
|
1396
|
-
[je]
|
|
1397
|
-
[He]
|
|
1670
|
+
[je]
|
|
1398
1671
|
].forEach((r) => this._injector.add(r));
|
|
1399
1672
|
}
|
|
1400
|
-
},
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
],
|
|
1405
|
-
const
|
|
1406
|
-
const r =
|
|
1673
|
+
}, J(Ge, "pluginName", br), Ge);
|
|
1674
|
+
nt = Sr([
|
|
1675
|
+
rt(1, Ae(Tt)),
|
|
1676
|
+
rt(2, Et)
|
|
1677
|
+
], nt);
|
|
1678
|
+
const Ir = (i) => {
|
|
1679
|
+
const r = A(ce), e = A(te), { alignShow: t } = i, [n, s] = j(D.default), a = [
|
|
1407
1680
|
{
|
|
1408
|
-
label:
|
|
1681
|
+
label: e.t("image-panel.align.default"),
|
|
1409
1682
|
value: D.default
|
|
1410
1683
|
},
|
|
1411
1684
|
{
|
|
1412
1685
|
options: [
|
|
1413
1686
|
{
|
|
1414
|
-
label:
|
|
1687
|
+
label: e.t("image-panel.align.left"),
|
|
1415
1688
|
value: D.left
|
|
1416
1689
|
},
|
|
1417
1690
|
{
|
|
1418
|
-
label:
|
|
1691
|
+
label: e.t("image-panel.align.center"),
|
|
1419
1692
|
value: D.center
|
|
1420
1693
|
},
|
|
1421
1694
|
{
|
|
1422
|
-
label:
|
|
1695
|
+
label: e.t("image-panel.align.right"),
|
|
1423
1696
|
value: D.right
|
|
1424
1697
|
}
|
|
1425
1698
|
]
|
|
@@ -1427,15 +1700,15 @@ const Mr = (i) => {
|
|
|
1427
1700
|
{
|
|
1428
1701
|
options: [
|
|
1429
1702
|
{
|
|
1430
|
-
label:
|
|
1703
|
+
label: e.t("image-panel.align.top"),
|
|
1431
1704
|
value: D.top
|
|
1432
1705
|
},
|
|
1433
1706
|
{
|
|
1434
|
-
label:
|
|
1707
|
+
label: e.t("image-panel.align.middle"),
|
|
1435
1708
|
value: D.middle
|
|
1436
1709
|
},
|
|
1437
1710
|
{
|
|
1438
|
-
label:
|
|
1711
|
+
label: e.t("image-panel.align.bottom"),
|
|
1439
1712
|
value: D.bottom
|
|
1440
1713
|
}
|
|
1441
1714
|
]
|
|
@@ -1443,47 +1716,47 @@ const Mr = (i) => {
|
|
|
1443
1716
|
{
|
|
1444
1717
|
options: [
|
|
1445
1718
|
{
|
|
1446
|
-
label:
|
|
1719
|
+
label: e.t("image-panel.align.horizon"),
|
|
1447
1720
|
value: D.horizon
|
|
1448
1721
|
},
|
|
1449
1722
|
{
|
|
1450
|
-
label:
|
|
1723
|
+
label: e.t("image-panel.align.vertical"),
|
|
1451
1724
|
value: D.vertical
|
|
1452
1725
|
}
|
|
1453
1726
|
]
|
|
1454
1727
|
}
|
|
1455
1728
|
];
|
|
1456
1729
|
function o(c) {
|
|
1457
|
-
s(c), r.executeCommand(
|
|
1730
|
+
s(c), r.executeCommand(ze.id, {
|
|
1458
1731
|
alignType: c
|
|
1459
1732
|
});
|
|
1460
1733
|
}
|
|
1461
1734
|
return /* @__PURE__ */ P(
|
|
1462
1735
|
"div",
|
|
1463
1736
|
{
|
|
1464
|
-
className:
|
|
1465
|
-
"univer-hidden": !
|
|
1737
|
+
className: Q("univer-relative univer-w-full", {
|
|
1738
|
+
"univer-hidden": !t
|
|
1466
1739
|
}),
|
|
1467
1740
|
children: [
|
|
1468
|
-
/* @__PURE__ */
|
|
1741
|
+
/* @__PURE__ */ v(
|
|
1469
1742
|
"header",
|
|
1470
1743
|
{
|
|
1471
1744
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1472
|
-
children: /* @__PURE__ */
|
|
1745
|
+
children: /* @__PURE__ */ v("div", { children: e.t("image-panel.align.title") })
|
|
1473
1746
|
}
|
|
1474
1747
|
),
|
|
1475
|
-
/* @__PURE__ */
|
|
1748
|
+
/* @__PURE__ */ v("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ v(
|
|
1476
1749
|
"div",
|
|
1477
1750
|
{
|
|
1478
1751
|
className: "univer-w-full univer-text-gray-900 dark:!univer-text-white",
|
|
1479
|
-
children: /* @__PURE__ */
|
|
1752
|
+
children: /* @__PURE__ */ v(st, { value: n, options: a, onChange: o })
|
|
1480
1753
|
}
|
|
1481
1754
|
) })
|
|
1482
1755
|
]
|
|
1483
1756
|
}
|
|
1484
1757
|
);
|
|
1485
|
-
},
|
|
1486
|
-
const { arrangeShow: r, drawings:
|
|
1758
|
+
}, yr = (i) => {
|
|
1759
|
+
const { arrangeShow: r, drawings: e } = i, t = A(te), n = A(re), [s, a] = j(e);
|
|
1487
1760
|
we(() => {
|
|
1488
1761
|
const c = n.focus$.subscribe((u) => {
|
|
1489
1762
|
a(u);
|
|
@@ -1499,53 +1772,53 @@ const Mr = (i) => {
|
|
|
1499
1772
|
return /* @__PURE__ */ P(
|
|
1500
1773
|
"div",
|
|
1501
1774
|
{
|
|
1502
|
-
className:
|
|
1775
|
+
className: Q("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
|
|
1503
1776
|
"univer-hidden": !r
|
|
1504
1777
|
}),
|
|
1505
1778
|
children: [
|
|
1506
|
-
/* @__PURE__ */
|
|
1779
|
+
/* @__PURE__ */ v(
|
|
1507
1780
|
"header",
|
|
1508
1781
|
{
|
|
1509
1782
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1510
|
-
children: /* @__PURE__ */
|
|
1783
|
+
children: /* @__PURE__ */ v("div", { children: t.t("image-panel.arrange.title") })
|
|
1511
1784
|
}
|
|
1512
1785
|
),
|
|
1513
1786
|
/* @__PURE__ */ P("div", { className: "univer-grid univer-grid-cols-2 univer-gap-2", children: [
|
|
1514
|
-
/* @__PURE__ */ P(
|
|
1515
|
-
o(
|
|
1787
|
+
/* @__PURE__ */ P(se, { onClick: () => {
|
|
1788
|
+
o(_e.forward);
|
|
1516
1789
|
}, children: [
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
|
|
1790
|
+
/* @__PURE__ */ v(wt, {}),
|
|
1791
|
+
t.t("image-panel.arrange.forward")
|
|
1519
1792
|
] }),
|
|
1520
|
-
/* @__PURE__ */ P(
|
|
1521
|
-
o(
|
|
1793
|
+
/* @__PURE__ */ P(se, { onClick: () => {
|
|
1794
|
+
o(_e.backward);
|
|
1522
1795
|
}, children: [
|
|
1523
|
-
/* @__PURE__ */
|
|
1524
|
-
|
|
1796
|
+
/* @__PURE__ */ v(mt, {}),
|
|
1797
|
+
t.t("image-panel.arrange.backward")
|
|
1525
1798
|
] }),
|
|
1526
|
-
/* @__PURE__ */ P(
|
|
1527
|
-
o(
|
|
1799
|
+
/* @__PURE__ */ P(se, { onClick: () => {
|
|
1800
|
+
o(_e.front);
|
|
1528
1801
|
}, children: [
|
|
1529
|
-
/* @__PURE__ */
|
|
1530
|
-
|
|
1802
|
+
/* @__PURE__ */ v(vt, {}),
|
|
1803
|
+
t.t("image-panel.arrange.front")
|
|
1531
1804
|
] }),
|
|
1532
|
-
/* @__PURE__ */ P(
|
|
1533
|
-
o(
|
|
1805
|
+
/* @__PURE__ */ P(se, { onClick: () => {
|
|
1806
|
+
o(_e.back);
|
|
1534
1807
|
}, children: [
|
|
1535
|
-
/* @__PURE__ */
|
|
1536
|
-
|
|
1808
|
+
/* @__PURE__ */ v(dt, {}),
|
|
1809
|
+
t.t("image-panel.arrange.back")
|
|
1537
1810
|
] })
|
|
1538
1811
|
] })
|
|
1539
1812
|
]
|
|
1540
1813
|
}
|
|
1541
1814
|
);
|
|
1542
|
-
},
|
|
1543
|
-
const r =
|
|
1544
|
-
const h =
|
|
1815
|
+
}, Mr = (i) => {
|
|
1816
|
+
const r = A(te), e = A(ue), t = A(re), { hasGroup: n, drawings: s } = i, [a, o] = j(!1), [c, u] = j(!0), [l, g] = j(!0), d = () => {
|
|
1817
|
+
const h = t.getFocusDrawings(), { unitId: p, subUnitId: C } = h[0], _ = Bt(10), b = Zt(0, 0, h.map((S) => S.transform || {})), R = {
|
|
1545
1818
|
unitId: p,
|
|
1546
1819
|
subUnitId: C,
|
|
1547
1820
|
drawingId: _,
|
|
1548
|
-
drawingType:
|
|
1821
|
+
drawingType: q.DRAWING_GROUP,
|
|
1549
1822
|
transform: b
|
|
1550
1823
|
}, T = h.map((S) => {
|
|
1551
1824
|
const I = S.transform || { left: 0, top: 0 }, { unitId: y, subUnitId: O, drawingId: M } = S;
|
|
@@ -1561,21 +1834,21 @@ const Mr = (i) => {
|
|
|
1561
1834
|
groupId: _
|
|
1562
1835
|
};
|
|
1563
1836
|
});
|
|
1564
|
-
|
|
1837
|
+
t.featurePluginGroupUpdateNotification([{
|
|
1565
1838
|
parent: R,
|
|
1566
1839
|
children: T
|
|
1567
1840
|
}]);
|
|
1568
1841
|
}, f = (h) => {
|
|
1569
|
-
if (h.drawingType !==
|
|
1842
|
+
if (h.drawingType !== q.DRAWING_GROUP)
|
|
1570
1843
|
return;
|
|
1571
1844
|
const { unitId: p, subUnitId: C, drawingId: _, transform: b = { width: 0, height: 0 } } = h;
|
|
1572
1845
|
if (b == null)
|
|
1573
1846
|
return;
|
|
1574
|
-
const R =
|
|
1847
|
+
const R = t.getDrawingsByGroup({ unitId: p, subUnitId: C, drawingId: _ });
|
|
1575
1848
|
if (R.length === 0)
|
|
1576
1849
|
return;
|
|
1577
1850
|
const T = R.map((S) => {
|
|
1578
|
-
const { transform: I } = S, { unitId: y, subUnitId: O, drawingId: M } = S, N =
|
|
1851
|
+
const { transform: I } = S, { unitId: y, subUnitId: O, drawingId: M } = S, N = Ft(I || {}, b, b.width || 0, b.height || 0);
|
|
1579
1852
|
return {
|
|
1580
1853
|
unitId: y,
|
|
1581
1854
|
subUnitId: O,
|
|
@@ -1591,23 +1864,23 @@ const Mr = (i) => {
|
|
|
1591
1864
|
parent: h,
|
|
1592
1865
|
children: T
|
|
1593
1866
|
};
|
|
1594
|
-
},
|
|
1595
|
-
const p =
|
|
1867
|
+
}, w = () => {
|
|
1868
|
+
const p = t.getFocusDrawings().map(
|
|
1596
1869
|
(C) => f(C)
|
|
1597
1870
|
).filter((C) => C != null);
|
|
1598
|
-
p.length !== 0 &&
|
|
1871
|
+
p.length !== 0 && t.featurePluginUngroupUpdateNotification(p);
|
|
1599
1872
|
};
|
|
1600
1873
|
return we(() => {
|
|
1601
1874
|
const h = s[0];
|
|
1602
1875
|
if (h == null)
|
|
1603
1876
|
return;
|
|
1604
|
-
const { unitId: p } = h, C =
|
|
1877
|
+
const { unitId: p } = h, C = e.getRenderById(p), _ = C == null ? void 0 : C.scene;
|
|
1605
1878
|
if (_ == null)
|
|
1606
1879
|
return;
|
|
1607
1880
|
const b = _.getTransformerByCreate(), R = b.clearControl$.subscribe((S) => {
|
|
1608
1881
|
S === !0 && o(!1);
|
|
1609
1882
|
}), T = b.changeStart$.subscribe((S) => {
|
|
1610
|
-
const { objects: I } = S, y =
|
|
1883
|
+
const { objects: I } = S, y = Le(I, t), O = y.filter((W) => (W == null ? void 0 : W.drawingType) === q.DRAWING_GROUP);
|
|
1611
1884
|
let M = !1, N = !1;
|
|
1612
1885
|
y.length > 1 && (M = !0), O.length > 0 && (N = !0), o(M || N), u(M), g(N);
|
|
1613
1886
|
});
|
|
@@ -1617,40 +1890,40 @@ const Mr = (i) => {
|
|
|
1617
1890
|
}, []), /* @__PURE__ */ P(
|
|
1618
1891
|
"div",
|
|
1619
1892
|
{
|
|
1620
|
-
className:
|
|
1893
|
+
className: Q("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
|
|
1621
1894
|
"univer-hidden": n === !0 && a === !1 || n === !1
|
|
1622
1895
|
}),
|
|
1623
1896
|
children: [
|
|
1624
|
-
/* @__PURE__ */
|
|
1897
|
+
/* @__PURE__ */ v(
|
|
1625
1898
|
"header",
|
|
1626
1899
|
{
|
|
1627
1900
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1628
|
-
children: /* @__PURE__ */
|
|
1901
|
+
children: /* @__PURE__ */ v("div", { children: r.t("image-panel.group.title") })
|
|
1629
1902
|
}
|
|
1630
1903
|
),
|
|
1631
1904
|
/* @__PURE__ */ P("div", { className: "univer-flex univer-items-center univer-justify-center univer-gap-2", children: [
|
|
1632
1905
|
/* @__PURE__ */ P(
|
|
1633
|
-
|
|
1906
|
+
se,
|
|
1634
1907
|
{
|
|
1635
|
-
className:
|
|
1908
|
+
className: Q({
|
|
1636
1909
|
"univer-hidden": !c
|
|
1637
1910
|
}),
|
|
1638
1911
|
onClick: d,
|
|
1639
1912
|
children: [
|
|
1640
|
-
/* @__PURE__ */
|
|
1913
|
+
/* @__PURE__ */ v(ft, {}),
|
|
1641
1914
|
r.t("image-panel.group.group")
|
|
1642
1915
|
]
|
|
1643
1916
|
}
|
|
1644
1917
|
),
|
|
1645
1918
|
/* @__PURE__ */ P(
|
|
1646
|
-
|
|
1919
|
+
se,
|
|
1647
1920
|
{
|
|
1648
|
-
className:
|
|
1921
|
+
className: Q({
|
|
1649
1922
|
"univer-hidden": !l
|
|
1650
1923
|
}),
|
|
1651
|
-
onClick:
|
|
1924
|
+
onClick: w,
|
|
1652
1925
|
children: [
|
|
1653
|
-
/* @__PURE__ */
|
|
1926
|
+
/* @__PURE__ */ v(_t, {}),
|
|
1654
1927
|
r.t("image-panel.group.unGroup")
|
|
1655
1928
|
]
|
|
1656
1929
|
}
|
|
@@ -1659,19 +1932,19 @@ const Mr = (i) => {
|
|
|
1659
1932
|
]
|
|
1660
1933
|
}
|
|
1661
1934
|
);
|
|
1662
|
-
},
|
|
1663
|
-
var
|
|
1664
|
-
const r =
|
|
1935
|
+
}, ye = 20, Me = 20, it = [-360, 360], Re = 300, Rr = (i) => {
|
|
1936
|
+
var Ke;
|
|
1937
|
+
const r = A(te), e = A(re), t = A(ue), { drawings: n, transformShow: s } = i, a = n[0];
|
|
1665
1938
|
if (a == null)
|
|
1666
1939
|
return;
|
|
1667
1940
|
const o = a.transform;
|
|
1668
1941
|
if (o == null)
|
|
1669
1942
|
return;
|
|
1670
|
-
const { unitId: c, subUnitId: u, drawingId: l, drawingType: g } = a, d =
|
|
1943
|
+
const { unitId: c, subUnitId: u, drawingId: l, drawingType: g } = a, d = t.getRenderById(c), f = d == null ? void 0 : d.scene;
|
|
1671
1944
|
if (f == null)
|
|
1672
1945
|
return;
|
|
1673
|
-
const
|
|
1674
|
-
if (
|
|
1946
|
+
const w = (Ke = f.getEngine()) == null ? void 0 : Ke.activeScene;
|
|
1947
|
+
if (w == null)
|
|
1675
1948
|
return;
|
|
1676
1949
|
const h = f.getTransformerByCreate(), {
|
|
1677
1950
|
width: p = 0,
|
|
@@ -1679,128 +1952,128 @@ const Mr = (i) => {
|
|
|
1679
1952
|
left: _ = 0,
|
|
1680
1953
|
top: b = 0,
|
|
1681
1954
|
angle: R = 0
|
|
1682
|
-
} = o, [T, S] =
|
|
1683
|
-
const { width:
|
|
1684
|
-
let
|
|
1685
|
-
return m +
|
|
1686
|
-
limitLeft:
|
|
1687
|
-
limitTop:
|
|
1688
|
-
limitWidth:
|
|
1689
|
-
limitHeight:
|
|
1955
|
+
} = o, [T, S] = j(p), [I, y] = j(C), [O, M] = j(_), [N, B] = j(b), [W, K] = j(R), [Y, ve] = j(h.keepRatio), ne = (m, E, H, k) => {
|
|
1956
|
+
const { width: U, height: X } = w, { ancestorLeft: V, ancestorTop: G } = f;
|
|
1957
|
+
let Z = m, ie = E, ge = H, de = k;
|
|
1958
|
+
return m + V < 0 && (Z = -V), E + G < 0 && (ie = -G), ge = U - Z - V, ge < ye && (ge = ye), de = X - ie - G, de < Me && (de = Me), m + ge + V > U && (Z = U - H - V), E + de + G > X && (ie = X - k - G), {
|
|
1959
|
+
limitLeft: Z,
|
|
1960
|
+
limitTop: ie,
|
|
1961
|
+
limitWidth: ge,
|
|
1962
|
+
limitHeight: de
|
|
1690
1963
|
};
|
|
1691
|
-
},
|
|
1692
|
-
const { objects: E } = m,
|
|
1693
|
-
if (
|
|
1964
|
+
}, $ = (m) => {
|
|
1965
|
+
const { objects: E } = m, H = Le(E, e);
|
|
1966
|
+
if (H.length !== 1)
|
|
1694
1967
|
return;
|
|
1695
|
-
const k =
|
|
1968
|
+
const k = H[0];
|
|
1696
1969
|
if (k == null)
|
|
1697
1970
|
return;
|
|
1698
|
-
const { transform:
|
|
1699
|
-
if (
|
|
1971
|
+
const { transform: U } = k;
|
|
1972
|
+
if (U == null)
|
|
1700
1973
|
return;
|
|
1701
1974
|
const {
|
|
1702
|
-
width:
|
|
1703
|
-
height:
|
|
1704
|
-
left:
|
|
1705
|
-
top:
|
|
1706
|
-
angle:
|
|
1707
|
-
} =
|
|
1708
|
-
|
|
1975
|
+
width: X,
|
|
1976
|
+
height: V,
|
|
1977
|
+
left: G,
|
|
1978
|
+
top: Z,
|
|
1979
|
+
angle: ie
|
|
1980
|
+
} = U;
|
|
1981
|
+
X != null && S(X), V != null && y(V), G != null && M(G), Z != null && B(Z), ie != null && K(ie);
|
|
1709
1982
|
};
|
|
1710
1983
|
we(() => {
|
|
1711
1984
|
const m = [
|
|
1712
1985
|
h.changeStart$.subscribe((E) => {
|
|
1713
|
-
|
|
1986
|
+
$(E);
|
|
1714
1987
|
}),
|
|
1715
1988
|
h.changing$.subscribe((E) => {
|
|
1716
|
-
|
|
1989
|
+
$(E);
|
|
1717
1990
|
}),
|
|
1718
1991
|
h.changeEnd$.subscribe((E) => {
|
|
1719
|
-
|
|
1992
|
+
$(E);
|
|
1720
1993
|
}),
|
|
1721
|
-
|
|
1994
|
+
e.focus$.subscribe((E) => {
|
|
1722
1995
|
if (E.length !== 1)
|
|
1723
1996
|
return;
|
|
1724
|
-
const
|
|
1725
|
-
if (
|
|
1997
|
+
const H = e.getDrawingByParam(E[0]);
|
|
1998
|
+
if (H == null)
|
|
1726
1999
|
return;
|
|
1727
|
-
const k =
|
|
2000
|
+
const k = H.transform;
|
|
1728
2001
|
if (k == null)
|
|
1729
2002
|
return;
|
|
1730
2003
|
const {
|
|
1731
|
-
width:
|
|
1732
|
-
height:
|
|
1733
|
-
left:
|
|
1734
|
-
top:
|
|
1735
|
-
angle:
|
|
2004
|
+
width: U,
|
|
2005
|
+
height: X,
|
|
2006
|
+
left: V,
|
|
2007
|
+
top: G,
|
|
2008
|
+
angle: Z
|
|
1736
2009
|
} = k;
|
|
1737
|
-
|
|
2010
|
+
U != null && S(U), X != null && y(X), V != null && M(V), G != null && B(G), Z != null && K(Z);
|
|
1738
2011
|
})
|
|
1739
2012
|
];
|
|
1740
2013
|
return () => {
|
|
1741
2014
|
m.forEach((E) => E.unsubscribe());
|
|
1742
2015
|
};
|
|
1743
2016
|
}, []);
|
|
1744
|
-
const
|
|
2017
|
+
const ke = Ce((m) => {
|
|
1745
2018
|
if (m == null)
|
|
1746
2019
|
return;
|
|
1747
|
-
const { limitWidth: E, limitHeight:
|
|
2020
|
+
const { limitWidth: E, limitHeight: H } = ne(O, N, m, I);
|
|
1748
2021
|
m = Math.min(m, E);
|
|
1749
2022
|
const k = { unitId: c, subUnitId: u, drawingId: l, drawingType: g, transform: { width: m } };
|
|
1750
|
-
if (
|
|
1751
|
-
let
|
|
1752
|
-
if (
|
|
2023
|
+
if (Y) {
|
|
2024
|
+
let U = m / T * I;
|
|
2025
|
+
if (U = Math.max(U, Me), U > H)
|
|
1753
2026
|
return;
|
|
1754
|
-
y(
|
|
2027
|
+
y(U), k.transform.height = U;
|
|
1755
2028
|
}
|
|
1756
|
-
S(m),
|
|
1757
|
-
},
|
|
2029
|
+
S(m), e.featurePluginUpdateNotification([k]), h.refreshControls().changeNotification();
|
|
2030
|
+
}, Re), bt = Ce((m) => {
|
|
1758
2031
|
if (m == null)
|
|
1759
2032
|
return;
|
|
1760
|
-
const { limitHeight: E, limitWidth:
|
|
2033
|
+
const { limitHeight: E, limitWidth: H } = ne(O, N, T, m);
|
|
1761
2034
|
m = Math.min(m, E);
|
|
1762
2035
|
const k = { unitId: c, subUnitId: u, drawingId: l, drawingType: g, transform: { height: m } };
|
|
1763
|
-
if (
|
|
1764
|
-
let
|
|
1765
|
-
if (
|
|
2036
|
+
if (Y) {
|
|
2037
|
+
let U = m / I * T;
|
|
2038
|
+
if (U = Math.max(U, ye), U > H)
|
|
1766
2039
|
return;
|
|
1767
|
-
S(
|
|
2040
|
+
S(U), k.transform.width = U;
|
|
1768
2041
|
}
|
|
1769
|
-
y(m),
|
|
1770
|
-
},
|
|
2042
|
+
y(m), e.featurePluginUpdateNotification([k]), h.refreshControls().changeNotification();
|
|
2043
|
+
}, Re), It = Ce((m) => {
|
|
1771
2044
|
if (m == null)
|
|
1772
2045
|
return;
|
|
1773
|
-
const { limitLeft: E } =
|
|
2046
|
+
const { limitLeft: E } = ne(m, N, T, I);
|
|
1774
2047
|
m = E;
|
|
1775
|
-
const
|
|
1776
|
-
M(m),
|
|
1777
|
-
},
|
|
2048
|
+
const H = { unitId: c, subUnitId: u, drawingId: l, drawingType: g, transform: { left: m } };
|
|
2049
|
+
M(m), e.featurePluginUpdateNotification([H]), h.refreshControls().changeNotification();
|
|
2050
|
+
}, Re), yt = Ce((m) => {
|
|
1778
2051
|
if (m == null)
|
|
1779
2052
|
return;
|
|
1780
|
-
const { limitTop: E } =
|
|
2053
|
+
const { limitTop: E } = ne(O, m, T, I);
|
|
1781
2054
|
m = E;
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1784
|
-
},
|
|
2055
|
+
const H = { unitId: c, subUnitId: u, drawingId: l, drawingType: g, transform: { top: m } };
|
|
2056
|
+
B(m), e.featurePluginUpdateNotification([H]), h.refreshControls().changeNotification();
|
|
2057
|
+
}, Re), Mt = (m) => {
|
|
1785
2058
|
if (m == null)
|
|
1786
2059
|
return;
|
|
1787
2060
|
const E = { unitId: c, subUnitId: u, drawingId: l, drawingType: g, transform: { angle: m } };
|
|
1788
|
-
|
|
1789
|
-
},
|
|
1790
|
-
|
|
2061
|
+
K(m), e.featurePluginUpdateNotification([E]), h.refreshControls().changeNotification();
|
|
2062
|
+
}, Rt = (m) => {
|
|
2063
|
+
ve(m), h.keepRatio = m;
|
|
1791
2064
|
};
|
|
1792
2065
|
return /* @__PURE__ */ P(
|
|
1793
2066
|
"div",
|
|
1794
2067
|
{
|
|
1795
|
-
className:
|
|
2068
|
+
className: Q("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
|
|
1796
2069
|
"univer-hidden": !s
|
|
1797
2070
|
}),
|
|
1798
2071
|
children: [
|
|
1799
|
-
/* @__PURE__ */
|
|
2072
|
+
/* @__PURE__ */ v(
|
|
1800
2073
|
"header",
|
|
1801
2074
|
{
|
|
1802
2075
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1803
|
-
children: /* @__PURE__ */
|
|
2076
|
+
children: /* @__PURE__ */ v("div", { children: r.t("image-panel.transform.title") })
|
|
1804
2077
|
}
|
|
1805
2078
|
),
|
|
1806
2079
|
/* @__PURE__ */ P(
|
|
@@ -1809,36 +2082,36 @@ const Mr = (i) => {
|
|
|
1809
2082
|
className: "univer-grid univer-grid-cols-3 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
1810
2083
|
children: [
|
|
1811
2084
|
/* @__PURE__ */ P("div", { children: [
|
|
1812
|
-
/* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
|
|
2085
|
+
/* @__PURE__ */ v("span", { children: r.t("image-panel.transform.width") }),
|
|
2086
|
+
/* @__PURE__ */ v(
|
|
2087
|
+
he,
|
|
1815
2088
|
{
|
|
1816
2089
|
precision: 1,
|
|
1817
2090
|
value: T,
|
|
1818
|
-
min:
|
|
2091
|
+
min: ye,
|
|
1819
2092
|
onChange: (m) => {
|
|
1820
|
-
|
|
2093
|
+
ke(m);
|
|
1821
2094
|
}
|
|
1822
2095
|
}
|
|
1823
2096
|
)
|
|
1824
2097
|
] }),
|
|
1825
2098
|
/* @__PURE__ */ P("div", { children: [
|
|
1826
|
-
/* @__PURE__ */
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
|
|
2099
|
+
/* @__PURE__ */ v("span", { children: r.t("image-panel.transform.height") }),
|
|
2100
|
+
/* @__PURE__ */ v(
|
|
2101
|
+
he,
|
|
1829
2102
|
{
|
|
1830
2103
|
precision: 1,
|
|
1831
2104
|
value: I,
|
|
1832
|
-
min:
|
|
2105
|
+
min: Me,
|
|
1833
2106
|
onChange: (m) => {
|
|
1834
|
-
|
|
2107
|
+
bt(m);
|
|
1835
2108
|
}
|
|
1836
2109
|
}
|
|
1837
2110
|
)
|
|
1838
2111
|
] }),
|
|
1839
2112
|
/* @__PURE__ */ P("div", { children: [
|
|
1840
|
-
/* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
2113
|
+
/* @__PURE__ */ v("span", { children: r.t("image-panel.transform.lock") }),
|
|
2114
|
+
/* @__PURE__ */ v("div", { className: "univer-text-center", children: /* @__PURE__ */ v($t, { checked: Y, onChange: Rt }) })
|
|
1842
2115
|
] })
|
|
1843
2116
|
]
|
|
1844
2117
|
}
|
|
@@ -1849,27 +2122,27 @@ const Mr = (i) => {
|
|
|
1849
2122
|
className: "univer-grid univer-grid-cols-3 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
1850
2123
|
children: [
|
|
1851
2124
|
/* @__PURE__ */ P("div", { children: [
|
|
1852
|
-
/* @__PURE__ */
|
|
1853
|
-
/* @__PURE__ */
|
|
1854
|
-
|
|
2125
|
+
/* @__PURE__ */ v("span", { children: r.t("image-panel.transform.x") }),
|
|
2126
|
+
/* @__PURE__ */ v(he, { precision: 1, value: O, onChange: (m) => {
|
|
2127
|
+
It(m);
|
|
1855
2128
|
} })
|
|
1856
2129
|
] }),
|
|
1857
2130
|
/* @__PURE__ */ P("div", { children: [
|
|
1858
|
-
/* @__PURE__ */
|
|
1859
|
-
/* @__PURE__ */
|
|
1860
|
-
|
|
2131
|
+
/* @__PURE__ */ v("span", { children: r.t("image-panel.transform.y") }),
|
|
2132
|
+
/* @__PURE__ */ v(he, { precision: 1, value: N, onChange: (m) => {
|
|
2133
|
+
yt(m);
|
|
1861
2134
|
} })
|
|
1862
2135
|
] }),
|
|
1863
2136
|
/* @__PURE__ */ P("div", { children: [
|
|
1864
|
-
/* @__PURE__ */
|
|
1865
|
-
/* @__PURE__ */
|
|
1866
|
-
|
|
2137
|
+
/* @__PURE__ */ v("span", { children: r.t("image-panel.transform.rotate") }),
|
|
2138
|
+
/* @__PURE__ */ v(
|
|
2139
|
+
he,
|
|
1867
2140
|
{
|
|
1868
2141
|
precision: 1,
|
|
1869
|
-
value:
|
|
1870
|
-
min:
|
|
1871
|
-
max:
|
|
1872
|
-
onChange:
|
|
2142
|
+
value: W,
|
|
2143
|
+
min: it[0],
|
|
2144
|
+
max: it[1],
|
|
2145
|
+
onChange: Mt
|
|
1873
2146
|
}
|
|
1874
2147
|
)
|
|
1875
2148
|
] })
|
|
@@ -1879,57 +2152,57 @@ const Mr = (i) => {
|
|
|
1879
2152
|
]
|
|
1880
2153
|
}
|
|
1881
2154
|
);
|
|
1882
|
-
},
|
|
1883
|
-
const r =
|
|
1884
|
-
if (
|
|
2155
|
+
}, Or = (i) => {
|
|
2156
|
+
const r = A(ce), e = A(te), { drawings: t, cropperShow: n } = i;
|
|
2157
|
+
if (t[0] == null)
|
|
1885
2158
|
return;
|
|
1886
|
-
const [a, o] =
|
|
2159
|
+
const [a, o] = j(x.FREE), c = ot(!1), u = [
|
|
1887
2160
|
{
|
|
1888
|
-
label:
|
|
1889
|
-
value:
|
|
2161
|
+
label: e.t("image-panel.crop.mode"),
|
|
2162
|
+
value: x.FREE
|
|
1890
2163
|
},
|
|
1891
2164
|
{
|
|
1892
2165
|
label: "1:1",
|
|
1893
|
-
value:
|
|
2166
|
+
value: x.R1_1
|
|
1894
2167
|
},
|
|
1895
2168
|
{
|
|
1896
2169
|
label: "16:9",
|
|
1897
|
-
value:
|
|
2170
|
+
value: x.R16_9
|
|
1898
2171
|
},
|
|
1899
2172
|
{
|
|
1900
2173
|
label: "9:16",
|
|
1901
|
-
value:
|
|
2174
|
+
value: x.R9_16
|
|
1902
2175
|
},
|
|
1903
2176
|
{
|
|
1904
2177
|
label: "5:4",
|
|
1905
|
-
value:
|
|
2178
|
+
value: x.R5_4
|
|
1906
2179
|
},
|
|
1907
2180
|
{
|
|
1908
2181
|
label: "4:5",
|
|
1909
|
-
value:
|
|
2182
|
+
value: x.R4_5
|
|
1910
2183
|
},
|
|
1911
2184
|
{
|
|
1912
2185
|
label: "4:3",
|
|
1913
|
-
value:
|
|
2186
|
+
value: x.R4_3
|
|
1914
2187
|
},
|
|
1915
2188
|
{
|
|
1916
2189
|
label: "3:4",
|
|
1917
|
-
value:
|
|
2190
|
+
value: x.R3_4
|
|
1918
2191
|
},
|
|
1919
2192
|
{
|
|
1920
2193
|
label: "3:2",
|
|
1921
|
-
value:
|
|
2194
|
+
value: x.R3_2
|
|
1922
2195
|
},
|
|
1923
2196
|
{
|
|
1924
2197
|
label: "2:3",
|
|
1925
|
-
value:
|
|
2198
|
+
value: x.R2_3
|
|
1926
2199
|
}
|
|
1927
2200
|
];
|
|
1928
2201
|
we(() => {
|
|
1929
2202
|
const d = r.onCommandExecuted((f) => {
|
|
1930
|
-
if (f.id ===
|
|
1931
|
-
const
|
|
1932
|
-
|
|
2203
|
+
if (f.id === oe.id) {
|
|
2204
|
+
const w = f.params;
|
|
2205
|
+
w != null && w.isAuto || (c.current = !1);
|
|
1933
2206
|
}
|
|
1934
2207
|
});
|
|
1935
2208
|
return () => {
|
|
@@ -1937,89 +2210,89 @@ const Mr = (i) => {
|
|
|
1937
2210
|
};
|
|
1938
2211
|
}, []);
|
|
1939
2212
|
function l(d) {
|
|
1940
|
-
o(d), c.current && r.executeCommand(
|
|
2213
|
+
o(d), c.current && r.executeCommand(Pe.id, {
|
|
1941
2214
|
cropType: d
|
|
1942
2215
|
});
|
|
1943
2216
|
}
|
|
1944
2217
|
const g = (d) => {
|
|
1945
|
-
r.executeCommand(
|
|
2218
|
+
r.executeCommand(Pe.id, {
|
|
1946
2219
|
cropType: d
|
|
1947
2220
|
}), c.current = !0;
|
|
1948
2221
|
};
|
|
1949
2222
|
return /* @__PURE__ */ P(
|
|
1950
2223
|
"div",
|
|
1951
2224
|
{
|
|
1952
|
-
className:
|
|
2225
|
+
className: Q("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
|
|
1953
2226
|
"univer-hidden": !n
|
|
1954
2227
|
}),
|
|
1955
2228
|
children: [
|
|
1956
|
-
/* @__PURE__ */
|
|
2229
|
+
/* @__PURE__ */ v(
|
|
1957
2230
|
"header",
|
|
1958
2231
|
{
|
|
1959
2232
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1960
|
-
children: /* @__PURE__ */
|
|
2233
|
+
children: /* @__PURE__ */ v("div", { children: e.t("image-panel.crop.title") })
|
|
1961
2234
|
}
|
|
1962
2235
|
),
|
|
1963
2236
|
/* @__PURE__ */ P("div", { className: "univer-flex univer-items-center univer-justify-center univer-gap-2", children: [
|
|
1964
|
-
/* @__PURE__ */ P(
|
|
2237
|
+
/* @__PURE__ */ P(se, { onClick: () => {
|
|
1965
2238
|
g(a);
|
|
1966
2239
|
}, children: [
|
|
1967
|
-
/* @__PURE__ */
|
|
1968
|
-
|
|
2240
|
+
/* @__PURE__ */ v(ht, {}),
|
|
2241
|
+
e.t("image-panel.crop.start")
|
|
1969
2242
|
] }),
|
|
1970
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ v(st, { value: a, options: u, onChange: l })
|
|
1971
2244
|
] })
|
|
1972
2245
|
]
|
|
1973
2246
|
}
|
|
1974
2247
|
);
|
|
1975
|
-
},
|
|
1976
|
-
const r =
|
|
2248
|
+
}, Ar = (i) => {
|
|
2249
|
+
const r = A(re), e = A(ue), t = A(te), { drawings: n, hasArrange: s = !0, hasTransform: a = !0, hasAlign: o = !0, hasCropper: c = !0, hasGroup: u = !0 } = i, l = n[0];
|
|
1977
2250
|
if (l == null)
|
|
1978
2251
|
return;
|
|
1979
|
-
const { unitId: g } = l, d =
|
|
2252
|
+
const { unitId: g } = l, d = e.getRenderById(g), f = d == null ? void 0 : d.scene;
|
|
1980
2253
|
if (f == null)
|
|
1981
2254
|
return;
|
|
1982
|
-
const
|
|
2255
|
+
const w = f.getTransformerByCreate(), [h, p] = j(!0), [C, _] = j(!0), [b, R] = j(!1), [T, S] = j(!0), [I, y] = j(!1);
|
|
1983
2256
|
return we(() => {
|
|
1984
|
-
const O =
|
|
1985
|
-
|
|
1986
|
-
}), M =
|
|
1987
|
-
const { objects:
|
|
1988
|
-
|
|
1989
|
-
}), N = r.focus$.subscribe((
|
|
1990
|
-
|
|
2257
|
+
const O = w.clearControl$.subscribe((B) => {
|
|
2258
|
+
B === !0 && (p(!1), _(!1), R(!1), S(!1), y(!0));
|
|
2259
|
+
}), M = w.changeStart$.subscribe((B) => {
|
|
2260
|
+
const { objects: W } = B, K = Le(W, r);
|
|
2261
|
+
K.length === 0 ? (p(!1), _(!1), R(!1), S(!1), y(!0)) : K.length === 1 ? (p(!0), _(!0), R(!1), S(!0), y(!1)) : (p(!0), _(!1), R(!0), S(!1), y(!1));
|
|
2262
|
+
}), N = r.focus$.subscribe((B) => {
|
|
2263
|
+
B.length === 0 ? (p(!1), _(!1), R(!1), S(!1), y(!0)) : B.length === 1 ? (p(!0), _(!0), R(!1), S(!0), y(!1)) : (p(!0), _(!1), R(!0), S(!1), y(!1));
|
|
1991
2264
|
});
|
|
1992
2265
|
return () => {
|
|
1993
2266
|
M.unsubscribe(), O.unsubscribe(), N.unsubscribe();
|
|
1994
2267
|
};
|
|
1995
|
-
}, []), /* @__PURE__ */ P(
|
|
1996
|
-
/* @__PURE__ */
|
|
2268
|
+
}, []), /* @__PURE__ */ P(Ht, { children: [
|
|
2269
|
+
/* @__PURE__ */ v(
|
|
1997
2270
|
"div",
|
|
1998
2271
|
{
|
|
1999
|
-
className:
|
|
2272
|
+
className: Q("univer-h-full", {
|
|
2000
2273
|
"univer-hidden": !I
|
|
2001
2274
|
}),
|
|
2002
|
-
children: /* @__PURE__ */
|
|
2275
|
+
children: /* @__PURE__ */ v("div", { className: "univer-flex univer-h-full univer-items-center univer-justify-center", children: /* @__PURE__ */ v("span", { children: t.t("image-panel.null") }) })
|
|
2003
2276
|
}
|
|
2004
2277
|
),
|
|
2005
|
-
/* @__PURE__ */
|
|
2006
|
-
/* @__PURE__ */
|
|
2007
|
-
/* @__PURE__ */
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
/* @__PURE__ */
|
|
2278
|
+
/* @__PURE__ */ v(yr, { arrangeShow: s === !0 ? h : !1, drawings: n }),
|
|
2279
|
+
/* @__PURE__ */ v(Rr, { transformShow: a === !0 ? C : !1, drawings: n }),
|
|
2280
|
+
/* @__PURE__ */ v(Ir, { alignShow: o === !0 ? b : !1, drawings: n }),
|
|
2281
|
+
/* @__PURE__ */ v(Or, { cropperShow: c === !0 ? T : !1, drawings: n }),
|
|
2282
|
+
/* @__PURE__ */ v(Mr, { hasGroup: u, drawings: n })
|
|
2010
2283
|
] });
|
|
2011
2284
|
};
|
|
2012
2285
|
export {
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2286
|
+
Pe as AutoImageCropOperation,
|
|
2287
|
+
Xt as COMPONENT_IMAGE_POPUP_MENU,
|
|
2288
|
+
oe as CloseImageCropOperation,
|
|
2289
|
+
Ar as DrawingCommonPanel,
|
|
2017
2290
|
Ue as DrawingRenderService,
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2291
|
+
Ie as ImageCropperObject,
|
|
2292
|
+
lr as ImagePopupMenu,
|
|
2293
|
+
ut as ImageResetSizeOperation,
|
|
2294
|
+
Ze as OpenImageCropOperation,
|
|
2295
|
+
ze as SetDrawingAlignOperation,
|
|
2296
|
+
nt as UniverDrawingUIPlugin,
|
|
2297
|
+
Le as getUpdateParams
|
|
2025
2298
|
};
|