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