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