@univerjs/drawing-ui 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +378 -365
- package/lib/index.js +378 -365
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.d.ts +3 -1
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
package/lib/es/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as _e, UniverInstanceType as ue, ICommandService as ce, LocaleService as re, Inject as Le, Disposable as ke, DrawingTypeEnum as q, checkIfMove as
|
|
5
|
-
import { getDrawingShapeKeyByDrawingSearch as L, SetDrawingSelectedOperation as Ee, IDrawingManagerService as ne, ImageSourceType as Xe, IImageIoService as
|
|
6
|
-
import { Group as
|
|
7
|
-
import { useDependency as A, ComponentManager as
|
|
8
|
-
import { jsx as v, jsxs as N, Fragment as
|
|
9
|
-
import { DropdownMenu as
|
|
10
|
-
import { useRef as
|
|
11
|
-
import { switchMap as
|
|
12
|
-
var
|
|
13
|
-
const
|
|
1
|
+
var Pt = Object.defineProperty;
|
|
2
|
+
var Bt = (i, r, e) => r in i ? Pt(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
|
|
3
|
+
var Z = (i, r, e) => Bt(i, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { CommandType as _e, UniverInstanceType as ue, ICommandService as ce, LocaleService as re, Inject as Le, Disposable as ke, DrawingTypeEnum as q, checkIfMove as lt, toDisposable as ve, IUniverInstanceService as $e, IURLImageService as Ut, ImageSourceType as Ye, Injector as xt, IConfigService as jt, Plugin as At, merge as Ht, ArrangeTypeEnum as Ie, generateRandomId as Lt, debounce as be } from "@univerjs/core";
|
|
5
|
+
import { getDrawingShapeKeyByDrawingSearch as L, SetDrawingSelectedOperation as Ee, IDrawingManagerService as ne, ImageSourceType as Xe, IImageIoService as ut } from "@univerjs/drawing";
|
|
6
|
+
import { Group as We, DrawingGroupObject as gt, DRAWING_OBJECT_LAYER_INDEX as Ne, RENDER_CLASS_TYPE as Je, IRenderManagerService as ge, Shape as kt, Rect as dt, Canvas as $t, Image as Ze, precisionTo as ye, CURSOR_TYPE as Pe, Vector2 as Ge, degToRad as qe, getGroupState as Vt, transformObjectOutOfGroup as Gt } from "@univerjs/engine-render";
|
|
7
|
+
import { useDependency as A, ComponentManager as Wt, IMessageService as Zt, IGalleryService as Ft, IDialogService as Kt } from "@univerjs/ui";
|
|
8
|
+
import { jsx as v, jsxs as N, Fragment as zt } from "react/jsx-runtime";
|
|
9
|
+
import { DropdownMenu as Yt, clsx as Q, borderClassName as Xt, MessageType as Qe, Select as ht, Button as se, InputNumber as pe, Checkbox as Jt } from "@univerjs/design";
|
|
10
|
+
import { useRef as ft, createElement as z, forwardRef as ee, useState as j, useEffect as Ce } from "react";
|
|
11
|
+
import { switchMap as qt, of as Qt, bufferTime as er, filter as et, map as tt } from "rxjs";
|
|
12
|
+
var T = /* @__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))(T || {});
|
|
13
|
+
const Ke = {
|
|
14
14
|
id: "sheet.operation.set-image-align",
|
|
15
15
|
type: _e.OPERATION,
|
|
16
16
|
handler: (i, r) => !0
|
|
@@ -23,12 +23,12 @@ const ze = {
|
|
|
23
23
|
type: _e.OPERATION,
|
|
24
24
|
handler: (i, r) => !0
|
|
25
25
|
};
|
|
26
|
-
var
|
|
27
|
-
const
|
|
26
|
+
var U = /* @__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))(U || {});
|
|
27
|
+
const Be = {
|
|
28
28
|
id: "sheet.operation.Auto-image-crop",
|
|
29
29
|
type: _e.OPERATION,
|
|
30
30
|
handler: (i, r) => !0
|
|
31
|
-
},
|
|
31
|
+
}, pt = {
|
|
32
32
|
id: "sheet.operation.image-reset-size",
|
|
33
33
|
type: _e.OPERATION,
|
|
34
34
|
handler: (i, r) => !0
|
|
@@ -38,24 +38,30 @@ function rt(i, r, e, t) {
|
|
|
38
38
|
if (n == null)
|
|
39
39
|
return;
|
|
40
40
|
const s = L(i), a = e.getObject(s);
|
|
41
|
-
if (a && !(a instanceof
|
|
41
|
+
if (a && !(a instanceof We))
|
|
42
42
|
return;
|
|
43
43
|
if (a != null) {
|
|
44
|
+
const l = a.getObjects();
|
|
45
|
+
for (const g of l)
|
|
46
|
+
if (g.oKey === r.oKey)
|
|
47
|
+
return;
|
|
44
48
|
a.addObject(r);
|
|
45
49
|
return;
|
|
46
50
|
}
|
|
47
|
-
const o = new
|
|
51
|
+
const o = new gt(s);
|
|
48
52
|
e.addObject(o, Ne).attachTransformerTo(o), o.addObject(r);
|
|
49
|
-
const { transform: c } = n;
|
|
50
|
-
c && o.transformByState(
|
|
53
|
+
const { transform: c, groupBaseBound: u } = n;
|
|
54
|
+
u && o.setBaseBound(u), c && o.transformByState(
|
|
51
55
|
{
|
|
52
56
|
left: c.left,
|
|
53
57
|
top: c.top,
|
|
54
|
-
angle: c.angle
|
|
58
|
+
angle: c.angle,
|
|
59
|
+
width: c.width,
|
|
60
|
+
height: c.height
|
|
55
61
|
}
|
|
56
62
|
);
|
|
57
63
|
}
|
|
58
|
-
function
|
|
64
|
+
function mt(i, r) {
|
|
59
65
|
var s;
|
|
60
66
|
const e = r ? i.getUnit(r) : i.getFocusedUnit();
|
|
61
67
|
if (e == null)
|
|
@@ -64,10 +70,13 @@ function ft(i, r) {
|
|
|
64
70
|
let n;
|
|
65
71
|
return e.type === ue.UNIVER_SHEET ? n = (s = e.getActiveSheet()) == null ? void 0 : s.getSheetId() : (e.type === ue.UNIVER_DOC || e.type === ue.UNIVER_SLIDE) && (n = t), { unitId: t, subUnitId: n, current: e };
|
|
66
72
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
const tr = "@univerjs/drawing-ui", rr = "0.17.0", nt = {
|
|
74
|
+
name: tr,
|
|
75
|
+
version: rr
|
|
76
|
+
}, nr = "drawing-ui.config", it = {}, ir = "COMPONENT_IMAGE_POPUP_MENU";
|
|
77
|
+
function Y({ ref: i, ...r }) {
|
|
78
|
+
const { icon: e, id: t, className: n, extend: s, ...a } = r, o = `univerjs-icon univerjs-icon-${t} ${n || ""}`.trim(), c = ft(`_${or()}`);
|
|
79
|
+
return wt(e, `${t}`, {
|
|
71
80
|
defIds: e.defIds,
|
|
72
81
|
idSuffix: c.current
|
|
73
82
|
}, {
|
|
@@ -76,14 +85,14 @@ function K({ ref: i, ...r }) {
|
|
|
76
85
|
...a
|
|
77
86
|
}, s);
|
|
78
87
|
}
|
|
79
|
-
function
|
|
88
|
+
function wt(i, r, e, t, n) {
|
|
80
89
|
return z(i.tag, {
|
|
81
90
|
key: r,
|
|
82
|
-
...
|
|
91
|
+
...ar(i, e, n),
|
|
83
92
|
...t
|
|
84
|
-
}, (
|
|
93
|
+
}, (sr(i, e).children || []).map((s, a) => wt(s, `${r}-${i.tag}-${a}`, e, void 0, n)));
|
|
85
94
|
}
|
|
86
|
-
function
|
|
95
|
+
function ar(i, r, e) {
|
|
87
96
|
const t = { ...i.attrs };
|
|
88
97
|
e != null && e.colorChannel1 && t.fill === "colorChannel1" && (t.fill = e.colorChannel1), i.tag === "mask" && t.id && (t.id = t.id + r.idSuffix), Object.entries(t).forEach(([s, a]) => {
|
|
89
98
|
s === "mask" && typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, `url(#$1${r.idSuffix})`));
|
|
@@ -93,7 +102,7 @@ function tr(i, r, e) {
|
|
|
93
102
|
typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, `url(#$1${r.idSuffix})`));
|
|
94
103
|
})), t;
|
|
95
104
|
}
|
|
96
|
-
function
|
|
105
|
+
function sr(i, r) {
|
|
97
106
|
var t;
|
|
98
107
|
const { defIds: e } = r;
|
|
99
108
|
return !e || e.length === 0 ? i : i.tag === "defs" && ((t = i.children) != null && t.length) ? {
|
|
@@ -107,11 +116,11 @@ function rr(i, r) {
|
|
|
107
116
|
} : n)
|
|
108
117
|
} : i;
|
|
109
118
|
}
|
|
110
|
-
function
|
|
119
|
+
function or() {
|
|
111
120
|
return Math.random().toString(36).substring(2, 8);
|
|
112
121
|
}
|
|
113
|
-
|
|
114
|
-
const
|
|
122
|
+
Y.displayName = "UniverIcon";
|
|
123
|
+
const cr = {
|
|
115
124
|
tag: "svg",
|
|
116
125
|
attrs: {
|
|
117
126
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -154,15 +163,15 @@ const ir = {
|
|
|
154
163
|
}
|
|
155
164
|
}
|
|
156
165
|
]
|
|
157
|
-
},
|
|
158
|
-
return z(
|
|
166
|
+
}, vt = ee(function(r, e) {
|
|
167
|
+
return z(Y, Object.assign({}, r, {
|
|
159
168
|
id: "bottom-icon",
|
|
160
169
|
ref: e,
|
|
161
|
-
icon:
|
|
170
|
+
icon: cr
|
|
162
171
|
}));
|
|
163
172
|
});
|
|
164
|
-
|
|
165
|
-
const
|
|
173
|
+
vt.displayName = "BottomIcon";
|
|
174
|
+
const lr = {
|
|
166
175
|
tag: "svg",
|
|
167
176
|
attrs: {
|
|
168
177
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -203,15 +212,15 @@ const ar = {
|
|
|
203
212
|
}
|
|
204
213
|
}
|
|
205
214
|
]
|
|
206
|
-
},
|
|
207
|
-
return z(
|
|
215
|
+
}, _t = ee(function(r, e) {
|
|
216
|
+
return z(Y, Object.assign({}, r, {
|
|
208
217
|
id: "create-copy-icon",
|
|
209
218
|
ref: e,
|
|
210
|
-
icon:
|
|
219
|
+
icon: lr
|
|
211
220
|
}));
|
|
212
221
|
});
|
|
213
|
-
|
|
214
|
-
const
|
|
222
|
+
_t.displayName = "CreateCopyIcon";
|
|
223
|
+
const ur = {
|
|
215
224
|
tag: "svg",
|
|
216
225
|
attrs: {
|
|
217
226
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -229,15 +238,15 @@ const sr = {
|
|
|
229
238
|
clipRule: "evenodd"
|
|
230
239
|
}
|
|
231
240
|
}]
|
|
232
|
-
},
|
|
233
|
-
return z(
|
|
241
|
+
}, Ct = ee(function(r, e) {
|
|
242
|
+
return z(Y, Object.assign({}, r, {
|
|
234
243
|
id: "group-icon",
|
|
235
244
|
ref: e,
|
|
236
|
-
icon:
|
|
245
|
+
icon: ur
|
|
237
246
|
}));
|
|
238
247
|
});
|
|
239
|
-
|
|
240
|
-
const
|
|
248
|
+
Ct.displayName = "GroupIcon";
|
|
249
|
+
const gr = {
|
|
241
250
|
tag: "svg",
|
|
242
251
|
attrs: {
|
|
243
252
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -255,15 +264,15 @@ const or = {
|
|
|
255
264
|
clipRule: "evenodd"
|
|
256
265
|
}
|
|
257
266
|
}]
|
|
258
|
-
},
|
|
259
|
-
return z(
|
|
267
|
+
}, St = ee(function(r, e) {
|
|
268
|
+
return z(Y, Object.assign({}, r, {
|
|
260
269
|
id: "more-down-icon",
|
|
261
270
|
ref: e,
|
|
262
|
-
icon:
|
|
271
|
+
icon: gr
|
|
263
272
|
}));
|
|
264
273
|
});
|
|
265
|
-
|
|
266
|
-
const
|
|
274
|
+
St.displayName = "MoreDownIcon";
|
|
275
|
+
const dr = {
|
|
267
276
|
tag: "svg",
|
|
268
277
|
attrs: {
|
|
269
278
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -287,15 +296,15 @@ const cr = {
|
|
|
287
296
|
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"
|
|
288
297
|
}
|
|
289
298
|
}]
|
|
290
|
-
},
|
|
291
|
-
return z(
|
|
299
|
+
}, It = ee(function(r, e) {
|
|
300
|
+
return z(Y, Object.assign({}, r, {
|
|
292
301
|
id: "move-down-icon",
|
|
293
302
|
ref: e,
|
|
294
|
-
icon:
|
|
303
|
+
icon: dr
|
|
295
304
|
}));
|
|
296
305
|
});
|
|
297
|
-
|
|
298
|
-
const
|
|
306
|
+
It.displayName = "MoveDownIcon";
|
|
307
|
+
const hr = {
|
|
299
308
|
tag: "svg",
|
|
300
309
|
attrs: {
|
|
301
310
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -319,15 +328,15 @@ const lr = {
|
|
|
319
328
|
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"
|
|
320
329
|
}
|
|
321
330
|
}]
|
|
322
|
-
},
|
|
323
|
-
return z(
|
|
331
|
+
}, bt = ee(function(r, e) {
|
|
332
|
+
return z(Y, Object.assign({}, r, {
|
|
324
333
|
id: "move-up-icon",
|
|
325
334
|
ref: e,
|
|
326
|
-
icon:
|
|
335
|
+
icon: hr
|
|
327
336
|
}));
|
|
328
337
|
});
|
|
329
|
-
|
|
330
|
-
const
|
|
338
|
+
bt.displayName = "MoveUpIcon";
|
|
339
|
+
const fr = {
|
|
331
340
|
tag: "svg",
|
|
332
341
|
attrs: {
|
|
333
342
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -363,15 +372,15 @@ const ur = {
|
|
|
363
372
|
}
|
|
364
373
|
}
|
|
365
374
|
]
|
|
366
|
-
},
|
|
367
|
-
return z(
|
|
375
|
+
}, yt = ee(function(r, e) {
|
|
376
|
+
return z(Y, Object.assign({}, r, {
|
|
368
377
|
id: "topmost-icon",
|
|
369
378
|
ref: e,
|
|
370
|
-
icon:
|
|
379
|
+
icon: fr
|
|
371
380
|
}));
|
|
372
381
|
});
|
|
373
|
-
|
|
374
|
-
const
|
|
382
|
+
yt.displayName = "TopmostIcon";
|
|
383
|
+
const pr = {
|
|
375
384
|
tag: "svg",
|
|
376
385
|
attrs: {
|
|
377
386
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -395,15 +404,15 @@ const gr = {
|
|
|
395
404
|
clipRule: "evenodd"
|
|
396
405
|
}
|
|
397
406
|
}]
|
|
398
|
-
},
|
|
399
|
-
return z(
|
|
407
|
+
}, Rt = ee(function(r, e) {
|
|
408
|
+
return z(Y, Object.assign({}, r, {
|
|
400
409
|
id: "ungroup-icon",
|
|
401
410
|
ref: e,
|
|
402
|
-
icon:
|
|
411
|
+
icon: pr
|
|
403
412
|
}));
|
|
404
413
|
});
|
|
405
|
-
|
|
406
|
-
const
|
|
414
|
+
Rt.displayName = "UngroupIcon";
|
|
415
|
+
const mr = {
|
|
407
416
|
tag: "svg",
|
|
408
417
|
attrs: {
|
|
409
418
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -448,15 +457,15 @@ const dr = {
|
|
|
448
457
|
}
|
|
449
458
|
}
|
|
450
459
|
]
|
|
451
|
-
},
|
|
452
|
-
return z(
|
|
460
|
+
}, Mt = ee(function(r, e) {
|
|
461
|
+
return z(Y, Object.assign({}, r, {
|
|
453
462
|
id: "autofill-double-icon",
|
|
454
463
|
ref: e,
|
|
455
|
-
icon:
|
|
464
|
+
icon: mr
|
|
456
465
|
}));
|
|
457
466
|
});
|
|
458
|
-
|
|
459
|
-
function
|
|
467
|
+
Mt.displayName = "AutofillDoubleIcon";
|
|
468
|
+
function wr(i) {
|
|
460
469
|
var h;
|
|
461
470
|
const { popup: r } = i, e = (h = r == null ? void 0 : r.extraProps) == null ? void 0 : h.menuItems;
|
|
462
471
|
if (!e) return null;
|
|
@@ -475,7 +484,7 @@ function hr(i) {
|
|
|
475
484
|
onMouseEnter: u,
|
|
476
485
|
onMouseLeave: l,
|
|
477
486
|
children: /* @__PURE__ */ v(
|
|
478
|
-
|
|
487
|
+
Yt,
|
|
479
488
|
{
|
|
480
489
|
align: "start",
|
|
481
490
|
items: w.map((p) => ({
|
|
@@ -488,18 +497,18 @@ function hr(i) {
|
|
|
488
497
|
children: /* @__PURE__ */ N(
|
|
489
498
|
"div",
|
|
490
499
|
{
|
|
491
|
-
className: Q("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800",
|
|
500
|
+
className: Q("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", Xt, {
|
|
492
501
|
"univer-bg-gray-100 dark:!univer-bg-gray-800": s,
|
|
493
502
|
"univer-bg-white dark:!univer-bg-gray-900": !s
|
|
494
503
|
}),
|
|
495
504
|
children: [
|
|
496
505
|
/* @__PURE__ */ v(
|
|
497
|
-
|
|
506
|
+
Mt,
|
|
498
507
|
{
|
|
499
508
|
className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white"
|
|
500
509
|
}
|
|
501
510
|
),
|
|
502
|
-
f && /* @__PURE__ */ v(
|
|
511
|
+
f && /* @__PURE__ */ v(St, { className: "dark:!univer-text-white" })
|
|
503
512
|
]
|
|
504
513
|
}
|
|
505
514
|
)
|
|
@@ -508,36 +517,36 @@ function hr(i) {
|
|
|
508
517
|
}
|
|
509
518
|
);
|
|
510
519
|
}
|
|
511
|
-
var
|
|
512
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
520
|
+
var vr = Object.getOwnPropertyDescriptor, _r = (i, r, e, t) => {
|
|
521
|
+
for (var n = t > 1 ? void 0 : t ? vr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
513
522
|
(a = i[s]) && (n = a(n) || n);
|
|
514
523
|
return n;
|
|
515
|
-
},
|
|
516
|
-
let
|
|
524
|
+
}, at = (i, r) => (e, t) => r(e, t, i);
|
|
525
|
+
let Ue = class extends ke {
|
|
517
526
|
constructor(i, r) {
|
|
518
527
|
super(), this._componentManager = i, this._commandService = r, this._init();
|
|
519
528
|
}
|
|
520
529
|
_initCustomComponents() {
|
|
521
530
|
const i = this._componentManager;
|
|
522
|
-
this.disposeWithMe(i.register(
|
|
531
|
+
this.disposeWithMe(i.register(ir, wr));
|
|
523
532
|
}
|
|
524
533
|
_initCommands() {
|
|
525
534
|
[
|
|
526
535
|
Fe,
|
|
527
536
|
oe,
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
537
|
+
pt,
|
|
538
|
+
Ke,
|
|
539
|
+
Be
|
|
531
540
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
532
541
|
}
|
|
533
542
|
_init() {
|
|
534
543
|
this._initCommands(), this._initCustomComponents();
|
|
535
544
|
}
|
|
536
545
|
};
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
],
|
|
546
|
+
Ue = _r([
|
|
547
|
+
at(0, Le(Wt)),
|
|
548
|
+
at(1, ce)
|
|
549
|
+
], Ue);
|
|
541
550
|
function Ve(i, r) {
|
|
542
551
|
const e = [];
|
|
543
552
|
return i.forEach((t) => {
|
|
@@ -560,15 +569,15 @@ function Ve(i, r) {
|
|
|
560
569
|
w === q.DRAWING_IMAGE && (h.srcRect = t.srcRect), e.push(h);
|
|
561
570
|
}), e;
|
|
562
571
|
}
|
|
563
|
-
var
|
|
564
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
572
|
+
var Cr = Object.getOwnPropertyDescriptor, Sr = (i, r, e, t) => {
|
|
573
|
+
for (var n = t > 1 ? void 0 : t ? Cr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
565
574
|
(a = i[s]) && (n = a(n) || n);
|
|
566
575
|
return n;
|
|
567
|
-
},
|
|
576
|
+
}, Re = (i, r) => (e, t) => r(e, t, i);
|
|
568
577
|
let xe = class extends ke {
|
|
569
578
|
constructor(r, e, t, n) {
|
|
570
579
|
super();
|
|
571
|
-
|
|
580
|
+
Z(this, "_sceneListenerOnDrawingMap", /* @__PURE__ */ new WeakSet());
|
|
572
581
|
this._currentUniverService = r, this._commandService = e, this._renderManagerService = t, this._drawingManagerService = n, this._initialize();
|
|
573
582
|
}
|
|
574
583
|
dispose() {
|
|
@@ -578,7 +587,7 @@ let xe = class extends ke {
|
|
|
578
587
|
this._recoveryImages(), this._drawingAddListener(), this._drawingRemoveListener(), this._drawingUpdateListener(), this._commandExecutedListener(), this._drawingArrangeListener(), this._drawingGroupListener(), this._drawingRefreshListener(), this._drawingVisibleListener();
|
|
579
588
|
}
|
|
580
589
|
_recoveryImages() {
|
|
581
|
-
const r = this._drawingManagerService.drawingManagerData, e =
|
|
590
|
+
const r = this._drawingManagerService.drawingManagerData, e = mt(this._currentUniverService);
|
|
582
591
|
if (e == null)
|
|
583
592
|
return;
|
|
584
593
|
const { unitId: t, subUnitId: n } = e;
|
|
@@ -594,7 +603,7 @@ let xe = class extends ke {
|
|
|
594
603
|
_commandExecutedListener() {
|
|
595
604
|
this.disposeWithMe(
|
|
596
605
|
this._commandService.onCommandExecuted((r) => {
|
|
597
|
-
if (r.id ===
|
|
606
|
+
if (r.id === Ke.id) {
|
|
598
607
|
const e = r.params;
|
|
599
608
|
if (e == null)
|
|
600
609
|
return;
|
|
@@ -664,8 +673,8 @@ let xe = class extends ke {
|
|
|
664
673
|
p != null && (h.classType === Je.GROUP ? h.transformByState({ left: p.left, top: p.top }) : h.transformByState(p));
|
|
665
674
|
}), l.length === 0)
|
|
666
675
|
return;
|
|
667
|
-
const g = L({ unitId: n, subUnitId: s, drawingId: a }), d = new
|
|
668
|
-
c.addObject(d, Ne).attachTransformerTo(d), d.addObjects(...l), e.transform && d.transformByState({ left: e.transform.left, top: e.transform.top }), u.clearSelectedObjects(), u.setSelectedControl(d);
|
|
676
|
+
const g = L({ unitId: n, subUnitId: s, drawingId: a }), d = new gt(g);
|
|
677
|
+
c.addObject(d, Ne).attachTransformerTo(d), d.addObjects(...l), e.groupBaseBound && d.setBaseBound(e.groupBaseBound), e.transform && d.transformByState({ left: e.transform.left, top: e.transform.top, width: e.transform.width, height: e.transform.height, angle: e.transform.angle }), u.clearSelectedObjects(), u.setSelectedControl(d);
|
|
669
678
|
}
|
|
670
679
|
// private _regroupDrawings(drawings: IDrawingSearch[]) {
|
|
671
680
|
// const renderObject = this._getSceneAndTransformerByDrawingSearch(drawings[0].unitId);
|
|
@@ -727,7 +736,7 @@ let xe = class extends ke {
|
|
|
727
736
|
}
|
|
728
737
|
_drawingAlign(r) {
|
|
729
738
|
const { alignType: e } = r, t = this._drawingManagerService.getFocusDrawings();
|
|
730
|
-
if (e ===
|
|
739
|
+
if (e === T.default)
|
|
731
740
|
return;
|
|
732
741
|
const n = [];
|
|
733
742
|
let s = Number.POSITIVE_INFINITY, a = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY, c = Number.NEGATIVE_INFINITY, u = 0;
|
|
@@ -752,42 +761,42 @@ let xe = class extends ke {
|
|
|
752
761
|
return;
|
|
753
762
|
const { scene: d, transformer: f } = g;
|
|
754
763
|
r.forEach((w, h) => {
|
|
755
|
-
const { unitId: p, subUnitId: C, drawingId: _, transform: I, drawingType:
|
|
756
|
-
let O =
|
|
764
|
+
const { unitId: p, subUnitId: C, drawingId: _, transform: I, drawingType: M } = w, { left: D = 0, top: S = 0, width: y = 0, height: b = 0 } = I;
|
|
765
|
+
let O = D, R = S;
|
|
757
766
|
switch (e) {
|
|
758
|
-
case
|
|
767
|
+
case T.left:
|
|
759
768
|
O = t;
|
|
760
769
|
break;
|
|
761
|
-
case
|
|
762
|
-
O = t + (s - t) / 2 -
|
|
770
|
+
case T.center:
|
|
771
|
+
O = t + (s - t) / 2 - y / 2;
|
|
763
772
|
break;
|
|
764
|
-
case
|
|
765
|
-
O = s -
|
|
773
|
+
case T.right:
|
|
774
|
+
O = s - y;
|
|
766
775
|
break;
|
|
767
|
-
case
|
|
768
|
-
|
|
776
|
+
case T.top:
|
|
777
|
+
R = n;
|
|
769
778
|
break;
|
|
770
|
-
case
|
|
771
|
-
|
|
779
|
+
case T.middle:
|
|
780
|
+
R = n + (a - n) / 2 - b / 2;
|
|
772
781
|
break;
|
|
773
|
-
case
|
|
774
|
-
|
|
782
|
+
case T.bottom:
|
|
783
|
+
R = a - b;
|
|
775
784
|
break;
|
|
776
|
-
case
|
|
785
|
+
case T.horizon:
|
|
777
786
|
O = t + c * h;
|
|
778
787
|
break;
|
|
779
|
-
case
|
|
780
|
-
|
|
788
|
+
case T.vertical:
|
|
789
|
+
R = n + u * h;
|
|
781
790
|
break;
|
|
782
791
|
}
|
|
783
|
-
(O !==
|
|
792
|
+
(O !== D || R !== S) && l.push({
|
|
784
793
|
unitId: p,
|
|
785
794
|
subUnitId: C,
|
|
786
795
|
drawingId: _,
|
|
787
|
-
drawingType:
|
|
796
|
+
drawingType: M,
|
|
788
797
|
transform: {
|
|
789
798
|
left: O,
|
|
790
|
-
top:
|
|
799
|
+
top: R
|
|
791
800
|
}
|
|
792
801
|
});
|
|
793
802
|
}), this._drawingManagerService.featurePluginUpdateNotification(l), f.refreshControls().changeNotification();
|
|
@@ -806,21 +815,21 @@ let xe = class extends ke {
|
|
|
806
815
|
height: w = 0
|
|
807
816
|
} = a;
|
|
808
817
|
switch (e) {
|
|
809
|
-
case
|
|
818
|
+
case T.left:
|
|
810
819
|
return o - g;
|
|
811
|
-
case
|
|
820
|
+
case T.center:
|
|
812
821
|
return o + u / 2 - (g + f / 2);
|
|
813
|
-
case
|
|
822
|
+
case T.right:
|
|
814
823
|
return o + u - (g + f);
|
|
815
|
-
case
|
|
824
|
+
case T.top:
|
|
816
825
|
return c - d;
|
|
817
|
-
case
|
|
826
|
+
case T.middle:
|
|
818
827
|
return c + l / 2 - (d + w / 2);
|
|
819
|
-
case
|
|
828
|
+
case T.bottom:
|
|
820
829
|
return c + l - (d + w);
|
|
821
|
-
case
|
|
830
|
+
case T.horizon:
|
|
822
831
|
return o + u / 2 - (g + f / 2);
|
|
823
|
-
case
|
|
832
|
+
case T.vertical:
|
|
824
833
|
return c + l / 2 - (d + w / 2);
|
|
825
834
|
default:
|
|
826
835
|
return 0;
|
|
@@ -892,7 +901,7 @@ let xe = class extends ke {
|
|
|
892
901
|
this.disposeWithMe(
|
|
893
902
|
this._drawingManagerService.update$.subscribe((r) => {
|
|
894
903
|
r.forEach((e) => {
|
|
895
|
-
var
|
|
904
|
+
var y;
|
|
896
905
|
const { unitId: t, subUnitId: n, drawingId: s } = e, a = this._drawingManagerService.getDrawingByParam(e);
|
|
897
906
|
if (a == null)
|
|
898
907
|
return;
|
|
@@ -902,10 +911,10 @@ let xe = class extends ke {
|
|
|
902
911
|
const { scene: l, transformer: g } = u;
|
|
903
912
|
if (o == null)
|
|
904
913
|
return !0;
|
|
905
|
-
const { left: d = 0, top: f = 0, width: w = 0, height: h = 0, angle: p = 0, flipX: C = !1, flipY: _ = !1, skewX: I = 0, skewY:
|
|
914
|
+
const { left: d = 0, top: f = 0, width: w = 0, height: h = 0, angle: p = 0, flipX: C = !1, flipY: _ = !1, skewX: I = 0, skewY: M = 0 } = o, D = L({ unitId: t, subUnitId: n, drawingId: s }), S = l.getObject(D);
|
|
906
915
|
if (S == null)
|
|
907
916
|
return !0;
|
|
908
|
-
S.transformByState({ left: d, top: f, width: w, height: h, angle: p, flipX: C, flipY: _, skewX: I, skewY:
|
|
917
|
+
S.transformByState({ left: d, top: f, width: w, height: h, angle: p, flipX: C, flipY: _, skewX: I, skewY: M }), (y = l.getTransformer()) == null || y.debounceRefreshControls();
|
|
909
918
|
});
|
|
910
919
|
})
|
|
911
920
|
);
|
|
@@ -932,9 +941,9 @@ let xe = class extends ke {
|
|
|
932
941
|
flipX: C = !1,
|
|
933
942
|
flipY: _ = !1,
|
|
934
943
|
skewX: I = 0,
|
|
935
|
-
skewY:
|
|
944
|
+
skewY: M = 0
|
|
936
945
|
} = c;
|
|
937
|
-
g.transformByState({ left: d, top: f, width: w, height: h, angle: p, flipX: C, flipY: _, skewX: I, skewY:
|
|
946
|
+
g.transformByState({ left: d, top: f, width: w, height: h, angle: p, flipX: C, flipY: _, skewX: I, skewY: M });
|
|
938
947
|
});
|
|
939
948
|
})
|
|
940
949
|
);
|
|
@@ -959,7 +968,7 @@ let xe = class extends ke {
|
|
|
959
968
|
if (t == null)
|
|
960
969
|
return !1;
|
|
961
970
|
const { transform: s } = t;
|
|
962
|
-
return
|
|
971
|
+
return lt(s, e == null ? void 0 : e[n]);
|
|
963
972
|
});
|
|
964
973
|
}
|
|
965
974
|
// group?.getObjects().forEach((o) => {
|
|
@@ -973,21 +982,21 @@ let xe = class extends ke {
|
|
|
973
982
|
const e = r.getTransformerByCreate();
|
|
974
983
|
let t = null;
|
|
975
984
|
this.disposeWithMe(
|
|
976
|
-
|
|
985
|
+
ve(
|
|
977
986
|
e.changeStart$.subscribe((n) => {
|
|
978
987
|
const { objects: s } = n, a = Array.from(s.values()), o = [];
|
|
979
988
|
t = a.map((c) => {
|
|
980
989
|
const { left: u, top: l, height: g, width: d, angle: f, oKey: w, isInGroup: h } = c, p = this._drawingManagerService.getDrawingOKey(w);
|
|
981
|
-
if (h || c instanceof
|
|
990
|
+
if (h || c instanceof We) {
|
|
982
991
|
let C = c.ancestorGroup;
|
|
983
|
-
if (C == null && c instanceof
|
|
992
|
+
if (C == null && c instanceof We && (C = c), C == null)
|
|
984
993
|
return null;
|
|
985
994
|
const _ = this._drawingManagerService.getDrawingOKey(C.oKey);
|
|
986
995
|
if (_) {
|
|
987
|
-
const { unitId: I, subUnitId:
|
|
988
|
-
o.push({ unitId: I, subUnitId:
|
|
989
|
-
const { left: S, top:
|
|
990
|
-
return { left: S, top:
|
|
996
|
+
const { unitId: I, subUnitId: M, drawingId: D } = _;
|
|
997
|
+
o.push({ unitId: I, subUnitId: M, drawingId: D });
|
|
998
|
+
const { left: S, top: y, height: b, width: O, angle: R } = C;
|
|
999
|
+
return { left: S, top: y, height: b, width: O, angle: R };
|
|
991
1000
|
}
|
|
992
1001
|
} else if (p != null) {
|
|
993
1002
|
const { unitId: C, subUnitId: _, drawingId: I } = p;
|
|
@@ -998,7 +1007,7 @@ let xe = class extends ke {
|
|
|
998
1007
|
})
|
|
999
1008
|
)
|
|
1000
1009
|
), this.disposeWithMe(
|
|
1001
|
-
|
|
1010
|
+
ve(
|
|
1002
1011
|
e.changeEnd$.subscribe((n) => {
|
|
1003
1012
|
const { objects: s } = n, a = this._filterUpdateParams(Ve(s, this._drawingManagerService), t);
|
|
1004
1013
|
a.length > 0 && this._drawingManagerService.featurePluginUpdateNotification(a);
|
|
@@ -1007,13 +1016,13 @@ let xe = class extends ke {
|
|
|
1007
1016
|
);
|
|
1008
1017
|
}
|
|
1009
1018
|
};
|
|
1010
|
-
xe =
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1019
|
+
xe = Sr([
|
|
1020
|
+
Re(0, $e),
|
|
1021
|
+
Re(1, ce),
|
|
1022
|
+
Re(2, ge),
|
|
1023
|
+
Re(3, ne)
|
|
1015
1024
|
], xe);
|
|
1016
|
-
class
|
|
1025
|
+
class Me extends kt {
|
|
1017
1026
|
constructor(e, t) {
|
|
1018
1027
|
t == null && (t = {}), t.transformerConfig = {
|
|
1019
1028
|
keepRatio: !1,
|
|
@@ -1023,11 +1032,11 @@ class Re extends Ht {
|
|
|
1023
1032
|
anchorSize: 24
|
|
1024
1033
|
};
|
|
1025
1034
|
super(e, t);
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1035
|
+
Z(this, "_srcRect");
|
|
1036
|
+
Z(this, "_prstGeom");
|
|
1037
|
+
Z(this, "_applyTransform");
|
|
1038
|
+
Z(this, "_dragPadding", 8);
|
|
1039
|
+
Z(this, "_cacheCanvas");
|
|
1031
1040
|
t != null && t.srcRect && (this._srcRect = t.srcRect), t != null && t.prstGeom && (this._prstGeom = t.prstGeom), t != null && t.applyTransform && (this._applyTransform = t.applyTransform), t != null && t.dragPadding && (this._dragPadding = t.dragPadding), this._applyProps();
|
|
1032
1041
|
}
|
|
1033
1042
|
refreshSrcRect(e, t) {
|
|
@@ -1056,7 +1065,7 @@ class Re extends Ht {
|
|
|
1056
1065
|
const n = this.getScene().getEngine(), { width: s, height: a } = n;
|
|
1057
1066
|
this._initialCacheCanvas(), (c = this._cacheCanvas) == null || c.clear();
|
|
1058
1067
|
const o = (u = this._cacheCanvas) == null ? void 0 : u.getContext();
|
|
1059
|
-
o != null && (o.save(),
|
|
1068
|
+
o != null && (o.save(), dt.drawWith(o, {
|
|
1060
1069
|
left: 0,
|
|
1061
1070
|
top: 0,
|
|
1062
1071
|
width: s,
|
|
@@ -1100,7 +1109,7 @@ class Re extends Ht {
|
|
|
1100
1109
|
return;
|
|
1101
1110
|
const e = this.getScene();
|
|
1102
1111
|
if (e == null) return;
|
|
1103
|
-
this._cacheCanvas = new
|
|
1112
|
+
this._cacheCanvas = new $t();
|
|
1104
1113
|
const t = e.getEngine();
|
|
1105
1114
|
this._cacheCanvas.setSize(t.width, t.height), t.onTransformChange$.subscribeEvent(() => {
|
|
1106
1115
|
var n;
|
|
@@ -1108,15 +1117,15 @@ class Re extends Ht {
|
|
|
1108
1117
|
});
|
|
1109
1118
|
}
|
|
1110
1119
|
}
|
|
1111
|
-
var
|
|
1112
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
1120
|
+
var Ir = Object.getOwnPropertyDescriptor, br = (i, r, e, t) => {
|
|
1121
|
+
for (var n = t > 1 ? void 0 : t ? Ir(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
1113
1122
|
(a = i[s]) && (n = a(n) || n);
|
|
1114
1123
|
return n;
|
|
1115
1124
|
}, le = (i, r) => (e, t) => r(e, t, i);
|
|
1116
1125
|
let je = class extends ke {
|
|
1117
1126
|
constructor(r, e, t, n, s, a) {
|
|
1118
1127
|
super();
|
|
1119
|
-
|
|
1128
|
+
Z(this, "_sceneListenerOnImageMap", /* @__PURE__ */ new WeakSet());
|
|
1120
1129
|
this._commandService = r, this._drawingManagerService = e, this._renderManagerService = t, this._univerInstanceService = n, this._messageService = s, this._localeService = a, this._init();
|
|
1121
1130
|
}
|
|
1122
1131
|
_init() {
|
|
@@ -1125,7 +1134,7 @@ let je = class extends ke {
|
|
|
1125
1134
|
_initAutoCrop() {
|
|
1126
1135
|
this.disposeWithMe(
|
|
1127
1136
|
this._commandService.onCommandExecuted((r) => {
|
|
1128
|
-
if (r.id !==
|
|
1137
|
+
if (r.id !== Be.id)
|
|
1129
1138
|
return;
|
|
1130
1139
|
const e = r.params;
|
|
1131
1140
|
if (e == null)
|
|
@@ -1165,34 +1174,34 @@ let je = class extends ke {
|
|
|
1165
1174
|
const { left: t, top: n, width: s, height: a } = e.calculateTransformWithSrcRect();
|
|
1166
1175
|
let o;
|
|
1167
1176
|
switch (r) {
|
|
1168
|
-
case
|
|
1177
|
+
case U.R1_1:
|
|
1169
1178
|
o = this._calculateSrcRectByRatio(t, n, s, a, 1, 1);
|
|
1170
1179
|
break;
|
|
1171
|
-
case
|
|
1180
|
+
case U.R16_9:
|
|
1172
1181
|
o = this._calculateSrcRectByRatio(t, n, s, a, 16, 9);
|
|
1173
1182
|
break;
|
|
1174
|
-
case
|
|
1183
|
+
case U.R9_16:
|
|
1175
1184
|
o = this._calculateSrcRectByRatio(t, n, s, a, 9, 16);
|
|
1176
1185
|
break;
|
|
1177
|
-
case
|
|
1186
|
+
case U.R5_4:
|
|
1178
1187
|
o = this._calculateSrcRectByRatio(t, n, s, a, 5, 4);
|
|
1179
1188
|
break;
|
|
1180
|
-
case
|
|
1189
|
+
case U.R4_5:
|
|
1181
1190
|
o = this._calculateSrcRectByRatio(t, n, s, a, 4, 5);
|
|
1182
1191
|
break;
|
|
1183
|
-
case
|
|
1192
|
+
case U.R4_3:
|
|
1184
1193
|
o = this._calculateSrcRectByRatio(t, n, s, a, 4, 3);
|
|
1185
1194
|
break;
|
|
1186
|
-
case
|
|
1195
|
+
case U.R3_4:
|
|
1187
1196
|
o = this._calculateSrcRectByRatio(t, n, s, a, 3, 4);
|
|
1188
1197
|
break;
|
|
1189
|
-
case
|
|
1198
|
+
case U.R3_2:
|
|
1190
1199
|
o = this._calculateSrcRectByRatio(t, n, s, a, 3, 2);
|
|
1191
1200
|
break;
|
|
1192
|
-
case
|
|
1201
|
+
case U.R2_3:
|
|
1193
1202
|
o = this._calculateSrcRectByRatio(t, n, s, a, 2, 3);
|
|
1194
1203
|
break;
|
|
1195
|
-
case
|
|
1204
|
+
case U.FREE:
|
|
1196
1205
|
}
|
|
1197
1206
|
if (o == null)
|
|
1198
1207
|
return;
|
|
@@ -1230,7 +1239,7 @@ let je = class extends ke {
|
|
|
1230
1239
|
}
|
|
1231
1240
|
const g = o.getTransformer();
|
|
1232
1241
|
g == null || g.clearControls();
|
|
1233
|
-
const d = new
|
|
1242
|
+
const d = new Me(`${u}-crop`, {
|
|
1234
1243
|
srcRect: l.srcRect,
|
|
1235
1244
|
prstGeom: l.prstGeom,
|
|
1236
1245
|
applyTransform: l.calculateTransformWithSrcRect()
|
|
@@ -1242,7 +1251,7 @@ let je = class extends ke {
|
|
|
1242
1251
|
_searchCropObject(r) {
|
|
1243
1252
|
const e = r.getAllObjectsByOrder();
|
|
1244
1253
|
for (const t of e)
|
|
1245
|
-
if (t instanceof
|
|
1254
|
+
if (t instanceof Me)
|
|
1246
1255
|
return t;
|
|
1247
1256
|
}
|
|
1248
1257
|
_initCloseCrop() {
|
|
@@ -1283,7 +1292,7 @@ let je = class extends ke {
|
|
|
1283
1292
|
})
|
|
1284
1293
|
);
|
|
1285
1294
|
const r = this._univerInstanceService.getCurrentTypeOfUnit$(ue.UNIVER_SHEET).pipe(
|
|
1286
|
-
|
|
1295
|
+
qt((e) => e ? e.activeSheet$ : Qt(null))
|
|
1287
1296
|
);
|
|
1288
1297
|
this.disposeWithMe(r.subscribe(() => {
|
|
1289
1298
|
this._commandService.syncExecuteCommand(oe.id);
|
|
@@ -1301,7 +1310,7 @@ let je = class extends ke {
|
|
|
1301
1310
|
this.disposeWithMe(
|
|
1302
1311
|
e.changeStart$.subscribe((n) => {
|
|
1303
1312
|
const { objects: s } = n, a = s.values().next().value;
|
|
1304
|
-
if (a == null || !(a instanceof
|
|
1313
|
+
if (a == null || !(a instanceof Me))
|
|
1305
1314
|
return;
|
|
1306
1315
|
const { left: o, top: c, height: u, width: l, angle: g } = a;
|
|
1307
1316
|
t = { left: o, top: c, height: u, width: l, angle: g }, e.clearCopperControl();
|
|
@@ -1309,10 +1318,10 @@ let je = class extends ke {
|
|
|
1309
1318
|
), this.disposeWithMe(
|
|
1310
1319
|
e.changeEnd$.subscribe((n) => {
|
|
1311
1320
|
const { objects: s } = n, a = s.values().next().value;
|
|
1312
|
-
if (a == null || !(a instanceof
|
|
1321
|
+
if (a == null || !(a instanceof Me))
|
|
1313
1322
|
return;
|
|
1314
1323
|
const { left: o, top: c, height: u, width: l, angle: g } = a;
|
|
1315
|
-
if (!
|
|
1324
|
+
if (!lt({ left: o, top: c, height: u, width: l, angle: g }, t))
|
|
1316
1325
|
return;
|
|
1317
1326
|
const d = this._getApplyObjectByCropObject(a);
|
|
1318
1327
|
if (d == null)
|
|
@@ -1349,12 +1358,12 @@ let je = class extends ke {
|
|
|
1349
1358
|
bottom: d - p - s
|
|
1350
1359
|
}, _ = { ...C };
|
|
1351
1360
|
if (f !== 0) {
|
|
1352
|
-
const I = t + a / 2,
|
|
1353
|
-
O.rotateByPoint(qe(f),
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1356
|
-
const
|
|
1357
|
-
_.left =
|
|
1361
|
+
const I = t + a / 2, M = n + s / 2, D = new Ge(I, M), S = g / 2 + u, y = d / 2 + l, b = new Ge(S, y), O = new Ge(u, l);
|
|
1362
|
+
O.rotateByPoint(qe(f), b);
|
|
1363
|
+
const R = O.clone();
|
|
1364
|
+
R.rotateByPoint(qe(-f), D);
|
|
1365
|
+
const B = t - R.x, P = n - R.y;
|
|
1366
|
+
_.left = B, _.top = P, _.right = g - B - a, _.bottom = d - P - s;
|
|
1358
1367
|
}
|
|
1359
1368
|
return {
|
|
1360
1369
|
srcRect: C,
|
|
@@ -1362,16 +1371,16 @@ let je = class extends ke {
|
|
|
1362
1371
|
};
|
|
1363
1372
|
}
|
|
1364
1373
|
};
|
|
1365
|
-
je =
|
|
1374
|
+
je = br([
|
|
1366
1375
|
le(0, ce),
|
|
1367
1376
|
le(1, ne),
|
|
1368
1377
|
le(2, ge),
|
|
1369
1378
|
le(3, $e),
|
|
1370
|
-
le(4,
|
|
1379
|
+
le(4, Zt),
|
|
1371
1380
|
le(5, Le(re))
|
|
1372
1381
|
], je);
|
|
1373
|
-
var
|
|
1374
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
1382
|
+
var yr = Object.getOwnPropertyDescriptor, Rr = (i, r, e, t) => {
|
|
1383
|
+
for (var n = t > 1 ? void 0 : t ? yr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
1375
1384
|
(a = i[s]) && (n = a(n) || n);
|
|
1376
1385
|
return n;
|
|
1377
1386
|
}, me = (i, r) => (e, t) => r(e, t, i);
|
|
@@ -1399,12 +1408,12 @@ let Ae = class {
|
|
|
1399
1408
|
return;
|
|
1400
1409
|
const w = d && f ? f : [e], h = [];
|
|
1401
1410
|
for (const p of w) {
|
|
1402
|
-
const { left: C, top: _, width: I, height:
|
|
1403
|
-
if (
|
|
1404
|
-
|
|
1411
|
+
const { left: C, top: _, width: I, height: M, angle: D, flipX: S, flipY: y, skewX: b, skewY: O } = p, R = w.indexOf(p), B = L({ unitId: u, subUnitId: l, drawingId: g }, d ? R : void 0), P = r.getObject(B);
|
|
1412
|
+
if (P != null) {
|
|
1413
|
+
P.transformByState({ left: C, top: _, width: I, height: M, angle: D, flipX: S, flipY: y, skewX: b, skewY: O });
|
|
1405
1414
|
continue;
|
|
1406
1415
|
}
|
|
1407
|
-
const
|
|
1416
|
+
const F = this._drawingManagerService.getDrawingOrder(u, l), X = F.indexOf(g), $ = { ...p, zIndex: X === -1 ? F.length - 1 : X }, Se = this._imageIoService.getImageSourceCache(n, s);
|
|
1408
1417
|
let te = !1;
|
|
1409
1418
|
if (Se != null)
|
|
1410
1419
|
$.image = Se;
|
|
@@ -1424,10 +1433,10 @@ let Ae = class {
|
|
|
1424
1433
|
te = !0;
|
|
1425
1434
|
} else
|
|
1426
1435
|
$.url = n, te = !0;
|
|
1427
|
-
if (r.getObject(
|
|
1436
|
+
if (r.getObject(B))
|
|
1428
1437
|
continue;
|
|
1429
1438
|
$.printable = !0;
|
|
1430
|
-
const V = new Ze(
|
|
1439
|
+
const V = new Ze(B, $);
|
|
1431
1440
|
te && this._imageIoService.addImageSourceCache(n, s, V.getNative()), r.addObject(V, Ne), this._drawingManagerService.getDrawingEditable() && r.attachTransformerTo(V), c && rt({ drawingId: c, unitId: u, subUnitId: l }, V, r, this._drawingManagerService), o != null && V.setPrstGeom(o), a != null && V.setSrcRect(a), h.push(V);
|
|
1432
1441
|
}
|
|
1433
1442
|
return h;
|
|
@@ -1451,17 +1460,17 @@ let Ae = class {
|
|
|
1451
1460
|
return;
|
|
1452
1461
|
const l = c && u ? u : [e], g = [];
|
|
1453
1462
|
for (const d of l) {
|
|
1454
|
-
const { left: f, top: w, width: h, height: p, angle: C, flipX: _, flipY: I, skewX:
|
|
1455
|
-
if (
|
|
1456
|
-
|
|
1463
|
+
const { left: f, top: w, width: h, height: p, angle: C, flipX: _, flipY: I, skewX: M, skewY: D } = d, S = l.indexOf(d), y = L({ unitId: s, subUnitId: a, drawingId: o }, c ? S : void 0), b = r.getObject(y);
|
|
1464
|
+
if (b != null) {
|
|
1465
|
+
b.transformByState({ left: f, top: w, width: h, height: p, angle: C, flipX: _, flipY: I, skewX: M, skewY: D });
|
|
1457
1466
|
continue;
|
|
1458
1467
|
}
|
|
1459
|
-
const O = this._drawingManagerService.getDrawingOrder(s, a),
|
|
1460
|
-
if (r.getObject(
|
|
1468
|
+
const O = this._drawingManagerService.getDrawingOrder(s, a), R = O.indexOf(o), B = { ...d, zIndex: R === -1 ? O.length - 1 : R };
|
|
1469
|
+
if (r.getObject(y))
|
|
1461
1470
|
continue;
|
|
1462
|
-
|
|
1463
|
-
const
|
|
1464
|
-
this._drawingManagerService.getDrawingVisible() && (r.addObject(
|
|
1471
|
+
B.printable = !1;
|
|
1472
|
+
const P = new dt(y, B);
|
|
1473
|
+
this._drawingManagerService.getDrawingVisible() && (r.addObject(P, Ne), this._drawingManagerService.getDrawingEditable() && i.allowTransform !== !1 && r.attachTransformerTo(P), n && rt({ drawingId: n, unitId: s, subUnitId: a }, P, r, this._drawingManagerService), g.push(P));
|
|
1465
1474
|
}
|
|
1466
1475
|
return g;
|
|
1467
1476
|
}
|
|
@@ -1491,15 +1500,15 @@ let Ae = class {
|
|
|
1491
1500
|
};
|
|
1492
1501
|
}
|
|
1493
1502
|
};
|
|
1494
|
-
Ae =
|
|
1503
|
+
Ae = Rr([
|
|
1495
1504
|
me(0, ne),
|
|
1496
|
-
me(1,
|
|
1497
|
-
me(2,
|
|
1498
|
-
me(3,
|
|
1505
|
+
me(1, ut),
|
|
1506
|
+
me(2, Ft),
|
|
1507
|
+
me(3, Ut),
|
|
1499
1508
|
me(4, $e)
|
|
1500
1509
|
], Ae);
|
|
1501
|
-
var
|
|
1502
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
1510
|
+
var Mr = Object.getOwnPropertyDescriptor, Or = (i, r, e, t) => {
|
|
1511
|
+
for (var n = t > 1 ? void 0 : t ? Mr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
1503
1512
|
(a = i[s]) && (n = a(n) || n);
|
|
1504
1513
|
return n;
|
|
1505
1514
|
}, ae = (i, r) => (e, t) => r(e, t, i);
|
|
@@ -1516,7 +1525,7 @@ let He = class extends ke {
|
|
|
1516
1525
|
_commandExecutedListener() {
|
|
1517
1526
|
this.disposeWithMe(
|
|
1518
1527
|
this._commandService.onCommandExecuted((i) => {
|
|
1519
|
-
if (i.id ===
|
|
1528
|
+
if (i.id === pt.id) {
|
|
1520
1529
|
const r = i.params;
|
|
1521
1530
|
if (r == null)
|
|
1522
1531
|
return;
|
|
@@ -1568,7 +1577,7 @@ let He = class extends ke {
|
|
|
1568
1577
|
_drawingAddListener() {
|
|
1569
1578
|
this.disposeWithMe(
|
|
1570
1579
|
this._drawingManagerService.add$.pipe(
|
|
1571
|
-
|
|
1580
|
+
er(33),
|
|
1572
1581
|
et((i) => i.length > 0),
|
|
1573
1582
|
tt((i) => i.flat()),
|
|
1574
1583
|
tt((i) => {
|
|
@@ -1586,7 +1595,7 @@ let He = class extends ke {
|
|
|
1586
1595
|
_insertImages(i) {
|
|
1587
1596
|
i.forEach(async (r) => {
|
|
1588
1597
|
var c;
|
|
1589
|
-
const { unitId: e, subUnitId: t } = r, n = this._getSceneAndTransformerByDrawingSearch(e), s = (c =
|
|
1598
|
+
const { unitId: e, subUnitId: t } = r, n = this._getSceneAndTransformerByDrawingSearch(e), s = (c = mt(this._currentUniverService, e)) == null ? void 0 : c.subUnitId;
|
|
1590
1599
|
if (n == null || s !== t)
|
|
1591
1600
|
return;
|
|
1592
1601
|
const a = this._drawingManagerService.getDrawingByParam(r);
|
|
@@ -1624,13 +1633,13 @@ let He = class extends ke {
|
|
|
1624
1633
|
}
|
|
1625
1634
|
_addHoverForImage(i) {
|
|
1626
1635
|
this.disposeWithMe(
|
|
1627
|
-
|
|
1636
|
+
ve(
|
|
1628
1637
|
i.onPointerEnter$.subscribeEvent(() => {
|
|
1629
1638
|
i.cursor = Pe.GRAB;
|
|
1630
1639
|
})
|
|
1631
1640
|
)
|
|
1632
1641
|
), this.disposeWithMe(
|
|
1633
|
-
|
|
1642
|
+
ve(
|
|
1634
1643
|
i.onPointerLeave$.subscribeEvent(() => {
|
|
1635
1644
|
i.cursor = Pe.DEFAULT;
|
|
1636
1645
|
})
|
|
@@ -1639,7 +1648,7 @@ let He = class extends ke {
|
|
|
1639
1648
|
}
|
|
1640
1649
|
_addDialogForImage(i) {
|
|
1641
1650
|
this.disposeWithMe(
|
|
1642
|
-
|
|
1651
|
+
ve(
|
|
1643
1652
|
i.onDblclick$.subscribeEvent(() => {
|
|
1644
1653
|
const r = `${i.oKey}-viewer-dialog`;
|
|
1645
1654
|
this._drawingRenderService.previewImage(r, i.getNative().src, i.getNativeSize().width, i.getNativeSize().height);
|
|
@@ -1648,71 +1657,69 @@ let He = class extends ke {
|
|
|
1648
1657
|
);
|
|
1649
1658
|
}
|
|
1650
1659
|
};
|
|
1651
|
-
He =
|
|
1660
|
+
He = Or([
|
|
1652
1661
|
ae(0, ce),
|
|
1653
1662
|
ae(1, ge),
|
|
1654
1663
|
ae(2, ne),
|
|
1655
|
-
ae(3,
|
|
1656
|
-
ae(4,
|
|
1664
|
+
ae(3, Kt),
|
|
1665
|
+
ae(4, ut),
|
|
1657
1666
|
ae(5, $e),
|
|
1658
1667
|
ae(6, Le(Ae))
|
|
1659
1668
|
], He);
|
|
1660
|
-
var
|
|
1661
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
1669
|
+
var Dr = Object.getOwnPropertyDescriptor, Tr = (i, r, e, t) => {
|
|
1670
|
+
for (var n = t > 1 ? void 0 : t ? Dr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
|
|
1662
1671
|
(a = i[s]) && (n = a(n) || n);
|
|
1663
1672
|
return n;
|
|
1664
|
-
},
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
let st = (We = class extends xt {
|
|
1668
|
-
constructor(i = nt, r, e) {
|
|
1673
|
+
}, st = (i, r) => (e, t) => r(e, t, i), we;
|
|
1674
|
+
let ot = (we = class extends At {
|
|
1675
|
+
constructor(i = it, r, e) {
|
|
1669
1676
|
super(), this._config = i, this._injector = r, this._configService = e;
|
|
1670
|
-
const { menu: t, ...n } =
|
|
1677
|
+
const { menu: t, ...n } = Ht(
|
|
1671
1678
|
{},
|
|
1672
|
-
|
|
1679
|
+
it,
|
|
1673
1680
|
this._config
|
|
1674
1681
|
);
|
|
1675
|
-
t && this._configService.setConfig("menu", t, { merge: !0 }), this._configService.setConfig(
|
|
1682
|
+
t && this._configService.setConfig("menu", t, { merge: !0 }), this._configService.setConfig(nr, n);
|
|
1676
1683
|
}
|
|
1677
1684
|
onStarting() {
|
|
1678
1685
|
this._initDependencies();
|
|
1679
1686
|
}
|
|
1680
1687
|
onRendered() {
|
|
1681
|
-
this._injector.get(xe), this._injector.get(
|
|
1688
|
+
this._injector.get(xe), this._injector.get(Ue), this._injector.get(je), this._injector.get(He);
|
|
1682
1689
|
}
|
|
1683
1690
|
_initDependencies() {
|
|
1684
1691
|
[
|
|
1685
1692
|
[Ae],
|
|
1686
1693
|
[xe],
|
|
1687
|
-
[
|
|
1694
|
+
[Ue],
|
|
1688
1695
|
[je],
|
|
1689
1696
|
[He]
|
|
1690
1697
|
].forEach((r) => this._injector.add(r));
|
|
1691
1698
|
}
|
|
1692
|
-
},
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
],
|
|
1697
|
-
const
|
|
1698
|
-
const r = A(ce), e = A(re), { alignShow: t } = i, [n, s] = j(
|
|
1699
|
+
}, Z(we, "pluginName", "UNIVER_DRAWING_UI_PLUGIN"), Z(we, "packageName", nt.name), Z(we, "version", nt.version), we);
|
|
1700
|
+
ot = Tr([
|
|
1701
|
+
st(1, Le(xt)),
|
|
1702
|
+
st(2, jt)
|
|
1703
|
+
], ot);
|
|
1704
|
+
const Er = (i) => {
|
|
1705
|
+
const r = A(ce), e = A(re), { alignShow: t } = i, [n, s] = j(T.default), a = [
|
|
1699
1706
|
{
|
|
1700
1707
|
label: e.t("image-panel.align.default"),
|
|
1701
|
-
value:
|
|
1708
|
+
value: T.default
|
|
1702
1709
|
},
|
|
1703
1710
|
{
|
|
1704
1711
|
options: [
|
|
1705
1712
|
{
|
|
1706
1713
|
label: e.t("image-panel.align.left"),
|
|
1707
|
-
value:
|
|
1714
|
+
value: T.left
|
|
1708
1715
|
},
|
|
1709
1716
|
{
|
|
1710
1717
|
label: e.t("image-panel.align.center"),
|
|
1711
|
-
value:
|
|
1718
|
+
value: T.center
|
|
1712
1719
|
},
|
|
1713
1720
|
{
|
|
1714
1721
|
label: e.t("image-panel.align.right"),
|
|
1715
|
-
value:
|
|
1722
|
+
value: T.right
|
|
1716
1723
|
}
|
|
1717
1724
|
]
|
|
1718
1725
|
},
|
|
@@ -1720,15 +1727,15 @@ const Or = (i) => {
|
|
|
1720
1727
|
options: [
|
|
1721
1728
|
{
|
|
1722
1729
|
label: e.t("image-panel.align.top"),
|
|
1723
|
-
value:
|
|
1730
|
+
value: T.top
|
|
1724
1731
|
},
|
|
1725
1732
|
{
|
|
1726
1733
|
label: e.t("image-panel.align.middle"),
|
|
1727
|
-
value:
|
|
1734
|
+
value: T.middle
|
|
1728
1735
|
},
|
|
1729
1736
|
{
|
|
1730
1737
|
label: e.t("image-panel.align.bottom"),
|
|
1731
|
-
value:
|
|
1738
|
+
value: T.bottom
|
|
1732
1739
|
}
|
|
1733
1740
|
]
|
|
1734
1741
|
},
|
|
@@ -1736,17 +1743,17 @@ const Or = (i) => {
|
|
|
1736
1743
|
options: [
|
|
1737
1744
|
{
|
|
1738
1745
|
label: e.t("image-panel.align.horizon"),
|
|
1739
|
-
value:
|
|
1746
|
+
value: T.horizon
|
|
1740
1747
|
},
|
|
1741
1748
|
{
|
|
1742
1749
|
label: e.t("image-panel.align.vertical"),
|
|
1743
|
-
value:
|
|
1750
|
+
value: T.vertical
|
|
1744
1751
|
}
|
|
1745
1752
|
]
|
|
1746
1753
|
}
|
|
1747
1754
|
];
|
|
1748
1755
|
function o(c) {
|
|
1749
|
-
s(c), r.executeCommand(
|
|
1756
|
+
s(c), r.executeCommand(Ke.id, {
|
|
1750
1757
|
alignType: c
|
|
1751
1758
|
});
|
|
1752
1759
|
}
|
|
@@ -1768,13 +1775,13 @@ const Or = (i) => {
|
|
|
1768
1775
|
"div",
|
|
1769
1776
|
{
|
|
1770
1777
|
className: "univer-w-full univer-text-gray-900 dark:!univer-text-white",
|
|
1771
|
-
children: /* @__PURE__ */ v(
|
|
1778
|
+
children: /* @__PURE__ */ v(ht, { value: n, options: a, onChange: o })
|
|
1772
1779
|
}
|
|
1773
1780
|
) })
|
|
1774
1781
|
]
|
|
1775
1782
|
}
|
|
1776
1783
|
);
|
|
1777
|
-
},
|
|
1784
|
+
}, Nr = (i) => {
|
|
1778
1785
|
const { arrangeShow: r, drawings: e } = i, t = A(re), n = A(ne), [s, a] = j(e);
|
|
1779
1786
|
Ce(() => {
|
|
1780
1787
|
const c = n.focus$.subscribe((u) => {
|
|
@@ -1806,72 +1813,78 @@ const Or = (i) => {
|
|
|
1806
1813
|
/* @__PURE__ */ N(se, { onClick: () => {
|
|
1807
1814
|
o(Ie.forward);
|
|
1808
1815
|
}, children: [
|
|
1809
|
-
/* @__PURE__ */ v(
|
|
1816
|
+
/* @__PURE__ */ v(bt, {}),
|
|
1810
1817
|
t.t("image-panel.arrange.forward")
|
|
1811
1818
|
] }),
|
|
1812
1819
|
/* @__PURE__ */ N(se, { onClick: () => {
|
|
1813
1820
|
o(Ie.backward);
|
|
1814
1821
|
}, children: [
|
|
1815
|
-
/* @__PURE__ */ v(
|
|
1822
|
+
/* @__PURE__ */ v(It, {}),
|
|
1816
1823
|
t.t("image-panel.arrange.backward")
|
|
1817
1824
|
] }),
|
|
1818
1825
|
/* @__PURE__ */ N(se, { onClick: () => {
|
|
1819
1826
|
o(Ie.front);
|
|
1820
1827
|
}, children: [
|
|
1821
|
-
/* @__PURE__ */ v(
|
|
1828
|
+
/* @__PURE__ */ v(yt, {}),
|
|
1822
1829
|
t.t("image-panel.arrange.front")
|
|
1823
1830
|
] }),
|
|
1824
1831
|
/* @__PURE__ */ N(se, { onClick: () => {
|
|
1825
1832
|
o(Ie.back);
|
|
1826
1833
|
}, children: [
|
|
1827
|
-
/* @__PURE__ */ v(
|
|
1834
|
+
/* @__PURE__ */ v(vt, {}),
|
|
1828
1835
|
t.t("image-panel.arrange.back")
|
|
1829
1836
|
] })
|
|
1830
1837
|
] })
|
|
1831
1838
|
]
|
|
1832
1839
|
}
|
|
1833
1840
|
);
|
|
1834
|
-
},
|
|
1841
|
+
}, Pr = (i) => {
|
|
1835
1842
|
const r = A(re), e = A(ge), t = A(ne), { hasGroup: n, drawings: s } = i, [a, o] = j(!1), [c, u] = j(!0), [l, g] = j(!0), d = () => {
|
|
1836
|
-
const h = t.getFocusDrawings(), { unitId: p, subUnitId: C } = h[0], _ =
|
|
1843
|
+
const h = t.getFocusDrawings(), { unitId: p, subUnitId: C } = h[0], _ = Lt(10), I = Vt(0, 0, h.map((S) => S.transform || {})), M = {
|
|
1837
1844
|
unitId: p,
|
|
1838
1845
|
subUnitId: C,
|
|
1839
1846
|
drawingId: _,
|
|
1840
1847
|
drawingType: q.DRAWING_GROUP,
|
|
1841
|
-
transform: I
|
|
1842
|
-
|
|
1843
|
-
|
|
1848
|
+
transform: I,
|
|
1849
|
+
groupBaseBound: {
|
|
1850
|
+
left: I.left,
|
|
1851
|
+
top: I.top,
|
|
1852
|
+
width: I.width,
|
|
1853
|
+
height: I.height
|
|
1854
|
+
}
|
|
1855
|
+
}, D = h.map((S) => {
|
|
1856
|
+
const y = S.transform || { left: 0, top: 0 }, { unitId: b, subUnitId: O, drawingId: R } = S;
|
|
1844
1857
|
return {
|
|
1845
|
-
unitId:
|
|
1858
|
+
unitId: b,
|
|
1846
1859
|
subUnitId: O,
|
|
1847
|
-
drawingId:
|
|
1860
|
+
drawingId: R,
|
|
1848
1861
|
transform: {
|
|
1849
|
-
...
|
|
1850
|
-
left:
|
|
1851
|
-
top:
|
|
1862
|
+
...y
|
|
1863
|
+
// left: transform.left! - groupTransform.left,
|
|
1864
|
+
// top: transform.top! - groupTransform.top,
|
|
1852
1865
|
},
|
|
1853
1866
|
groupId: _
|
|
1854
1867
|
};
|
|
1855
1868
|
});
|
|
1856
1869
|
t.featurePluginGroupUpdateNotification([{
|
|
1857
|
-
parent:
|
|
1858
|
-
children:
|
|
1870
|
+
parent: M,
|
|
1871
|
+
children: D
|
|
1859
1872
|
}]);
|
|
1860
1873
|
}, f = (h) => {
|
|
1861
1874
|
if (h.drawingType !== q.DRAWING_GROUP)
|
|
1862
1875
|
return;
|
|
1863
|
-
const { unitId: p, subUnitId: C, drawingId: _, transform: I = { width: 0, height: 0 } } = h;
|
|
1876
|
+
const { unitId: p, subUnitId: C, drawingId: _, transform: I = { width: 0, height: 0 }, groupBaseBound: M } = h;
|
|
1864
1877
|
if (I == null)
|
|
1865
1878
|
return;
|
|
1866
|
-
const
|
|
1867
|
-
if (
|
|
1879
|
+
const D = t.getDrawingsByGroup({ unitId: p, subUnitId: C, drawingId: _ });
|
|
1880
|
+
if (D.length === 0)
|
|
1868
1881
|
return;
|
|
1869
|
-
const
|
|
1870
|
-
const { transform: b } =
|
|
1882
|
+
const S = D.map((y) => {
|
|
1883
|
+
const { transform: b } = y, { unitId: O, subUnitId: R, drawingId: B } = y, P = Gt(b || {}, I, I.width || 0, I.height || 0, M);
|
|
1871
1884
|
return {
|
|
1872
|
-
unitId:
|
|
1873
|
-
subUnitId:
|
|
1874
|
-
drawingId:
|
|
1885
|
+
unitId: O,
|
|
1886
|
+
subUnitId: R,
|
|
1887
|
+
drawingId: B,
|
|
1875
1888
|
transform: {
|
|
1876
1889
|
...b,
|
|
1877
1890
|
...P
|
|
@@ -1881,7 +1894,7 @@ const Or = (i) => {
|
|
|
1881
1894
|
});
|
|
1882
1895
|
return {
|
|
1883
1896
|
parent: h,
|
|
1884
|
-
children:
|
|
1897
|
+
children: S
|
|
1885
1898
|
};
|
|
1886
1899
|
}, w = () => {
|
|
1887
1900
|
const p = t.getFocusDrawings().map(
|
|
@@ -1896,15 +1909,15 @@ const Or = (i) => {
|
|
|
1896
1909
|
const { unitId: p } = h, C = e.getRenderById(p), _ = C == null ? void 0 : C.scene;
|
|
1897
1910
|
if (_ == null)
|
|
1898
1911
|
return;
|
|
1899
|
-
const I = _.getTransformerByCreate(),
|
|
1912
|
+
const I = _.getTransformerByCreate(), M = I.clearControl$.subscribe((S) => {
|
|
1900
1913
|
S === !0 && o(!1);
|
|
1901
|
-
}),
|
|
1902
|
-
const { objects:
|
|
1903
|
-
let
|
|
1904
|
-
|
|
1914
|
+
}), D = I.changeStart$.subscribe((S) => {
|
|
1915
|
+
const { objects: y } = S, b = Ve(y, t), O = b.filter((F) => (F == null ? void 0 : F.drawingType) === q.DRAWING_GROUP);
|
|
1916
|
+
let R = !1, B = !1;
|
|
1917
|
+
b.length > 1 && (R = !0), O.length > 0 && (B = !0), o(R || B), u(R), g(B);
|
|
1905
1918
|
});
|
|
1906
1919
|
return () => {
|
|
1907
|
-
|
|
1920
|
+
D.unsubscribe(), M.unsubscribe();
|
|
1908
1921
|
};
|
|
1909
1922
|
}, []), /* @__PURE__ */ N(
|
|
1910
1923
|
"div",
|
|
@@ -1929,7 +1942,7 @@ const Or = (i) => {
|
|
|
1929
1942
|
}),
|
|
1930
1943
|
onClick: d,
|
|
1931
1944
|
children: [
|
|
1932
|
-
/* @__PURE__ */ v(
|
|
1945
|
+
/* @__PURE__ */ v(Ct, {}),
|
|
1933
1946
|
r.t("image-panel.group.group")
|
|
1934
1947
|
]
|
|
1935
1948
|
}
|
|
@@ -1942,7 +1955,7 @@ const Or = (i) => {
|
|
|
1942
1955
|
}),
|
|
1943
1956
|
onClick: w,
|
|
1944
1957
|
children: [
|
|
1945
|
-
/* @__PURE__ */ v(
|
|
1958
|
+
/* @__PURE__ */ v(Rt, {}),
|
|
1946
1959
|
r.t("image-panel.group.unGroup")
|
|
1947
1960
|
]
|
|
1948
1961
|
}
|
|
@@ -1951,8 +1964,8 @@ const Or = (i) => {
|
|
|
1951
1964
|
]
|
|
1952
1965
|
}
|
|
1953
1966
|
);
|
|
1954
|
-
}, Oe = 20, De = 20,
|
|
1955
|
-
var
|
|
1967
|
+
}, Oe = 20, De = 20, ct = [-360, 360], Te = 300, Br = (i) => {
|
|
1968
|
+
var ze;
|
|
1956
1969
|
const r = A(re), e = A(ne), t = A(ge), { drawings: n, transformShow: s } = i, a = n[0];
|
|
1957
1970
|
if (a == null)
|
|
1958
1971
|
return;
|
|
@@ -1962,7 +1975,7 @@ const Or = (i) => {
|
|
|
1962
1975
|
const { unitId: c, subUnitId: u, drawingId: l, drawingType: g } = a, d = t.getRenderById(c), f = d == null ? void 0 : d.scene;
|
|
1963
1976
|
if (f == null)
|
|
1964
1977
|
return;
|
|
1965
|
-
const w = (
|
|
1978
|
+
const w = (ze = f.getEngine()) == null ? void 0 : ze.activeScene;
|
|
1966
1979
|
if (w == null)
|
|
1967
1980
|
return;
|
|
1968
1981
|
const h = f.getTransformerByCreate(), {
|
|
@@ -1970,12 +1983,12 @@ const Or = (i) => {
|
|
|
1970
1983
|
height: C = 0,
|
|
1971
1984
|
left: _ = 0,
|
|
1972
1985
|
top: I = 0,
|
|
1973
|
-
angle:
|
|
1974
|
-
} = o, [
|
|
1975
|
-
const { width: x, height:
|
|
1976
|
-
let
|
|
1977
|
-
return m + G < 0 && (
|
|
1978
|
-
limitLeft:
|
|
1986
|
+
angle: M = 0
|
|
1987
|
+
} = o, [D, S] = j(p), [y, b] = j(C), [O, R] = j(_), [B, P] = j(I), [F, X] = j(M), [$, Se] = j(h.keepRatio), te = (m, E, H, k) => {
|
|
1988
|
+
const { width: x, height: J } = w, { ancestorLeft: G, ancestorTop: W } = f;
|
|
1989
|
+
let K = m, ie = E, he = H, fe = k;
|
|
1990
|
+
return m + G < 0 && (K = -G), E + W < 0 && (ie = -W), he = x - K - G, he < Oe && (he = Oe), fe = J - ie - W, fe < De && (fe = De), m + he + G > x && (K = x - H - G), E + fe + W > J && (ie = J - k - W), {
|
|
1991
|
+
limitLeft: K,
|
|
1979
1992
|
limitTop: ie,
|
|
1980
1993
|
limitWidth: he,
|
|
1981
1994
|
limitHeight: fe
|
|
@@ -1991,13 +2004,13 @@ const Or = (i) => {
|
|
|
1991
2004
|
if (x == null)
|
|
1992
2005
|
return;
|
|
1993
2006
|
const {
|
|
1994
|
-
width:
|
|
2007
|
+
width: J,
|
|
1995
2008
|
height: G,
|
|
1996
2009
|
left: W,
|
|
1997
|
-
top:
|
|
2010
|
+
top: K,
|
|
1998
2011
|
angle: ie
|
|
1999
2012
|
} = x;
|
|
2000
|
-
|
|
2013
|
+
J != null && S(J), G != null && b(G), W != null && R(W), K != null && P(K), ie != null && X(ie);
|
|
2001
2014
|
};
|
|
2002
2015
|
Ce(() => {
|
|
2003
2016
|
const m = [
|
|
@@ -2021,12 +2034,12 @@ const Or = (i) => {
|
|
|
2021
2034
|
return;
|
|
2022
2035
|
const {
|
|
2023
2036
|
width: x,
|
|
2024
|
-
height:
|
|
2037
|
+
height: J,
|
|
2025
2038
|
left: G,
|
|
2026
2039
|
top: W,
|
|
2027
|
-
angle:
|
|
2040
|
+
angle: K
|
|
2028
2041
|
} = k;
|
|
2029
|
-
x != null && S(x),
|
|
2042
|
+
x != null && S(x), J != null && b(J), G != null && R(G), W != null && P(W), K != null && X(K);
|
|
2030
2043
|
})
|
|
2031
2044
|
];
|
|
2032
2045
|
return () => {
|
|
@@ -2036,49 +2049,49 @@ const Or = (i) => {
|
|
|
2036
2049
|
const de = be((m) => {
|
|
2037
2050
|
if (m == null)
|
|
2038
2051
|
return;
|
|
2039
|
-
const { limitWidth: E, limitHeight: H } = te(O,
|
|
2052
|
+
const { limitWidth: E, limitHeight: H } = te(O, B, m, y);
|
|
2040
2053
|
m = Math.min(m, E);
|
|
2041
2054
|
const k = { unitId: c, subUnitId: u, drawingId: l, drawingType: g, transform: { width: m } };
|
|
2042
2055
|
if ($) {
|
|
2043
|
-
let x = m /
|
|
2056
|
+
let x = m / D * y;
|
|
2044
2057
|
if (x = Math.max(x, De), x > H)
|
|
2045
2058
|
return;
|
|
2046
|
-
|
|
2059
|
+
b(x), k.transform.height = x;
|
|
2047
2060
|
}
|
|
2048
2061
|
S(m), e.featurePluginUpdateNotification([k]), h.refreshControls().changeNotification();
|
|
2049
|
-
}, Te),
|
|
2062
|
+
}, Te), Ot = be((m) => {
|
|
2050
2063
|
if (m == null)
|
|
2051
2064
|
return;
|
|
2052
|
-
const { limitHeight: E, limitWidth: H } = te(O,
|
|
2065
|
+
const { limitHeight: E, limitWidth: H } = te(O, B, D, m);
|
|
2053
2066
|
m = Math.min(m, E);
|
|
2054
2067
|
const k = { unitId: c, subUnitId: u, drawingId: l, drawingType: g, transform: { height: m } };
|
|
2055
2068
|
if ($) {
|
|
2056
|
-
let x = m /
|
|
2069
|
+
let x = m / y * D;
|
|
2057
2070
|
if (x = Math.max(x, Oe), x > H)
|
|
2058
2071
|
return;
|
|
2059
2072
|
S(x), k.transform.width = x;
|
|
2060
2073
|
}
|
|
2061
|
-
|
|
2062
|
-
}, Te),
|
|
2074
|
+
b(m), e.featurePluginUpdateNotification([k]), h.refreshControls().changeNotification();
|
|
2075
|
+
}, Te), Dt = be((m) => {
|
|
2063
2076
|
if (m == null)
|
|
2064
2077
|
return;
|
|
2065
|
-
const { limitLeft: E } = te(m,
|
|
2078
|
+
const { limitLeft: E } = te(m, B, D, y);
|
|
2066
2079
|
m = E;
|
|
2067
2080
|
const H = { unitId: c, subUnitId: u, drawingId: l, drawingType: g, transform: { left: m } };
|
|
2068
|
-
|
|
2069
|
-
}, Te),
|
|
2081
|
+
R(m), e.featurePluginUpdateNotification([H]), h.refreshControls().changeNotification();
|
|
2082
|
+
}, Te), Tt = be((m) => {
|
|
2070
2083
|
if (m == null)
|
|
2071
2084
|
return;
|
|
2072
|
-
const { limitTop: E } = te(O, m,
|
|
2085
|
+
const { limitTop: E } = te(O, m, D, y);
|
|
2073
2086
|
m = E;
|
|
2074
2087
|
const H = { unitId: c, subUnitId: u, drawingId: l, drawingType: g, transform: { top: m } };
|
|
2075
|
-
|
|
2076
|
-
}, Te),
|
|
2088
|
+
P(m), e.featurePluginUpdateNotification([H]), h.refreshControls().changeNotification();
|
|
2089
|
+
}, Te), Et = (m) => {
|
|
2077
2090
|
if (m == null)
|
|
2078
2091
|
return;
|
|
2079
2092
|
const E = { unitId: c, subUnitId: u, drawingId: l, drawingType: g, transform: { angle: m } };
|
|
2080
|
-
|
|
2081
|
-
},
|
|
2093
|
+
X(m), e.featurePluginUpdateNotification([E]), h.refreshControls().changeNotification();
|
|
2094
|
+
}, Nt = (m) => {
|
|
2082
2095
|
Se(m), h.keepRatio = m;
|
|
2083
2096
|
};
|
|
2084
2097
|
return /* @__PURE__ */ N(
|
|
@@ -2106,7 +2119,7 @@ const Or = (i) => {
|
|
|
2106
2119
|
pe,
|
|
2107
2120
|
{
|
|
2108
2121
|
precision: 1,
|
|
2109
|
-
value:
|
|
2122
|
+
value: D,
|
|
2110
2123
|
min: Oe,
|
|
2111
2124
|
onChange: (m) => {
|
|
2112
2125
|
de(m);
|
|
@@ -2120,17 +2133,17 @@ const Or = (i) => {
|
|
|
2120
2133
|
pe,
|
|
2121
2134
|
{
|
|
2122
2135
|
precision: 1,
|
|
2123
|
-
value:
|
|
2136
|
+
value: y,
|
|
2124
2137
|
min: De,
|
|
2125
2138
|
onChange: (m) => {
|
|
2126
|
-
|
|
2139
|
+
Ot(m);
|
|
2127
2140
|
}
|
|
2128
2141
|
}
|
|
2129
2142
|
)
|
|
2130
2143
|
] }),
|
|
2131
2144
|
/* @__PURE__ */ N("div", { children: [
|
|
2132
2145
|
/* @__PURE__ */ v("span", { children: r.t("image-panel.transform.lock") }),
|
|
2133
|
-
/* @__PURE__ */ v("div", { className: "univer-text-center", children: /* @__PURE__ */ v(
|
|
2146
|
+
/* @__PURE__ */ v("div", { className: "univer-text-center", children: /* @__PURE__ */ v(Jt, { checked: $, onChange: Nt }) })
|
|
2134
2147
|
] })
|
|
2135
2148
|
]
|
|
2136
2149
|
}
|
|
@@ -2143,13 +2156,13 @@ const Or = (i) => {
|
|
|
2143
2156
|
/* @__PURE__ */ N("div", { children: [
|
|
2144
2157
|
/* @__PURE__ */ v("span", { children: r.t("image-panel.transform.x") }),
|
|
2145
2158
|
/* @__PURE__ */ v(pe, { precision: 1, value: O, onChange: (m) => {
|
|
2146
|
-
|
|
2159
|
+
Dt(m);
|
|
2147
2160
|
} })
|
|
2148
2161
|
] }),
|
|
2149
2162
|
/* @__PURE__ */ N("div", { children: [
|
|
2150
2163
|
/* @__PURE__ */ v("span", { children: r.t("image-panel.transform.y") }),
|
|
2151
|
-
/* @__PURE__ */ v(pe, { precision: 1, value:
|
|
2152
|
-
|
|
2164
|
+
/* @__PURE__ */ v(pe, { precision: 1, value: B, onChange: (m) => {
|
|
2165
|
+
Tt(m);
|
|
2153
2166
|
} })
|
|
2154
2167
|
] }),
|
|
2155
2168
|
/* @__PURE__ */ N("div", { children: [
|
|
@@ -2158,10 +2171,10 @@ const Or = (i) => {
|
|
|
2158
2171
|
pe,
|
|
2159
2172
|
{
|
|
2160
2173
|
precision: 1,
|
|
2161
|
-
value:
|
|
2162
|
-
min:
|
|
2163
|
-
max:
|
|
2164
|
-
onChange:
|
|
2174
|
+
value: F,
|
|
2175
|
+
min: ct[0],
|
|
2176
|
+
max: ct[1],
|
|
2177
|
+
onChange: Et
|
|
2165
2178
|
}
|
|
2166
2179
|
)
|
|
2167
2180
|
] })
|
|
@@ -2171,50 +2184,50 @@ const Or = (i) => {
|
|
|
2171
2184
|
]
|
|
2172
2185
|
}
|
|
2173
2186
|
);
|
|
2174
|
-
},
|
|
2187
|
+
}, Ur = (i) => {
|
|
2175
2188
|
const r = A(ce), e = A(re), { drawings: t, cropperShow: n } = i;
|
|
2176
2189
|
if (t[0] == null)
|
|
2177
2190
|
return;
|
|
2178
|
-
const [a, o] = j(
|
|
2191
|
+
const [a, o] = j(U.FREE), c = ft(!1), u = [
|
|
2179
2192
|
{
|
|
2180
2193
|
label: e.t("image-panel.crop.mode"),
|
|
2181
|
-
value:
|
|
2194
|
+
value: U.FREE
|
|
2182
2195
|
},
|
|
2183
2196
|
{
|
|
2184
2197
|
label: "1:1",
|
|
2185
|
-
value:
|
|
2198
|
+
value: U.R1_1
|
|
2186
2199
|
},
|
|
2187
2200
|
{
|
|
2188
2201
|
label: "16:9",
|
|
2189
|
-
value:
|
|
2202
|
+
value: U.R16_9
|
|
2190
2203
|
},
|
|
2191
2204
|
{
|
|
2192
2205
|
label: "9:16",
|
|
2193
|
-
value:
|
|
2206
|
+
value: U.R9_16
|
|
2194
2207
|
},
|
|
2195
2208
|
{
|
|
2196
2209
|
label: "5:4",
|
|
2197
|
-
value:
|
|
2210
|
+
value: U.R5_4
|
|
2198
2211
|
},
|
|
2199
2212
|
{
|
|
2200
2213
|
label: "4:5",
|
|
2201
|
-
value:
|
|
2214
|
+
value: U.R4_5
|
|
2202
2215
|
},
|
|
2203
2216
|
{
|
|
2204
2217
|
label: "4:3",
|
|
2205
|
-
value:
|
|
2218
|
+
value: U.R4_3
|
|
2206
2219
|
},
|
|
2207
2220
|
{
|
|
2208
2221
|
label: "3:4",
|
|
2209
|
-
value:
|
|
2222
|
+
value: U.R3_4
|
|
2210
2223
|
},
|
|
2211
2224
|
{
|
|
2212
2225
|
label: "3:2",
|
|
2213
|
-
value:
|
|
2226
|
+
value: U.R3_2
|
|
2214
2227
|
},
|
|
2215
2228
|
{
|
|
2216
2229
|
label: "2:3",
|
|
2217
|
-
value:
|
|
2230
|
+
value: U.R2_3
|
|
2218
2231
|
}
|
|
2219
2232
|
];
|
|
2220
2233
|
Ce(() => {
|
|
@@ -2229,12 +2242,12 @@ const Or = (i) => {
|
|
|
2229
2242
|
};
|
|
2230
2243
|
}, []);
|
|
2231
2244
|
function l(d) {
|
|
2232
|
-
o(d), c.current && r.executeCommand(
|
|
2245
|
+
o(d), c.current && r.executeCommand(Be.id, {
|
|
2233
2246
|
cropType: d
|
|
2234
2247
|
});
|
|
2235
2248
|
}
|
|
2236
2249
|
const g = (d) => {
|
|
2237
|
-
r.executeCommand(
|
|
2250
|
+
r.executeCommand(Be.id, {
|
|
2238
2251
|
cropType: d
|
|
2239
2252
|
}), c.current = !0;
|
|
2240
2253
|
};
|
|
@@ -2256,64 +2269,64 @@ const Or = (i) => {
|
|
|
2256
2269
|
/* @__PURE__ */ N(se, { onClick: () => {
|
|
2257
2270
|
g(a);
|
|
2258
2271
|
}, children: [
|
|
2259
|
-
/* @__PURE__ */ v(
|
|
2272
|
+
/* @__PURE__ */ v(_t, {}),
|
|
2260
2273
|
e.t("image-panel.crop.start")
|
|
2261
2274
|
] }),
|
|
2262
|
-
/* @__PURE__ */ v(
|
|
2275
|
+
/* @__PURE__ */ v(ht, { value: a, options: u, onChange: l })
|
|
2263
2276
|
] })
|
|
2264
2277
|
]
|
|
2265
2278
|
}
|
|
2266
2279
|
);
|
|
2267
|
-
},
|
|
2280
|
+
}, Wr = (i) => {
|
|
2268
2281
|
const r = A(ne), e = A(ge), t = A(re), { drawings: n, hasArrange: s = !0, hasTransform: a = !0, hasAlign: o = !0, hasCropper: c = !0, hasGroup: u = !0 } = i, l = n[0];
|
|
2269
2282
|
if (l == null)
|
|
2270
2283
|
return;
|
|
2271
2284
|
const { unitId: g } = l, d = e.getRenderById(g), f = d == null ? void 0 : d.scene;
|
|
2272
2285
|
if (f == null)
|
|
2273
2286
|
return;
|
|
2274
|
-
const w = f.getTransformerByCreate(), [h, p] = j(!0), [C, _] = j(!0), [I,
|
|
2287
|
+
const w = f.getTransformerByCreate(), [h, p] = j(!0), [C, _] = j(!0), [I, M] = j(!1), [D, S] = j(!0), [y, b] = j(!1);
|
|
2275
2288
|
return Ce(() => {
|
|
2276
|
-
const O = w.clearControl$.subscribe((
|
|
2277
|
-
|
|
2278
|
-
}),
|
|
2279
|
-
const { objects:
|
|
2280
|
-
|
|
2281
|
-
}),
|
|
2282
|
-
|
|
2289
|
+
const O = w.clearControl$.subscribe((P) => {
|
|
2290
|
+
P === !0 && (p(!1), _(!1), M(!1), S(!1), b(!0));
|
|
2291
|
+
}), R = w.changeStart$.subscribe((P) => {
|
|
2292
|
+
const { objects: F } = P, X = Ve(F, r);
|
|
2293
|
+
X.length === 0 ? (p(!1), _(!1), M(!1), S(!1), b(!0)) : X.length === 1 ? (p(!0), _(!0), M(!1), S(!0), b(!1)) : (p(!0), _(!1), M(!0), S(!1), b(!1));
|
|
2294
|
+
}), B = r.focus$.subscribe((P) => {
|
|
2295
|
+
P.length === 0 ? (p(!1), _(!1), M(!1), S(!1), b(!0)) : P.length === 1 ? (p(!0), _(!0), M(!1), S(!0), b(!1)) : (p(!0), _(!1), M(!0), S(!1), b(!1));
|
|
2283
2296
|
});
|
|
2284
2297
|
return () => {
|
|
2285
|
-
|
|
2298
|
+
R.unsubscribe(), O.unsubscribe(), B.unsubscribe();
|
|
2286
2299
|
};
|
|
2287
|
-
}, []), /* @__PURE__ */ N(
|
|
2300
|
+
}, []), /* @__PURE__ */ N(zt, { children: [
|
|
2288
2301
|
/* @__PURE__ */ v(
|
|
2289
2302
|
"div",
|
|
2290
2303
|
{
|
|
2291
2304
|
className: Q("univer-h-full", {
|
|
2292
|
-
"univer-hidden": !
|
|
2305
|
+
"univer-hidden": !y
|
|
2293
2306
|
}),
|
|
2294
2307
|
children: /* @__PURE__ */ v("div", { className: "univer-flex univer-h-full univer-items-center univer-justify-center", children: /* @__PURE__ */ v("span", { children: t.t("image-panel.null") }) })
|
|
2295
2308
|
}
|
|
2296
2309
|
),
|
|
2297
|
-
/* @__PURE__ */ v(
|
|
2298
|
-
/* @__PURE__ */ v(
|
|
2299
|
-
/* @__PURE__ */ v(
|
|
2300
|
-
/* @__PURE__ */ v(
|
|
2301
|
-
/* @__PURE__ */ v(
|
|
2310
|
+
/* @__PURE__ */ v(Nr, { arrangeShow: s === !0 ? h : !1, drawings: n }),
|
|
2311
|
+
/* @__PURE__ */ v(Br, { transformShow: a === !0 ? C : !1, drawings: n }),
|
|
2312
|
+
/* @__PURE__ */ v(Er, { alignShow: o === !0 ? I : !1, drawings: n }),
|
|
2313
|
+
/* @__PURE__ */ v(Ur, { cropperShow: c === !0 ? D : !1, drawings: n }),
|
|
2314
|
+
/* @__PURE__ */ v(Pr, { hasGroup: u, drawings: n })
|
|
2302
2315
|
] });
|
|
2303
2316
|
};
|
|
2304
2317
|
export {
|
|
2305
|
-
|
|
2306
|
-
|
|
2318
|
+
Be as AutoImageCropOperation,
|
|
2319
|
+
ir as COMPONENT_IMAGE_POPUP_MENU,
|
|
2307
2320
|
oe as CloseImageCropOperation,
|
|
2308
|
-
|
|
2321
|
+
Wr as DrawingCommonPanel,
|
|
2309
2322
|
Ae as DrawingRenderService,
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2323
|
+
Me as ImageCropperObject,
|
|
2324
|
+
wr as ImagePopupMenu,
|
|
2325
|
+
pt as ImageResetSizeOperation,
|
|
2313
2326
|
Fe as OpenImageCropOperation,
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2327
|
+
Ke as SetDrawingAlignOperation,
|
|
2328
|
+
ot as UniverDrawingUIPlugin,
|
|
2329
|
+
mt as getCurrentUnitInfo,
|
|
2317
2330
|
Ve as getUpdateParams,
|
|
2318
2331
|
rt as insertGroupObject
|
|
2319
2332
|
};
|