@univerjs/drawing-ui 0.7.0-beta.0 → 0.7.0-nightly.202504301607
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 +15 -2
- package/lib/es/index.js +1105 -1071
- package/lib/index.css +1 -1
- package/lib/index.js +1105 -1071
- package/lib/types/views/utils/classnames.d.ts +18 -0
- package/lib/umd/index.js +15 -2
- package/package.json +8 -8
- package/LICENSE +0 -176
package/lib/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UniverInstanceType as
|
|
5
|
-
import { getDrawingShapeKeyByDrawingSearch as
|
|
6
|
-
import { Group as
|
|
7
|
-
import { IDialogService as
|
|
8
|
-
import { jsxs as
|
|
9
|
-
import { useState as
|
|
10
|
-
import {
|
|
11
|
-
import { switchMap as
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
1
|
+
var Pt = Object.defineProperty;
|
|
2
|
+
var jt = (i, r, t) => r in i ? Pt(i, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[r] = t;
|
|
3
|
+
var te = (i, r, t) => jt(i, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { UniverInstanceType as Ee, DrawingTypeEnum as re, CommandType as Se, ICommandService as he, LocaleService as ie, ArrangeTypeEnum as Ie, Tools as Bt, debounce as Me, Inject as ke, Disposable as Ve, checkIfMove as ct, toDisposable as _e, IUniverInstanceService as Ze, ImageSourceType as qe, Injector as Ut, IConfigService as xt, Plugin as At, merge as Ht } from "@univerjs/core";
|
|
5
|
+
import { getDrawingShapeKeyByDrawingSearch as W, ImageSourceType as Lt, IDrawingManagerService as ae, IImageIoService as lt, SetDrawingSelectedOperation as Te } from "@univerjs/drawing";
|
|
6
|
+
import { Group as Ce, DRAWING_OBJECT_LAYER_INDEX as Pe, Image as Ke, Rect as dt, IRenderManagerService as me, getGroupState as kt, transformObjectOutOfGroup as Vt, RENDER_CLASS_TYPE as Qe, Shape as Wt, Canvas as Gt, precisionTo as Re, CURSOR_TYPE as je, Vector2 as $e, degToRad as et } from "@univerjs/engine-render";
|
|
7
|
+
import { IDialogService as ut, useDependency as k, ComponentManager as $t, IMessageService as zt } from "@univerjs/ui";
|
|
8
|
+
import { jsxs as P, jsx as g, Fragment as Ft } from "react/jsx-runtime";
|
|
9
|
+
import { useState as L, forwardRef as X, useRef as gt, createElement as J, useEffect as be } from "react";
|
|
10
|
+
import { Select as ht, Button as ue, clsx as Y, InputNumber as we, Checkbox as Kt, DropdownMenu as Yt, MessageType as tt } from "@univerjs/design";
|
|
11
|
+
import { switchMap as Zt, of as Xt } from "rxjs";
|
|
12
|
+
function rt(i, r, t, e) {
|
|
13
|
+
const n = e.getDrawingByParam(i);
|
|
14
|
+
if (n == null)
|
|
15
15
|
return;
|
|
16
|
-
const
|
|
17
|
-
if (a && !(a instanceof
|
|
16
|
+
const s = W(i), a = t.getObject(s);
|
|
17
|
+
if (a && !(a instanceof Ce))
|
|
18
18
|
return;
|
|
19
19
|
if (a != null) {
|
|
20
|
-
a.addObject(
|
|
20
|
+
a.addObject(r);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const { transform: c } =
|
|
26
|
-
c &&
|
|
23
|
+
const o = new Ce(s);
|
|
24
|
+
t.addObject(o, Pe).attachTransformerTo(o), o.addObject(r);
|
|
25
|
+
const { transform: c } = n;
|
|
26
|
+
c && o.transformByState(
|
|
27
27
|
{
|
|
28
28
|
left: c.left,
|
|
29
29
|
top: c.top,
|
|
@@ -31,208 +31,196 @@ function en(i, t, n, e) {
|
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
var
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
34
|
+
function ft(i, r) {
|
|
35
|
+
var s;
|
|
36
|
+
const t = r ? i.getUnit(r) : i.getFocusedUnit();
|
|
37
|
+
if (t == null)
|
|
38
38
|
return;
|
|
39
|
-
const e =
|
|
40
|
-
let
|
|
41
|
-
return
|
|
39
|
+
const e = t.getUnitId();
|
|
40
|
+
let n;
|
|
41
|
+
return t.type === Ee.UNIVER_SHEET ? n = (s = t.getActiveSheet()) == null ? void 0 : s.getSheetId() : (t.type === Ee.UNIVER_DOC || t.type === Ee.UNIVER_SLIDE) && (n = e), { unitId: e, subUnitId: n, current: t };
|
|
42
42
|
}
|
|
43
|
-
const
|
|
44
|
-
var
|
|
45
|
-
for (var
|
|
46
|
-
(a = i[
|
|
47
|
-
return
|
|
48
|
-
},
|
|
49
|
-
const
|
|
50
|
-
let
|
|
51
|
-
constructor(i,
|
|
52
|
-
this._drawingManagerService = i, this._imageIoService =
|
|
43
|
+
const mt = "COMPONENT_IMAGE_VIEWER";
|
|
44
|
+
var Jt = Object.getOwnPropertyDescriptor, qt = (i, r, t, e) => {
|
|
45
|
+
for (var n = e > 1 ? void 0 : e ? Jt(r, t) : r, s = i.length - 1, a; s >= 0; s--)
|
|
46
|
+
(a = i[s]) && (n = a(n) || n);
|
|
47
|
+
return n;
|
|
48
|
+
}, ze = (i, r) => (t, e) => r(t, e, i);
|
|
49
|
+
const nt = 50;
|
|
50
|
+
let Be = class {
|
|
51
|
+
constructor(i, r, t) {
|
|
52
|
+
this._drawingManagerService = i, this._imageIoService = r, this._dialogService = t;
|
|
53
53
|
}
|
|
54
54
|
// eslint-disable-next-line max-lines-per-function
|
|
55
|
-
async renderImages(i,
|
|
55
|
+
async renderImages(i, r) {
|
|
56
56
|
const {
|
|
57
|
-
transform:
|
|
57
|
+
transform: t,
|
|
58
58
|
drawingType: e,
|
|
59
|
-
source:
|
|
60
|
-
imageSourceType:
|
|
59
|
+
source: n,
|
|
60
|
+
imageSourceType: s,
|
|
61
61
|
srcRect: a,
|
|
62
|
-
prstGeom:
|
|
62
|
+
prstGeom: o,
|
|
63
63
|
groupId: c,
|
|
64
64
|
unitId: l,
|
|
65
|
-
subUnitId:
|
|
66
|
-
drawingId:
|
|
65
|
+
subUnitId: d,
|
|
66
|
+
drawingId: u,
|
|
67
67
|
isMultiTransform: h,
|
|
68
68
|
transforms: f
|
|
69
69
|
} = i;
|
|
70
|
-
if (e !==
|
|
70
|
+
if (e !== re.DRAWING_IMAGE || !this._drawingManagerService.getDrawingVisible() || t == null)
|
|
71
71
|
return;
|
|
72
|
-
const
|
|
73
|
-
for (const
|
|
74
|
-
const { left:
|
|
75
|
-
if (
|
|
76
|
-
|
|
72
|
+
const w = h && f ? f : [t], v = [];
|
|
73
|
+
for (const m of w) {
|
|
74
|
+
const { left: C, top: _, width: R, height: b, angle: N, flipX: I, flipY: S, skewX: y, skewY: M } = m, O = w.indexOf(m), j = W({ unitId: l, subUnitId: d, drawingId: u }, h ? O : void 0), E = r.getObject(j);
|
|
75
|
+
if (E != null) {
|
|
76
|
+
E.transformByState({ left: C, top: _, width: R, height: b, angle: N, flipX: I, flipY: S, skewX: y, skewY: M });
|
|
77
77
|
continue;
|
|
78
78
|
}
|
|
79
|
-
const
|
|
80
|
-
let
|
|
81
|
-
if (
|
|
82
|
-
|
|
79
|
+
const se = this._drawingManagerService.getDrawingOrder(l, d), G = se.indexOf(u), Q = { ...m, zIndex: G === -1 ? se.length - 1 : G }, ye = this._imageIoService.getImageSourceCache(n, s);
|
|
80
|
+
let oe = !1;
|
|
81
|
+
if (ye != null)
|
|
82
|
+
Q.image = ye;
|
|
83
83
|
else {
|
|
84
|
-
if (
|
|
84
|
+
if (s === Lt.UUID)
|
|
85
85
|
try {
|
|
86
|
-
|
|
87
|
-
} catch (
|
|
88
|
-
console.error(
|
|
86
|
+
Q.url = await this._imageIoService.getImage(n);
|
|
87
|
+
} catch (Ge) {
|
|
88
|
+
console.error(Ge);
|
|
89
89
|
continue;
|
|
90
90
|
}
|
|
91
91
|
else
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
Q.url = n;
|
|
93
|
+
oe = !0;
|
|
94
94
|
}
|
|
95
|
-
if (
|
|
95
|
+
if (r.getObject(j))
|
|
96
96
|
continue;
|
|
97
|
-
|
|
98
|
-
const z = new
|
|
99
|
-
|
|
97
|
+
Q.printable = !0;
|
|
98
|
+
const z = new Ke(j, Q);
|
|
99
|
+
oe && this._imageIoService.addImageSourceCache(n, s, z.getNative()), this._drawingManagerService.getDrawingVisible() && (r.addObject(z, Pe), this._drawingManagerService.getDrawingEditable() && r.attachTransformerTo(z), c && rt({ drawingId: c, unitId: l, subUnitId: d }, z, r, this._drawingManagerService), o != null && z.setPrstGeom(o), a != null && z.setSrcRect(a), v.push(z));
|
|
100
100
|
}
|
|
101
|
-
return
|
|
101
|
+
return v;
|
|
102
102
|
}
|
|
103
|
-
renderFloatDom(i,
|
|
103
|
+
renderFloatDom(i, r) {
|
|
104
104
|
const {
|
|
105
|
-
transform:
|
|
105
|
+
transform: t,
|
|
106
106
|
drawingType: e,
|
|
107
|
-
groupId:
|
|
108
|
-
unitId:
|
|
107
|
+
groupId: n,
|
|
108
|
+
unitId: s,
|
|
109
109
|
subUnitId: a,
|
|
110
|
-
drawingId:
|
|
110
|
+
drawingId: o,
|
|
111
111
|
isMultiTransform: c,
|
|
112
112
|
transforms: l
|
|
113
113
|
} = i;
|
|
114
|
-
if (e !==
|
|
114
|
+
if (e !== re.DRAWING_DOM || !this._drawingManagerService.getDrawingVisible() || t == null)
|
|
115
115
|
return;
|
|
116
|
-
const
|
|
117
|
-
for (const h of
|
|
118
|
-
const { left: f, top:
|
|
116
|
+
const d = c && l ? l : [t], u = [];
|
|
117
|
+
for (const h of d) {
|
|
118
|
+
const { left: f, top: w, width: v, height: m, angle: C, flipX: _, flipY: R, skewX: b, skewY: N } = h, I = d.indexOf(h), S = W({ unitId: s, subUnitId: a, drawingId: o }, c ? I : void 0), y = r.getObject(S);
|
|
119
119
|
if (y != null) {
|
|
120
|
-
y.transformByState({ left: f, top:
|
|
120
|
+
y.transformByState({ left: f, top: w, width: v, height: m, angle: C, flipX: _, flipY: R, skewX: b, skewY: N });
|
|
121
121
|
continue;
|
|
122
122
|
}
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
123
|
+
const M = this._drawingManagerService.getDrawingOrder(s, a), O = M.indexOf(o), j = { ...h, zIndex: O === -1 ? M.length - 1 : O };
|
|
124
|
+
if (r.getObject(S))
|
|
125
125
|
continue;
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
this._drawingManagerService.getDrawingVisible() && (
|
|
126
|
+
j.printable = !1;
|
|
127
|
+
const E = new dt(S, j);
|
|
128
|
+
this._drawingManagerService.getDrawingVisible() && (r.addObject(E, Pe), this._drawingManagerService.getDrawingEditable() && i.allowTransform !== !1 && r.attachTransformerTo(E), n && rt({ drawingId: n, unitId: s, subUnitId: a }, E, r, this._drawingManagerService), u.push(E));
|
|
129
129
|
}
|
|
130
|
-
return
|
|
131
|
-
}
|
|
132
|
-
renderDrawing(i,
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
switch (
|
|
136
|
-
case
|
|
137
|
-
return this.renderImages(
|
|
130
|
+
return u;
|
|
131
|
+
}
|
|
132
|
+
renderDrawing(i, r) {
|
|
133
|
+
const t = this._drawingManagerService.getDrawingByParam(i);
|
|
134
|
+
if (t != null)
|
|
135
|
+
switch (t.drawingType) {
|
|
136
|
+
case re.DRAWING_IMAGE:
|
|
137
|
+
return this.renderImages(t, r);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
previewImage(i,
|
|
141
|
-
const
|
|
142
|
-
width: Math.max(
|
|
143
|
-
id:
|
|
140
|
+
previewImage(i, r, t, e) {
|
|
141
|
+
const n = `${i}-viewer-dialog`, s = window.innerWidth - nt, a = window.innerHeight - nt, o = this._adjustImageSize(t, e, s, a), c = this._dialogService.open({
|
|
142
|
+
width: Math.max(o.width, 200),
|
|
143
|
+
id: n,
|
|
144
144
|
children: {
|
|
145
145
|
label: {
|
|
146
|
-
name:
|
|
146
|
+
name: mt,
|
|
147
147
|
props: {
|
|
148
|
-
src:
|
|
149
|
-
width:
|
|
150
|
-
height:
|
|
148
|
+
src: r,
|
|
149
|
+
width: o.width,
|
|
150
|
+
height: o.height
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
154
|
destroyOnClose: !0,
|
|
155
155
|
closable: !1,
|
|
156
156
|
onClose: () => {
|
|
157
|
-
this._dialogService.close(
|
|
157
|
+
this._dialogService.close(n), c.dispose();
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
_adjustImageSize(i,
|
|
162
|
-
if (i <=
|
|
161
|
+
_adjustImageSize(i, r, t, e) {
|
|
162
|
+
if (i <= t && r <= e)
|
|
163
163
|
return {
|
|
164
164
|
width: i,
|
|
165
|
-
height:
|
|
165
|
+
height: r
|
|
166
166
|
};
|
|
167
|
-
const
|
|
167
|
+
const n = t / i, s = e / r, a = Math.min(n, s);
|
|
168
168
|
return {
|
|
169
169
|
width: Math.floor(i * a),
|
|
170
|
-
height: Math.floor(
|
|
170
|
+
height: Math.floor(r * a)
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
],
|
|
179
|
-
function
|
|
180
|
-
const
|
|
174
|
+
Be = qt([
|
|
175
|
+
ze(0, ae),
|
|
176
|
+
ze(1, lt),
|
|
177
|
+
ze(2, ut)
|
|
178
|
+
], Be);
|
|
179
|
+
function We(i, r) {
|
|
180
|
+
const t = [];
|
|
181
181
|
return i.forEach((e) => {
|
|
182
|
-
const { oKey:
|
|
183
|
-
if (
|
|
184
|
-
return
|
|
185
|
-
const { unitId:
|
|
186
|
-
unitId:
|
|
182
|
+
const { oKey: n, left: s, top: a, height: o, width: c, angle: l } = e, d = r.getDrawingOKey(n);
|
|
183
|
+
if (d == null)
|
|
184
|
+
return t.push(null), !0;
|
|
185
|
+
const { unitId: u, subUnitId: h, drawingId: f, drawingType: w } = d, v = {
|
|
186
|
+
unitId: u,
|
|
187
187
|
subUnitId: h,
|
|
188
188
|
drawingId: f,
|
|
189
|
-
drawingType:
|
|
189
|
+
drawingType: w,
|
|
190
190
|
transform: {
|
|
191
|
-
left:
|
|
191
|
+
left: s,
|
|
192
192
|
top: a,
|
|
193
|
-
height:
|
|
193
|
+
height: o,
|
|
194
194
|
width: c,
|
|
195
195
|
angle: l
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
|
-
|
|
199
|
-
}),
|
|
198
|
+
w === re.DRAWING_IMAGE && (v.srcRect = e.srcRect), t.push(v);
|
|
199
|
+
}), t;
|
|
200
200
|
}
|
|
201
201
|
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 || {});
|
|
202
|
-
const
|
|
202
|
+
const Xe = {
|
|
203
203
|
id: "sheet.operation.set-image-align",
|
|
204
|
-
type:
|
|
205
|
-
handler: (i,
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
imageCommonPanelBorder: et,
|
|
209
|
-
imageCommonPanelTitle: nt,
|
|
210
|
-
imageCommonPanelRow: tt,
|
|
211
|
-
imageCommonPanelRowVertical: rt,
|
|
212
|
-
imageCommonPanelColumn: it,
|
|
213
|
-
imageCommonPanelColumnCenter: at,
|
|
214
|
-
imageCommonPanelInline: ot,
|
|
215
|
-
imageCommonPanelSpan2: st,
|
|
216
|
-
imageCommonPanelSpan3: ct,
|
|
217
|
-
imageCommonPanelInput: lt
|
|
218
|
-
}, gt = (i) => {
|
|
219
|
-
const t = k(me), n = k(te), { alignShow: e } = i, [r, o] = x(D.default), a = [
|
|
204
|
+
type: Se.OPERATION,
|
|
205
|
+
handler: (i, r) => !0
|
|
206
|
+
}, Qt = (i) => {
|
|
207
|
+
const r = k(he), t = k(ie), { alignShow: e } = i, [n, s] = L(D.default), a = [
|
|
220
208
|
{
|
|
221
|
-
label:
|
|
209
|
+
label: t.t("image-panel.align.default"),
|
|
222
210
|
value: D.default
|
|
223
211
|
},
|
|
224
212
|
{
|
|
225
213
|
options: [
|
|
226
214
|
{
|
|
227
|
-
label:
|
|
215
|
+
label: t.t("image-panel.align.left"),
|
|
228
216
|
value: D.left
|
|
229
217
|
},
|
|
230
218
|
{
|
|
231
|
-
label:
|
|
219
|
+
label: t.t("image-panel.align.center"),
|
|
232
220
|
value: D.center
|
|
233
221
|
},
|
|
234
222
|
{
|
|
235
|
-
label:
|
|
223
|
+
label: t.t("image-panel.align.right"),
|
|
236
224
|
value: D.right
|
|
237
225
|
}
|
|
238
226
|
]
|
|
@@ -240,15 +228,15 @@ const Ye = {
|
|
|
240
228
|
{
|
|
241
229
|
options: [
|
|
242
230
|
{
|
|
243
|
-
label:
|
|
231
|
+
label: t.t("image-panel.align.top"),
|
|
244
232
|
value: D.top
|
|
245
233
|
},
|
|
246
234
|
{
|
|
247
|
-
label:
|
|
235
|
+
label: t.t("image-panel.align.middle"),
|
|
248
236
|
value: D.middle
|
|
249
237
|
},
|
|
250
238
|
{
|
|
251
|
-
label:
|
|
239
|
+
label: t.t("image-panel.align.bottom"),
|
|
252
240
|
value: D.bottom
|
|
253
241
|
}
|
|
254
242
|
]
|
|
@@ -256,621 +244,667 @@ const Ye = {
|
|
|
256
244
|
{
|
|
257
245
|
options: [
|
|
258
246
|
{
|
|
259
|
-
label:
|
|
247
|
+
label: t.t("image-panel.align.horizon"),
|
|
260
248
|
value: D.horizon
|
|
261
249
|
},
|
|
262
250
|
{
|
|
263
|
-
label:
|
|
251
|
+
label: t.t("image-panel.align.vertical"),
|
|
264
252
|
value: D.vertical
|
|
265
253
|
}
|
|
266
254
|
]
|
|
267
255
|
}
|
|
268
256
|
];
|
|
269
|
-
function
|
|
270
|
-
|
|
257
|
+
function o(l) {
|
|
258
|
+
s(l), r.executeCommand(Xe.id, {
|
|
271
259
|
alignType: l
|
|
272
260
|
});
|
|
273
261
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
262
|
+
return /* @__PURE__ */ P(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
className: `
|
|
266
|
+
univer-relative univer-w-full univer-border-l-0 univer-border-r-0 univer-border-t univer-border-solid
|
|
267
|
+
univer-border-gray-200
|
|
268
|
+
`,
|
|
269
|
+
style: { display: ((l) => l ? "block" : "none")(e) },
|
|
270
|
+
children: [
|
|
271
|
+
/* @__PURE__ */ g(
|
|
272
|
+
"div",
|
|
273
|
+
{
|
|
274
|
+
className: `
|
|
275
|
+
univer-relative univer-mt-2.5 univer-flex univer-h-full univer-items-start univer-justify-start
|
|
276
|
+
`,
|
|
277
|
+
children: /* @__PURE__ */ g("div", { className: "univer-w-full univer-text-gray-900", children: /* @__PURE__ */ g("div", { children: t.t("image-panel.align.title") }) })
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
/* @__PURE__ */ g(
|
|
281
|
+
"div",
|
|
282
|
+
{
|
|
283
|
+
className: `
|
|
284
|
+
univer-relative univer-mt-2.5 univer-flex univer-h-full univer-items-start univer-justify-start
|
|
285
|
+
`,
|
|
286
|
+
children: /* @__PURE__ */ g("div", { className: "univer-w-full univer-text-gray-900", children: /* @__PURE__ */ g(ht, { value: n, options: a, onChange: o }) })
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
);
|
|
279
292
|
};
|
|
280
293
|
var $ = function() {
|
|
281
294
|
return $ = Object.assign || function(i) {
|
|
282
|
-
for (var
|
|
283
|
-
|
|
284
|
-
for (var
|
|
295
|
+
for (var r, t = 1, e = arguments.length; t < e; t++) {
|
|
296
|
+
r = arguments[t];
|
|
297
|
+
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (i[n] = r[n]);
|
|
285
298
|
}
|
|
286
299
|
return i;
|
|
287
300
|
}, $.apply(this, arguments);
|
|
288
|
-
},
|
|
289
|
-
var
|
|
290
|
-
for (var e in i) Object.prototype.hasOwnProperty.call(i, e) &&
|
|
301
|
+
}, er = function(i, r) {
|
|
302
|
+
var t = {};
|
|
303
|
+
for (var e in i) Object.prototype.hasOwnProperty.call(i, e) && r.indexOf(e) < 0 && (t[e] = i[e]);
|
|
291
304
|
if (i != null && typeof Object.getOwnPropertySymbols == "function")
|
|
292
|
-
for (var
|
|
293
|
-
|
|
294
|
-
return
|
|
295
|
-
},
|
|
296
|
-
var
|
|
297
|
-
return
|
|
305
|
+
for (var n = 0, e = Object.getOwnPropertySymbols(i); n < e.length; n++)
|
|
306
|
+
r.indexOf(e[n]) < 0 && Object.prototype.propertyIsEnumerable.call(i, e[n]) && (t[e[n]] = i[e[n]]);
|
|
307
|
+
return t;
|
|
308
|
+
}, q = X(function(i, r) {
|
|
309
|
+
var t = i.icon, e = i.id, n = i.className, s = i.extend, a = er(i, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(e, " ").concat(n || "").trim(), c = gt("_".concat(nr()));
|
|
310
|
+
return pt(t, "".concat(e), { defIds: t.defIds, idSuffix: c.current }, $({ ref: r, className: o }, a), s);
|
|
298
311
|
});
|
|
299
|
-
function
|
|
300
|
-
return
|
|
301
|
-
return
|
|
312
|
+
function pt(i, r, t, e, n) {
|
|
313
|
+
return J(i.tag, $($({ key: r }, tr(i, t, n)), e), (rr(i, t).children || []).map(function(s, a) {
|
|
314
|
+
return pt(s, "".concat(r, "-").concat(i.tag, "-").concat(a), t, void 0, n);
|
|
302
315
|
}));
|
|
303
316
|
}
|
|
304
|
-
function
|
|
317
|
+
function tr(i, r, t) {
|
|
305
318
|
var e = $({}, i.attrs);
|
|
306
|
-
|
|
307
|
-
var a =
|
|
308
|
-
a === "mask" && typeof
|
|
319
|
+
t != null && t.colorChannel1 && e.fill === "colorChannel1" && (e.fill = t.colorChannel1), i.tag === "mask" && e.id && (e.id = e.id + r.idSuffix), Object.entries(e).forEach(function(s) {
|
|
320
|
+
var a = s[0], o = s[1];
|
|
321
|
+
a === "mask" && typeof o == "string" && (e[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(r.idSuffix, ")")));
|
|
309
322
|
});
|
|
310
|
-
var
|
|
311
|
-
return !
|
|
312
|
-
var a =
|
|
313
|
-
typeof
|
|
323
|
+
var n = r.defIds;
|
|
324
|
+
return !n || n.length === 0 || (i.tag === "use" && e["xlink:href"] && (e["xlink:href"] = e["xlink:href"] + r.idSuffix), Object.entries(e).forEach(function(s) {
|
|
325
|
+
var a = s[0], o = s[1];
|
|
326
|
+
typeof o == "string" && (e[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(r.idSuffix, ")")));
|
|
314
327
|
})), e;
|
|
315
328
|
}
|
|
316
|
-
function
|
|
317
|
-
var
|
|
318
|
-
return !e || e.length === 0 ? i : i.tag === "defs" && (!((
|
|
319
|
-
return typeof
|
|
329
|
+
function rr(i, r) {
|
|
330
|
+
var t, e = r.defIds;
|
|
331
|
+
return !e || e.length === 0 ? i : i.tag === "defs" && (!((t = i.children) === null || t === void 0) && t.length) ? $($({}, i), { children: i.children.map(function(n) {
|
|
332
|
+
return typeof n.attrs.id == "string" && e && e.indexOf(n.attrs.id) > -1 ? $($({}, n), { attrs: $($({}, n.attrs), { id: n.attrs.id + r.idSuffix }) }) : n;
|
|
320
333
|
}) }) : i;
|
|
321
334
|
}
|
|
322
|
-
function
|
|
335
|
+
function nr() {
|
|
323
336
|
return Math.random().toString(36).substring(2, 8);
|
|
324
337
|
}
|
|
325
|
-
|
|
326
|
-
var
|
|
327
|
-
return
|
|
338
|
+
q.displayName = "UniverIcon";
|
|
339
|
+
var ir = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "colorChannel1", 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" } }, { tag: "path", attrs: { fill: "currentColor", 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.56377zM2.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.83647zM9.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", fillRule: "evenodd", clipRule: "evenodd" } }] }, vt = X(function(i, r) {
|
|
340
|
+
return J(q, Object.assign({}, i, {
|
|
328
341
|
id: "autofill",
|
|
329
|
-
ref:
|
|
330
|
-
icon:
|
|
342
|
+
ref: r,
|
|
343
|
+
icon: ir
|
|
331
344
|
}));
|
|
332
345
|
});
|
|
333
|
-
|
|
334
|
-
var
|
|
335
|
-
return
|
|
346
|
+
vt.displayName = "Autofill";
|
|
347
|
+
var ar = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.0045 4.4334C14.8881 4.4334 15.6045 3.71705 15.6045 2.8334 15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334 2.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.8334 3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334zM14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999 15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999 2.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.9999 3.45439 6.77899 3.63348 6.5999 3.85439 6.5999H14.1544C14.3753 6.5999 14.5544 6.77899 14.5544 6.9999z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M8.57975 14.5902L6.58023 12.5907C6.34591 12.3564 6.34591 11.9765 6.58023 11.7421 6.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.56641 9.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.7421 11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946 8.64077 14.6502 8.70566 14.6923 8.77482 14.7209 8.84557 14.7502 8.92314 14.7664 9.00449 14.7664 9.08585 14.7664 9.16342 14.7502 9.23416 14.7209 9.30332 14.6923 9.36821 14.6502 9.42482 14.5946" } }] }, wt = X(function(i, r) {
|
|
348
|
+
return J(q, Object.assign({}, i, {
|
|
336
349
|
id: "bottom-single",
|
|
337
|
-
ref:
|
|
338
|
-
icon:
|
|
350
|
+
ref: r,
|
|
351
|
+
icon: ar
|
|
339
352
|
}));
|
|
340
353
|
});
|
|
341
|
-
|
|
342
|
-
var
|
|
343
|
-
return
|
|
354
|
+
wt.displayName = "BottomSingle";
|
|
355
|
+
var sr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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.51296 9.08632 7.84433 8.81769 8.11296 8.48632 8.11296H6.57705C6.24568 8.11296 5.97705 7.84433 5.97705 7.51296zM6.57705 9.41028C6.24568 9.41028 5.97705 9.67891 5.97705 10.0103 5.97705 10.3416 6.24568 10.6103 6.57705 10.6103H10.8199C11.1512 10.6103 11.4199 10.3416 11.4199 10.0103 11.4199 9.67891 11.1512 9.41028 10.8199 9.41028H6.57705z" } }, { tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", 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" } }] }, _t = X(function(i, r) {
|
|
356
|
+
return J(q, Object.assign({}, i, {
|
|
344
357
|
id: "create-copy-single",
|
|
345
|
-
ref:
|
|
346
|
-
icon:
|
|
358
|
+
ref: r,
|
|
359
|
+
icon: sr
|
|
347
360
|
}));
|
|
348
361
|
});
|
|
349
|
-
|
|
350
|
-
var
|
|
351
|
-
return
|
|
362
|
+
_t.displayName = "CreateCopySingle";
|
|
363
|
+
var or = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ct = X(function(i, r) {
|
|
364
|
+
return J(q, Object.assign({}, i, {
|
|
352
365
|
id: "group-single",
|
|
353
|
-
ref:
|
|
354
|
-
icon:
|
|
366
|
+
ref: r,
|
|
367
|
+
icon: or
|
|
355
368
|
}));
|
|
356
369
|
});
|
|
357
|
-
|
|
358
|
-
var
|
|
359
|
-
return
|
|
370
|
+
Ct.displayName = "GroupSingle";
|
|
371
|
+
var cr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }] }, St = X(function(i, r) {
|
|
372
|
+
return J(q, Object.assign({}, i, {
|
|
360
373
|
id: "more-down-single",
|
|
361
|
-
ref:
|
|
362
|
-
icon:
|
|
374
|
+
ref: r,
|
|
375
|
+
icon: cr
|
|
363
376
|
}));
|
|
364
377
|
});
|
|
365
|
-
|
|
366
|
-
var
|
|
367
|
-
return
|
|
378
|
+
St.displayName = "MoreDownSingle";
|
|
379
|
+
var lr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", 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" } }] }, bt = X(function(i, r) {
|
|
380
|
+
return J(q, Object.assign({}, i, {
|
|
368
381
|
id: "move-down-single",
|
|
369
|
-
ref:
|
|
370
|
-
icon:
|
|
382
|
+
ref: r,
|
|
383
|
+
icon: lr
|
|
371
384
|
}));
|
|
372
385
|
});
|
|
373
|
-
|
|
374
|
-
var
|
|
375
|
-
return
|
|
386
|
+
bt.displayName = "MoveDownSingle";
|
|
387
|
+
var dr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", 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" } }] }, yt = X(function(i, r) {
|
|
388
|
+
return J(q, Object.assign({}, i, {
|
|
376
389
|
id: "move-up-single",
|
|
377
|
-
ref:
|
|
378
|
-
icon:
|
|
390
|
+
ref: r,
|
|
391
|
+
icon: dr
|
|
379
392
|
}));
|
|
380
393
|
});
|
|
381
|
-
|
|
382
|
-
var
|
|
383
|
-
return
|
|
394
|
+
yt.displayName = "MoveUpSingle";
|
|
395
|
+
var ur = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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" } }, { tag: "path", attrs: { fill: "currentColor", 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 9 15.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 9 2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9 13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439zM1.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.1665 15.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.1665 2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665 13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543z", fillRule: "evenodd", clipRule: "evenodd" } }] }, It = X(function(i, r) {
|
|
396
|
+
return J(q, Object.assign({}, i, {
|
|
384
397
|
id: "topmost-single",
|
|
385
|
-
ref:
|
|
386
|
-
icon:
|
|
398
|
+
ref: r,
|
|
399
|
+
icon: ur
|
|
387
400
|
}));
|
|
388
401
|
});
|
|
389
|
-
|
|
390
|
-
var
|
|
391
|
-
return
|
|
402
|
+
It.displayName = "TopmostSingle";
|
|
403
|
+
var gr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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" } }, { tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }] }, Mt = X(function(i, r) {
|
|
404
|
+
return J(q, Object.assign({}, i, {
|
|
392
405
|
id: "ungroup-single",
|
|
393
|
-
ref:
|
|
394
|
-
icon:
|
|
406
|
+
ref: r,
|
|
407
|
+
icon: gr
|
|
395
408
|
}));
|
|
396
409
|
});
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
const { arrangeShow:
|
|
400
|
-
|
|
401
|
-
const l =
|
|
402
|
-
|
|
410
|
+
Mt.displayName = "UngroupSingle";
|
|
411
|
+
const U = "univer-relative univer-mt-2.5 univer-flex univer-h-full univer-items-start univer-justify-between univer-gap-2 univer-flex-no-wrap", B = "univer-w-full univer-text-left univer-text-gray-400", ne = "univer-flex univer-items-center univer-gap-1", hr = (i) => {
|
|
412
|
+
const { arrangeShow: r, drawings: t } = i, e = k(ie), n = k(ae), s = (l) => l ? "block" : "none", [a, o] = L(t);
|
|
413
|
+
be(() => {
|
|
414
|
+
const l = n.focus$.subscribe((d) => {
|
|
415
|
+
o(d);
|
|
403
416
|
});
|
|
404
417
|
return () => {
|
|
405
418
|
l.unsubscribe();
|
|
406
419
|
};
|
|
407
420
|
}, []);
|
|
408
421
|
const c = (l) => {
|
|
409
|
-
const
|
|
410
|
-
|
|
422
|
+
const d = a[0].unitId, u = a[0].subUnitId, h = a.map((f) => f.drawingId);
|
|
423
|
+
n.featurePluginOrderUpdateNotification({ unitId: d, subUnitId: u, drawingIds: h, arrangeType: l });
|
|
411
424
|
};
|
|
412
|
-
return /* @__PURE__ */
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
425
|
+
return /* @__PURE__ */ P(
|
|
426
|
+
"div",
|
|
427
|
+
{
|
|
428
|
+
className: "univer-relative univer-mt-5 univer-w-full",
|
|
429
|
+
style: { display: s(r) },
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: /* @__PURE__ */ g("div", { children: e.t("image-panel.arrange.title") }) }) }),
|
|
432
|
+
/* @__PURE__ */ P("div", { className: U, children: [
|
|
433
|
+
/* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(ue, { onClick: () => {
|
|
434
|
+
c(Ie.forward);
|
|
435
|
+
}, children: /* @__PURE__ */ P("span", { className: ne, children: [
|
|
436
|
+
/* @__PURE__ */ g(yt, {}),
|
|
437
|
+
e.t("image-panel.arrange.forward")
|
|
438
|
+
] }) }) }),
|
|
439
|
+
/* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(ue, { onClick: () => {
|
|
440
|
+
c(Ie.backward);
|
|
441
|
+
}, children: /* @__PURE__ */ P("span", { className: ne, children: [
|
|
442
|
+
/* @__PURE__ */ g(bt, {}),
|
|
443
|
+
e.t("image-panel.arrange.backward")
|
|
444
|
+
] }) }) })
|
|
445
|
+
] }),
|
|
446
|
+
/* @__PURE__ */ P("div", { className: U, children: [
|
|
447
|
+
/* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(ue, { onClick: () => {
|
|
448
|
+
c(Ie.front);
|
|
449
|
+
}, children: /* @__PURE__ */ P("span", { className: ne, children: [
|
|
450
|
+
/* @__PURE__ */ g(It, {}),
|
|
451
|
+
e.t("image-panel.arrange.front")
|
|
452
|
+
] }) }) }),
|
|
453
|
+
/* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(ue, { onClick: () => {
|
|
454
|
+
c(Ie.back);
|
|
455
|
+
}, children: /* @__PURE__ */ P("span", { className: ne, children: [
|
|
456
|
+
/* @__PURE__ */ g(wt, {}),
|
|
457
|
+
e.t("image-panel.arrange.back")
|
|
458
|
+
] }) }) })
|
|
459
|
+
] })
|
|
460
|
+
]
|
|
461
|
+
}
|
|
462
|
+
);
|
|
463
|
+
}, fr = (i) => {
|
|
464
|
+
const r = k(ie), t = k(me), e = k(ae), { hasGroup: n, drawings: s } = i, [a, o] = L(!1), [c, l] = L(!0), [d, u] = L(!0), h = (m) => m ? "block" : "none", f = () => {
|
|
465
|
+
const m = e.getFocusDrawings(), { unitId: C, subUnitId: _ } = m[0], R = Bt.generateRandomId(10), b = kt(0, 0, m.map((S) => S.transform || {})), N = {
|
|
466
|
+
unitId: C,
|
|
447
467
|
subUnitId: _,
|
|
448
|
-
drawingId:
|
|
449
|
-
drawingType:
|
|
450
|
-
transform:
|
|
451
|
-
},
|
|
452
|
-
const y =
|
|
468
|
+
drawingId: R,
|
|
469
|
+
drawingType: re.DRAWING_GROUP,
|
|
470
|
+
transform: b
|
|
471
|
+
}, I = m.map((S) => {
|
|
472
|
+
const y = S.transform || { left: 0, top: 0 }, { unitId: M, subUnitId: O, drawingId: j } = S;
|
|
453
473
|
return {
|
|
454
|
-
unitId:
|
|
474
|
+
unitId: M,
|
|
455
475
|
subUnitId: O,
|
|
456
|
-
drawingId:
|
|
476
|
+
drawingId: j,
|
|
457
477
|
transform: {
|
|
458
478
|
...y,
|
|
459
|
-
left: y.left -
|
|
460
|
-
top: y.top -
|
|
479
|
+
left: y.left - b.left,
|
|
480
|
+
top: y.top - b.top
|
|
461
481
|
},
|
|
462
|
-
groupId:
|
|
482
|
+
groupId: R
|
|
463
483
|
};
|
|
464
484
|
});
|
|
465
485
|
e.featurePluginGroupUpdateNotification([{
|
|
466
486
|
parent: N,
|
|
467
|
-
children:
|
|
487
|
+
children: I
|
|
468
488
|
}]);
|
|
469
|
-
},
|
|
470
|
-
if (
|
|
489
|
+
}, w = (m) => {
|
|
490
|
+
if (m.drawingType !== re.DRAWING_GROUP)
|
|
471
491
|
return;
|
|
472
|
-
const { unitId:
|
|
473
|
-
if (
|
|
492
|
+
const { unitId: C, subUnitId: _, drawingId: R, transform: b = { width: 0, height: 0 } } = m;
|
|
493
|
+
if (b == null)
|
|
474
494
|
return;
|
|
475
|
-
const N = e.getDrawingsByGroup({ unitId:
|
|
495
|
+
const N = e.getDrawingsByGroup({ unitId: C, subUnitId: _, drawingId: R });
|
|
476
496
|
if (N.length === 0)
|
|
477
497
|
return;
|
|
478
|
-
const
|
|
479
|
-
const { transform: y } =
|
|
498
|
+
const I = N.map((S) => {
|
|
499
|
+
const { transform: y } = S, { unitId: M, subUnitId: O, drawingId: j } = S, E = Vt(y || {}, b, b.width || 0, b.height || 0);
|
|
480
500
|
return {
|
|
481
|
-
unitId:
|
|
501
|
+
unitId: M,
|
|
482
502
|
subUnitId: O,
|
|
483
|
-
drawingId:
|
|
503
|
+
drawingId: j,
|
|
484
504
|
transform: {
|
|
485
505
|
...y,
|
|
486
|
-
...
|
|
506
|
+
...E
|
|
487
507
|
},
|
|
488
508
|
groupId: void 0
|
|
489
509
|
};
|
|
490
510
|
});
|
|
491
511
|
return {
|
|
492
|
-
parent:
|
|
493
|
-
children:
|
|
512
|
+
parent: m,
|
|
513
|
+
children: I
|
|
494
514
|
};
|
|
495
|
-
},
|
|
496
|
-
const
|
|
497
|
-
(_) =>
|
|
515
|
+
}, v = () => {
|
|
516
|
+
const C = e.getFocusDrawings().map(
|
|
517
|
+
(_) => w(_)
|
|
498
518
|
).filter((_) => _ != null);
|
|
499
|
-
|
|
519
|
+
C.length !== 0 && e.featurePluginUngroupUpdateNotification(C);
|
|
500
520
|
};
|
|
501
|
-
return
|
|
502
|
-
const
|
|
503
|
-
if (
|
|
521
|
+
return be(() => {
|
|
522
|
+
const m = s[0];
|
|
523
|
+
if (m == null)
|
|
504
524
|
return;
|
|
505
|
-
const { unitId:
|
|
506
|
-
if (
|
|
525
|
+
const { unitId: C } = m, _ = t.getRenderById(C), R = _ == null ? void 0 : _.scene;
|
|
526
|
+
if (R == null)
|
|
507
527
|
return;
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
}),
|
|
511
|
-
const { objects: y } =
|
|
512
|
-
let
|
|
513
|
-
|
|
528
|
+
const b = R.getTransformerByCreate(), N = b.clearControl$.subscribe((S) => {
|
|
529
|
+
S === !0 && o(!1);
|
|
530
|
+
}), I = b.changeStart$.subscribe((S) => {
|
|
531
|
+
const { objects: y } = S, M = We(y, e), O = M.filter((G) => (G == null ? void 0 : G.drawingType) === re.DRAWING_GROUP);
|
|
532
|
+
let j = !1, E = !1;
|
|
533
|
+
M.length > 1 && (j = !0), O.length > 0 && (E = !0), o(j || E), l(j), u(E);
|
|
514
534
|
});
|
|
515
535
|
return () => {
|
|
516
|
-
|
|
536
|
+
I.unsubscribe(), N.unsubscribe();
|
|
517
537
|
};
|
|
518
|
-
}, []), /* @__PURE__ */
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
/* @__PURE__ */
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
/* @__PURE__ */
|
|
523
|
-
|
|
538
|
+
}, []), /* @__PURE__ */ P("div", { className: "univer-relative univer-mt-5 univer-w-full", style: { display: h(n === !0 ? a : !1) }, children: [
|
|
539
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: /* @__PURE__ */ g("div", { children: r.t("image-panel.group.title") }) }) }),
|
|
540
|
+
/* @__PURE__ */ P("div", { className: U, children: [
|
|
541
|
+
/* @__PURE__ */ g("div", { className: Y(ne, "univer-justify-center"), children: /* @__PURE__ */ g(ue, { style: { display: h(c) }, onClick: f, children: /* @__PURE__ */ P("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
|
|
542
|
+
/* @__PURE__ */ g(Ct, {}),
|
|
543
|
+
r.t("image-panel.group.group")
|
|
524
544
|
] }) }) }),
|
|
525
|
-
/* @__PURE__ */
|
|
526
|
-
/* @__PURE__ */
|
|
527
|
-
|
|
545
|
+
/* @__PURE__ */ g("div", { className: Y(ne, "univer-justify-center"), children: /* @__PURE__ */ g(ue, { style: { display: h(d) }, onClick: v, children: /* @__PURE__ */ P("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
|
|
546
|
+
/* @__PURE__ */ g(Mt, {}),
|
|
547
|
+
r.t("image-panel.group.unGroup")
|
|
528
548
|
] }) }) })
|
|
529
549
|
] })
|
|
530
550
|
] });
|
|
531
|
-
},
|
|
532
|
-
var
|
|
533
|
-
const
|
|
551
|
+
}, le = 20, mr = 20, pr = [-3600, 3600], Oe = 300, vr = (i) => {
|
|
552
|
+
var Je;
|
|
553
|
+
const r = k(ie), t = k(ae), e = k(me), { drawings: n, transformShow: s } = i, a = n[0];
|
|
534
554
|
if (a == null)
|
|
535
555
|
return;
|
|
536
|
-
const
|
|
537
|
-
if (
|
|
556
|
+
const o = a.transform;
|
|
557
|
+
if (o == null)
|
|
538
558
|
return;
|
|
539
|
-
const { unitId: c, subUnitId: l, drawingId:
|
|
559
|
+
const { unitId: c, subUnitId: l, drawingId: d, drawingType: u } = a, h = e.getRenderById(c), f = h == null ? void 0 : h.scene;
|
|
540
560
|
if (f == null)
|
|
541
561
|
return;
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
562
|
+
const w = (Je = f.getEngine()) == null ? void 0 : Je.activeScene;
|
|
563
|
+
if (w == null)
|
|
544
564
|
return;
|
|
545
|
-
const
|
|
546
|
-
width:
|
|
547
|
-
height:
|
|
565
|
+
const v = f.getTransformerByCreate(), {
|
|
566
|
+
width: m = 0,
|
|
567
|
+
height: C = 0,
|
|
548
568
|
left: _ = 0,
|
|
549
|
-
top:
|
|
550
|
-
angle:
|
|
551
|
-
} =
|
|
552
|
-
const { width:
|
|
553
|
-
let
|
|
554
|
-
return
|
|
555
|
-
limitLeft:
|
|
556
|
-
limitTop:
|
|
557
|
-
limitWidth:
|
|
558
|
-
limitHeight:
|
|
569
|
+
top: R = 0,
|
|
570
|
+
angle: b = 0
|
|
571
|
+
} = o, [N, I] = L(m), [S, y] = L(C), [M, O] = L(_), [j, E] = L(R), [se, G] = L(b), [Q, ye] = L(v.keepRatio), oe = (p, T, H, V) => {
|
|
572
|
+
const { width: A, height: ee } = w, { ancestorLeft: F, ancestorTop: K } = f;
|
|
573
|
+
let Z = p, ce = T, pe = H, ve = V;
|
|
574
|
+
return p + F < 0 && (Z = -F), T + K < 0 && (ce = -K), pe = A - Z - F, pe < le && (pe = le), ve = ee - ce - K, ve < le && (ve = le), p + pe + F > A && (Z = A - H - F), T + ve + K > ee && (ce = ee - V - K), {
|
|
575
|
+
limitLeft: Z,
|
|
576
|
+
limitTop: ce,
|
|
577
|
+
limitWidth: pe,
|
|
578
|
+
limitHeight: ve
|
|
559
579
|
};
|
|
560
|
-
}, z = (
|
|
561
|
-
const { objects:
|
|
562
|
-
if (
|
|
580
|
+
}, z = (p) => {
|
|
581
|
+
const { objects: T } = p, H = We(T, t);
|
|
582
|
+
if (H.length !== 1)
|
|
563
583
|
return;
|
|
564
|
-
const V =
|
|
584
|
+
const V = H[0];
|
|
565
585
|
if (V == null)
|
|
566
586
|
return;
|
|
567
|
-
const { transform:
|
|
568
|
-
if (
|
|
587
|
+
const { transform: A } = V;
|
|
588
|
+
if (A == null)
|
|
569
589
|
return;
|
|
570
590
|
const {
|
|
571
|
-
width:
|
|
591
|
+
width: ee,
|
|
572
592
|
height: F,
|
|
573
593
|
left: K,
|
|
574
|
-
top:
|
|
575
|
-
angle:
|
|
576
|
-
} =
|
|
577
|
-
|
|
594
|
+
top: Z,
|
|
595
|
+
angle: ce
|
|
596
|
+
} = A;
|
|
597
|
+
ee != null && I(ee), F != null && y(F), K != null && O(K), Z != null && E(Z), ce != null && G(ce);
|
|
578
598
|
};
|
|
579
|
-
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
z(
|
|
599
|
+
be(() => {
|
|
600
|
+
const p = [
|
|
601
|
+
v.changeStart$.subscribe((T) => {
|
|
602
|
+
z(T);
|
|
583
603
|
}),
|
|
584
|
-
|
|
585
|
-
z(
|
|
604
|
+
v.changing$.subscribe((T) => {
|
|
605
|
+
z(T);
|
|
586
606
|
}),
|
|
587
|
-
|
|
588
|
-
z(
|
|
607
|
+
v.changeEnd$.subscribe((T) => {
|
|
608
|
+
z(T);
|
|
589
609
|
}),
|
|
590
|
-
|
|
591
|
-
if (
|
|
610
|
+
t.focus$.subscribe((T) => {
|
|
611
|
+
if (T.length !== 1)
|
|
592
612
|
return;
|
|
593
|
-
const
|
|
594
|
-
if (
|
|
613
|
+
const H = t.getDrawingByParam(T[0]);
|
|
614
|
+
if (H == null)
|
|
595
615
|
return;
|
|
596
|
-
const V =
|
|
616
|
+
const V = H.transform;
|
|
597
617
|
if (V == null)
|
|
598
618
|
return;
|
|
599
619
|
const {
|
|
600
|
-
width:
|
|
601
|
-
height:
|
|
620
|
+
width: A,
|
|
621
|
+
height: ee,
|
|
602
622
|
left: F,
|
|
603
623
|
top: K,
|
|
604
|
-
angle:
|
|
624
|
+
angle: Z
|
|
605
625
|
} = V;
|
|
606
|
-
|
|
626
|
+
A != null && I(A), ee != null && y(ee), F != null && O(F), K != null && E(K), Z != null && G(Z);
|
|
607
627
|
})
|
|
608
628
|
];
|
|
609
629
|
return () => {
|
|
610
|
-
|
|
630
|
+
p.forEach((T) => T.unsubscribe());
|
|
611
631
|
};
|
|
612
632
|
}, []);
|
|
613
|
-
const
|
|
614
|
-
if (
|
|
633
|
+
const Ge = Me((p) => {
|
|
634
|
+
if (p == null)
|
|
615
635
|
return;
|
|
616
|
-
|
|
617
|
-
const { limitWidth:
|
|
618
|
-
|
|
619
|
-
const V = { unitId: c, subUnitId: l, drawingId:
|
|
620
|
-
if (
|
|
621
|
-
let
|
|
622
|
-
if (
|
|
636
|
+
p = Math.max(p, le);
|
|
637
|
+
const { limitWidth: T, limitHeight: H } = oe(M, j, p, S);
|
|
638
|
+
p = Math.min(p, T);
|
|
639
|
+
const V = { unitId: c, subUnitId: l, drawingId: d, drawingType: u, transform: { width: p } };
|
|
640
|
+
if (Q) {
|
|
641
|
+
let A = p / N * S;
|
|
642
|
+
if (A = Math.max(A, mr), A > H)
|
|
623
643
|
return;
|
|
624
|
-
y(
|
|
644
|
+
y(A), V.transform.height = A;
|
|
625
645
|
}
|
|
626
|
-
|
|
627
|
-
},
|
|
628
|
-
if (
|
|
646
|
+
I(p), t.featurePluginUpdateNotification([V]), v.refreshControls().changeNotification();
|
|
647
|
+
}, Oe), Ot = Me((p) => {
|
|
648
|
+
if (p == null)
|
|
629
649
|
return;
|
|
630
|
-
|
|
631
|
-
const { limitHeight:
|
|
632
|
-
|
|
633
|
-
const V = { unitId: c, subUnitId: l, drawingId:
|
|
634
|
-
if (
|
|
635
|
-
let
|
|
636
|
-
if (
|
|
650
|
+
p = Math.max(p, le);
|
|
651
|
+
const { limitHeight: T, limitWidth: H } = oe(M, j, N, p);
|
|
652
|
+
p = Math.min(p, T);
|
|
653
|
+
const V = { unitId: c, subUnitId: l, drawingId: d, drawingType: u, transform: { height: p } };
|
|
654
|
+
if (Q) {
|
|
655
|
+
let A = p / S * N;
|
|
656
|
+
if (A = Math.max(A, le), A > H)
|
|
637
657
|
return;
|
|
638
|
-
|
|
658
|
+
I(A), V.transform.width = A;
|
|
639
659
|
}
|
|
640
|
-
y(
|
|
641
|
-
},
|
|
642
|
-
if (
|
|
660
|
+
y(p), t.featurePluginUpdateNotification([V]), v.refreshControls().changeNotification();
|
|
661
|
+
}, Oe), Nt = Me((p) => {
|
|
662
|
+
if (p == null)
|
|
643
663
|
return;
|
|
644
|
-
const { limitLeft:
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
O(
|
|
648
|
-
},
|
|
649
|
-
if (
|
|
664
|
+
const { limitLeft: T } = oe(p, j, N, S);
|
|
665
|
+
p = T;
|
|
666
|
+
const H = { unitId: c, subUnitId: l, drawingId: d, drawingType: u, transform: { left: p } };
|
|
667
|
+
O(p), t.featurePluginUpdateNotification([H]), v.refreshControls().changeNotification();
|
|
668
|
+
}, Oe), Dt = Me((p) => {
|
|
669
|
+
if (p == null)
|
|
650
670
|
return;
|
|
651
|
-
const { limitTop:
|
|
652
|
-
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
},
|
|
656
|
-
if (
|
|
671
|
+
const { limitTop: T } = oe(M, p, N, S);
|
|
672
|
+
p = T;
|
|
673
|
+
const H = { unitId: c, subUnitId: l, drawingId: d, drawingType: u, transform: { top: p } };
|
|
674
|
+
E(p), t.featurePluginUpdateNotification([H]), v.refreshControls().changeNotification();
|
|
675
|
+
}, Oe), Et = (p) => {
|
|
676
|
+
if (p == null)
|
|
657
677
|
return;
|
|
658
|
-
const [
|
|
659
|
-
|
|
660
|
-
const V = { unitId: c, subUnitId: l, drawingId:
|
|
661
|
-
|
|
662
|
-
},
|
|
663
|
-
|
|
664
|
-
}
|
|
665
|
-
return /* @__PURE__ */
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
}
|
|
678
|
+
const [T, H] = pr;
|
|
679
|
+
p < T && (p = T), p > H && (p = H);
|
|
680
|
+
const V = { unitId: c, subUnitId: l, drawingId: d, drawingType: u, transform: { angle: p } };
|
|
681
|
+
G(p), t.featurePluginUpdateNotification([V]), v.refreshControls().changeNotification();
|
|
682
|
+
}, Tt = (p) => {
|
|
683
|
+
ye(p), v.keepRatio = p;
|
|
684
|
+
};
|
|
685
|
+
return /* @__PURE__ */ P(
|
|
686
|
+
"div",
|
|
687
|
+
{
|
|
688
|
+
className: `
|
|
689
|
+
univer-relative univer-mt-5 univer-w-full univer-border-b-0 univer-border-l-0 univer-border-r-0
|
|
690
|
+
univer-border-t univer-border-solid univer-border-t-gray-200
|
|
691
|
+
`,
|
|
692
|
+
style: { display: ((p) => p ? "block" : "none")(s) },
|
|
693
|
+
children: [
|
|
694
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: Y(B), children: /* @__PURE__ */ g("div", { children: r.t("image-panel.transform.title") }) }) }),
|
|
695
|
+
/* @__PURE__ */ P("div", { className: U, children: [
|
|
696
|
+
/* @__PURE__ */ g("div", { className: Y(B), children: /* @__PURE__ */ P("label", { children: [
|
|
697
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: r.t("image-panel.transform.width") }) }),
|
|
698
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: /* @__PURE__ */ g(we, { precision: 1, value: N, onChange: (p) => {
|
|
699
|
+
Ge(p);
|
|
700
|
+
} }) }) })
|
|
701
|
+
] }) }),
|
|
702
|
+
/* @__PURE__ */ g("div", { className: Y(B), children: /* @__PURE__ */ P("label", { children: [
|
|
703
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: r.t("image-panel.transform.height") }) }),
|
|
704
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: /* @__PURE__ */ g(we, { precision: 1, value: S, onChange: (p) => {
|
|
705
|
+
Ot(p);
|
|
706
|
+
} }) }) })
|
|
707
|
+
] }) }),
|
|
708
|
+
/* @__PURE__ */ g("div", { className: Y(B), children: /* @__PURE__ */ P("label", { children: [
|
|
709
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: r.t("image-panel.transform.lock") }) }),
|
|
710
|
+
/* @__PURE__ */ g("div", { className: Y(U, "univer-h-9 univer-items-center univer-justify-center"), children: /* @__PURE__ */ g("div", { className: B, children: /* @__PURE__ */ g(Kt, { checked: Q, onChange: Tt }) }) })
|
|
711
|
+
] }) })
|
|
712
|
+
] }),
|
|
713
|
+
/* @__PURE__ */ P("div", { className: U, children: [
|
|
714
|
+
/* @__PURE__ */ g("div", { className: Y(B), children: /* @__PURE__ */ P("label", { children: [
|
|
715
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: r.t("image-panel.transform.x") }) }),
|
|
716
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: /* @__PURE__ */ g(we, { precision: 1, value: M, onChange: (p) => {
|
|
717
|
+
Nt(p);
|
|
718
|
+
} }) }) })
|
|
719
|
+
] }) }),
|
|
720
|
+
/* @__PURE__ */ g("div", { className: Y(B), children: /* @__PURE__ */ P("label", { children: [
|
|
721
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: r.t("image-panel.transform.y") }) }),
|
|
722
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: /* @__PURE__ */ g(we, { precision: 1, value: j, onChange: (p) => {
|
|
723
|
+
Dt(p);
|
|
724
|
+
} }) }) })
|
|
725
|
+
] }) }),
|
|
726
|
+
/* @__PURE__ */ g("div", { className: Y(B), children: /* @__PURE__ */ P("label", { children: [
|
|
727
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: r.t("image-panel.transform.rotate") }) }),
|
|
728
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: /* @__PURE__ */ g(we, { precision: 1, value: se, onChange: Et }) }) })
|
|
729
|
+
] }) })
|
|
730
|
+
] })
|
|
731
|
+
]
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
}, Ye = {
|
|
705
735
|
id: "sheet.operation.open-image-crop",
|
|
706
|
-
type:
|
|
707
|
-
handler: (i,
|
|
736
|
+
type: Se.OPERATION,
|
|
737
|
+
handler: (i, r) => !0
|
|
708
738
|
}, ge = {
|
|
709
739
|
id: "sheet.operation.close-image-crop",
|
|
710
|
-
type:
|
|
711
|
-
handler: (i,
|
|
740
|
+
type: Se.OPERATION,
|
|
741
|
+
handler: (i, r) => !0
|
|
712
742
|
};
|
|
713
|
-
var
|
|
714
|
-
const
|
|
743
|
+
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 || {});
|
|
744
|
+
const Ue = {
|
|
715
745
|
id: "sheet.operation.Auto-image-crop",
|
|
716
|
-
type:
|
|
717
|
-
handler: (i,
|
|
718
|
-
},
|
|
719
|
-
const
|
|
746
|
+
type: Se.OPERATION,
|
|
747
|
+
handler: (i, r) => !0
|
|
748
|
+
}, wr = (i) => {
|
|
749
|
+
const r = k(he), t = k(ie), { drawings: e, cropperShow: n } = i;
|
|
720
750
|
if (e[0] == null)
|
|
721
751
|
return;
|
|
722
|
-
const [a,
|
|
752
|
+
const [a, o] = L(x.FREE), c = gt(!1), l = [
|
|
723
753
|
{
|
|
724
|
-
label:
|
|
725
|
-
value:
|
|
754
|
+
label: t.t("image-panel.crop.mode"),
|
|
755
|
+
value: x.FREE
|
|
726
756
|
},
|
|
727
757
|
{
|
|
728
758
|
label: "1:1",
|
|
729
|
-
value:
|
|
759
|
+
value: x.R1_1
|
|
730
760
|
},
|
|
731
761
|
{
|
|
732
762
|
label: "16:9",
|
|
733
|
-
value:
|
|
763
|
+
value: x.R16_9
|
|
734
764
|
},
|
|
735
765
|
{
|
|
736
766
|
label: "9:16",
|
|
737
|
-
value:
|
|
767
|
+
value: x.R9_16
|
|
738
768
|
},
|
|
739
769
|
{
|
|
740
770
|
label: "5:4",
|
|
741
|
-
value:
|
|
771
|
+
value: x.R5_4
|
|
742
772
|
},
|
|
743
773
|
{
|
|
744
774
|
label: "4:5",
|
|
745
|
-
value:
|
|
775
|
+
value: x.R4_5
|
|
746
776
|
},
|
|
747
777
|
{
|
|
748
778
|
label: "4:3",
|
|
749
|
-
value:
|
|
779
|
+
value: x.R4_3
|
|
750
780
|
},
|
|
751
781
|
{
|
|
752
782
|
label: "3:4",
|
|
753
|
-
value:
|
|
783
|
+
value: x.R3_4
|
|
754
784
|
},
|
|
755
785
|
{
|
|
756
786
|
label: "3:2",
|
|
757
|
-
value:
|
|
787
|
+
value: x.R3_2
|
|
758
788
|
},
|
|
759
789
|
{
|
|
760
790
|
label: "2:3",
|
|
761
|
-
value:
|
|
791
|
+
value: x.R2_3
|
|
762
792
|
}
|
|
763
793
|
];
|
|
764
|
-
|
|
765
|
-
const f =
|
|
766
|
-
if (
|
|
767
|
-
const
|
|
768
|
-
|
|
794
|
+
be(() => {
|
|
795
|
+
const f = r.onCommandExecuted((w) => {
|
|
796
|
+
if (w.id === ge.id) {
|
|
797
|
+
const v = w.params;
|
|
798
|
+
v != null && v.isAuto || (c.current = !1);
|
|
769
799
|
}
|
|
770
800
|
});
|
|
771
801
|
return () => {
|
|
772
802
|
f == null || f.dispose();
|
|
773
803
|
};
|
|
774
804
|
}, []);
|
|
775
|
-
function
|
|
776
|
-
|
|
805
|
+
function d(f) {
|
|
806
|
+
o(f), c.current && r.executeCommand(Ue.id, {
|
|
777
807
|
cropType: f
|
|
778
808
|
});
|
|
779
809
|
}
|
|
780
|
-
const
|
|
781
|
-
|
|
810
|
+
const u = (f) => f ? "block" : "none", h = (f) => {
|
|
811
|
+
r.executeCommand(Ue.id, {
|
|
782
812
|
cropType: f
|
|
783
813
|
}), c.current = !0;
|
|
784
814
|
};
|
|
785
|
-
return /* @__PURE__ */
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
815
|
+
return /* @__PURE__ */ P(
|
|
816
|
+
"div",
|
|
817
|
+
{
|
|
818
|
+
className: `
|
|
819
|
+
univer-relative univer-mt-5 univer-w-full univer-border-b-0 univer-border-l-0 univer-border-r-0
|
|
820
|
+
univer-border-t univer-border-solid univer-border-t-gray-200
|
|
821
|
+
`,
|
|
822
|
+
style: { display: u(n) },
|
|
823
|
+
children: [
|
|
824
|
+
/* @__PURE__ */ g("div", { className: U, children: /* @__PURE__ */ g("div", { className: B, children: /* @__PURE__ */ g("div", { children: t.t("image-panel.crop.title") }) }) }),
|
|
825
|
+
/* @__PURE__ */ P("div", { className: U, children: [
|
|
826
|
+
/* @__PURE__ */ g("div", { className: ne, children: /* @__PURE__ */ g(ue, { onClick: () => {
|
|
827
|
+
h(a);
|
|
828
|
+
}, children: /* @__PURE__ */ P("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
|
|
829
|
+
/* @__PURE__ */ g(_t, {}),
|
|
830
|
+
t.t("image-panel.crop.start")
|
|
831
|
+
] }) }) }),
|
|
832
|
+
/* @__PURE__ */ g("div", { className: ne, children: /* @__PURE__ */ g(ht, { value: a, options: l, onChange: d }) })
|
|
833
|
+
] })
|
|
834
|
+
]
|
|
835
|
+
}
|
|
836
|
+
);
|
|
837
|
+
}, $r = (i) => {
|
|
838
|
+
const r = k(ae), t = k(me), e = k(ie), { drawings: n, hasArrange: s = !0, hasTransform: a = !0, hasAlign: o = !0, hasCropper: c = !0, hasGroup: l = !0 } = i, d = n[0];
|
|
839
|
+
if (d == null)
|
|
800
840
|
return;
|
|
801
|
-
const { unitId:
|
|
841
|
+
const { unitId: u } = d, h = t.getRenderById(u), f = h == null ? void 0 : h.scene;
|
|
802
842
|
if (f == null)
|
|
803
843
|
return;
|
|
804
|
-
const
|
|
805
|
-
return
|
|
806
|
-
const
|
|
807
|
-
|
|
808
|
-
}), O =
|
|
809
|
-
const { objects:
|
|
810
|
-
|
|
811
|
-
}),
|
|
812
|
-
|
|
844
|
+
const w = f.getTransformerByCreate(), [v, m] = L(!0), [C, _] = L(!0), [R, b] = L(!1), [N, I] = L(!0), [S, y] = L(!1);
|
|
845
|
+
return be(() => {
|
|
846
|
+
const M = w.clearControl$.subscribe((E) => {
|
|
847
|
+
E === !0 && (m(!1), _(!1), b(!1), I(!1), y(!0));
|
|
848
|
+
}), O = w.changeStart$.subscribe((E) => {
|
|
849
|
+
const { objects: se } = E, G = We(se, r);
|
|
850
|
+
G.length === 0 ? (m(!1), _(!1), b(!1), I(!1), y(!0)) : G.length === 1 ? (m(!0), _(!0), b(!1), I(!0), y(!1)) : (m(!0), _(!1), b(!0), I(!1), y(!1));
|
|
851
|
+
}), j = r.focus$.subscribe((E) => {
|
|
852
|
+
E.length === 0 ? (m(!1), _(!1), b(!1), I(!1), y(!0)) : E.length === 1 ? (m(!0), _(!0), b(!1), I(!0), y(!1)) : (m(!0), _(!1), b(!0), I(!1), y(!1));
|
|
813
853
|
});
|
|
814
854
|
return () => {
|
|
815
|
-
O.unsubscribe(),
|
|
855
|
+
O.unsubscribe(), M.unsubscribe(), j.unsubscribe();
|
|
816
856
|
};
|
|
817
|
-
}, []), /* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */
|
|
820
|
-
/* @__PURE__ */
|
|
821
|
-
/* @__PURE__ */
|
|
822
|
-
/* @__PURE__ */
|
|
823
|
-
/* @__PURE__ */
|
|
857
|
+
}, []), /* @__PURE__ */ P(Ft, { children: [
|
|
858
|
+
/* @__PURE__ */ g("div", { style: { display: S === !0 ? "block" : "none", height: "100%" }, children: /* @__PURE__ */ g("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", top: "50%", marginTop: "-100px" }, children: /* @__PURE__ */ g("span", { children: e.t("image-panel.null") }) }) }),
|
|
859
|
+
/* @__PURE__ */ g(hr, { arrangeShow: s === !0 ? v : !1, drawings: n }),
|
|
860
|
+
/* @__PURE__ */ g(vr, { transformShow: a === !0 ? C : !1, drawings: n }),
|
|
861
|
+
/* @__PURE__ */ g(Qt, { alignShow: o === !0 ? R : !1, drawings: n }),
|
|
862
|
+
/* @__PURE__ */ g(wr, { cropperShow: c === !0 ? N : !1, drawings: n }),
|
|
863
|
+
/* @__PURE__ */ g(fr, { hasGroup: l, drawings: n })
|
|
824
864
|
] });
|
|
825
|
-
},
|
|
826
|
-
var
|
|
827
|
-
const { popup:
|
|
828
|
-
if (!
|
|
829
|
-
const e = k(
|
|
865
|
+
}, _r = (i) => {
|
|
866
|
+
var v;
|
|
867
|
+
const { popup: r } = i, t = (v = r == null ? void 0 : r.extraProps) == null ? void 0 : v.menuItems;
|
|
868
|
+
if (!t) return null;
|
|
869
|
+
const e = k(he), n = k(ie), [s, a] = L(!1), [o, c] = L(!1), l = () => {
|
|
830
870
|
c(!0);
|
|
831
|
-
},
|
|
871
|
+
}, d = () => {
|
|
832
872
|
c(!1);
|
|
833
|
-
},
|
|
834
|
-
a(
|
|
835
|
-
}, h = (
|
|
836
|
-
e.executeCommand(
|
|
837
|
-
}, f =
|
|
838
|
-
return /* @__PURE__ */
|
|
873
|
+
}, u = (m) => {
|
|
874
|
+
a(m);
|
|
875
|
+
}, h = (m) => {
|
|
876
|
+
e.executeCommand(m.commandId, m.commandParams), a(!1);
|
|
877
|
+
}, f = s || o, w = t.filter((m) => !m.disable);
|
|
878
|
+
return /* @__PURE__ */ g(
|
|
839
879
|
"div",
|
|
840
880
|
{
|
|
841
881
|
onMouseEnter: l,
|
|
842
|
-
onMouseLeave:
|
|
843
|
-
children: /* @__PURE__ */
|
|
844
|
-
|
|
882
|
+
onMouseLeave: d,
|
|
883
|
+
children: /* @__PURE__ */ g(
|
|
884
|
+
Yt,
|
|
845
885
|
{
|
|
846
886
|
align: "start",
|
|
847
|
-
items:
|
|
887
|
+
items: w.map((m) => ({
|
|
848
888
|
type: "item",
|
|
849
|
-
children:
|
|
850
|
-
onSelect: () => h(
|
|
889
|
+
children: n.t(m.label),
|
|
890
|
+
onSelect: () => h(m)
|
|
851
891
|
})),
|
|
852
|
-
open:
|
|
853
|
-
onOpenChange:
|
|
854
|
-
children: /* @__PURE__ */
|
|
892
|
+
open: s,
|
|
893
|
+
onOpenChange: u,
|
|
894
|
+
children: /* @__PURE__ */ P(
|
|
855
895
|
"div",
|
|
856
896
|
{
|
|
857
|
-
className:
|
|
897
|
+
className: Y(`
|
|
858
898
|
univer-flex univer-items-center univer-gap-2 univer-rounded univer-border univer-border-solid
|
|
859
899
|
univer-border-gray-200 univer-p-1
|
|
860
900
|
hover:univer-bg-gray-100
|
|
861
901
|
`, {
|
|
862
|
-
"univer-bg-gray-100":
|
|
863
|
-
"univer-bg-white": !
|
|
902
|
+
"univer-bg-gray-100": s,
|
|
903
|
+
"univer-bg-white": !s
|
|
864
904
|
}),
|
|
865
905
|
children: [
|
|
866
|
-
/* @__PURE__ */
|
|
867
|
-
|
|
868
|
-
{
|
|
869
|
-
style: { color: "#35322B" },
|
|
870
|
-
extend: { colorChannel1: "rgb(var(--green-700, #409f11))" }
|
|
871
|
-
}
|
|
872
|
-
),
|
|
873
|
-
f && /* @__PURE__ */ u(_n, { className: "univer-text-[10px] univer-text-gray-400" })
|
|
906
|
+
/* @__PURE__ */ g(vt, { className: "univer-fill-green-500 univer-text-gray-900" }),
|
|
907
|
+
f && /* @__PURE__ */ g(St, { className: "univer-text-[10px] univer-text-gray-400" })
|
|
874
908
|
]
|
|
875
909
|
}
|
|
876
910
|
)
|
|
@@ -878,61 +912,61 @@ const Be = {
|
|
|
878
912
|
)
|
|
879
913
|
}
|
|
880
914
|
);
|
|
881
|
-
},
|
|
915
|
+
}, Cr = "COMPONENT_IMAGE_POPUP_MENU", Sr = "drawing-ui.config", it = {}, Rt = {
|
|
882
916
|
id: "sheet.operation.image-reset-size",
|
|
883
|
-
type:
|
|
884
|
-
handler: (i,
|
|
885
|
-
},
|
|
886
|
-
const { src:
|
|
887
|
-
return
|
|
917
|
+
type: Se.OPERATION,
|
|
918
|
+
handler: (i, r) => !0
|
|
919
|
+
}, br = (i) => {
|
|
920
|
+
const { src: r } = i;
|
|
921
|
+
return r ? /* @__PURE__ */ g("div", { className: "univer-py-2", children: /* @__PURE__ */ g(
|
|
888
922
|
"img",
|
|
889
923
|
{
|
|
890
924
|
className: "univer-relative univer-block univer-size-full",
|
|
891
|
-
src:
|
|
925
|
+
src: r,
|
|
892
926
|
alt: "Univer Image Viewer"
|
|
893
927
|
}
|
|
894
928
|
) }) : null;
|
|
895
929
|
};
|
|
896
|
-
var
|
|
897
|
-
for (var
|
|
898
|
-
(a = i[
|
|
899
|
-
return
|
|
900
|
-
},
|
|
901
|
-
let
|
|
902
|
-
constructor(i,
|
|
903
|
-
super(), this._componentManager = i, this._commandService =
|
|
930
|
+
var yr = Object.getOwnPropertyDescriptor, Ir = (i, r, t, e) => {
|
|
931
|
+
for (var n = e > 1 ? void 0 : e ? yr(r, t) : r, s = i.length - 1, a; s >= 0; s--)
|
|
932
|
+
(a = i[s]) && (n = a(n) || n);
|
|
933
|
+
return n;
|
|
934
|
+
}, at = (i, r) => (t, e) => r(t, e, i);
|
|
935
|
+
let xe = class extends Ve {
|
|
936
|
+
constructor(i, r) {
|
|
937
|
+
super(), this._componentManager = i, this._commandService = r, this._init();
|
|
904
938
|
}
|
|
905
939
|
_initCustomComponents() {
|
|
906
940
|
const i = this._componentManager;
|
|
907
|
-
this.disposeWithMe(i.register(
|
|
941
|
+
this.disposeWithMe(i.register(Cr, _r)), this.disposeWithMe(i.register(mt, br));
|
|
908
942
|
}
|
|
909
943
|
_initCommands() {
|
|
910
944
|
[
|
|
911
|
-
Fe,
|
|
912
|
-
ge,
|
|
913
|
-
Pn,
|
|
914
945
|
Ye,
|
|
915
|
-
|
|
946
|
+
ge,
|
|
947
|
+
Rt,
|
|
948
|
+
Xe,
|
|
949
|
+
Ue
|
|
916
950
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
917
951
|
}
|
|
918
952
|
_init() {
|
|
919
953
|
this._initCommands(), this._initCustomComponents();
|
|
920
954
|
}
|
|
921
955
|
};
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
],
|
|
926
|
-
var
|
|
927
|
-
for (var
|
|
928
|
-
(a = i[
|
|
929
|
-
return
|
|
930
|
-
},
|
|
931
|
-
let
|
|
932
|
-
constructor(
|
|
956
|
+
xe = Ir([
|
|
957
|
+
at(0, ke($t)),
|
|
958
|
+
at(1, he)
|
|
959
|
+
], xe);
|
|
960
|
+
var Mr = Object.getOwnPropertyDescriptor, Rr = (i, r, t, e) => {
|
|
961
|
+
for (var n = e > 1 ? void 0 : e ? Mr(r, t) : r, s = i.length - 1, a; s >= 0; s--)
|
|
962
|
+
(a = i[s]) && (n = a(n) || n);
|
|
963
|
+
return n;
|
|
964
|
+
}, Ne = (i, r) => (t, e) => r(t, e, i);
|
|
965
|
+
let Ae = class extends Ve {
|
|
966
|
+
constructor(r, t, e, n) {
|
|
933
967
|
super();
|
|
934
|
-
|
|
935
|
-
this._currentUniverService =
|
|
968
|
+
te(this, "_sceneListenerOnDrawingMap", /* @__PURE__ */ new WeakSet());
|
|
969
|
+
this._currentUniverService = r, this._commandService = t, this._renderManagerService = e, this._drawingManagerService = n, this._initialize();
|
|
936
970
|
}
|
|
937
971
|
dispose() {
|
|
938
972
|
super.dispose();
|
|
@@ -941,39 +975,39 @@ let Ue = class extends xe {
|
|
|
941
975
|
this._recoveryImages(), this._drawingAddListener(), this._drawingRemoveListener(), this._drawingUpdateListener(), this._commandExecutedListener(), this._drawingArrangeListener(), this._drawingGroupListener(), this._drawingRefreshListener(), this._drawingVisibleListener();
|
|
942
976
|
}
|
|
943
977
|
_recoveryImages() {
|
|
944
|
-
const
|
|
945
|
-
if (
|
|
978
|
+
const r = this._drawingManagerService.drawingManagerData, t = ft(this._currentUniverService);
|
|
979
|
+
if (t == null)
|
|
946
980
|
return;
|
|
947
|
-
const { unitId: e, subUnitId:
|
|
948
|
-
Object.keys(
|
|
949
|
-
Object.keys(
|
|
950
|
-
const
|
|
951
|
-
|
|
952
|
-
|
|
981
|
+
const { unitId: e, subUnitId: n } = t;
|
|
982
|
+
Object.keys(r).forEach((s) => {
|
|
983
|
+
Object.keys(r[s]).forEach((a) => {
|
|
984
|
+
const o = r[s][a].data;
|
|
985
|
+
o == null || s !== e || a !== n || Object.keys(o).forEach((c) => {
|
|
986
|
+
o[c] && this._insertDrawing([{ unitId: s, subUnitId: a, drawingId: c }]);
|
|
953
987
|
});
|
|
954
988
|
});
|
|
955
989
|
});
|
|
956
990
|
}
|
|
957
991
|
_commandExecutedListener() {
|
|
958
992
|
this.disposeWithMe(
|
|
959
|
-
this._commandService.onCommandExecuted((
|
|
960
|
-
if (
|
|
961
|
-
const
|
|
962
|
-
if (
|
|
993
|
+
this._commandService.onCommandExecuted((r) => {
|
|
994
|
+
if (r.id === Xe.id) {
|
|
995
|
+
const t = r.params;
|
|
996
|
+
if (t == null)
|
|
963
997
|
return;
|
|
964
|
-
this._drawingAlign(
|
|
998
|
+
this._drawingAlign(t);
|
|
965
999
|
}
|
|
966
1000
|
})
|
|
967
1001
|
);
|
|
968
1002
|
}
|
|
969
1003
|
_drawingGroupListener() {
|
|
970
1004
|
this.disposeWithMe(
|
|
971
|
-
this._drawingManagerService.group$.subscribe((
|
|
972
|
-
this._groupDrawings(
|
|
1005
|
+
this._drawingManagerService.group$.subscribe((r) => {
|
|
1006
|
+
this._groupDrawings(r);
|
|
973
1007
|
})
|
|
974
1008
|
), this.disposeWithMe(
|
|
975
|
-
this._drawingManagerService.ungroup$.subscribe((
|
|
976
|
-
this._ungroupDrawings(
|
|
1009
|
+
this._drawingManagerService.ungroup$.subscribe((r) => {
|
|
1010
|
+
this._ungroupDrawings(r);
|
|
977
1011
|
})
|
|
978
1012
|
);
|
|
979
1013
|
}
|
|
@@ -997,38 +1031,38 @@ let Ue = class extends xe {
|
|
|
997
1031
|
// break;
|
|
998
1032
|
// }
|
|
999
1033
|
// }
|
|
1000
|
-
_getSceneAndTransformerByDrawingSearch(
|
|
1001
|
-
if (
|
|
1034
|
+
_getSceneAndTransformerByDrawingSearch(r) {
|
|
1035
|
+
if (r == null)
|
|
1002
1036
|
return;
|
|
1003
|
-
const
|
|
1037
|
+
const t = this._renderManagerService.getRenderById(r), e = t == null ? void 0 : t.scene;
|
|
1004
1038
|
if (e == null)
|
|
1005
1039
|
return null;
|
|
1006
|
-
const
|
|
1007
|
-
return { scene: e, transformer:
|
|
1040
|
+
const n = e.getTransformerByCreate();
|
|
1041
|
+
return { scene: e, transformer: n };
|
|
1008
1042
|
}
|
|
1009
|
-
_groupDrawings(
|
|
1010
|
-
|
|
1011
|
-
this._groupDrawing(
|
|
1043
|
+
_groupDrawings(r) {
|
|
1044
|
+
r.forEach((t) => {
|
|
1045
|
+
this._groupDrawing(t);
|
|
1012
1046
|
});
|
|
1013
1047
|
}
|
|
1014
|
-
_groupDrawing(
|
|
1015
|
-
const { parent:
|
|
1016
|
-
if (
|
|
1048
|
+
_groupDrawing(r) {
|
|
1049
|
+
const { parent: t, children: e } = r, { unitId: n, subUnitId: s, drawingId: a } = t, o = this._getSceneAndTransformerByDrawingSearch(t.unitId);
|
|
1050
|
+
if (o == null)
|
|
1017
1051
|
return;
|
|
1018
|
-
const { scene: c, transformer: l } =
|
|
1052
|
+
const { scene: c, transformer: l } = o;
|
|
1019
1053
|
this._commandService.syncExecuteCommand(ge.id);
|
|
1020
|
-
const
|
|
1054
|
+
const d = [];
|
|
1021
1055
|
if (e.forEach((f) => {
|
|
1022
|
-
const
|
|
1023
|
-
if (
|
|
1056
|
+
const w = W(f), v = c.getObjectIncludeInGroup(w);
|
|
1057
|
+
if (v == null || d.includes(v))
|
|
1024
1058
|
return;
|
|
1025
|
-
|
|
1026
|
-
const { transform:
|
|
1027
|
-
|
|
1028
|
-
}),
|
|
1059
|
+
d.push(v);
|
|
1060
|
+
const { transform: m } = f;
|
|
1061
|
+
m != null && (v.classType === Qe.GROUP ? v.transformByState({ left: m.left, top: m.top }) : v.transformByState(m));
|
|
1062
|
+
}), d.length === 0)
|
|
1029
1063
|
return;
|
|
1030
|
-
const
|
|
1031
|
-
c.addObject(h,
|
|
1064
|
+
const u = W({ unitId: n, subUnitId: s, drawingId: a }), h = new Ce(u);
|
|
1065
|
+
c.addObject(h, Pe).attachTransformerTo(h), h.addObjects(...d), t.transform && h.transformByState({ left: t.transform.left, top: t.transform.top }), l.clearSelectedObjects(), l.setSelectedControl(h);
|
|
1032
1066
|
}
|
|
1033
1067
|
// private _regroupDrawings(drawings: IDrawingSearch[]) {
|
|
1034
1068
|
// const renderObject = this._getSceneAndTransformerByDrawingSearch(drawings[0].unitId);
|
|
@@ -1064,127 +1098,127 @@ let Ue = class extends xe {
|
|
|
1064
1098
|
// transformer.clearSelectedObjects();
|
|
1065
1099
|
// transformer.setSelectedControl(firstGroup);
|
|
1066
1100
|
// }
|
|
1067
|
-
_ungroupDrawings(
|
|
1068
|
-
|
|
1069
|
-
this._ungroupDrawing(
|
|
1101
|
+
_ungroupDrawings(r) {
|
|
1102
|
+
r.forEach((t) => {
|
|
1103
|
+
this._ungroupDrawing(t);
|
|
1070
1104
|
});
|
|
1071
1105
|
}
|
|
1072
|
-
_ungroupDrawing(
|
|
1073
|
-
const { parent:
|
|
1074
|
-
if (
|
|
1106
|
+
_ungroupDrawing(r) {
|
|
1107
|
+
const { parent: t, children: e } = r, n = this._getSceneAndTransformerByDrawingSearch(t.unitId);
|
|
1108
|
+
if (n == null)
|
|
1075
1109
|
return;
|
|
1076
|
-
const { scene:
|
|
1077
|
-
e.forEach((
|
|
1078
|
-
const h =
|
|
1110
|
+
const { scene: s, transformer: a } = n;
|
|
1111
|
+
e.forEach((u) => {
|
|
1112
|
+
const h = W(u), f = s.getObjectIncludeInGroup(h);
|
|
1079
1113
|
if (f == null)
|
|
1080
1114
|
return !0;
|
|
1081
1115
|
if (f == null)
|
|
1082
1116
|
return;
|
|
1083
|
-
const { transform:
|
|
1084
|
-
|
|
1117
|
+
const { transform: w } = u;
|
|
1118
|
+
w != null && (f.classType === Qe.GROUP ? f.transformByState({ left: w.left, top: w.top }) : f.transformByState(w));
|
|
1085
1119
|
});
|
|
1086
|
-
const
|
|
1087
|
-
c.getObjects().forEach((
|
|
1088
|
-
c.removeSelfObjectAndTransform(
|
|
1120
|
+
const o = W(t), c = s.getObject(o), { width: l, height: d } = c;
|
|
1121
|
+
c.getObjects().forEach((u) => {
|
|
1122
|
+
c.removeSelfObjectAndTransform(u.oKey, l, d);
|
|
1089
1123
|
}), c.dispose(), a.clearSelectedObjects();
|
|
1090
1124
|
}
|
|
1091
|
-
_drawingAlign(
|
|
1092
|
-
const { alignType:
|
|
1093
|
-
if (
|
|
1125
|
+
_drawingAlign(r) {
|
|
1126
|
+
const { alignType: t } = r, e = this._drawingManagerService.getFocusDrawings();
|
|
1127
|
+
if (t === D.default)
|
|
1094
1128
|
return;
|
|
1095
|
-
const
|
|
1096
|
-
let
|
|
1097
|
-
e.forEach((
|
|
1098
|
-
const { unitId:
|
|
1099
|
-
if (
|
|
1129
|
+
const n = [];
|
|
1130
|
+
let s = Number.POSITIVE_INFINITY, a = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY, c = Number.NEGATIVE_INFINITY, l = 0;
|
|
1131
|
+
e.forEach((d) => {
|
|
1132
|
+
const { unitId: u, subUnitId: h, drawingId: f, drawingType: w } = d, v = this._drawingManagerService.getDrawingByParam({ unitId: u, subUnitId: h, drawingId: f });
|
|
1133
|
+
if (v == null || v.transform == null)
|
|
1100
1134
|
return;
|
|
1101
|
-
|
|
1102
|
-
unitId:
|
|
1135
|
+
n.push({
|
|
1136
|
+
unitId: u,
|
|
1103
1137
|
subUnitId: h,
|
|
1104
1138
|
drawingId: f,
|
|
1105
|
-
drawingType:
|
|
1106
|
-
transform:
|
|
1139
|
+
drawingType: w,
|
|
1140
|
+
transform: v.transform
|
|
1107
1141
|
});
|
|
1108
|
-
const { left:
|
|
1109
|
-
|
|
1110
|
-
}), l !== 0 && (this._sortDrawingTransform(
|
|
1142
|
+
const { left: m = 0, top: C = 0, width: _ = 0, height: R = 0 } = v.transform;
|
|
1143
|
+
s = Math.min(s, m), a = Math.min(a, C), o = Math.max(o, m + _), c = Math.max(c, C + R), l++;
|
|
1144
|
+
}), l !== 0 && (this._sortDrawingTransform(n, t), this._applyAlignType(n, t, s, a, o, c, l));
|
|
1111
1145
|
}
|
|
1112
|
-
_applyAlignType(
|
|
1113
|
-
const c = Math.round((
|
|
1114
|
-
if (
|
|
1146
|
+
_applyAlignType(r, t, e, n, s, a, o) {
|
|
1147
|
+
const c = Math.round((s - e) / o * 10) / 10, l = Math.round((a - n) / o * 10) / 10, d = [], u = this._getSceneAndTransformerByDrawingSearch(r[0].unitId);
|
|
1148
|
+
if (u == null)
|
|
1115
1149
|
return;
|
|
1116
|
-
const { scene: h, transformer: f } =
|
|
1117
|
-
|
|
1118
|
-
const { unitId:
|
|
1119
|
-
let
|
|
1120
|
-
switch (
|
|
1150
|
+
const { scene: h, transformer: f } = u;
|
|
1151
|
+
r.forEach((w, v) => {
|
|
1152
|
+
const { unitId: m, subUnitId: C, drawingId: _, transform: R, drawingType: b } = w, { left: N = 0, top: I = 0, width: S = 0, height: y = 0 } = R;
|
|
1153
|
+
let M = N, O = I;
|
|
1154
|
+
switch (t) {
|
|
1121
1155
|
case D.left:
|
|
1122
|
-
|
|
1156
|
+
M = e;
|
|
1123
1157
|
break;
|
|
1124
1158
|
case D.center:
|
|
1125
|
-
|
|
1159
|
+
M = e + (s - e) / 2 - S / 2;
|
|
1126
1160
|
break;
|
|
1127
1161
|
case D.right:
|
|
1128
|
-
|
|
1162
|
+
M = s - S;
|
|
1129
1163
|
break;
|
|
1130
1164
|
case D.top:
|
|
1131
|
-
O =
|
|
1165
|
+
O = n;
|
|
1132
1166
|
break;
|
|
1133
1167
|
case D.middle:
|
|
1134
|
-
O =
|
|
1168
|
+
O = n + (a - n) / 2 - y / 2;
|
|
1135
1169
|
break;
|
|
1136
1170
|
case D.bottom:
|
|
1137
1171
|
O = a - y;
|
|
1138
1172
|
break;
|
|
1139
1173
|
case D.horizon:
|
|
1140
|
-
|
|
1174
|
+
M = e + c * v;
|
|
1141
1175
|
break;
|
|
1142
1176
|
case D.vertical:
|
|
1143
|
-
O =
|
|
1177
|
+
O = n + l * v;
|
|
1144
1178
|
break;
|
|
1145
1179
|
}
|
|
1146
|
-
(
|
|
1147
|
-
unitId:
|
|
1148
|
-
subUnitId:
|
|
1180
|
+
(M !== N || O !== I) && d.push({
|
|
1181
|
+
unitId: m,
|
|
1182
|
+
subUnitId: C,
|
|
1149
1183
|
drawingId: _,
|
|
1150
|
-
drawingType:
|
|
1184
|
+
drawingType: b,
|
|
1151
1185
|
transform: {
|
|
1152
|
-
left:
|
|
1186
|
+
left: M,
|
|
1153
1187
|
top: O
|
|
1154
1188
|
}
|
|
1155
1189
|
});
|
|
1156
|
-
}), this._drawingManagerService.featurePluginUpdateNotification(
|
|
1190
|
+
}), this._drawingManagerService.featurePluginUpdateNotification(d), f.refreshControls().changeNotification();
|
|
1157
1191
|
}
|
|
1158
|
-
_sortDrawingTransform(
|
|
1159
|
-
|
|
1160
|
-
const
|
|
1161
|
-
left:
|
|
1192
|
+
_sortDrawingTransform(r, t) {
|
|
1193
|
+
r.sort((e, n) => {
|
|
1194
|
+
const s = e.transform, a = n.transform, {
|
|
1195
|
+
left: o = 0,
|
|
1162
1196
|
top: c = 0,
|
|
1163
1197
|
width: l = 0,
|
|
1164
|
-
height:
|
|
1165
|
-
} =
|
|
1166
|
-
left:
|
|
1198
|
+
height: d = 0
|
|
1199
|
+
} = s, {
|
|
1200
|
+
left: u = 0,
|
|
1167
1201
|
top: h = 0,
|
|
1168
1202
|
width: f = 0,
|
|
1169
|
-
height:
|
|
1203
|
+
height: w = 0
|
|
1170
1204
|
} = a;
|
|
1171
|
-
switch (
|
|
1205
|
+
switch (t) {
|
|
1172
1206
|
case D.left:
|
|
1173
|
-
return
|
|
1207
|
+
return o - u;
|
|
1174
1208
|
case D.center:
|
|
1175
|
-
return
|
|
1209
|
+
return o + l / 2 - (u + f / 2);
|
|
1176
1210
|
case D.right:
|
|
1177
|
-
return
|
|
1211
|
+
return o + l - (u + f);
|
|
1178
1212
|
case D.top:
|
|
1179
1213
|
return c - h;
|
|
1180
1214
|
case D.middle:
|
|
1181
|
-
return c +
|
|
1215
|
+
return c + d / 2 - (h + w / 2);
|
|
1182
1216
|
case D.bottom:
|
|
1183
|
-
return c +
|
|
1217
|
+
return c + d - (h + w);
|
|
1184
1218
|
case D.horizon:
|
|
1185
|
-
return
|
|
1219
|
+
return o + l / 2 - (u + f / 2);
|
|
1186
1220
|
case D.vertical:
|
|
1187
|
-
return c +
|
|
1221
|
+
return c + d / 2 - (h + w / 2);
|
|
1188
1222
|
default:
|
|
1189
1223
|
return 0;
|
|
1190
1224
|
}
|
|
@@ -1192,60 +1226,60 @@ let Ue = class extends xe {
|
|
|
1192
1226
|
}
|
|
1193
1227
|
_drawingArrangeListener() {
|
|
1194
1228
|
this.disposeWithMe(
|
|
1195
|
-
this._drawingManagerService.order$.subscribe((
|
|
1196
|
-
this._drawingArrange(
|
|
1229
|
+
this._drawingManagerService.order$.subscribe((r) => {
|
|
1230
|
+
this._drawingArrange(r);
|
|
1197
1231
|
})
|
|
1198
1232
|
);
|
|
1199
1233
|
}
|
|
1200
|
-
_drawingArrange(
|
|
1201
|
-
const { unitId:
|
|
1202
|
-
if (
|
|
1234
|
+
_drawingArrange(r) {
|
|
1235
|
+
const { unitId: t, subUnitId: e, drawingIds: n } = r, s = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1236
|
+
if (s == null)
|
|
1203
1237
|
return;
|
|
1204
|
-
const { scene: a } =
|
|
1205
|
-
|
|
1206
|
-
const c =
|
|
1238
|
+
const { scene: a } = s;
|
|
1239
|
+
n.forEach((o) => {
|
|
1240
|
+
const c = W({ unitId: t, subUnitId: e, drawingId: o }), l = a.fuzzyMathObjects(c, !0);
|
|
1207
1241
|
if (l == null || l.length === 0)
|
|
1208
1242
|
return;
|
|
1209
|
-
const
|
|
1210
|
-
for (const
|
|
1211
|
-
|
|
1243
|
+
const d = this._drawingManagerService.getDrawingOrder(t, e).indexOf(o);
|
|
1244
|
+
for (const u of l)
|
|
1245
|
+
u.setProps({ zIndex: d }), u.makeDirty();
|
|
1212
1246
|
});
|
|
1213
1247
|
}
|
|
1214
1248
|
_drawingAddListener() {
|
|
1215
1249
|
this.disposeWithMe(
|
|
1216
|
-
this._drawingManagerService.add$.subscribe((
|
|
1217
|
-
this._insertDrawing(
|
|
1250
|
+
this._drawingManagerService.add$.subscribe((r) => {
|
|
1251
|
+
this._insertDrawing(r);
|
|
1218
1252
|
})
|
|
1219
1253
|
);
|
|
1220
1254
|
}
|
|
1221
|
-
_insertDrawing(
|
|
1222
|
-
const
|
|
1223
|
-
|
|
1224
|
-
const { unitId:
|
|
1255
|
+
_insertDrawing(r) {
|
|
1256
|
+
const t = [];
|
|
1257
|
+
r.forEach((e) => {
|
|
1258
|
+
const { unitId: n } = e;
|
|
1225
1259
|
if (this._drawingManagerService.getDrawingByParam(e) == null)
|
|
1226
1260
|
return;
|
|
1227
|
-
const a = this._getSceneAndTransformerByDrawingSearch(
|
|
1261
|
+
const a = this._getSceneAndTransformerByDrawingSearch(n);
|
|
1228
1262
|
if (a == null)
|
|
1229
1263
|
return;
|
|
1230
|
-
const { scene:
|
|
1231
|
-
|
|
1232
|
-
}),
|
|
1264
|
+
const { scene: o } = a;
|
|
1265
|
+
t.includes(o) || t.push(o);
|
|
1266
|
+
}), t.forEach((e) => {
|
|
1233
1267
|
this._sceneListenerOnDrawingMap.has(e) || (this._addListenerOnDrawing(e), this._sceneListenerOnDrawingMap.add(e));
|
|
1234
1268
|
});
|
|
1235
1269
|
}
|
|
1236
1270
|
_drawingRemoveListener() {
|
|
1237
1271
|
this.disposeWithMe(
|
|
1238
|
-
this._drawingManagerService.remove$.subscribe((
|
|
1239
|
-
|
|
1240
|
-
var
|
|
1241
|
-
const { unitId: e, subUnitId:
|
|
1272
|
+
this._drawingManagerService.remove$.subscribe((r) => {
|
|
1273
|
+
r.forEach((t) => {
|
|
1274
|
+
var d;
|
|
1275
|
+
const { unitId: e, subUnitId: n, drawingId: s } = t, a = this._getSceneAndTransformerByDrawingSearch(e);
|
|
1242
1276
|
if (a == null)
|
|
1243
1277
|
return;
|
|
1244
|
-
const { scene:
|
|
1278
|
+
const { scene: o } = a, c = W({ unitId: e, subUnitId: n, drawingId: s }), l = o.fuzzyMathObjects(c, !0);
|
|
1245
1279
|
if (l.length > 0) {
|
|
1246
|
-
for (const
|
|
1247
|
-
|
|
1248
|
-
(
|
|
1280
|
+
for (const u of l)
|
|
1281
|
+
u.dispose();
|
|
1282
|
+
(d = o.getTransformer()) == null || d.clearSelectedObjects();
|
|
1249
1283
|
}
|
|
1250
1284
|
});
|
|
1251
1285
|
})
|
|
@@ -1253,76 +1287,76 @@ let Ue = class extends xe {
|
|
|
1253
1287
|
}
|
|
1254
1288
|
_drawingUpdateListener() {
|
|
1255
1289
|
this.disposeWithMe(
|
|
1256
|
-
this._drawingManagerService.update$.subscribe((
|
|
1257
|
-
|
|
1258
|
-
var
|
|
1259
|
-
const { unitId: e, subUnitId:
|
|
1290
|
+
this._drawingManagerService.update$.subscribe((r) => {
|
|
1291
|
+
r.forEach((t) => {
|
|
1292
|
+
var S;
|
|
1293
|
+
const { unitId: e, subUnitId: n, drawingId: s } = t, a = this._drawingManagerService.getDrawingByParam(t);
|
|
1260
1294
|
if (a == null)
|
|
1261
1295
|
return;
|
|
1262
|
-
const { transform:
|
|
1296
|
+
const { transform: o, drawingType: c } = a, l = this._getSceneAndTransformerByDrawingSearch(e);
|
|
1263
1297
|
if (l == null)
|
|
1264
1298
|
return;
|
|
1265
|
-
const { scene:
|
|
1266
|
-
if (
|
|
1299
|
+
const { scene: d, transformer: u } = l;
|
|
1300
|
+
if (o == null)
|
|
1267
1301
|
return !0;
|
|
1268
|
-
const { left: h = 0, top: f = 0, width:
|
|
1269
|
-
if (
|
|
1302
|
+
const { left: h = 0, top: f = 0, width: w = 0, height: v = 0, angle: m = 0, flipX: C = !1, flipY: _ = !1, skewX: R = 0, skewY: b = 0 } = o, N = W({ unitId: e, subUnitId: n, drawingId: s }), I = d.getObject(N);
|
|
1303
|
+
if (I == null)
|
|
1270
1304
|
return !0;
|
|
1271
|
-
|
|
1305
|
+
I.transformByState({ left: h, top: f, width: w, height: v, angle: m, flipX: C, flipY: _, skewX: R, skewY: b }), (S = d.getTransformer()) == null || S.debounceRefreshControls();
|
|
1272
1306
|
});
|
|
1273
1307
|
})
|
|
1274
1308
|
);
|
|
1275
1309
|
}
|
|
1276
1310
|
_drawingRefreshListener() {
|
|
1277
1311
|
this.disposeWithMe(
|
|
1278
|
-
this._drawingManagerService.refreshTransform$.subscribe((
|
|
1279
|
-
|
|
1280
|
-
const { unitId: e, subUnitId:
|
|
1312
|
+
this._drawingManagerService.refreshTransform$.subscribe((r) => {
|
|
1313
|
+
r.forEach((t) => {
|
|
1314
|
+
const { unitId: e, subUnitId: n, drawingId: s } = t, a = this._getSceneAndTransformerByDrawingSearch(e);
|
|
1281
1315
|
if (a == null)
|
|
1282
1316
|
return;
|
|
1283
|
-
const
|
|
1284
|
-
if (
|
|
1317
|
+
const o = this._drawingManagerService.getDrawingByParam(t);
|
|
1318
|
+
if (o == null)
|
|
1285
1319
|
return;
|
|
1286
|
-
const { transform: c } =
|
|
1287
|
-
if (
|
|
1320
|
+
const { transform: c } = o, { scene: l } = a, d = W({ unitId: e, subUnitId: n, drawingId: s }), u = l.getObject(d);
|
|
1321
|
+
if (u == null || c == null)
|
|
1288
1322
|
return !0;
|
|
1289
1323
|
const {
|
|
1290
1324
|
left: h = 0,
|
|
1291
1325
|
top: f = 0,
|
|
1292
|
-
width:
|
|
1293
|
-
height:
|
|
1294
|
-
angle:
|
|
1295
|
-
flipX:
|
|
1326
|
+
width: w = 0,
|
|
1327
|
+
height: v = 0,
|
|
1328
|
+
angle: m = 0,
|
|
1329
|
+
flipX: C = !1,
|
|
1296
1330
|
flipY: _ = !1,
|
|
1297
|
-
skewX:
|
|
1298
|
-
skewY:
|
|
1331
|
+
skewX: R = 0,
|
|
1332
|
+
skewY: b = 0
|
|
1299
1333
|
} = c;
|
|
1300
|
-
|
|
1334
|
+
u.transformByState({ left: h, top: f, width: w, height: v, angle: m, flipX: C, flipY: _, skewX: R, skewY: b });
|
|
1301
1335
|
});
|
|
1302
1336
|
})
|
|
1303
1337
|
);
|
|
1304
1338
|
}
|
|
1305
1339
|
_drawingVisibleListener() {
|
|
1306
1340
|
this.disposeWithMe(
|
|
1307
|
-
this._drawingManagerService.visible$.subscribe((
|
|
1308
|
-
|
|
1309
|
-
const { unitId: e, subUnitId:
|
|
1310
|
-
if (
|
|
1341
|
+
this._drawingManagerService.visible$.subscribe((r) => {
|
|
1342
|
+
r.forEach((t) => {
|
|
1343
|
+
const { unitId: e, subUnitId: n, drawingId: s, visible: a } = t, o = this._getSceneAndTransformerByDrawingSearch(e);
|
|
1344
|
+
if (o == null)
|
|
1311
1345
|
return;
|
|
1312
|
-
const { scene: c } =
|
|
1313
|
-
if (
|
|
1346
|
+
const { scene: c } = o, l = W({ unitId: e, subUnitId: n, drawingId: s }), d = c.getObject(l);
|
|
1347
|
+
if (d == null)
|
|
1314
1348
|
return !0;
|
|
1315
|
-
a ?
|
|
1349
|
+
a ? d.show() : d.hide();
|
|
1316
1350
|
});
|
|
1317
1351
|
})
|
|
1318
1352
|
);
|
|
1319
1353
|
}
|
|
1320
|
-
_filterUpdateParams(
|
|
1321
|
-
return
|
|
1354
|
+
_filterUpdateParams(r, t) {
|
|
1355
|
+
return r.filter((e, n) => {
|
|
1322
1356
|
if (e == null)
|
|
1323
1357
|
return !1;
|
|
1324
|
-
const { transform:
|
|
1325
|
-
return
|
|
1358
|
+
const { transform: s } = e;
|
|
1359
|
+
return ct(s, t == null ? void 0 : t[n]);
|
|
1326
1360
|
});
|
|
1327
1361
|
}
|
|
1328
1362
|
// group?.getObjects().forEach((o) => {
|
|
@@ -1332,52 +1366,52 @@ let Ue = class extends xe {
|
|
|
1332
1366
|
// drawings.push({ unitId, subUnitId, drawingId });
|
|
1333
1367
|
// }
|
|
1334
1368
|
// });
|
|
1335
|
-
_addListenerOnDrawing(
|
|
1336
|
-
const
|
|
1369
|
+
_addListenerOnDrawing(r) {
|
|
1370
|
+
const t = r.getTransformerByCreate();
|
|
1337
1371
|
let e = null;
|
|
1338
1372
|
this.disposeWithMe(
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
const { objects:
|
|
1373
|
+
_e(
|
|
1374
|
+
t.changeStart$.subscribe((n) => {
|
|
1375
|
+
const { objects: s } = n, a = Array.from(s.values()), o = [];
|
|
1342
1376
|
e = a.map((c) => {
|
|
1343
|
-
const { left: l, top:
|
|
1344
|
-
if (
|
|
1345
|
-
let
|
|
1346
|
-
if (
|
|
1377
|
+
const { left: l, top: d, height: u, width: h, angle: f, oKey: w, isInGroup: v } = c, m = this._drawingManagerService.getDrawingOKey(w);
|
|
1378
|
+
if (v || c instanceof Ce) {
|
|
1379
|
+
let C = c.ancestorGroup;
|
|
1380
|
+
if (C == null && c instanceof Ce && (C = c), C == null)
|
|
1347
1381
|
return null;
|
|
1348
|
-
const _ = this._drawingManagerService.getDrawingOKey(
|
|
1382
|
+
const _ = this._drawingManagerService.getDrawingOKey(C.oKey);
|
|
1349
1383
|
if (_) {
|
|
1350
|
-
const { unitId:
|
|
1351
|
-
|
|
1352
|
-
const { left:
|
|
1353
|
-
return { left:
|
|
1384
|
+
const { unitId: R, subUnitId: b, drawingId: N } = _;
|
|
1385
|
+
o.push({ unitId: R, subUnitId: b, drawingId: N });
|
|
1386
|
+
const { left: I, top: S, height: y, width: M, angle: O } = C;
|
|
1387
|
+
return { left: I, top: S, height: y, width: M, angle: O };
|
|
1354
1388
|
}
|
|
1355
|
-
} else if (
|
|
1356
|
-
const { unitId:
|
|
1357
|
-
return
|
|
1389
|
+
} else if (m != null) {
|
|
1390
|
+
const { unitId: C, subUnitId: _, drawingId: R } = m;
|
|
1391
|
+
return o.push({ unitId: C, subUnitId: _, drawingId: R }), { left: l, top: d, height: u, width: h, angle: f };
|
|
1358
1392
|
}
|
|
1359
1393
|
return null;
|
|
1360
|
-
}).filter((c) => c != null),
|
|
1394
|
+
}).filter((c) => c != null), o.length > 0 ? this._commandService.syncExecuteCommand(Te.id, o) : this._commandService.syncExecuteCommand(Te.id, []);
|
|
1361
1395
|
})
|
|
1362
1396
|
)
|
|
1363
1397
|
), this.disposeWithMe(
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
const { objects:
|
|
1398
|
+
_e(
|
|
1399
|
+
t.changeEnd$.subscribe((n) => {
|
|
1400
|
+
const { objects: s } = n, a = this._filterUpdateParams(We(s, this._drawingManagerService), e);
|
|
1367
1401
|
a.length > 0 && this._drawingManagerService.featurePluginUpdateNotification(a);
|
|
1368
1402
|
})
|
|
1369
1403
|
)
|
|
1370
1404
|
);
|
|
1371
1405
|
}
|
|
1372
1406
|
};
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
],
|
|
1379
|
-
class
|
|
1380
|
-
constructor(
|
|
1407
|
+
Ae = Rr([
|
|
1408
|
+
Ne(0, Ze),
|
|
1409
|
+
Ne(1, he),
|
|
1410
|
+
Ne(2, me),
|
|
1411
|
+
Ne(3, ae)
|
|
1412
|
+
], Ae);
|
|
1413
|
+
class De extends Wt {
|
|
1414
|
+
constructor(t, e) {
|
|
1381
1415
|
e == null && (e = {}), e.transformerConfig = {
|
|
1382
1416
|
keepRatio: !1,
|
|
1383
1417
|
isCropper: !0,
|
|
@@ -1385,362 +1419,362 @@ class Me extends Gn {
|
|
|
1385
1419
|
anchorStroke: "rgb(255, 255, 255)",
|
|
1386
1420
|
anchorSize: 24
|
|
1387
1421
|
};
|
|
1388
|
-
super(
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1422
|
+
super(t, e);
|
|
1423
|
+
te(this, "_srcRect");
|
|
1424
|
+
te(this, "_prstGeom");
|
|
1425
|
+
te(this, "_applyTransform");
|
|
1426
|
+
te(this, "_dragPadding", 8);
|
|
1427
|
+
te(this, "_cacheCanvas");
|
|
1394
1428
|
e != null && e.srcRect && (this._srcRect = e.srcRect), e != null && e.prstGeom && (this._prstGeom = e.prstGeom), e != null && e.applyTransform && (this._applyTransform = e.applyTransform), e != null && e.dragPadding && (this._dragPadding = e.dragPadding), this._applyProps();
|
|
1395
1429
|
}
|
|
1396
|
-
refreshSrcRect(
|
|
1397
|
-
this._srcRect =
|
|
1430
|
+
refreshSrcRect(t, e) {
|
|
1431
|
+
this._srcRect = t, this._applyTransform = e, this._applyProps();
|
|
1398
1432
|
}
|
|
1399
1433
|
get srcRect() {
|
|
1400
1434
|
return this._srcRect;
|
|
1401
1435
|
}
|
|
1402
1436
|
dispose() {
|
|
1403
|
-
var
|
|
1404
|
-
super.dispose(), (
|
|
1437
|
+
var t;
|
|
1438
|
+
super.dispose(), (t = this._cacheCanvas) == null || t.dispose(), this._srcRect = null;
|
|
1405
1439
|
}
|
|
1406
|
-
isHit(
|
|
1407
|
-
const e = this.getInverseCoord(
|
|
1440
|
+
isHit(t) {
|
|
1441
|
+
const e = this.getInverseCoord(t);
|
|
1408
1442
|
return e.x >= -this.strokeWidth / 2 && e.x <= this.width + this.strokeWidth / 2 && e.y >= -this.strokeWidth / 2 && e.y <= this.height + this.strokeWidth / 2 && !this._inSurround(e);
|
|
1409
1443
|
}
|
|
1410
|
-
_inSurround(
|
|
1444
|
+
_inSurround(t) {
|
|
1411
1445
|
const e = this._dragPadding;
|
|
1412
|
-
return
|
|
1446
|
+
return t.x >= e - this.strokeWidth / 2 && t.x <= this.width + this.strokeWidth / 2 - e && t.y >= e - this.strokeWidth / 2 && t.y <= this.height + this.strokeWidth / 2 - e;
|
|
1413
1447
|
}
|
|
1414
|
-
render(
|
|
1415
|
-
return this.visible ? (
|
|
1448
|
+
render(t, e) {
|
|
1449
|
+
return this.visible ? (t.save(), this._draw(t), t.restore(), this.makeDirty(!1), this) : (this.makeDirty(!1), this);
|
|
1416
1450
|
}
|
|
1417
|
-
_draw(
|
|
1451
|
+
_draw(t) {
|
|
1418
1452
|
var c, l;
|
|
1419
|
-
const
|
|
1453
|
+
const n = this.getScene().getEngine(), { width: s, height: a } = n;
|
|
1420
1454
|
this._initialCacheCanvas(), (c = this._cacheCanvas) == null || c.clear();
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1455
|
+
const o = (l = this._cacheCanvas) == null ? void 0 : l.getContext();
|
|
1456
|
+
o != null && (o.save(), dt.drawWith(o, {
|
|
1423
1457
|
left: 0,
|
|
1424
1458
|
top: 0,
|
|
1425
|
-
width:
|
|
1459
|
+
width: s,
|
|
1426
1460
|
height: a,
|
|
1427
1461
|
fill: "rgba(0, 0, 0, 0.5)"
|
|
1428
|
-
}),
|
|
1462
|
+
}), o.setTransform(t.getTransform()), this._clipForApplyObject(o), this._applyCache(t), o.restore());
|
|
1429
1463
|
}
|
|
1430
|
-
_clipForApplyObject(
|
|
1464
|
+
_clipForApplyObject(t) {
|
|
1431
1465
|
let e = 0;
|
|
1432
|
-
if (this._prstGeom != null && (e = 1),
|
|
1433
|
-
const
|
|
1434
|
-
|
|
1466
|
+
if (this._prstGeom != null && (e = 1), t.globalCompositeOperation = "destination-out", t.beginPath(), e === 0) {
|
|
1467
|
+
const n = this.transform.getMatrix();
|
|
1468
|
+
t.transform(n[0], n[1], n[2], n[3], n[4], n[5]), t.rect(0, 0, this.width, this.height), t.fill();
|
|
1435
1469
|
}
|
|
1436
1470
|
}
|
|
1437
1471
|
_applyProps() {
|
|
1438
1472
|
if (this._applyTransform == null)
|
|
1439
1473
|
return;
|
|
1440
|
-
let
|
|
1441
|
-
const { left: a = 0, top:
|
|
1474
|
+
let t = 0, e = 0, n = 0, s = 0;
|
|
1475
|
+
const { left: a = 0, top: o = 0, width: c = 0, height: l = 0, angle: d } = this._applyTransform;
|
|
1442
1476
|
if (this._srcRect != null) {
|
|
1443
|
-
const { left: f = 0, top:
|
|
1444
|
-
|
|
1477
|
+
const { left: f = 0, top: w = 0, right: v = 0, bottom: m = 0 } = this._srcRect;
|
|
1478
|
+
t = f, e = w, n = v, s = m;
|
|
1445
1479
|
}
|
|
1446
|
-
const
|
|
1480
|
+
const u = a + t, h = o + e;
|
|
1447
1481
|
this.transformByState({
|
|
1448
|
-
left:
|
|
1482
|
+
left: u,
|
|
1449
1483
|
top: h,
|
|
1450
|
-
width: a + c -
|
|
1451
|
-
height:
|
|
1452
|
-
angle:
|
|
1484
|
+
width: a + c - n - u,
|
|
1485
|
+
height: o + l - s - h,
|
|
1486
|
+
angle: d
|
|
1453
1487
|
});
|
|
1454
1488
|
}
|
|
1455
|
-
_applyCache(
|
|
1456
|
-
if (!
|
|
1489
|
+
_applyCache(t) {
|
|
1490
|
+
if (!t || this._cacheCanvas == null)
|
|
1457
1491
|
return;
|
|
1458
1492
|
const e = this._cacheCanvas.getContext();
|
|
1459
|
-
e.save(),
|
|
1493
|
+
e.save(), t.save(), t.setTransform(1, 0, 0, 1, 0, 0), e.setTransform(1, 0, 0, 1, 0, 0), t.drawImage(this._cacheCanvas.getCanvasEle(), 0, 0), t.restore(), e.restore();
|
|
1460
1494
|
}
|
|
1461
1495
|
_initialCacheCanvas() {
|
|
1462
1496
|
if (this._cacheCanvas != null)
|
|
1463
1497
|
return;
|
|
1464
|
-
const
|
|
1465
|
-
if (
|
|
1466
|
-
this._cacheCanvas = new
|
|
1467
|
-
const e =
|
|
1498
|
+
const t = this.getScene();
|
|
1499
|
+
if (t == null) return;
|
|
1500
|
+
this._cacheCanvas = new Gt();
|
|
1501
|
+
const e = t.getEngine();
|
|
1468
1502
|
this._cacheCanvas.setSize(e.width, e.height), e.onTransformChange$.subscribeEvent(() => {
|
|
1469
|
-
var
|
|
1470
|
-
(
|
|
1503
|
+
var n;
|
|
1504
|
+
(n = this._cacheCanvas) == null || n.setSize(e.width, e.height), this.makeDirty(!0);
|
|
1471
1505
|
});
|
|
1472
1506
|
}
|
|
1473
1507
|
}
|
|
1474
|
-
var
|
|
1475
|
-
for (var
|
|
1476
|
-
(a = i[
|
|
1477
|
-
return
|
|
1478
|
-
},
|
|
1479
|
-
let
|
|
1480
|
-
constructor(
|
|
1508
|
+
var Or = Object.getOwnPropertyDescriptor, Nr = (i, r, t, e) => {
|
|
1509
|
+
for (var n = e > 1 ? void 0 : e ? Or(r, t) : r, s = i.length - 1, a; s >= 0; s--)
|
|
1510
|
+
(a = i[s]) && (n = a(n) || n);
|
|
1511
|
+
return n;
|
|
1512
|
+
}, fe = (i, r) => (t, e) => r(t, e, i);
|
|
1513
|
+
let He = class extends Ve {
|
|
1514
|
+
constructor(r, t, e, n, s, a) {
|
|
1481
1515
|
super();
|
|
1482
|
-
|
|
1483
|
-
this._commandService =
|
|
1516
|
+
te(this, "_sceneListenerOnImageMap", /* @__PURE__ */ new WeakSet());
|
|
1517
|
+
this._commandService = r, this._drawingManagerService = t, this._renderManagerService = e, this._univerInstanceService = n, this._messageService = s, this._localeService = a, this._init();
|
|
1484
1518
|
}
|
|
1485
1519
|
_init() {
|
|
1486
1520
|
this._initOpenCrop(), this._initCloseCrop(), this._initAutoCrop();
|
|
1487
1521
|
}
|
|
1488
1522
|
_initAutoCrop() {
|
|
1489
1523
|
this.disposeWithMe(
|
|
1490
|
-
this._commandService.onCommandExecuted((
|
|
1491
|
-
if (
|
|
1524
|
+
this._commandService.onCommandExecuted((r) => {
|
|
1525
|
+
if (r.id !== Ue.id)
|
|
1492
1526
|
return;
|
|
1493
|
-
const
|
|
1494
|
-
if (
|
|
1527
|
+
const t = r.params;
|
|
1528
|
+
if (t == null)
|
|
1495
1529
|
return;
|
|
1496
|
-
const { cropType: e } =
|
|
1497
|
-
if (
|
|
1530
|
+
const { cropType: e } = t, n = this._drawingManagerService.getFocusDrawings();
|
|
1531
|
+
if (n.length !== 1)
|
|
1498
1532
|
return;
|
|
1499
|
-
const
|
|
1500
|
-
if (
|
|
1533
|
+
const s = n[0], { unitId: a, subUnitId: o, drawingId: c } = s, l = this._renderManagerService.getRenderById(a), d = l == null ? void 0 : l.scene;
|
|
1534
|
+
if (d == null)
|
|
1501
1535
|
return !0;
|
|
1502
|
-
this._searchCropObject(
|
|
1503
|
-
const h =
|
|
1504
|
-
if (!(f instanceof
|
|
1536
|
+
this._searchCropObject(d) != null && this._commandService.syncExecuteCommand(ge.id, { isAuto: !0 });
|
|
1537
|
+
const h = W({ unitId: a, subUnitId: o, drawingId: c }), f = d.getObject(h);
|
|
1538
|
+
if (!(f instanceof Ke)) {
|
|
1505
1539
|
this._messageService.show({
|
|
1506
|
-
type:
|
|
1540
|
+
type: tt.Error,
|
|
1507
1541
|
content: this._localeService.t("image-cropper.error")
|
|
1508
1542
|
});
|
|
1509
1543
|
return;
|
|
1510
1544
|
}
|
|
1511
|
-
f != null && (this._updateCropperObject(e, f), this._commandService.executeCommand(
|
|
1545
|
+
f != null && (this._updateCropperObject(e, f), this._commandService.executeCommand(Ye.id, { unitId: a, subUnitId: o, drawingId: c }));
|
|
1512
1546
|
})
|
|
1513
1547
|
);
|
|
1514
1548
|
}
|
|
1515
|
-
_calculateSrcRectByRatio(
|
|
1516
|
-
const
|
|
1517
|
-
let l = e,
|
|
1518
|
-
|
|
1519
|
-
const
|
|
1549
|
+
_calculateSrcRectByRatio(r, t, e, n, s, a) {
|
|
1550
|
+
const o = e / n, c = s / a;
|
|
1551
|
+
let l = e, d = n;
|
|
1552
|
+
o > c ? l = n * c : d = e / c;
|
|
1553
|
+
const u = (e - l) / 2, h = (n - d) / 2;
|
|
1520
1554
|
return {
|
|
1521
|
-
left:
|
|
1522
|
-
top:
|
|
1523
|
-
right:
|
|
1524
|
-
bottom:
|
|
1555
|
+
left: Re(u, 1),
|
|
1556
|
+
top: Re(h, 1),
|
|
1557
|
+
right: Re(e - (u + l), 1),
|
|
1558
|
+
bottom: Re(n - (h + d), 1)
|
|
1525
1559
|
};
|
|
1526
1560
|
}
|
|
1527
|
-
_updateCropperObject(
|
|
1528
|
-
const { left: e, top:
|
|
1529
|
-
let
|
|
1530
|
-
switch (
|
|
1531
|
-
case
|
|
1532
|
-
|
|
1561
|
+
_updateCropperObject(r, t) {
|
|
1562
|
+
const { left: e, top: n, width: s, height: a } = t.calculateTransformWithSrcRect();
|
|
1563
|
+
let o;
|
|
1564
|
+
switch (r) {
|
|
1565
|
+
case x.R1_1:
|
|
1566
|
+
o = this._calculateSrcRectByRatio(e, n, s, a, 1, 1);
|
|
1533
1567
|
break;
|
|
1534
|
-
case
|
|
1535
|
-
|
|
1568
|
+
case x.R16_9:
|
|
1569
|
+
o = this._calculateSrcRectByRatio(e, n, s, a, 16, 9);
|
|
1536
1570
|
break;
|
|
1537
|
-
case
|
|
1538
|
-
|
|
1571
|
+
case x.R9_16:
|
|
1572
|
+
o = this._calculateSrcRectByRatio(e, n, s, a, 9, 16);
|
|
1539
1573
|
break;
|
|
1540
|
-
case
|
|
1541
|
-
|
|
1574
|
+
case x.R5_4:
|
|
1575
|
+
o = this._calculateSrcRectByRatio(e, n, s, a, 5, 4);
|
|
1542
1576
|
break;
|
|
1543
|
-
case
|
|
1544
|
-
|
|
1577
|
+
case x.R4_5:
|
|
1578
|
+
o = this._calculateSrcRectByRatio(e, n, s, a, 4, 5);
|
|
1545
1579
|
break;
|
|
1546
|
-
case
|
|
1547
|
-
|
|
1580
|
+
case x.R4_3:
|
|
1581
|
+
o = this._calculateSrcRectByRatio(e, n, s, a, 4, 3);
|
|
1548
1582
|
break;
|
|
1549
|
-
case
|
|
1550
|
-
|
|
1583
|
+
case x.R3_4:
|
|
1584
|
+
o = this._calculateSrcRectByRatio(e, n, s, a, 3, 4);
|
|
1551
1585
|
break;
|
|
1552
|
-
case
|
|
1553
|
-
|
|
1586
|
+
case x.R3_2:
|
|
1587
|
+
o = this._calculateSrcRectByRatio(e, n, s, a, 3, 2);
|
|
1554
1588
|
break;
|
|
1555
|
-
case
|
|
1556
|
-
|
|
1589
|
+
case x.R2_3:
|
|
1590
|
+
o = this._calculateSrcRectByRatio(e, n, s, a, 2, 3);
|
|
1557
1591
|
break;
|
|
1558
|
-
case
|
|
1592
|
+
case x.FREE:
|
|
1559
1593
|
}
|
|
1560
|
-
if (
|
|
1594
|
+
if (o == null)
|
|
1561
1595
|
return;
|
|
1562
|
-
|
|
1563
|
-
const { left: c = 0, top: l = 0, bottom:
|
|
1564
|
-
|
|
1596
|
+
t.setSrcRect(o);
|
|
1597
|
+
const { left: c = 0, top: l = 0, bottom: d = 0, right: u = 0 } = o;
|
|
1598
|
+
t.transformByStateCloseCropper({
|
|
1565
1599
|
left: e + c,
|
|
1566
|
-
top:
|
|
1567
|
-
width:
|
|
1568
|
-
height: a -
|
|
1600
|
+
top: n + l,
|
|
1601
|
+
width: s - u - c,
|
|
1602
|
+
height: a - d - l
|
|
1569
1603
|
});
|
|
1570
1604
|
}
|
|
1571
1605
|
_initOpenCrop() {
|
|
1572
1606
|
this.disposeWithMe(
|
|
1573
|
-
this._commandService.onCommandExecuted((
|
|
1574
|
-
if (
|
|
1607
|
+
this._commandService.onCommandExecuted((r) => {
|
|
1608
|
+
if (r.id !== Ye.id)
|
|
1575
1609
|
return;
|
|
1576
|
-
const
|
|
1577
|
-
if (
|
|
1610
|
+
const t = r.params;
|
|
1611
|
+
if (t == null)
|
|
1578
1612
|
return;
|
|
1579
|
-
const { unitId: e, subUnitId:
|
|
1580
|
-
if (
|
|
1613
|
+
const { unitId: e, subUnitId: n, drawingId: s } = t, a = this._renderManagerService.getRenderById(e), o = a == null ? void 0 : a.scene;
|
|
1614
|
+
if (o == null)
|
|
1581
1615
|
return !0;
|
|
1582
|
-
if (this._sceneListenerOnImageMap.has(
|
|
1616
|
+
if (this._sceneListenerOnImageMap.has(o) || (this._addListenerOnImage(o), this._sceneListenerOnImageMap.add(o)), this._drawingManagerService.getDrawingByParam({ unitId: e, subUnitId: n, drawingId: s }) == null)
|
|
1583
1617
|
return;
|
|
1584
|
-
const l =
|
|
1585
|
-
if (
|
|
1618
|
+
const l = W({ unitId: e, subUnitId: n, drawingId: s }), d = o.getObject(l);
|
|
1619
|
+
if (d == null)
|
|
1586
1620
|
return;
|
|
1587
|
-
if (!(
|
|
1621
|
+
if (!(d instanceof Ke)) {
|
|
1588
1622
|
this._messageService.show({
|
|
1589
|
-
type:
|
|
1623
|
+
type: tt.Error,
|
|
1590
1624
|
content: this._localeService.t("image-cropper.error")
|
|
1591
1625
|
});
|
|
1592
1626
|
return;
|
|
1593
1627
|
}
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1596
|
-
const h = new
|
|
1597
|
-
srcRect:
|
|
1598
|
-
prstGeom:
|
|
1599
|
-
applyTransform:
|
|
1628
|
+
const u = o.getTransformer();
|
|
1629
|
+
u == null || u.clearControls();
|
|
1630
|
+
const h = new De(`${l}-crop`, {
|
|
1631
|
+
srcRect: d.srcRect,
|
|
1632
|
+
prstGeom: d.prstGeom,
|
|
1633
|
+
applyTransform: d.calculateTransformWithSrcRect()
|
|
1600
1634
|
});
|
|
1601
|
-
|
|
1635
|
+
o.addObject(h, d.getLayerIndex() + 1).attachTransformerTo(h), u == null || u.createControlForCopper(h), this._addHoverForImageCopper(h), d.openRenderByCropper(), u == null || u.refreshControls(), h.makeDirty(!0), this._commandService.syncExecuteCommand(Te.id, [{ unitId: e, subUnitId: n, drawingId: s }]);
|
|
1602
1636
|
})
|
|
1603
1637
|
);
|
|
1604
1638
|
}
|
|
1605
|
-
_searchCropObject(
|
|
1606
|
-
const
|
|
1607
|
-
for (const e of
|
|
1608
|
-
if (e instanceof
|
|
1639
|
+
_searchCropObject(r) {
|
|
1640
|
+
const t = r.getAllObjectsByOrder();
|
|
1641
|
+
for (const e of t)
|
|
1642
|
+
if (e instanceof De)
|
|
1609
1643
|
return e;
|
|
1610
1644
|
}
|
|
1611
1645
|
_initCloseCrop() {
|
|
1612
1646
|
this.disposeWithMe(
|
|
1613
|
-
this._commandService.onCommandExecuted((
|
|
1614
|
-
if (
|
|
1647
|
+
this._commandService.onCommandExecuted((t) => {
|
|
1648
|
+
if (t.id !== ge.id)
|
|
1615
1649
|
return;
|
|
1616
1650
|
const e = this._univerInstanceService.getFocusedUnit();
|
|
1617
1651
|
if (e == null)
|
|
1618
1652
|
return;
|
|
1619
|
-
const
|
|
1653
|
+
const n = e.getUnitId(), s = this._renderManagerService.getRenderById(n), a = s == null ? void 0 : s.scene;
|
|
1620
1654
|
if (a == null)
|
|
1621
1655
|
return !0;
|
|
1622
|
-
const
|
|
1623
|
-
if (
|
|
1656
|
+
const o = this._searchCropObject(a);
|
|
1657
|
+
if (o == null)
|
|
1624
1658
|
return;
|
|
1625
|
-
const c = this._getApplyObjectByCropObject(
|
|
1659
|
+
const c = this._getApplyObjectByCropObject(o);
|
|
1626
1660
|
if (c == null)
|
|
1627
1661
|
return;
|
|
1628
1662
|
const l = a.getTransformerByCreate();
|
|
1629
|
-
l.detachFrom(
|
|
1630
|
-
const
|
|
1631
|
-
if (
|
|
1632
|
-
const { left: h, top: f, height:
|
|
1663
|
+
l.detachFrom(o), l.clearCopperControl();
|
|
1664
|
+
const d = this._getSrcRectByTransformState(c, o), u = this._drawingManagerService.getDrawingOKey(c.oKey);
|
|
1665
|
+
if (u != null) {
|
|
1666
|
+
const { left: h, top: f, height: w, width: v } = o;
|
|
1633
1667
|
this._drawingManagerService.featurePluginUpdateNotification([{
|
|
1634
|
-
...
|
|
1668
|
+
...u,
|
|
1635
1669
|
transform: {
|
|
1636
|
-
...
|
|
1670
|
+
...u.transform,
|
|
1637
1671
|
left: h,
|
|
1638
1672
|
top: f,
|
|
1639
|
-
height:
|
|
1640
|
-
width:
|
|
1673
|
+
height: w,
|
|
1674
|
+
width: v
|
|
1641
1675
|
},
|
|
1642
|
-
srcRect:
|
|
1676
|
+
srcRect: d.srcRectAngle
|
|
1643
1677
|
}]);
|
|
1644
1678
|
}
|
|
1645
|
-
c.setSrcRect({ ...
|
|
1679
|
+
c.setSrcRect({ ...d.srcRectAngle }), c.closeRenderByCropper(), c.makeDirty(!0), o == null || o.dispose();
|
|
1646
1680
|
})
|
|
1647
1681
|
);
|
|
1648
|
-
const
|
|
1649
|
-
|
|
1682
|
+
const r = this._univerInstanceService.getCurrentTypeOfUnit$(Ee.UNIVER_SHEET).pipe(
|
|
1683
|
+
Zt((t) => t ? t.activeSheet$ : Xt(null))
|
|
1650
1684
|
);
|
|
1651
|
-
this.disposeWithMe(
|
|
1685
|
+
this.disposeWithMe(r.subscribe(() => {
|
|
1652
1686
|
this._commandService.syncExecuteCommand(ge.id);
|
|
1653
1687
|
}));
|
|
1654
1688
|
}
|
|
1655
|
-
_getApplyObjectByCropObject(
|
|
1656
|
-
const
|
|
1657
|
-
if (!
|
|
1658
|
-
const
|
|
1659
|
-
return
|
|
1689
|
+
_getApplyObjectByCropObject(r) {
|
|
1690
|
+
const t = r.oKey, e = t.slice(0, t.length - 5), n = r.getScene();
|
|
1691
|
+
if (!n) return null;
|
|
1692
|
+
const s = n.getObject(e);
|
|
1693
|
+
return s == null ? null : s;
|
|
1660
1694
|
}
|
|
1661
|
-
_addListenerOnImage(
|
|
1662
|
-
const
|
|
1695
|
+
_addListenerOnImage(r) {
|
|
1696
|
+
const t = r.getTransformerByCreate();
|
|
1663
1697
|
let e = null;
|
|
1664
1698
|
this.disposeWithMe(
|
|
1665
|
-
|
|
1666
|
-
const { objects:
|
|
1667
|
-
if (a == null || !(a instanceof
|
|
1699
|
+
t.changeStart$.subscribe((n) => {
|
|
1700
|
+
const { objects: s } = n, a = s.values().next().value;
|
|
1701
|
+
if (a == null || !(a instanceof De))
|
|
1668
1702
|
return;
|
|
1669
|
-
const { left:
|
|
1670
|
-
e = { left:
|
|
1703
|
+
const { left: o, top: c, height: l, width: d, angle: u } = a;
|
|
1704
|
+
e = { left: o, top: c, height: l, width: d, angle: u }, t.clearCopperControl();
|
|
1671
1705
|
})
|
|
1672
1706
|
), this.disposeWithMe(
|
|
1673
|
-
|
|
1674
|
-
const { objects:
|
|
1675
|
-
if (a == null || !(a instanceof
|
|
1707
|
+
t.changeEnd$.subscribe((n) => {
|
|
1708
|
+
const { objects: s } = n, a = s.values().next().value;
|
|
1709
|
+
if (a == null || !(a instanceof De))
|
|
1676
1710
|
return;
|
|
1677
|
-
const { left:
|
|
1678
|
-
if (!
|
|
1711
|
+
const { left: o, top: c, height: l, width: d, angle: u } = a;
|
|
1712
|
+
if (!ct({ left: o, top: c, height: l, width: d, angle: u }, e))
|
|
1679
1713
|
return;
|
|
1680
1714
|
const h = this._getApplyObjectByCropObject(a);
|
|
1681
1715
|
if (h == null)
|
|
1682
1716
|
return;
|
|
1683
1717
|
const f = this._getSrcRectByTransformState(h, a);
|
|
1684
|
-
a.refreshSrcRect(f.srcRect, h.getState()),
|
|
1718
|
+
a.refreshSrcRect(f.srcRect, h.getState()), t.createControlForCopper(a);
|
|
1685
1719
|
})
|
|
1686
|
-
), this._endCropListener(
|
|
1720
|
+
), this._endCropListener(r);
|
|
1687
1721
|
}
|
|
1688
|
-
_addHoverForImageCopper(
|
|
1722
|
+
_addHoverForImageCopper(r) {
|
|
1689
1723
|
this.disposeWithMe(
|
|
1690
|
-
|
|
1691
|
-
|
|
1724
|
+
r.onPointerEnter$.subscribeEvent(() => {
|
|
1725
|
+
r.cursor = je.MOVE;
|
|
1692
1726
|
})
|
|
1693
1727
|
), this.disposeWithMe(
|
|
1694
|
-
|
|
1695
|
-
|
|
1728
|
+
r.onPointerLeave$.subscribeEvent(() => {
|
|
1729
|
+
r.cursor = je.DEFAULT;
|
|
1696
1730
|
})
|
|
1697
1731
|
);
|
|
1698
1732
|
}
|
|
1699
|
-
_endCropListener(
|
|
1700
|
-
const
|
|
1733
|
+
_endCropListener(r) {
|
|
1734
|
+
const t = r.getTransformerByCreate();
|
|
1701
1735
|
this.disposeWithMe(
|
|
1702
|
-
|
|
1736
|
+
t.clearControl$.subscribe((e) => {
|
|
1703
1737
|
e === !0 && this._commandService.syncExecuteCommand(ge.id);
|
|
1704
1738
|
})
|
|
1705
1739
|
);
|
|
1706
1740
|
}
|
|
1707
|
-
_getSrcRectByTransformState(
|
|
1708
|
-
const { left: e, top:
|
|
1709
|
-
left:
|
|
1710
|
-
top:
|
|
1711
|
-
right:
|
|
1712
|
-
bottom: h -
|
|
1713
|
-
}, _ = { ...
|
|
1741
|
+
_getSrcRectByTransformState(r, t) {
|
|
1742
|
+
const { left: e, top: n, height: s, width: a, strokeWidth: o, angle: c } = t, { left: l, top: d, width: u, height: h, angle: f, strokeWidth: w } = r, v = e - l, m = n - d, C = {
|
|
1743
|
+
left: v,
|
|
1744
|
+
top: m,
|
|
1745
|
+
right: u - v - a,
|
|
1746
|
+
bottom: h - m - s
|
|
1747
|
+
}, _ = { ...C };
|
|
1714
1748
|
if (f !== 0) {
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
const O =
|
|
1718
|
-
O.rotateByPoint(
|
|
1719
|
-
const
|
|
1720
|
-
_.left =
|
|
1749
|
+
const R = e + a / 2, b = n + s / 2, N = new $e(R, b), I = u / 2 + l, S = h / 2 + d, y = new $e(I, S), M = new $e(l, d);
|
|
1750
|
+
M.rotateByPoint(et(f), y);
|
|
1751
|
+
const O = M.clone();
|
|
1752
|
+
O.rotateByPoint(et(-f), N);
|
|
1753
|
+
const j = e - O.x, E = n - O.y;
|
|
1754
|
+
_.left = j, _.top = E, _.right = u - j - a, _.bottom = h - E - s;
|
|
1721
1755
|
}
|
|
1722
1756
|
return {
|
|
1723
|
-
srcRect:
|
|
1757
|
+
srcRect: C,
|
|
1724
1758
|
srcRectAngle: _
|
|
1725
1759
|
};
|
|
1726
1760
|
}
|
|
1727
1761
|
};
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
],
|
|
1736
|
-
var
|
|
1737
|
-
for (var
|
|
1738
|
-
(a = i[
|
|
1739
|
-
return
|
|
1740
|
-
},
|
|
1741
|
-
let
|
|
1742
|
-
constructor(i,
|
|
1743
|
-
super(), this._commandService = i, this._renderManagerService =
|
|
1762
|
+
He = Nr([
|
|
1763
|
+
fe(0, he),
|
|
1764
|
+
fe(1, ae),
|
|
1765
|
+
fe(2, me),
|
|
1766
|
+
fe(3, Ze),
|
|
1767
|
+
fe(4, zt),
|
|
1768
|
+
fe(5, ke(ie))
|
|
1769
|
+
], He);
|
|
1770
|
+
var Dr = Object.getOwnPropertyDescriptor, Er = (i, r, t, e) => {
|
|
1771
|
+
for (var n = e > 1 ? void 0 : e ? Dr(r, t) : r, s = i.length - 1, a; s >= 0; s--)
|
|
1772
|
+
(a = i[s]) && (n = a(n) || n);
|
|
1773
|
+
return n;
|
|
1774
|
+
}, de = (i, r) => (t, e) => r(t, e, i);
|
|
1775
|
+
let Le = class extends Ve {
|
|
1776
|
+
constructor(i, r, t, e, n, s, a) {
|
|
1777
|
+
super(), this._commandService = i, this._renderManagerService = r, this._drawingManagerService = t, this._dialogService = e, this._imageIoService = n, this._currentUniverService = s, this._drawingRenderService = a, this._initialize();
|
|
1744
1778
|
}
|
|
1745
1779
|
dispose() {
|
|
1746
1780
|
super.dispose();
|
|
@@ -1751,11 +1785,11 @@ let He = class extends xe {
|
|
|
1751
1785
|
_commandExecutedListener() {
|
|
1752
1786
|
this.disposeWithMe(
|
|
1753
1787
|
this._commandService.onCommandExecuted((i) => {
|
|
1754
|
-
if (i.id ===
|
|
1755
|
-
const
|
|
1756
|
-
if (
|
|
1788
|
+
if (i.id === Rt.id) {
|
|
1789
|
+
const r = i.params;
|
|
1790
|
+
if (r == null)
|
|
1757
1791
|
return;
|
|
1758
|
-
this._resetImageSize(
|
|
1792
|
+
this._resetImageSize(r);
|
|
1759
1793
|
}
|
|
1760
1794
|
})
|
|
1761
1795
|
);
|
|
@@ -1763,32 +1797,32 @@ let He = class extends xe {
|
|
|
1763
1797
|
_getSceneAndTransformerByDrawingSearch(i) {
|
|
1764
1798
|
if (i == null)
|
|
1765
1799
|
return;
|
|
1766
|
-
const
|
|
1767
|
-
if (
|
|
1800
|
+
const r = this._renderManagerService.getRenderById(i), t = r == null ? void 0 : r.scene;
|
|
1801
|
+
if (t == null)
|
|
1768
1802
|
return null;
|
|
1769
|
-
const e =
|
|
1770
|
-
return { scene:
|
|
1803
|
+
const e = t.getTransformerByCreate();
|
|
1804
|
+
return { scene: t, transformer: e };
|
|
1771
1805
|
}
|
|
1772
1806
|
_resetImageSize(i) {
|
|
1773
|
-
const
|
|
1807
|
+
const r = [], t = [];
|
|
1774
1808
|
i.forEach((e) => {
|
|
1775
|
-
const { unitId:
|
|
1776
|
-
if (
|
|
1809
|
+
const { unitId: n, subUnitId: s, drawingId: a } = e, o = this._getSceneAndTransformerByDrawingSearch(n);
|
|
1810
|
+
if (o == null)
|
|
1777
1811
|
return;
|
|
1778
|
-
const { scene: c } =
|
|
1779
|
-
if (m == null)
|
|
1780
|
-
return !0;
|
|
1781
|
-
const d = this._drawingManagerService.getDrawingByParam(e);
|
|
1812
|
+
const { scene: c } = o, l = W({ unitId: n, subUnitId: s, drawingId: a }), d = c.getObject(l);
|
|
1782
1813
|
if (d == null)
|
|
1783
1814
|
return !0;
|
|
1784
|
-
|
|
1815
|
+
const u = this._drawingManagerService.getDrawingByParam(e);
|
|
1816
|
+
if (u == null)
|
|
1817
|
+
return !0;
|
|
1818
|
+
if (u.drawingType !== re.DRAWING_IMAGE)
|
|
1785
1819
|
return;
|
|
1786
|
-
|
|
1787
|
-
const { width: h, height: f } =
|
|
1788
|
-
|
|
1789
|
-
...
|
|
1820
|
+
d.resetSize();
|
|
1821
|
+
const { width: h, height: f } = d.getNativeSize();
|
|
1822
|
+
t.includes(c) === !1 && t.push(c), r.push({
|
|
1823
|
+
...u,
|
|
1790
1824
|
transform: {
|
|
1791
|
-
...
|
|
1825
|
+
...u.transform,
|
|
1792
1826
|
height: f,
|
|
1793
1827
|
width: h,
|
|
1794
1828
|
angle: 0
|
|
@@ -1796,9 +1830,9 @@ let He = class extends xe {
|
|
|
1796
1830
|
srcRect: null,
|
|
1797
1831
|
prstGeom: null
|
|
1798
1832
|
});
|
|
1799
|
-
}), this._drawingManagerService.featurePluginUpdateNotification(
|
|
1833
|
+
}), this._drawingManagerService.featurePluginUpdateNotification(r), t.forEach((e) => {
|
|
1800
1834
|
e.getTransformerByCreate().refreshControls().changeNotification();
|
|
1801
|
-
}), this._commandService.syncExecuteCommand(
|
|
1835
|
+
}), this._commandService.syncExecuteCommand(Te.id, i);
|
|
1802
1836
|
}
|
|
1803
1837
|
_drawingAddListener() {
|
|
1804
1838
|
this.disposeWithMe(
|
|
@@ -1808,127 +1842,127 @@ let He = class extends xe {
|
|
|
1808
1842
|
);
|
|
1809
1843
|
}
|
|
1810
1844
|
_insertImages(i) {
|
|
1811
|
-
i.forEach(async (
|
|
1845
|
+
i.forEach(async (r) => {
|
|
1812
1846
|
var c;
|
|
1813
|
-
const { unitId:
|
|
1814
|
-
if (
|
|
1847
|
+
const { unitId: t, subUnitId: e } = r, n = this._getSceneAndTransformerByDrawingSearch(t), s = (c = ft(this._currentUniverService, t)) == null ? void 0 : c.subUnitId;
|
|
1848
|
+
if (n == null || s !== e)
|
|
1815
1849
|
return;
|
|
1816
|
-
const a = this._drawingManagerService.getDrawingByParam(
|
|
1850
|
+
const a = this._drawingManagerService.getDrawingByParam(r);
|
|
1817
1851
|
if (a == null)
|
|
1818
1852
|
return;
|
|
1819
|
-
const
|
|
1820
|
-
if (this._drawingManagerService.refreshTransform([a]), !(
|
|
1821
|
-
for (const l of
|
|
1853
|
+
const o = await this._drawingRenderService.renderImages(a, n.scene);
|
|
1854
|
+
if (this._drawingManagerService.refreshTransform([a]), !(o == null || o.length === 0))
|
|
1855
|
+
for (const l of o)
|
|
1822
1856
|
this._addHoverForImage(l), this._addDialogForImage(l);
|
|
1823
1857
|
});
|
|
1824
1858
|
}
|
|
1825
1859
|
_imageUpdateListener() {
|
|
1826
1860
|
this.disposeWithMe(
|
|
1827
1861
|
this._drawingManagerService.update$.subscribe((i) => {
|
|
1828
|
-
i.forEach((
|
|
1829
|
-
const { unitId:
|
|
1830
|
-
if (
|
|
1862
|
+
i.forEach((r) => {
|
|
1863
|
+
const { unitId: t, subUnitId: e, drawingId: n } = r, s = this._drawingManagerService.getDrawingByParam(r);
|
|
1864
|
+
if (s == null)
|
|
1831
1865
|
return;
|
|
1832
|
-
const { transform: a, drawingType:
|
|
1833
|
-
if (
|
|
1866
|
+
const { transform: a, drawingType: o, srcRect: c, prstGeom: l, source: d, imageSourceType: u } = s;
|
|
1867
|
+
if (o !== re.DRAWING_IMAGE)
|
|
1834
1868
|
return;
|
|
1835
|
-
const h = this._getSceneAndTransformerByDrawingSearch(
|
|
1869
|
+
const h = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1836
1870
|
if (h == null)
|
|
1837
1871
|
return;
|
|
1838
|
-
const { scene: f, transformer:
|
|
1872
|
+
const { scene: f, transformer: w } = h;
|
|
1839
1873
|
if (a == null)
|
|
1840
1874
|
return !0;
|
|
1841
|
-
const
|
|
1842
|
-
if (
|
|
1875
|
+
const v = W({ unitId: t, subUnitId: e, drawingId: n }), m = f.getObject(v);
|
|
1876
|
+
if (m == null)
|
|
1843
1877
|
return !0;
|
|
1844
|
-
|
|
1878
|
+
m.setSrcRect(c), m.setPrstGeom(l), d != null && d.length > 0 && (u === qe.BASE64 || u === qe.URL) && m.changeSource(d);
|
|
1845
1879
|
});
|
|
1846
1880
|
})
|
|
1847
1881
|
);
|
|
1848
1882
|
}
|
|
1849
1883
|
_addHoverForImage(i) {
|
|
1850
1884
|
this.disposeWithMe(
|
|
1851
|
-
|
|
1885
|
+
_e(
|
|
1852
1886
|
i.onPointerEnter$.subscribeEvent(() => {
|
|
1853
|
-
i.cursor =
|
|
1887
|
+
i.cursor = je.GRAB;
|
|
1854
1888
|
})
|
|
1855
1889
|
)
|
|
1856
1890
|
), this.disposeWithMe(
|
|
1857
|
-
|
|
1891
|
+
_e(
|
|
1858
1892
|
i.onPointerLeave$.subscribeEvent(() => {
|
|
1859
|
-
i.cursor =
|
|
1893
|
+
i.cursor = je.DEFAULT;
|
|
1860
1894
|
})
|
|
1861
1895
|
)
|
|
1862
1896
|
);
|
|
1863
1897
|
}
|
|
1864
1898
|
_addDialogForImage(i) {
|
|
1865
1899
|
this.disposeWithMe(
|
|
1866
|
-
|
|
1900
|
+
_e(
|
|
1867
1901
|
i.onDblclick$.subscribeEvent(() => {
|
|
1868
|
-
const
|
|
1869
|
-
this._drawingRenderService.previewImage(
|
|
1902
|
+
const r = `${i.oKey}-viewer-dialog`;
|
|
1903
|
+
this._drawingRenderService.previewImage(r, i.getNative().src, i.getNativeSize().width, i.getNativeSize().height);
|
|
1870
1904
|
})
|
|
1871
1905
|
)
|
|
1872
1906
|
);
|
|
1873
1907
|
}
|
|
1874
1908
|
};
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
],
|
|
1884
|
-
var
|
|
1885
|
-
for (var
|
|
1886
|
-
(a = i[
|
|
1887
|
-
return
|
|
1888
|
-
},
|
|
1889
|
-
const
|
|
1890
|
-
var
|
|
1891
|
-
let
|
|
1892
|
-
constructor(i =
|
|
1893
|
-
super(), this._config = i, this._injector =
|
|
1894
|
-
const { menu: e, ...
|
|
1909
|
+
Le = Er([
|
|
1910
|
+
de(0, he),
|
|
1911
|
+
de(1, me),
|
|
1912
|
+
de(2, ae),
|
|
1913
|
+
de(3, ut),
|
|
1914
|
+
de(4, lt),
|
|
1915
|
+
de(5, Ze),
|
|
1916
|
+
de(6, ke(Be))
|
|
1917
|
+
], Le);
|
|
1918
|
+
var Tr = Object.getOwnPropertyDescriptor, Pr = (i, r, t, e) => {
|
|
1919
|
+
for (var n = e > 1 ? void 0 : e ? Tr(r, t) : r, s = i.length - 1, a; s >= 0; s--)
|
|
1920
|
+
(a = i[s]) && (n = a(n) || n);
|
|
1921
|
+
return n;
|
|
1922
|
+
}, st = (i, r) => (t, e) => r(t, e, i);
|
|
1923
|
+
const jr = "UNIVER_DRAWING_UI_PLUGIN";
|
|
1924
|
+
var Fe;
|
|
1925
|
+
let ot = (Fe = class extends At {
|
|
1926
|
+
constructor(i = it, r, t) {
|
|
1927
|
+
super(), this._config = i, this._injector = r, this._configService = t;
|
|
1928
|
+
const { menu: e, ...n } = Ht(
|
|
1895
1929
|
{},
|
|
1896
|
-
|
|
1930
|
+
it,
|
|
1897
1931
|
this._config
|
|
1898
1932
|
);
|
|
1899
|
-
e && this._configService.setConfig("menu", e, { merge: !0 }), this._configService.setConfig(
|
|
1933
|
+
e && this._configService.setConfig("menu", e, { merge: !0 }), this._configService.setConfig(Sr, n);
|
|
1900
1934
|
}
|
|
1901
1935
|
onStarting() {
|
|
1902
1936
|
this._initDependencies();
|
|
1903
1937
|
}
|
|
1904
1938
|
onRendered() {
|
|
1905
|
-
this._injector.get(
|
|
1939
|
+
this._injector.get(Ae), this._injector.get(xe), this._injector.get(He), this._injector.get(Le);
|
|
1906
1940
|
}
|
|
1907
1941
|
_initDependencies() {
|
|
1908
1942
|
[
|
|
1909
|
-
[
|
|
1910
|
-
[Ue],
|
|
1911
|
-
[je],
|
|
1943
|
+
[Be],
|
|
1912
1944
|
[Ae],
|
|
1913
|
-
[
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1945
|
+
[xe],
|
|
1946
|
+
[He],
|
|
1947
|
+
[Le]
|
|
1948
|
+
].forEach((r) => this._injector.add(r));
|
|
1949
|
+
}
|
|
1950
|
+
}, te(Fe, "pluginName", jr), Fe);
|
|
1951
|
+
ot = Pr([
|
|
1952
|
+
st(1, ke(Ut)),
|
|
1953
|
+
st(2, xt)
|
|
1954
|
+
], ot);
|
|
1921
1955
|
export {
|
|
1922
|
-
|
|
1923
|
-
|
|
1956
|
+
Ue as AutoImageCropOperation,
|
|
1957
|
+
Cr as COMPONENT_IMAGE_POPUP_MENU,
|
|
1924
1958
|
ge as CloseImageCropOperation,
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1959
|
+
$r as DrawingCommonPanel,
|
|
1960
|
+
Be as DrawingRenderService,
|
|
1961
|
+
De as ImageCropperObject,
|
|
1962
|
+
_r as ImagePopupMenu,
|
|
1963
|
+
Rt as ImageResetSizeOperation,
|
|
1964
|
+
Ye as OpenImageCropOperation,
|
|
1965
|
+
Xe as SetDrawingAlignOperation,
|
|
1966
|
+
ot as UniverDrawingUIPlugin,
|
|
1967
|
+
We as getUpdateParams
|
|
1934
1968
|
};
|