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