@univerjs/docs-drawing-ui 0.6.0 → 0.6.1-nightly.202502211606
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +288 -285
- package/lib/umd/index.js +1 -1
- package/package.json +15 -15
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
var Ct = Object.defineProperty;
|
|
2
2
|
var Dt = (i, e, n) => e in i ? Ct(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
3
|
var Ce = (i, e, n) => Dt(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { Disposable as Xe, UndoCommand as Ot, RedoCommand as Tt, JSONX as q, IUniverInstanceService as Q, ICommandService as z, PositionedObjectLayoutType as H, CommandType as K, BooleanNumber as oe, ObjectRelativeFromH as ne, ObjectRelativeFromV as V, Tools as
|
|
4
|
+
import { Disposable as Xe, UndoCommand as Ot, RedoCommand as Tt, JSONX as q, IUniverInstanceService as Q, ICommandService as z, PositionedObjectLayoutType as H, CommandType as K, BooleanNumber as oe, ObjectRelativeFromH as ne, ObjectRelativeFromV as V, Tools as Pe, TextX as vn, TextXActionType as Z, toDisposable as Le, throttle as On, COLORS as yt, MemoryCursor as Pt, IUndoRedoService as Gn, BuildTextUtils as bt, ArrangeTypeEnum as Ze, Inject as ve, IContextService as Vn, LocaleService as ln, WrapTextType as $e, DrawingTypeEnum as Mt, FOCUSING_COMMON_DRAWINGS as tn, UniverInstanceType as be, Direction as fe, DocumentFlavor as fn, FOCUSING_UNIVER_EDITOR as Rt, RxDisposable as Nt, SHEET_EDITOR_UNITS as At, LifecycleService as Et, DOCS_ZEN_EDITOR_UNIT_ID_KEY as xt, fromEventSubject as Lt, LifecycleStages as Tn, DependentOn as Bt, Injector as Ut, IConfigService as kt, Plugin as Ft, merge as Ht } from "@univerjs/core";
|
|
5
5
|
import { IDocDrawingService as Be, UniverDocsDrawingPlugin as Wt } from "@univerjs/docs-drawing";
|
|
6
|
-
import { IDrawingManagerService as Ie, IImageIoService as Gt, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Vt, DRAWING_IMAGE_COUNT_LIMIT as
|
|
6
|
+
import { IDrawingManagerService as Ie, IImageIoService as Gt, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Vt, DRAWING_IMAGE_COUNT_LIMIT as yn, ImageUploadStatusType as hn, DRAWING_IMAGE_ALLOW_SIZE as jt, getImageSize as $t, getDrawingShapeKeyByDrawingSearch as zt, DRAWING_IMAGE_WIDTH_LIMIT as Pn, DRAWING_IMAGE_HEIGHT_LIMIT as bn, UniverDrawingPlugin as qt } from "@univerjs/drawing";
|
|
7
7
|
import { DrawingCommonPanel as Xt, ImageCropperObject as Kt, COMPONENT_IMAGE_POPUP_MENU as Yt, OpenImageCropOperation as Zt, ImageResetSizeOperation as Qt, UniverDrawingUIPlugin as Jt } from "@univerjs/drawing-ui";
|
|
8
8
|
import { IRenderManagerService as ee, DocumentEditArea as Fe, Liquid as jn, PageLayoutType as Mn, DocumentSkeletonPageType as Rn, Vector2 as ei, Rect as ni, getColor as ti, TRANSFORM_CHANGE_OBSERVABLE_TYPE as ii } from "@univerjs/engine-render";
|
|
9
9
|
import { IMessageService as ri, ILocalFileService as oi, ISidebarService as si, useDependency as we, getMenuHiddenObservable as $n, MenuItemType as zn, RibbonStartGroup as ai, KeyCode as He, ComponentManager as ci, IMenuManagerService as di, IShortcutService as li, UniverUIPlugin as gi } from "@univerjs/ui";
|
|
10
10
|
import { RichTextEditingMutation as J, DocSkeletonManagerService as se, DocSelectionManagerService as In } from "@univerjs/docs";
|
|
11
11
|
import { DocSelectionRenderService as Me, getRichTextEditPath as ze, NodePositionConvertToCursor as Nn, getOneTextSelectionRange as An, getAnchorBounding as mi, TEXT_RANGE_LAYER_INDEX as ui, getDocObject as fi, getCustomBlockIdsInSelections as hi, docDrawingPositionToTransform as pi, DocCanvasPopManagerService as wi, IEditorService as vi, SetDocZoomRatioOperation as Ii } from "@univerjs/docs-ui";
|
|
12
12
|
import { BehaviorSubject as _i, debounceTime as qn, Observable as Si, takeUntil as En, filter as xn } from "rxjs";
|
|
13
|
-
import { MessageType as Ln, InputNumber as ke, Select as Bn, Checkbox as Ci, RadioGroup as Un, Radio as
|
|
13
|
+
import { MessageType as Ln, InputNumber as ke, Select as Bn, Checkbox as Ci, RadioGroup as Un, Radio as ye } from "@univerjs/design";
|
|
14
14
|
import { jsxs as X, jsx as f } from "react/jsx-runtime";
|
|
15
15
|
import { forwardRef as Xn, useRef as Di, createElement as Kn, useState as re, useEffect as _n } from "react";
|
|
16
16
|
const Oi = "docs-drawing-ui.config", kn = {};
|
|
17
|
-
var Ti = Object.getOwnPropertyDescriptor,
|
|
17
|
+
var Ti = Object.getOwnPropertyDescriptor, yi = (i, e, n, t) => {
|
|
18
18
|
for (var r = t > 1 ? void 0 : t ? Ti(e, n) : e, o = i.length - 1, s; o >= 0; o--)
|
|
19
19
|
(s = i[o]) && (r = s(r) || r);
|
|
20
20
|
return r;
|
|
21
21
|
}, Ve = (i, e) => (n, t) => e(n, t, i);
|
|
22
|
-
function
|
|
22
|
+
function Pi(i) {
|
|
23
23
|
var t, r, o, s;
|
|
24
24
|
if (q.isNoop(i) || !Array.isArray(i))
|
|
25
25
|
return null;
|
|
26
|
-
const e = i.find((
|
|
26
|
+
const e = i.find((a) => Array.isArray(a) && (a == null ? void 0 : a[0]) === "drawings");
|
|
27
27
|
if (e == null || !Array.isArray(e) || e.length < 3 || typeof e[1] == "string" && typeof e[2] != "object" || Array.isArray(e[1]) && typeof e[1][1] != "object")
|
|
28
28
|
return null;
|
|
29
29
|
const n = [];
|
|
30
30
|
if (Array.isArray(e == null ? void 0 : e[1]))
|
|
31
|
-
for (const
|
|
32
|
-
Array.isArray(
|
|
33
|
-
type: (t =
|
|
34
|
-
drawingId:
|
|
35
|
-
drawing: (r =
|
|
31
|
+
for (const a of e)
|
|
32
|
+
Array.isArray(a) && n.push({
|
|
33
|
+
type: (t = a == null ? void 0 : a[1]) != null && t.i ? "add" : "remove",
|
|
34
|
+
drawingId: a == null ? void 0 : a[0],
|
|
35
|
+
drawing: (r = a == null ? void 0 : a[1]) == null ? void 0 : r.i
|
|
36
36
|
});
|
|
37
37
|
else
|
|
38
38
|
n.push({
|
|
@@ -69,10 +69,10 @@ let rn = class extends Xe {
|
|
|
69
69
|
this._commandService.beforeCommandExecuted((i) => {
|
|
70
70
|
if (i.id !== J.id)
|
|
71
71
|
return;
|
|
72
|
-
const e = i.params, { unitId: n, actions: t } = e, r =
|
|
72
|
+
const e = i.params, { unitId: n, actions: t } = e, r = Pi(t);
|
|
73
73
|
if (r != null)
|
|
74
|
-
for (const { type: o, drawingId: s, drawing:
|
|
75
|
-
o === "add" ? this._addDrawings(n, [
|
|
74
|
+
for (const { type: o, drawingId: s, drawing: a } of r)
|
|
75
|
+
o === "add" ? this._addDrawings(n, [a]) : this._removeDrawings(n, [s]);
|
|
76
76
|
})
|
|
77
77
|
), this.disposeWithMe(
|
|
78
78
|
this._commandService.onCommandExecuted((i) => {
|
|
@@ -97,16 +97,16 @@ let rn = class extends Xe {
|
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
_addDrawings(i, e) {
|
|
100
|
-
const n = this._drawingManagerService, t = this._docDrawingService, r = this._docDrawingService.getBatchAddOp(e), { subUnitId: o, redo: s, objects:
|
|
101
|
-
n.applyJson1(i, o, s), t.applyJson1(i, o, s), n.addNotification(
|
|
100
|
+
const n = this._drawingManagerService, t = this._docDrawingService, r = this._docDrawingService.getBatchAddOp(e), { subUnitId: o, redo: s, objects: a } = r;
|
|
101
|
+
n.applyJson1(i, o, s), t.applyJson1(i, o, s), n.addNotification(a), t.addNotification(a);
|
|
102
102
|
}
|
|
103
103
|
_removeDrawings(i, e) {
|
|
104
104
|
const n = this._drawingManagerService, t = this._docDrawingService, r = this._docDrawingService.getBatchRemoveOp(e.map((d) => ({
|
|
105
105
|
unitId: i,
|
|
106
106
|
subUnitId: i,
|
|
107
107
|
drawingId: d
|
|
108
|
-
}))), { subUnitId: o, redo: s, objects:
|
|
109
|
-
n.applyJson1(i, o, s), t.applyJson1(i, o, s), n.removeNotification(
|
|
108
|
+
}))), { subUnitId: o, redo: s, objects: a } = r;
|
|
109
|
+
n.applyJson1(i, o, s), t.applyJson1(i, o, s), n.removeNotification(a), t.removeNotification(a);
|
|
110
110
|
}
|
|
111
111
|
_updateDrawingsOrder(i) {
|
|
112
112
|
const e = this._univerInstanceService.getUniverDocInstance(i);
|
|
@@ -125,7 +125,7 @@ let rn = class extends Xe {
|
|
|
125
125
|
t.orderNotification(o), r.orderNotification(o);
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
rn =
|
|
128
|
+
rn = yi([
|
|
129
129
|
Ve(0, Q),
|
|
130
130
|
Ve(1, z),
|
|
131
131
|
Ve(2, Ie),
|
|
@@ -151,16 +151,16 @@ const Mi = {
|
|
|
151
151
|
};
|
|
152
152
|
function Yn(i, e, n, t, r, o, s) {
|
|
153
153
|
var p, h;
|
|
154
|
-
const
|
|
154
|
+
const a = new vn(), d = q.getInstance(), c = [], l = o.getSelfOrHeaderFooterModel(e).getBody(), m = o.getSelfOrHeaderFooterModel(i).getBody();
|
|
155
155
|
if (l == null || m == null)
|
|
156
156
|
return;
|
|
157
157
|
const g = (h = (p = l.customBlocks) == null ? void 0 : p.find((v) => v.blockId === r)) == null ? void 0 : h.startIndex;
|
|
158
158
|
if (g != null) {
|
|
159
159
|
if (t = Math.min(m.dataStream.length - 2, t), i === e) {
|
|
160
|
-
if (t < g ? (t > 0 &&
|
|
160
|
+
if (t < g ? (t > 0 && a.push({
|
|
161
161
|
t: Z.RETAIN,
|
|
162
162
|
len: t
|
|
163
|
-
}),
|
|
163
|
+
}), a.push({
|
|
164
164
|
t: Z.INSERT,
|
|
165
165
|
body: {
|
|
166
166
|
dataStream: "\b",
|
|
@@ -170,22 +170,22 @@ function Yn(i, e, n, t, r, o, s) {
|
|
|
170
170
|
}]
|
|
171
171
|
},
|
|
172
172
|
len: 1
|
|
173
|
-
}),
|
|
173
|
+
}), a.push({
|
|
174
174
|
t: Z.RETAIN,
|
|
175
175
|
len: g - t
|
|
176
|
-
}),
|
|
176
|
+
}), a.push({
|
|
177
177
|
t: Z.DELETE,
|
|
178
178
|
len: 1
|
|
179
|
-
})) : (g > 0 &&
|
|
179
|
+
})) : (g > 0 && a.push({
|
|
180
180
|
t: Z.RETAIN,
|
|
181
181
|
len: g
|
|
182
|
-
}),
|
|
182
|
+
}), a.push({
|
|
183
183
|
t: Z.DELETE,
|
|
184
184
|
len: 1
|
|
185
|
-
}), t - g - 1 > 0 &&
|
|
185
|
+
}), t - g - 1 > 0 && a.push({
|
|
186
186
|
t: Z.RETAIN,
|
|
187
187
|
len: t - g - 1
|
|
188
|
-
}),
|
|
188
|
+
}), a.push({
|
|
189
189
|
t: Z.INSERT,
|
|
190
190
|
body: {
|
|
191
191
|
dataStream: "\b",
|
|
@@ -196,22 +196,22 @@ function Yn(i, e, n, t, r, o, s) {
|
|
|
196
196
|
},
|
|
197
197
|
len: 1
|
|
198
198
|
})), t !== g) {
|
|
199
|
-
const v = ze(o, e), w = d.editOp(
|
|
200
|
-
|
|
199
|
+
const v = ze(o, e), w = d.editOp(a.serialize(), v);
|
|
200
|
+
c.push(w);
|
|
201
201
|
}
|
|
202
202
|
} else {
|
|
203
|
-
g > 0 &&
|
|
203
|
+
g > 0 && a.push({
|
|
204
204
|
t: Z.RETAIN,
|
|
205
205
|
len: g
|
|
206
|
-
}),
|
|
206
|
+
}), a.push({
|
|
207
207
|
t: Z.DELETE,
|
|
208
208
|
len: 1
|
|
209
209
|
});
|
|
210
|
-
let v = ze(o, e), w = d.editOp(
|
|
211
|
-
|
|
210
|
+
let v = ze(o, e), w = d.editOp(a.serialize(), v);
|
|
211
|
+
c.push(w), a.empty(), t > 0 && a.push({
|
|
212
212
|
t: Z.RETAIN,
|
|
213
213
|
len: t
|
|
214
|
-
}),
|
|
214
|
+
}), a.push({
|
|
215
215
|
t: Z.INSERT,
|
|
216
216
|
body: {
|
|
217
217
|
dataStream: "\b",
|
|
@@ -221,9 +221,9 @@ function Yn(i, e, n, t, r, o, s) {
|
|
|
221
221
|
}]
|
|
222
222
|
},
|
|
223
223
|
len: 1
|
|
224
|
-
}), v = ze(o, i), w = d.editOp(
|
|
224
|
+
}), v = ze(o, i), w = d.editOp(a.serialize(), v), c.push(w), s.setSegment(i), s.setSegmentPage(n);
|
|
225
225
|
}
|
|
226
|
-
return
|
|
226
|
+
return c;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
const Zn = {
|
|
@@ -234,10 +234,10 @@ const Zn = {
|
|
|
234
234
|
var A, U;
|
|
235
235
|
if (e == null)
|
|
236
236
|
return !1;
|
|
237
|
-
const { drawings: n, wrappingStyle: t, unitId: r } = e, o = i.get(z), s = i.get(Q), d = i.get(ee).getRenderById(r),
|
|
238
|
-
if (g == null ||
|
|
237
|
+
const { drawings: n, wrappingStyle: t, unitId: r } = e, o = i.get(z), s = i.get(Q), d = i.get(ee).getRenderById(r), c = d == null ? void 0 : d.with(se).getSkeleton().getSkeletonData(), l = d == null ? void 0 : d.with(se).getViewModel(), m = d == null ? void 0 : d.scene, g = s.getCurrentUniverDocInstance();
|
|
238
|
+
if (g == null || c == null || m == null || l == null)
|
|
239
239
|
return !1;
|
|
240
|
-
const p = l.getEditArea(), h = m.getTransformerByCreate(), { pages: v, skeHeaders: w, skeFooters: S } =
|
|
240
|
+
const p = l.getEditArea(), h = m.getTransformerByCreate(), { pages: v, skeHeaders: w, skeFooters: S } = c, O = q.getInstance(), D = [], { drawings: T = {} } = g.getSnapshot();
|
|
241
241
|
for (const N of n) {
|
|
242
242
|
const { drawingId: I } = N, L = T[I].layoutType, W = Mi[t];
|
|
243
243
|
if (L !== W) {
|
|
@@ -247,15 +247,15 @@ const Zn = {
|
|
|
247
247
|
if (t === "behindText" || t === "inFrontOfText") {
|
|
248
248
|
const C = T[I].behindDoc, R = t === "behindText" ? oe.TRUE : oe.FALSE;
|
|
249
249
|
if (C !== R) {
|
|
250
|
-
const
|
|
251
|
-
D.push(
|
|
250
|
+
const y = O.replaceOp(["drawings", I, "behindDoc"], C, R);
|
|
251
|
+
D.push(y);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
if (t === "inline")
|
|
255
255
|
continue;
|
|
256
256
|
let x = null, G = 0, _ = 0;
|
|
257
257
|
for (const C of v) {
|
|
258
|
-
const { headerId: R, footerId:
|
|
258
|
+
const { headerId: R, footerId: y, marginTop: B, marginLeft: k, marginBottom: b, pageWidth: E, pageHeight: $ } = C;
|
|
259
259
|
switch (p) {
|
|
260
260
|
case Fe.HEADER: {
|
|
261
261
|
const F = (A = w.get(R)) == null ? void 0 : A.get(E);
|
|
@@ -263,7 +263,7 @@ const Zn = {
|
|
|
263
263
|
break;
|
|
264
264
|
}
|
|
265
265
|
case Fe.FOOTER: {
|
|
266
|
-
const F = (U = S.get(
|
|
266
|
+
const F = (U = S.get(y)) == null ? void 0 : U.get(E);
|
|
267
267
|
F != null && F.skeDrawings.has(I) && (x = F.skeDrawings.get(I), G = $ - b + F.marginTop, _ = k);
|
|
268
268
|
break;
|
|
269
269
|
}
|
|
@@ -276,15 +276,15 @@ const Zn = {
|
|
|
276
276
|
break;
|
|
277
277
|
}
|
|
278
278
|
if (x != null) {
|
|
279
|
-
const { aTop: C, aLeft: R } = x,
|
|
279
|
+
const { aTop: C, aLeft: R } = x, y = T[I].docTransform.positionH;
|
|
280
280
|
let B = R;
|
|
281
|
-
|
|
281
|
+
y.relativeFrom === ne.MARGIN ? B -= _ : y.relativeFrom === ne.COLUMN && (B -= x.columnLeft);
|
|
282
282
|
const k = {
|
|
283
|
-
relativeFrom:
|
|
283
|
+
relativeFrom: y.relativeFrom,
|
|
284
284
|
posOffset: B
|
|
285
285
|
};
|
|
286
|
-
if (
|
|
287
|
-
const F = O.replaceOp(["drawings", I, "docTransform", "positionH"],
|
|
286
|
+
if (y.posOffset !== k.posOffset) {
|
|
287
|
+
const F = O.replaceOp(["drawings", I, "docTransform", "positionH"], y, k);
|
|
288
288
|
D.push(F);
|
|
289
289
|
}
|
|
290
290
|
const b = T[I].docTransform.positionV;
|
|
@@ -309,8 +309,8 @@ const Zn = {
|
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
311
|
M.params.actions = D.reduce((N, I) => q.compose(N, I), null);
|
|
312
|
-
const
|
|
313
|
-
return h.refreshControls(), !!
|
|
312
|
+
const P = o.syncExecuteCommand(M.id, M.params);
|
|
313
|
+
return h.refreshControls(), !!P;
|
|
314
314
|
}
|
|
315
315
|
}, Qn = {
|
|
316
316
|
id: "doc.command.update-doc-drawing-distance",
|
|
@@ -321,26 +321,26 @@ const Zn = {
|
|
|
321
321
|
const n = i.get(z), r = i.get(Q).getCurrentUniverDocInstance();
|
|
322
322
|
if (r == null)
|
|
323
323
|
return !1;
|
|
324
|
-
const { drawings: o, dist: s, unitId:
|
|
324
|
+
const { drawings: o, dist: s, unitId: a } = e, d = q.getInstance(), c = [], { drawings: l = {} } = r.getSnapshot();
|
|
325
325
|
for (const p of o) {
|
|
326
326
|
const { drawingId: h } = p;
|
|
327
327
|
for (const [v, w] of Object.entries(s)) {
|
|
328
328
|
const S = l[h][v];
|
|
329
329
|
if (S !== w) {
|
|
330
330
|
const O = d.replaceOp(["drawings", h, v], S, w);
|
|
331
|
-
|
|
331
|
+
c.push(O);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
const m = {
|
|
336
336
|
id: J.id,
|
|
337
337
|
params: {
|
|
338
|
-
unitId:
|
|
338
|
+
unitId: a,
|
|
339
339
|
actions: [],
|
|
340
340
|
textRanges: null
|
|
341
341
|
}
|
|
342
342
|
};
|
|
343
|
-
return m.params.actions =
|
|
343
|
+
return m.params.actions = c.reduce((p, h) => q.compose(p, h), null), !!n.syncExecuteCommand(m.id, m.params);
|
|
344
344
|
}
|
|
345
345
|
}, Jn = {
|
|
346
346
|
id: "doc.command.update-doc-drawing-wrap-text",
|
|
@@ -351,23 +351,23 @@ const Zn = {
|
|
|
351
351
|
const n = i.get(z), r = i.get(Q).getCurrentUniverDocInstance();
|
|
352
352
|
if (r == null)
|
|
353
353
|
return !1;
|
|
354
|
-
const { drawings: o, wrapText: s, unitId:
|
|
354
|
+
const { drawings: o, wrapText: s, unitId: a } = e, d = q.getInstance(), c = [], { drawings: l = {} } = r.getSnapshot();
|
|
355
355
|
for (const p of o) {
|
|
356
356
|
const { drawingId: h } = p, v = l[h].wrapText;
|
|
357
357
|
if (v !== s) {
|
|
358
358
|
const w = d.replaceOp(["drawings", h, "wrapText"], v, s);
|
|
359
|
-
|
|
359
|
+
c.push(w);
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
const m = {
|
|
363
363
|
id: J.id,
|
|
364
364
|
params: {
|
|
365
|
-
unitId:
|
|
365
|
+
unitId: a,
|
|
366
366
|
actions: [],
|
|
367
367
|
textRanges: null
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
|
-
return m.params.actions =
|
|
370
|
+
return m.params.actions = c.reduce((p, h) => q.compose(p, h), null), !!n.syncExecuteCommand(m.id, m.params);
|
|
371
371
|
}
|
|
372
372
|
}, qe = {
|
|
373
373
|
id: "doc.command.update-drawing-doc-transform",
|
|
@@ -378,13 +378,13 @@ const Zn = {
|
|
|
378
378
|
const n = i.get(z), t = i.get(Q), o = i.get(ee).getRenderById(e.unitId), s = o == null ? void 0 : o.scene;
|
|
379
379
|
if (s == null)
|
|
380
380
|
return !1;
|
|
381
|
-
const
|
|
381
|
+
const a = s.getTransformerByCreate(), d = t.getCurrentUniverDocInstance();
|
|
382
382
|
if (d == null)
|
|
383
383
|
return !1;
|
|
384
|
-
const { drawings:
|
|
385
|
-
for (const w of
|
|
384
|
+
const { drawings: c, unitId: l } = e, m = q.getInstance(), g = [], { drawings: p = {} } = d.getSnapshot();
|
|
385
|
+
for (const w of c) {
|
|
386
386
|
const { drawingId: S, key: O, value: D } = w, T = p[S].docTransform[O];
|
|
387
|
-
if (!
|
|
387
|
+
if (!Pe.diffValue(T, D)) {
|
|
388
388
|
const M = m.replaceOp(["drawings", S, "docTransform", O], T, D);
|
|
389
389
|
g.push(M);
|
|
390
390
|
}
|
|
@@ -400,7 +400,7 @@ const Zn = {
|
|
|
400
400
|
};
|
|
401
401
|
h.params.actions = g.reduce((w, S) => q.compose(w, S), null);
|
|
402
402
|
const v = n.syncExecuteCommand(h.id, h.params);
|
|
403
|
-
return
|
|
403
|
+
return a.refreshControls(), !!v;
|
|
404
404
|
}
|
|
405
405
|
}, et = {
|
|
406
406
|
id: "doc.command.move-inline-drawing",
|
|
@@ -409,15 +409,15 @@ const Zn = {
|
|
|
409
409
|
var U, N;
|
|
410
410
|
if (e == null)
|
|
411
411
|
return !1;
|
|
412
|
-
const n = i.get(ee), t = (U = n.getRenderById(e.unitId)) == null ? void 0 : U.with(Me), r = i.get(gn), o = n.getRenderById(e.unitId), s = o == null ? void 0 : o.scene,
|
|
412
|
+
const n = i.get(ee), t = (U = n.getRenderById(e.unitId)) == null ? void 0 : U.with(Me), r = i.get(gn), o = n.getRenderById(e.unitId), s = o == null ? void 0 : o.scene, a = o == null ? void 0 : o.with(se).getSkeleton();
|
|
413
413
|
if (s == null || t == null)
|
|
414
414
|
return !1;
|
|
415
|
-
const d = s.getTransformerByCreate(),
|
|
415
|
+
const d = s.getTransformerByCreate(), c = i.get(z), m = i.get(Q).getCurrentUniverDocInstance();
|
|
416
416
|
if (m == null)
|
|
417
417
|
return !1;
|
|
418
418
|
const { drawing: g, unitId: p, offset: h, segmentId: v, segmentPage: w, needRefreshDrawings: S } = e;
|
|
419
419
|
if (S)
|
|
420
|
-
return r.refreshDrawings(
|
|
420
|
+
return r.refreshDrawings(a), d.refreshControls(), !0;
|
|
421
421
|
const O = [], { drawingId: D } = g, T = (N = t.getSegment()) != null ? N : "", M = Yn(
|
|
422
422
|
v,
|
|
423
423
|
T,
|
|
@@ -428,9 +428,9 @@ const Zn = {
|
|
|
428
428
|
t
|
|
429
429
|
);
|
|
430
430
|
if (M == null || M.length === 0)
|
|
431
|
-
return r.refreshDrawings(
|
|
431
|
+
return r.refreshDrawings(a), d.refreshControls(), !1;
|
|
432
432
|
O.push(...M);
|
|
433
|
-
const
|
|
433
|
+
const P = {
|
|
434
434
|
id: J.id,
|
|
435
435
|
params: {
|
|
436
436
|
unitId: p,
|
|
@@ -438,8 +438,8 @@ const Zn = {
|
|
|
438
438
|
textRanges: null
|
|
439
439
|
}
|
|
440
440
|
};
|
|
441
|
-
|
|
442
|
-
const A =
|
|
441
|
+
P.params.actions = O.reduce((I, L) => q.compose(I, L), null);
|
|
442
|
+
const A = c.syncExecuteCommand(P.id, P.params);
|
|
443
443
|
return d.refreshControls(), !!A;
|
|
444
444
|
}
|
|
445
445
|
}, nt = {
|
|
@@ -453,8 +453,8 @@ const Zn = {
|
|
|
453
453
|
const n = i.get(ee), t = (x = n.getRenderById(e.unitId)) == null ? void 0 : x.with(Me), r = n.getRenderById(e.unitId), o = r == null ? void 0 : r.scene;
|
|
454
454
|
if (o == null || t == null)
|
|
455
455
|
return !1;
|
|
456
|
-
const s = o.getTransformerByCreate(),
|
|
457
|
-
if (
|
|
456
|
+
const s = o.getTransformerByCreate(), a = i.get(z), c = i.get(Q).getCurrentUniverDocInstance();
|
|
457
|
+
if (c == null)
|
|
458
458
|
return !1;
|
|
459
459
|
const { drawing: l, unitId: m, offset: g, docTransform: p, segmentId: h, segmentPage: v } = e, w = [], { drawingId: S } = l, O = (G = t.getSegment()) != null ? G : "", D = Yn(
|
|
460
460
|
h,
|
|
@@ -462,26 +462,26 @@ const Zn = {
|
|
|
462
462
|
v,
|
|
463
463
|
g,
|
|
464
464
|
S,
|
|
465
|
-
|
|
465
|
+
c,
|
|
466
466
|
t
|
|
467
467
|
);
|
|
468
468
|
if (D == null)
|
|
469
469
|
return !1;
|
|
470
470
|
D.length > 0 && w.push(...D);
|
|
471
|
-
const T = q.getInstance(), { drawings: M = {} } =
|
|
472
|
-
if (!
|
|
471
|
+
const T = q.getInstance(), { drawings: M = {} } = c.getSnapshot(), P = M[S].docTransform, { positionH: A, positionV: U, size: N, angle: I } = P;
|
|
472
|
+
if (!Pe.diffValue(A, p.positionH)) {
|
|
473
473
|
const _ = T.replaceOp(["drawings", S, "docTransform", "positionH"], A, p.positionH);
|
|
474
474
|
w.push(_);
|
|
475
475
|
}
|
|
476
|
-
if (!
|
|
476
|
+
if (!Pe.diffValue(U, p.positionV)) {
|
|
477
477
|
const _ = T.replaceOp(["drawings", S, "docTransform", "positionV"], U, p.positionV);
|
|
478
478
|
w.push(_);
|
|
479
479
|
}
|
|
480
|
-
if (!
|
|
480
|
+
if (!Pe.diffValue(N, p.size)) {
|
|
481
481
|
const _ = T.replaceOp(["drawings", S, "docTransform", "size"], N, p.size);
|
|
482
482
|
w.push(_);
|
|
483
483
|
}
|
|
484
|
-
if (!
|
|
484
|
+
if (!Pe.diffValue(I, p.angle)) {
|
|
485
485
|
const _ = T.replaceOp(["drawings", S, "docTransform", "angle"], I, p.angle);
|
|
486
486
|
w.push(_);
|
|
487
487
|
}
|
|
@@ -495,7 +495,7 @@ const Zn = {
|
|
|
495
495
|
}
|
|
496
496
|
};
|
|
497
497
|
L.params.actions = w.reduce((_, C) => q.compose(_, C), null);
|
|
498
|
-
const W =
|
|
498
|
+
const W = a.syncExecuteCommand(L.id, L.params);
|
|
499
499
|
return s.refreshControls(), !!W;
|
|
500
500
|
}
|
|
501
501
|
};
|
|
@@ -543,14 +543,14 @@ let on = class extends Xe {
|
|
|
543
543
|
this.disposeWithMe(
|
|
544
544
|
Le(
|
|
545
545
|
n.changeStart$.subscribe((o) => {
|
|
546
|
-
var
|
|
546
|
+
var a;
|
|
547
547
|
this._transformerCache.clear();
|
|
548
548
|
const { objects: s } = o;
|
|
549
549
|
for (const d of s.values()) {
|
|
550
|
-
const { oKey:
|
|
550
|
+
const { oKey: c, width: l, height: m, left: g, top: p, angle: h } = d, v = this._drawingManagerService.getDrawingOKey(c);
|
|
551
551
|
if (v == null)
|
|
552
552
|
continue;
|
|
553
|
-
const w = this._univerInstanceService.getUniverDocInstance(v.unitId), S = (
|
|
553
|
+
const w = this._univerInstanceService.getUniverDocInstance(v.unitId), S = (a = w == null ? void 0 : w.getSnapshot().drawings) == null ? void 0 : a[v.drawingId];
|
|
554
554
|
(S == null ? void 0 : S.layoutType) === H.INLINE && d.setOpacity(0.2), S != null && this._transformerCache.set(v.drawingId, {
|
|
555
555
|
drawing: S,
|
|
556
556
|
top: p,
|
|
@@ -567,14 +567,14 @@ let on = class extends Xe {
|
|
|
567
567
|
On(this._nonInlineDrawingTransform.bind(this), 50), this.disposeWithMe(
|
|
568
568
|
Le(
|
|
569
569
|
n.changing$.subscribe((o) => {
|
|
570
|
-
const { objects: s, offsetX:
|
|
570
|
+
const { objects: s, offsetX: a, offsetY: d } = o;
|
|
571
571
|
if (s.size > 1)
|
|
572
572
|
t(s);
|
|
573
573
|
else if (s.size === 1) {
|
|
574
|
-
const
|
|
575
|
-
if (
|
|
574
|
+
const c = this._transformerCache.values().next().value, l = s.values().next().value, { width: m, height: g, top: p, left: h, angle: v } = l;
|
|
575
|
+
if (c && m === c.width && g === c.height && p === c.top && h === c.left && v === c.angle)
|
|
576
576
|
return;
|
|
577
|
-
|
|
577
|
+
c && (c.drawing.layoutType, H.INLINE), c && c.drawing.layoutType === H.INLINE && a != null && d != null && this._updateInlineDrawingAnchor(c.drawing, a, d);
|
|
578
578
|
}
|
|
579
579
|
})
|
|
580
580
|
)
|
|
@@ -582,21 +582,21 @@ let on = class extends Xe {
|
|
|
582
582
|
Le(
|
|
583
583
|
// eslint-disable-next-line complexity
|
|
584
584
|
n.changeEnd$.subscribe((o) => {
|
|
585
|
-
const { objects: s, offsetX:
|
|
586
|
-
for (const
|
|
587
|
-
const l = this._drawingManagerService.getDrawingOKey(
|
|
585
|
+
const { objects: s, offsetX: a, offsetY: d } = o;
|
|
586
|
+
for (const c of s.values()) {
|
|
587
|
+
const l = this._drawingManagerService.getDrawingOKey(c.oKey);
|
|
588
588
|
if (l == null)
|
|
589
589
|
continue;
|
|
590
590
|
const m = this._transformerCache.get(l == null ? void 0 : l.drawingId);
|
|
591
|
-
(m == null ? void 0 : m.drawing.layoutType) === H.INLINE &&
|
|
591
|
+
(m == null ? void 0 : m.drawing.layoutType) === H.INLINE && c.setOpacity(1);
|
|
592
592
|
}
|
|
593
593
|
if (this._anchorShape && this._anchorShape.hide(), s.size > 1)
|
|
594
594
|
this._updateMultipleDrawingDocTransform(s);
|
|
595
595
|
else if (s.size === 1) {
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
596
|
+
const c = this._transformerCache.values().next().value, l = s.values().next().value, { width: m, height: g, top: p, left: h, angle: v } = l;
|
|
597
|
+
if (c && m === c.width && g === c.height && p === c.top && h === c.left && v === c.angle)
|
|
598
598
|
return;
|
|
599
|
-
|
|
599
|
+
c && c.drawing.layoutType === H.INLINE ? m !== c.width || g !== c.height || v !== c.angle ? this._updateDrawingSize(c, l) : a != null && d != null && this._moveInlineDrawing(c.drawing, a, d) : c && this._nonInlineDrawingTransform(c.drawing, l);
|
|
600
600
|
}
|
|
601
601
|
this._transformerCache.clear();
|
|
602
602
|
})
|
|
@@ -610,7 +610,7 @@ let on = class extends Xe {
|
|
|
610
610
|
const n = [];
|
|
611
611
|
let t, r;
|
|
612
612
|
for (const o of e.values()) {
|
|
613
|
-
const { oKey: s, left:
|
|
613
|
+
const { oKey: s, left: a, top: d, angle: c } = o;
|
|
614
614
|
let { width: l, height: m } = o;
|
|
615
615
|
const g = this._drawingManagerService.getDrawingOKey(s);
|
|
616
616
|
if (g == null)
|
|
@@ -627,18 +627,18 @@ let on = class extends Xe {
|
|
|
627
627
|
width: l,
|
|
628
628
|
height: m
|
|
629
629
|
}
|
|
630
|
-
}), D !==
|
|
630
|
+
}), D !== c && n.push({
|
|
631
631
|
drawingId: g.drawingId,
|
|
632
632
|
key: "angle",
|
|
633
|
-
value:
|
|
634
|
-
}), v !== d || w !==
|
|
635
|
-
const
|
|
636
|
-
|
|
633
|
+
value: c
|
|
634
|
+
}), v !== d || w !== a) {
|
|
635
|
+
const P = d - v, A = a - w;
|
|
636
|
+
P !== 0 && n.push({
|
|
637
637
|
drawingId: g.drawingId,
|
|
638
638
|
key: "positionV",
|
|
639
639
|
value: {
|
|
640
640
|
relativeFrom: h.docTransform.positionV.relativeFrom,
|
|
641
|
-
posOffset: h.docTransform.positionV.posOffset +
|
|
641
|
+
posOffset: h.docTransform.positionV.posOffset + P
|
|
642
642
|
}
|
|
643
643
|
}), A !== 0 && n.push({
|
|
644
644
|
drawingId: g.drawingId,
|
|
@@ -675,13 +675,13 @@ let on = class extends Xe {
|
|
|
675
675
|
const r = this._renderManagerService.getRenderById(e.unitId), o = r == null ? void 0 : r.with(se).getSkeleton();
|
|
676
676
|
if (r == null)
|
|
677
677
|
return;
|
|
678
|
-
const { mainComponent: s, scene:
|
|
678
|
+
const { mainComponent: s, scene: a } = r, d = s, c = a.getViewports()[0], {
|
|
679
679
|
pageLayoutType: l = Mn.VERTICAL,
|
|
680
680
|
pageMarginLeft: m,
|
|
681
681
|
pageMarginTop: g
|
|
682
682
|
} = d.getOffsetConfig();
|
|
683
683
|
let p = null, h = !1, v = -1, w = "";
|
|
684
|
-
const S = 0.5, O = this._getTransformCoordForDocumentOffset(d,
|
|
684
|
+
const S = 0.5, O = this._getTransformCoordForDocumentOffset(d, c, n, t);
|
|
685
685
|
if (O == null)
|
|
686
686
|
return;
|
|
687
687
|
const D = (x = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : x.with(Me);
|
|
@@ -699,18 +699,18 @@ let on = class extends Xe {
|
|
|
699
699
|
}
|
|
700
700
|
);
|
|
701
701
|
if (T) {
|
|
702
|
-
const { node: _, ratioX: C, segmentPage: R, segmentId:
|
|
703
|
-
h = C < S, p = _, v = R, w =
|
|
702
|
+
const { node: _, ratioX: C, segmentPage: R, segmentId: y } = T;
|
|
703
|
+
h = C < S, p = _, v = R, w = y;
|
|
704
704
|
}
|
|
705
705
|
if (p == null)
|
|
706
706
|
return;
|
|
707
|
-
const M = o == null ? void 0 : o.findPositionByGlyph(p, v),
|
|
708
|
-
if (M == null || o == null ||
|
|
707
|
+
const M = o == null ? void 0 : o.findPositionByGlyph(p, v), P = this._getDocObject();
|
|
708
|
+
if (M == null || o == null || P == null || Fn(M))
|
|
709
709
|
return;
|
|
710
710
|
const A = {
|
|
711
711
|
...M,
|
|
712
712
|
isBack: h
|
|
713
|
-
}, U =
|
|
713
|
+
}, U = P.document.getOffsetConfig(), N = new Nn(U, o), { cursorList: I, contentBoxPointGroup: L } = N.getRangePointData(A, A), { startOffset: W } = (G = An(I)) != null ? G : {};
|
|
714
714
|
if (W != null)
|
|
715
715
|
return { offset: W, contentBoxPointGroup: L, segmentId: w, segmentPage: v };
|
|
716
716
|
}
|
|
@@ -720,25 +720,25 @@ let on = class extends Xe {
|
|
|
720
720
|
const t = this._renderManagerService.getRenderById(e.unitId), r = t == null ? void 0 : t.with(se).getSkeleton(), o = r == null ? void 0 : r.getSkeletonData();
|
|
721
721
|
if (o == null || t == null)
|
|
722
722
|
return;
|
|
723
|
-
const { pages: s, skeHeaders:
|
|
724
|
-
let { width: M, height:
|
|
723
|
+
const { pages: s, skeHeaders: a, skeFooters: d } = o, { mainComponent: c, scene: l } = t, m = c, g = l.getViewports()[0], { pageLayoutType: p = Mn.VERTICAL, pageMarginLeft: h, pageMarginTop: v, docsLeft: w, docsTop: S } = m.getOffsetConfig(), { left: O, top: D, angle: T } = n;
|
|
724
|
+
let { width: M, height: P } = n;
|
|
725
725
|
const { positionV: A, positionH: U } = e.docTransform, { width: N, height: I } = this._getPageContentSize(e);
|
|
726
|
-
M = Math.min(M, N),
|
|
726
|
+
M = Math.min(M, N), P = Math.min(P, I);
|
|
727
727
|
let L = null, W = "", x = -1;
|
|
728
728
|
const G = !1, _ = {
|
|
729
729
|
...e.docTransform,
|
|
730
730
|
size: {
|
|
731
731
|
width: M,
|
|
732
|
-
height:
|
|
732
|
+
height: P
|
|
733
733
|
},
|
|
734
734
|
angle: T
|
|
735
|
-
}, { x: C, y: R } = l.getViewportScrollXY(g),
|
|
736
|
-
if (
|
|
735
|
+
}, { x: C, y: R } = l.getViewportScrollXY(g), y = this._getTransformCoordForDocumentOffset(m, g, O - C, D - R);
|
|
736
|
+
if (y == null)
|
|
737
737
|
return;
|
|
738
738
|
const B = (_e = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : _e.with(Me);
|
|
739
739
|
if (B == null)
|
|
740
740
|
return;
|
|
741
|
-
const k = r == null ? void 0 : r.findNodeByCoord(
|
|
741
|
+
const k = r == null ? void 0 : r.findNodeByCoord(y, p, h, v, {
|
|
742
742
|
strict: !1,
|
|
743
743
|
segmentId: B.getSegment(),
|
|
744
744
|
segmentPage: B.getSegmentPage()
|
|
@@ -759,7 +759,7 @@ let on = class extends Xe {
|
|
|
759
759
|
if (x > -1 && St === x) {
|
|
760
760
|
switch (Y) {
|
|
761
761
|
case Rn.HEADER: {
|
|
762
|
-
const Ge = (Oe =
|
|
762
|
+
const Ge = (Oe = a.get(mn)) == null ? void 0 : Oe.get(Cn);
|
|
763
763
|
if (Ge)
|
|
764
764
|
this._liquid.translatePagePadding({
|
|
765
765
|
marginTop: Ge.marginTop,
|
|
@@ -831,7 +831,7 @@ let on = class extends Xe {
|
|
|
831
831
|
}
|
|
832
832
|
// Update drawing when use transformer to resize it.
|
|
833
833
|
_updateDrawingSize(e, n) {
|
|
834
|
-
const t = [], { drawing: r, width: o, height: s, angle:
|
|
834
|
+
const t = [], { drawing: r, width: o, height: s, angle: a } = e, { unitId: d, subUnitId: c } = r;
|
|
835
835
|
let { width: l, height: m, angle: g } = n;
|
|
836
836
|
const { width: p, height: h } = this._getPageContentSize(r);
|
|
837
837
|
l = Math.min(p, l), m = Math.min(h, m), (l !== o || m !== s) && t.push({
|
|
@@ -841,56 +841,56 @@ let on = class extends Xe {
|
|
|
841
841
|
width: l,
|
|
842
842
|
height: m
|
|
843
843
|
}
|
|
844
|
-
}), g !==
|
|
844
|
+
}), g !== a && t.push({
|
|
845
845
|
drawingId: r.drawingId,
|
|
846
846
|
key: "angle",
|
|
847
847
|
value: g
|
|
848
|
-
}), t.length > 0 && d &&
|
|
848
|
+
}), t.length > 0 && d && c && this._commandService.executeCommand(qe.id, {
|
|
849
849
|
unitId: d,
|
|
850
|
-
subUnitId:
|
|
850
|
+
subUnitId: c,
|
|
851
851
|
drawings: t
|
|
852
852
|
});
|
|
853
853
|
}
|
|
854
854
|
// Update inline drawing when use transformer to move it.
|
|
855
855
|
_moveInlineDrawing(e, n, t) {
|
|
856
|
-
const r = this._getInlineDrawingAnchor(e, n, t), { offset: o, segmentId: s, segmentPage:
|
|
856
|
+
const r = this._getInlineDrawingAnchor(e, n, t), { offset: o, segmentId: s, segmentPage: a } = r != null ? r : {};
|
|
857
857
|
return this._commandService.executeCommand(et.id, {
|
|
858
858
|
unitId: e.unitId,
|
|
859
859
|
subUnitId: e.unitId,
|
|
860
860
|
drawing: e,
|
|
861
861
|
offset: o,
|
|
862
862
|
segmentId: s,
|
|
863
|
-
segmentPage:
|
|
863
|
+
segmentPage: a,
|
|
864
864
|
needRefreshDrawings: o == null
|
|
865
865
|
});
|
|
866
866
|
}
|
|
867
867
|
// Limit the drawing to the page area, mainly in the vertical direction,
|
|
868
868
|
// and the upper and lower limits cannot exceed the page margin area.
|
|
869
869
|
_limitDrawingInPage(e, n) {
|
|
870
|
-
const t = this._renderManagerService.getRenderById(e.unitId), { left: r, top: o, width: s, height:
|
|
870
|
+
const t = this._renderManagerService.getRenderById(e.unitId), { left: r, top: o, width: s, height: a, angle: d } = n, c = t == null ? void 0 : t.with(se).getSkeleton(), l = c == null ? void 0 : c.getSkeletonData(), { pages: m } = l != null ? l : {};
|
|
871
871
|
if (l == null || t == null || m == null)
|
|
872
872
|
return {
|
|
873
873
|
left: r,
|
|
874
874
|
top: o,
|
|
875
875
|
width: s,
|
|
876
|
-
height:
|
|
876
|
+
height: a,
|
|
877
877
|
angle: d
|
|
878
878
|
};
|
|
879
879
|
const { mainComponent: g } = t, p = g, { top: h, pageLayoutType: v, pageMarginLeft: w, pageMarginTop: S } = p;
|
|
880
880
|
let O = o;
|
|
881
881
|
this._liquid.reset();
|
|
882
882
|
for (const D of m) {
|
|
883
|
-
const { marginBottom: T, pageHeight: M } = D,
|
|
883
|
+
const { marginBottom: T, pageHeight: M } = D, P = m.indexOf(D), A = m[P + 1];
|
|
884
884
|
if (A == null)
|
|
885
885
|
continue;
|
|
886
|
-
if (
|
|
886
|
+
if (Pe.hasIntersectionBetweenTwoRanges(
|
|
887
887
|
o,
|
|
888
|
-
o +
|
|
888
|
+
o + a,
|
|
889
889
|
this._liquid.y + h + M - T,
|
|
890
890
|
this._liquid.y + h + M + S + A.marginTop
|
|
891
891
|
)) {
|
|
892
|
-
const N = o +
|
|
893
|
-
N < I ? O = Math.min(o, this._liquid.y + h + M - T -
|
|
892
|
+
const N = o + a / 2, I = this._liquid.y + h + M + S / 2;
|
|
893
|
+
N < I ? O = Math.min(o, this._liquid.y + h + M - T - a) : O = Math.max(o, this._liquid.y + h + M + S + A.marginTop);
|
|
894
894
|
}
|
|
895
895
|
this._liquid.translatePage(D, v, w, S);
|
|
896
896
|
}
|
|
@@ -898,7 +898,7 @@ let on = class extends Xe {
|
|
|
898
898
|
left: r,
|
|
899
899
|
top: O,
|
|
900
900
|
width: s,
|
|
901
|
-
height:
|
|
901
|
+
height: a,
|
|
902
902
|
angle: d
|
|
903
903
|
};
|
|
904
904
|
}
|
|
@@ -906,15 +906,15 @@ let on = class extends Xe {
|
|
|
906
906
|
const r = e.isMultiTransform === oe.TRUE ? n : this._limitDrawingInPage(e, n);
|
|
907
907
|
if (t && r.top !== n.top)
|
|
908
908
|
return;
|
|
909
|
-
const o = this._getDrawingAnchor(e, r), { offset: s, docTransform:
|
|
910
|
-
return s == null ||
|
|
909
|
+
const o = this._getDrawingAnchor(e, r), { offset: s, docTransform: a, segmentId: d, segmentPage: c } = o != null ? o : {};
|
|
910
|
+
return s == null || a == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, n]])) : this._commandService.executeCommand(nt.id, {
|
|
911
911
|
unitId: e.unitId,
|
|
912
912
|
subUnitId: e.unitId,
|
|
913
913
|
drawing: e,
|
|
914
914
|
offset: s,
|
|
915
|
-
docTransform:
|
|
915
|
+
docTransform: a,
|
|
916
916
|
segmentId: d,
|
|
917
|
-
segmentPage:
|
|
917
|
+
segmentPage: c
|
|
918
918
|
});
|
|
919
919
|
}
|
|
920
920
|
_getSceneAndTransformerByDrawingSearch(e) {
|
|
@@ -936,19 +936,19 @@ let on = class extends Xe {
|
|
|
936
936
|
if (t == null)
|
|
937
937
|
return;
|
|
938
938
|
const { mainComponent: r, scene: o } = t, s = r, {
|
|
939
|
-
docsLeft:
|
|
939
|
+
docsLeft: a,
|
|
940
940
|
docsTop: d
|
|
941
|
-
} = s.getOffsetConfig(),
|
|
941
|
+
} = s.getOffsetConfig(), c = mi(n), { left: l, top: m, height: g } = c, p = l + a, h = m + d;
|
|
942
942
|
if (this._anchorShape) {
|
|
943
943
|
this._anchorShape.transformByState({ left: p, top: h, height: g }), this._anchorShape.show();
|
|
944
944
|
return;
|
|
945
945
|
}
|
|
946
|
-
const v = 6, w = new ni(Ai +
|
|
946
|
+
const v = 6, w = new ni(Ai + Pe.generateRandomId(v), {
|
|
947
947
|
left: p,
|
|
948
948
|
top: h,
|
|
949
949
|
height: g,
|
|
950
950
|
strokeWidth: 2,
|
|
951
|
-
stroke: ti(
|
|
951
|
+
stroke: ti(yt.darkGray, 1),
|
|
952
952
|
evented: !1
|
|
953
953
|
});
|
|
954
954
|
this._anchorShape = w, o.addObject(w, ui);
|
|
@@ -963,19 +963,19 @@ let on = class extends Xe {
|
|
|
963
963
|
width: r,
|
|
964
964
|
height: o
|
|
965
965
|
};
|
|
966
|
-
const { pages:
|
|
966
|
+
const { pages: a } = s;
|
|
967
967
|
let d = null;
|
|
968
|
-
for (const
|
|
969
|
-
const { skeDrawings: l } =
|
|
968
|
+
for (const c of a) {
|
|
969
|
+
const { skeDrawings: l } = c;
|
|
970
970
|
if (l.has(e.drawingId)) {
|
|
971
|
-
d =
|
|
971
|
+
d = c;
|
|
972
972
|
break;
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
975
|
if (d) {
|
|
976
|
-
const { pageWidth:
|
|
976
|
+
const { pageWidth: c, pageHeight: l, marginLeft: m, marginBottom: g, marginRight: p, marginTop: h } = d;
|
|
977
977
|
return {
|
|
978
|
-
width: Math.max(r,
|
|
978
|
+
width: Math.max(r, c - m - p),
|
|
979
979
|
height: Math.max(o, l - h - g)
|
|
980
980
|
};
|
|
981
981
|
} else
|
|
@@ -1007,8 +1007,8 @@ var he = function() {
|
|
|
1007
1007
|
e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
|
|
1008
1008
|
return n;
|
|
1009
1009
|
}, tt = Xn(function(i, e) {
|
|
1010
|
-
var n = i.icon, t = i.id, r = i.className, o = i.extend, s = Ei(i, ["icon", "id", "className", "extend"]),
|
|
1011
|
-
return it(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, he({ ref: e, className:
|
|
1010
|
+
var n = i.icon, t = i.id, r = i.className, o = i.extend, s = Ei(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = Di("_".concat(Bi()));
|
|
1011
|
+
return it(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, he({ ref: e, className: a }, s), o);
|
|
1012
1012
|
});
|
|
1013
1013
|
function it(i, e, n, t, r) {
|
|
1014
1014
|
return Kn(i.tag, he(he({ key: e }, xi(i, n, r)), t), (Li(i, n).children || []).map(function(o, s) {
|
|
@@ -1017,11 +1017,14 @@ function it(i, e, n, t, r) {
|
|
|
1017
1017
|
}
|
|
1018
1018
|
function xi(i, e, n) {
|
|
1019
1019
|
var t = he({}, i.attrs);
|
|
1020
|
-
n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1)
|
|
1020
|
+
n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1), i.tag === "mask" && t.id && (t.id = t.id + e.idSuffix), Object.entries(t).forEach(function(o) {
|
|
1021
|
+
var s = o[0], a = o[1];
|
|
1022
|
+
s === "mask" && typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
1023
|
+
});
|
|
1021
1024
|
var r = e.defIds;
|
|
1022
1025
|
return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(o) {
|
|
1023
|
-
var s = o[0],
|
|
1024
|
-
typeof
|
|
1026
|
+
var s = o[0], a = o[1];
|
|
1027
|
+
typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
1025
1028
|
})), t;
|
|
1026
1029
|
}
|
|
1027
1030
|
function Li(i, e) {
|
|
@@ -1047,11 +1050,11 @@ const Sn = {
|
|
|
1047
1050
|
type: K.COMMAND,
|
|
1048
1051
|
// eslint-disable-next-line max-lines-per-function
|
|
1049
1052
|
handler: (i, e) => {
|
|
1050
|
-
var M,
|
|
1053
|
+
var M, P, A, U;
|
|
1051
1054
|
const n = i.get(z), t = i.get(Q), r = i.get(ee), o = t.getCurrentUniverDocInstance();
|
|
1052
1055
|
if (e == null || o == null)
|
|
1053
1056
|
return !1;
|
|
1054
|
-
const s = r.getRenderById(e.unitId).with(Me), { drawings:
|
|
1057
|
+
const s = r.getRenderById(e.unitId).with(Me), { drawings: a } = e, d = (M = s.getSegment()) != null ? M : "", c = new vn(), l = q.getInstance(), m = (A = (P = o.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : P.customBlocks) != null ? A : [], g = a.map((N) => m.find((I) => I.blockId === N.drawingId)).filter((N) => !!N).sort((N, I) => N.startIndex > I.startIndex ? 1 : -1), p = a[0].unitId, h = new Pt();
|
|
1055
1058
|
h.reset();
|
|
1056
1059
|
const v = g[0].startIndex, w = [
|
|
1057
1060
|
{
|
|
@@ -1068,16 +1071,16 @@ const Sn = {
|
|
|
1068
1071
|
}, O = [];
|
|
1069
1072
|
for (const N of g) {
|
|
1070
1073
|
const { startIndex: I } = N;
|
|
1071
|
-
I > h.cursor &&
|
|
1074
|
+
I > h.cursor && c.push({
|
|
1072
1075
|
t: Z.RETAIN,
|
|
1073
1076
|
len: I - h.cursor
|
|
1074
|
-
}),
|
|
1077
|
+
}), c.push({
|
|
1075
1078
|
t: Z.DELETE,
|
|
1076
1079
|
len: 1
|
|
1077
1080
|
}), h.moveCursorTo(I + 1);
|
|
1078
1081
|
}
|
|
1079
1082
|
const D = ze(o, d);
|
|
1080
|
-
O.push(l.editOp(
|
|
1083
|
+
O.push(l.editOp(c.serialize(), D));
|
|
1081
1084
|
for (const N of g) {
|
|
1082
1085
|
const { blockId: I } = N, L = ((U = o.getDrawings()) != null ? U : {})[I], x = o.getDrawingsOrder().indexOf(I), G = l.removeOp(["drawings", I], L), _ = l.removeOp(["drawingsOrder", x], I);
|
|
1083
1086
|
O.push(G), O.push(_);
|
|
@@ -1092,11 +1095,11 @@ const Sn = {
|
|
|
1092
1095
|
if (t.length === 0)
|
|
1093
1096
|
return !1;
|
|
1094
1097
|
const { unitId: r } = t[0], o = t.map((s) => {
|
|
1095
|
-
const { unitId:
|
|
1098
|
+
const { unitId: a, subUnitId: d, drawingId: c, drawingType: l } = s;
|
|
1096
1099
|
return {
|
|
1097
|
-
unitId:
|
|
1100
|
+
unitId: a,
|
|
1098
1101
|
subUnitId: d,
|
|
1099
|
-
drawingId:
|
|
1102
|
+
drawingId: c,
|
|
1100
1103
|
drawingType: l
|
|
1101
1104
|
};
|
|
1102
1105
|
});
|
|
@@ -1118,7 +1121,7 @@ const Sn = {
|
|
|
1118
1121
|
t.push(g.unitId);
|
|
1119
1122
|
});
|
|
1120
1123
|
});
|
|
1121
|
-
const r = n.getGroupDrawingOp(e), { unitId: o, subUnitId: s, undo:
|
|
1124
|
+
const r = n.getGroupDrawingOp(e), { unitId: o, subUnitId: s, undo: a, redo: d, objects: c } = r;
|
|
1122
1125
|
return !1;
|
|
1123
1126
|
}
|
|
1124
1127
|
}, at = {
|
|
@@ -1126,18 +1129,18 @@ const Sn = {
|
|
|
1126
1129
|
type: K.COMMAND,
|
|
1127
1130
|
// eslint-disable-next-line max-lines-per-function
|
|
1128
1131
|
handler: (i, e) => {
|
|
1129
|
-
var
|
|
1132
|
+
var P, A, U, N;
|
|
1130
1133
|
if (e == null)
|
|
1131
1134
|
return !1;
|
|
1132
1135
|
const n = i.get(z), t = i.get(In), r = i.get(Q), o = t.getActiveTextRange(), s = r.getCurrentUniverDocInstance();
|
|
1133
1136
|
if (o == null || s == null)
|
|
1134
1137
|
return !1;
|
|
1135
|
-
const
|
|
1138
|
+
const a = s.getUnitId(), { drawings: d } = e, { collapsed: c, startOffset: l, segmentId: m } = o, g = s.getSelfOrHeaderFooterModel(m).getBody();
|
|
1136
1139
|
if (g == null)
|
|
1137
1140
|
return !1;
|
|
1138
|
-
const p = new vn(), h = q.getInstance(), v = [], w = (A = (
|
|
1141
|
+
const p = new vn(), h = q.getInstance(), v = [], w = (A = (P = s.getSnapshot().drawingsOrder) == null ? void 0 : P.length) != null ? A : 0;
|
|
1139
1142
|
let S = 0;
|
|
1140
|
-
if (
|
|
1143
|
+
if (c)
|
|
1141
1144
|
l > 0 && p.push({
|
|
1142
1145
|
t: Z.RETAIN,
|
|
1143
1146
|
len: l
|
|
@@ -1151,8 +1154,8 @@ const Sn = {
|
|
|
1151
1154
|
const C = W[_], R = x.indexOf(_);
|
|
1152
1155
|
if (C == null || R < 0)
|
|
1153
1156
|
continue;
|
|
1154
|
-
const
|
|
1155
|
-
v.push(
|
|
1157
|
+
const y = h.removeOp(["drawings", _], C), B = h.removeOp(["drawingsOrder", R], _);
|
|
1158
|
+
v.push(y), v.push(B), S++;
|
|
1156
1159
|
}
|
|
1157
1160
|
}
|
|
1158
1161
|
p.push({
|
|
@@ -1175,7 +1178,7 @@ const Sn = {
|
|
|
1175
1178
|
const T = {
|
|
1176
1179
|
id: J.id,
|
|
1177
1180
|
params: {
|
|
1178
|
-
unitId:
|
|
1181
|
+
unitId: a,
|
|
1179
1182
|
actions: [],
|
|
1180
1183
|
textRanges: []
|
|
1181
1184
|
}
|
|
@@ -1189,15 +1192,15 @@ const Sn = {
|
|
|
1189
1192
|
const n = i.get(z), t = i.get(Be);
|
|
1190
1193
|
if (e == null)
|
|
1191
1194
|
return !1;
|
|
1192
|
-
const { unitId: r, subUnitId: o, drawingIds: s, arrangeType:
|
|
1193
|
-
let
|
|
1194
|
-
if (
|
|
1195
|
+
const { unitId: r, subUnitId: o, drawingIds: s, arrangeType: a } = e, d = { unitId: r, subUnitId: o, drawingIds: s };
|
|
1196
|
+
let c;
|
|
1197
|
+
if (a === Ze.forward ? c = t.getForwardDrawingsOp(d) : a === Ze.backward ? c = t.getBackwardDrawingOp(d) : a === Ze.front ? c = t.getFrontDrawingsOp(d) : a === Ze.back && (c = t.getBackDrawingsOp(d)), c == null)
|
|
1195
1198
|
return !1;
|
|
1196
|
-
const { redo: l } =
|
|
1199
|
+
const { redo: l } = c;
|
|
1197
1200
|
if (l == null)
|
|
1198
1201
|
return !1;
|
|
1199
1202
|
const m = [];
|
|
1200
|
-
let g =
|
|
1203
|
+
let g = Pe.deepClone(l);
|
|
1201
1204
|
g = g.slice(3), g.unshift("drawingsOrder"), m.push(g);
|
|
1202
1205
|
const p = {
|
|
1203
1206
|
id: J.id,
|
|
@@ -1222,7 +1225,7 @@ const Sn = {
|
|
|
1222
1225
|
t.push(g.unitId);
|
|
1223
1226
|
});
|
|
1224
1227
|
});
|
|
1225
|
-
const r = n.getUngroupDrawingOp(e), { unitId: o, subUnitId: s, undo:
|
|
1228
|
+
const r = n.getUngroupDrawingOp(e), { unitId: o, subUnitId: s, undo: a, redo: d, objects: c } = r;
|
|
1226
1229
|
return !1;
|
|
1227
1230
|
}
|
|
1228
1231
|
};
|
|
@@ -1232,17 +1235,17 @@ var ki = Object.getOwnPropertyDescriptor, Fi = (i, e, n, t) => {
|
|
|
1232
1235
|
return r;
|
|
1233
1236
|
}, me = (i, e) => (n, t) => e(n, t, i);
|
|
1234
1237
|
let sn = class extends Xe {
|
|
1235
|
-
constructor(i, e, n, t, r, o, s,
|
|
1236
|
-
super(), this._context = i, this._commandService = e, this._docSelectionManagerService = n, this._renderManagerSrv = t, this._imageIoService = r, this._docDrawingService = o, this._drawingManagerService = s, this._contextService =
|
|
1238
|
+
constructor(i, e, n, t, r, o, s, a, d, c, l, m, g) {
|
|
1239
|
+
super(), this._context = i, this._commandService = e, this._docSelectionManagerService = n, this._renderManagerSrv = t, this._imageIoService = r, this._docDrawingService = o, this._drawingManagerService = s, this._contextService = a, this._messageService = d, this._localeService = c, this._docSelectionRenderService = l, this._docRefreshDrawingsService = m, this._fileOpenerService = g, this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._transformDrawingListener(), this._editAreaChangeListener();
|
|
1237
1240
|
}
|
|
1238
1241
|
async insertDocImage() {
|
|
1239
1242
|
const i = await this._fileOpenerService.openFile({
|
|
1240
1243
|
multiple: !0,
|
|
1241
1244
|
accept: Vt.map((n) => `.${n.replace("image/", "")}`).join(",")
|
|
1242
1245
|
}), e = i.length;
|
|
1243
|
-
return e >
|
|
1246
|
+
return e > yn ? (this._messageService.show({
|
|
1244
1247
|
type: Ln.Error,
|
|
1245
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(
|
|
1248
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(yn))
|
|
1246
1249
|
}), !1) : e === 0 ? !1 : (await this._insertFloatImages(i), !0);
|
|
1247
1250
|
}
|
|
1248
1251
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -1275,14 +1278,14 @@ let sn = class extends Xe {
|
|
|
1275
1278
|
for (const r of e) {
|
|
1276
1279
|
if (r == null)
|
|
1277
1280
|
continue;
|
|
1278
|
-
const { imageId: o, imageSourceType: s, source:
|
|
1281
|
+
const { imageId: o, imageSourceType: s, source: a, base64Cache: d } = r, { width: c, height: l, image: m } = await $t(d || "");
|
|
1279
1282
|
this._imageIoService.addImageSourceCache(o, s, m);
|
|
1280
1283
|
let g = 1;
|
|
1281
|
-
if (
|
|
1282
|
-
const w =
|
|
1284
|
+
if (c > Pn || l > bn) {
|
|
1285
|
+
const w = Pn / c, S = bn / l;
|
|
1283
1286
|
g = Math.min(w, S);
|
|
1284
1287
|
}
|
|
1285
|
-
const p = this._getImagePosition(
|
|
1288
|
+
const p = this._getImagePosition(c * g, l * g);
|
|
1286
1289
|
if (p == null)
|
|
1287
1290
|
return;
|
|
1288
1291
|
const h = {
|
|
@@ -1291,7 +1294,7 @@ let sn = class extends Xe {
|
|
|
1291
1294
|
drawingId: o,
|
|
1292
1295
|
drawingType: Mt.DRAWING_IMAGE,
|
|
1293
1296
|
imageSourceType: s,
|
|
1294
|
-
source:
|
|
1297
|
+
source: a,
|
|
1295
1298
|
transform: pi(p),
|
|
1296
1299
|
docTransform: p,
|
|
1297
1300
|
behindDoc: oe.FALSE,
|
|
@@ -1393,30 +1396,30 @@ let sn = class extends Xe {
|
|
|
1393
1396
|
);
|
|
1394
1397
|
}
|
|
1395
1398
|
_findSegmentIdByDrawingId(i) {
|
|
1396
|
-
var s,
|
|
1399
|
+
var s, a, d;
|
|
1397
1400
|
const { unit: e } = this._context, { body: n, headers: t = {}, footers: r = {} } = e.getSnapshot();
|
|
1398
|
-
if (((s = n == null ? void 0 : n.customBlocks) != null ? s : []).some((
|
|
1401
|
+
if (((s = n == null ? void 0 : n.customBlocks) != null ? s : []).some((c) => c.blockId === i))
|
|
1399
1402
|
return "";
|
|
1400
|
-
for (const
|
|
1401
|
-
if ((
|
|
1402
|
-
return
|
|
1403
|
-
for (const
|
|
1404
|
-
if ((d = r[
|
|
1405
|
-
return
|
|
1403
|
+
for (const c of Object.keys(t))
|
|
1404
|
+
if ((a = t[c].body.customBlocks) != null && a.some((l) => l.blockId === i))
|
|
1405
|
+
return c;
|
|
1406
|
+
for (const c of Object.keys(r))
|
|
1407
|
+
if ((d = r[c].body.customBlocks) != null && d.some((l) => l.blockId === i))
|
|
1408
|
+
return c;
|
|
1406
1409
|
return "";
|
|
1407
1410
|
}
|
|
1408
1411
|
// Update drawings edit status and opacity. You can not edit header footer images when you are editing body. and vice verse.
|
|
1409
1412
|
_updateDrawingsEditStatus() {
|
|
1410
|
-
var
|
|
1411
|
-
const { unit: i, scene: e, unitId: n } = this._context, t = (
|
|
1413
|
+
var a;
|
|
1414
|
+
const { unit: i, scene: e, unitId: n } = this._context, t = (a = this._renderManagerSrv.getRenderById(n)) == null ? void 0 : a.with(se).getViewModel();
|
|
1412
1415
|
if (t == null || i == null)
|
|
1413
1416
|
return;
|
|
1414
1417
|
const r = i.getSnapshot(), { drawings: o = {} } = r, s = t.getEditArea() === Fe.BODY;
|
|
1415
1418
|
for (const d of Object.keys(o)) {
|
|
1416
|
-
const
|
|
1419
|
+
const c = o[d], l = zt({ unitId: n, drawingId: c.drawingId, subUnitId: n }), m = e.fuzzyMathObjects(l, !0);
|
|
1417
1420
|
if (m.length)
|
|
1418
1421
|
for (const g of m)
|
|
1419
|
-
e.detachTransformerFrom(g), g.setOpacity(0.5), (s &&
|
|
1422
|
+
e.detachTransformerFrom(g), g.setOpacity(0.5), (s && c.isMultiTransform !== oe.TRUE || !s && c.isMultiTransform === oe.TRUE) && (e.attachTransformerTo(g), g.setOpacity(1));
|
|
1420
1423
|
}
|
|
1421
1424
|
}
|
|
1422
1425
|
_editAreaChangeListener() {
|
|
@@ -1441,7 +1444,7 @@ let sn = class extends Xe {
|
|
|
1441
1444
|
_setDrawingSelections(i) {
|
|
1442
1445
|
var r, o;
|
|
1443
1446
|
const { unit: e } = this._context, n = (o = (r = e.getSnapshot().body) == null ? void 0 : r.customBlocks) != null ? o : [], t = i.map((s) => {
|
|
1444
|
-
const
|
|
1447
|
+
const a = s.drawingId, d = n.find((c) => c.blockId === a);
|
|
1445
1448
|
return d ? d.startIndex : null;
|
|
1446
1449
|
}).filter((s) => s !== null).map((s) => ({ startOffset: s, endOffset: s + 1 }));
|
|
1447
1450
|
this._docSelectionManagerService.replaceDocRanges(t);
|
|
@@ -1472,15 +1475,15 @@ const lt = {
|
|
|
1472
1475
|
id: "doc.command.move-drawing",
|
|
1473
1476
|
type: K.COMMAND,
|
|
1474
1477
|
handler: (i, e) => {
|
|
1475
|
-
const n = i.get(z), t = i.get(Be), r = i.get(Q), o = i.get(ee), { direction: s } = e,
|
|
1476
|
-
if (
|
|
1478
|
+
const n = i.get(z), t = i.get(Be), r = i.get(Q), o = i.get(ee), { direction: s } = e, a = t.getFocusDrawings();
|
|
1479
|
+
if (a.length === 0)
|
|
1477
1480
|
return !1;
|
|
1478
|
-
const d =
|
|
1481
|
+
const d = a[0].unitId, c = o.getRenderById(d), l = c == null ? void 0 : c.scene;
|
|
1479
1482
|
if (l == null)
|
|
1480
1483
|
return !1;
|
|
1481
|
-
const m = l.getTransformerByCreate(), g = r.getUniverDocInstance(d), p =
|
|
1482
|
-
var
|
|
1483
|
-
const { drawingId: w } = v, S = (
|
|
1484
|
+
const m = l.getTransformerByCreate(), g = r.getUniverDocInstance(d), p = a.map((v) => {
|
|
1485
|
+
var P, A, U, N, I;
|
|
1486
|
+
const { drawingId: w } = v, S = (P = g == null ? void 0 : g.getSnapshot().drawings) == null ? void 0 : P[w];
|
|
1484
1487
|
if (S == null || S.layoutType === H.INLINE)
|
|
1485
1488
|
return null;
|
|
1486
1489
|
const { positionH: O, positionV: D } = S.docTransform, T = { ...O }, M = { ...D };
|
|
@@ -1564,10 +1567,10 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1564
1567
|
imageCommonPanelSpan2: Xi,
|
|
1565
1568
|
imageCommonPanelInput: Ki
|
|
1566
1569
|
}, Hn = -1e3, Wn = 1e3, Yi = (i) => {
|
|
1567
|
-
const e = we(z), n = we(ln), t = we(Ie), r = we(ee), o = we(Q), { drawings: s } = i,
|
|
1568
|
-
if (
|
|
1570
|
+
const e = we(z), n = we(ln), t = we(Ie), r = we(ee), o = we(Q), { drawings: s } = i, a = s[0];
|
|
1571
|
+
if (a == null)
|
|
1569
1572
|
return;
|
|
1570
|
-
const { unitId: d } =
|
|
1573
|
+
const { unitId: d } = a, c = o.getUniverDocInstance(d), l = c == null ? void 0 : c.getSnapshot().documentStyle.documentFlavor, m = r.getRenderById(d), g = m == null ? void 0 : m.scene;
|
|
1571
1574
|
if (g == null)
|
|
1572
1575
|
return;
|
|
1573
1576
|
const p = g.getTransformerByCreate(), h = [{
|
|
@@ -1600,21 +1603,21 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1600
1603
|
}), [T, M] = re({
|
|
1601
1604
|
relativeFrom: V.PAGE,
|
|
1602
1605
|
posOffset: 0
|
|
1603
|
-
}), [
|
|
1606
|
+
}), [P, A] = re(!0), [U, N] = re(!0);
|
|
1604
1607
|
function I(C, R) {
|
|
1605
1608
|
var b;
|
|
1606
1609
|
C === "positionH" ? D(R) : M(R);
|
|
1607
|
-
const
|
|
1608
|
-
if (
|
|
1610
|
+
const y = t.getFocusDrawings();
|
|
1611
|
+
if (y.length === 0)
|
|
1609
1612
|
return;
|
|
1610
|
-
const B =
|
|
1613
|
+
const B = y.map((E) => ({
|
|
1611
1614
|
unitId: E.unitId,
|
|
1612
1615
|
subUnitId: E.subUnitId,
|
|
1613
1616
|
drawingId: E.drawingId
|
|
1614
1617
|
}));
|
|
1615
1618
|
e.executeCommand(qe.id, {
|
|
1616
|
-
unitId:
|
|
1617
|
-
subUnitId:
|
|
1619
|
+
unitId: y[0].unitId,
|
|
1620
|
+
subUnitId: y[0].unitId,
|
|
1618
1621
|
drawings: B.map((E) => ({
|
|
1619
1622
|
drawingId: E.drawingId,
|
|
1620
1623
|
key: C,
|
|
@@ -1626,7 +1629,7 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1626
1629
|
}
|
|
1627
1630
|
function L(C) {
|
|
1628
1631
|
var ie, _e, Se;
|
|
1629
|
-
const R = O.relativeFrom,
|
|
1632
|
+
const R = O.relativeFrom, y = O.posOffset, B = Number(C);
|
|
1630
1633
|
if (R === B)
|
|
1631
1634
|
return;
|
|
1632
1635
|
const k = t.getFocusDrawings();
|
|
@@ -1661,13 +1664,13 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1661
1664
|
R === ne.COLUMN ? ce -= $.columnLeft : R === ne.MARGIN && (ce -= F), B === ne.COLUMN ? ce += $.columnLeft : B === ne.MARGIN ? ce += F : ne.PAGE;
|
|
1662
1665
|
const te = {
|
|
1663
1666
|
relativeFrom: B,
|
|
1664
|
-
posOffset: (
|
|
1667
|
+
posOffset: (y != null ? y : 0) - ce
|
|
1665
1668
|
};
|
|
1666
1669
|
I("positionH", te);
|
|
1667
1670
|
}
|
|
1668
1671
|
function W(C) {
|
|
1669
1672
|
var Oe, Ne, Ae, Te, le, ge;
|
|
1670
|
-
const R = T.relativeFrom,
|
|
1673
|
+
const R = T.relativeFrom, y = T.posOffset, B = Number(C);
|
|
1671
1674
|
if (R === B)
|
|
1672
1675
|
return;
|
|
1673
1676
|
const k = t.getFocusDrawings();
|
|
@@ -1683,19 +1686,19 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1683
1686
|
R === V.PARAGRAPH ? de -= _e.top : R === V.LINE ? de -= te.top : R === V.PAGE && (de += Se.marginTop), B === V.PARAGRAPH ? de += _e.top : B === V.LINE ? de += te.top : B === V.PAGE && (de -= Se.marginTop);
|
|
1684
1687
|
const De = {
|
|
1685
1688
|
relativeFrom: B,
|
|
1686
|
-
posOffset: (
|
|
1689
|
+
posOffset: (y != null ? y : 0) - de
|
|
1687
1690
|
};
|
|
1688
1691
|
I("positionV", De);
|
|
1689
1692
|
}
|
|
1690
1693
|
function x(C) {
|
|
1691
1694
|
var E;
|
|
1692
|
-
const R =
|
|
1693
|
-
if (
|
|
1695
|
+
const R = c == null ? void 0 : c.getSnapshot(), y = (E = R == null ? void 0 : R.drawings) == null ? void 0 : E[C.drawingId];
|
|
1696
|
+
if (y == null)
|
|
1694
1697
|
return;
|
|
1695
|
-
const { layoutType: B } =
|
|
1698
|
+
const { layoutType: B } = y, {
|
|
1696
1699
|
positionH: k,
|
|
1697
1700
|
positionV: b
|
|
1698
|
-
} =
|
|
1701
|
+
} = y.docTransform;
|
|
1699
1702
|
D(k), M(b), S(B === H.INLINE), A(b.relativeFrom === V.PARAGRAPH || b.relativeFrom === V.LINE);
|
|
1700
1703
|
}
|
|
1701
1704
|
function G() {
|
|
@@ -1707,14 +1710,14 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1707
1710
|
}
|
|
1708
1711
|
return _n(() => {
|
|
1709
1712
|
G();
|
|
1710
|
-
const C = t.focus$.subscribe((
|
|
1711
|
-
if (
|
|
1713
|
+
const C = t.focus$.subscribe((y) => {
|
|
1714
|
+
if (y.length === 0) {
|
|
1712
1715
|
N(!1);
|
|
1713
1716
|
return;
|
|
1714
1717
|
}
|
|
1715
|
-
N(!0), x(
|
|
1716
|
-
}), R = e.onCommandExecuted(async (
|
|
1717
|
-
|
|
1718
|
+
N(!0), x(y[0]);
|
|
1719
|
+
}), R = e.onCommandExecuted(async (y) => {
|
|
1720
|
+
y.id === J.id && G();
|
|
1718
1721
|
});
|
|
1719
1722
|
return () => {
|
|
1720
1723
|
C.unsubscribe(), R.dispose();
|
|
@@ -1792,16 +1795,16 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1792
1795
|
] }) })
|
|
1793
1796
|
] }),
|
|
1794
1797
|
/* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSubtitle), children: /* @__PURE__ */ f("div", { children: n.t("image-position.options") }) }) }),
|
|
1795
|
-
/* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, style: { marginBottom: "50px" }, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(Ci, { disabled: w, checked:
|
|
1798
|
+
/* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, style: { marginBottom: "50px" }, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(Ci, { disabled: w, checked: P, onChange: _, children: n.t("image-position.moveObjectWithText") }) }) })
|
|
1796
1799
|
] });
|
|
1797
1800
|
}, Je = 0, en = 100, Zi = (i) => {
|
|
1798
|
-
const e = we(z), n = we(ln), t = we(Ie), r = we(ee), o = we(Q), { drawings: s } = i,
|
|
1799
|
-
if (
|
|
1801
|
+
const e = we(z), n = we(ln), t = we(Ie), r = we(ee), o = we(Q), { drawings: s } = i, a = s[0];
|
|
1802
|
+
if (a == null)
|
|
1800
1803
|
return null;
|
|
1801
|
-
const { unitId: d } =
|
|
1804
|
+
const { unitId: d } = a, c = o.getUniverDocInstance(d), l = r.getRenderById(d);
|
|
1802
1805
|
if ((l == null ? void 0 : l.scene) == null)
|
|
1803
1806
|
return null;
|
|
1804
|
-
const [g, p] = re(!0), [h, v] = re(!0), [w, S] = re(!0), [O, D] = re(ue.INLINE), [T, M] = re(""), [
|
|
1807
|
+
const [g, p] = re(!0), [h, v] = re(!0), [w, S] = re(!0), [O, D] = re(ue.INLINE), [T, M] = re(""), [P, A] = re({
|
|
1805
1808
|
distT: 0,
|
|
1806
1809
|
distL: 0,
|
|
1807
1810
|
distB: 0,
|
|
@@ -1812,14 +1815,14 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1812
1815
|
const C = t.getFocusDrawings();
|
|
1813
1816
|
if (C.length === 0)
|
|
1814
1817
|
return;
|
|
1815
|
-
const { unitId: R, subUnitId:
|
|
1818
|
+
const { unitId: R, subUnitId: y } = C[0], B = C.map(({ unitId: k, subUnitId: b, drawingId: E }) => ({
|
|
1816
1819
|
unitId: k,
|
|
1817
1820
|
subUnitId: b,
|
|
1818
1821
|
drawingId: E
|
|
1819
1822
|
}));
|
|
1820
1823
|
e.executeCommand(Zn.id, {
|
|
1821
1824
|
unitId: R,
|
|
1822
|
-
subUnitId:
|
|
1825
|
+
subUnitId: y,
|
|
1823
1826
|
drawings: B,
|
|
1824
1827
|
wrappingStyle: _
|
|
1825
1828
|
});
|
|
@@ -1829,10 +1832,10 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1829
1832
|
const C = t.getFocusDrawings();
|
|
1830
1833
|
if (C.length === 0)
|
|
1831
1834
|
return;
|
|
1832
|
-
const R = C.map((
|
|
1833
|
-
unitId:
|
|
1834
|
-
subUnitId:
|
|
1835
|
-
drawingId:
|
|
1835
|
+
const R = C.map((y) => ({
|
|
1836
|
+
unitId: y.unitId,
|
|
1837
|
+
subUnitId: y.subUnitId,
|
|
1838
|
+
drawingId: y.drawingId
|
|
1836
1839
|
}));
|
|
1837
1840
|
e.executeCommand(Jn.id, {
|
|
1838
1841
|
unitId: C[0].unitId,
|
|
@@ -1844,19 +1847,19 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1844
1847
|
function W(_, C) {
|
|
1845
1848
|
if (_ == null)
|
|
1846
1849
|
return;
|
|
1847
|
-
const R = { ...
|
|
1850
|
+
const R = { ...P, [C]: _ };
|
|
1848
1851
|
A(R);
|
|
1849
|
-
const
|
|
1850
|
-
if (
|
|
1852
|
+
const y = t.getFocusDrawings();
|
|
1853
|
+
if (y.length === 0)
|
|
1851
1854
|
return;
|
|
1852
|
-
const B =
|
|
1855
|
+
const B = y.map((k) => ({
|
|
1853
1856
|
unitId: k.unitId,
|
|
1854
1857
|
subUnitId: k.subUnitId,
|
|
1855
1858
|
drawingId: k.drawingId
|
|
1856
1859
|
}));
|
|
1857
1860
|
e.executeCommand(Qn.id, {
|
|
1858
|
-
unitId:
|
|
1859
|
-
subUnitId:
|
|
1861
|
+
unitId: y[0].unitId,
|
|
1862
|
+
subUnitId: y[0].unitId,
|
|
1860
1863
|
drawings: B,
|
|
1861
1864
|
dist: {
|
|
1862
1865
|
[C]: _
|
|
@@ -1869,12 +1872,12 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1869
1872
|
}
|
|
1870
1873
|
function G(_) {
|
|
1871
1874
|
var Y, ae;
|
|
1872
|
-
const C = (ae = (Y =
|
|
1875
|
+
const C = (ae = (Y = c == null ? void 0 : c.getSnapshot()) == null ? void 0 : Y.drawings) == null ? void 0 : ae[_.drawingId];
|
|
1873
1876
|
if (C == null)
|
|
1874
1877
|
return;
|
|
1875
1878
|
const {
|
|
1876
1879
|
distT: R = 0,
|
|
1877
|
-
distL:
|
|
1880
|
+
distL: y = 0,
|
|
1878
1881
|
distB: B = 0,
|
|
1879
1882
|
distR: k = 0,
|
|
1880
1883
|
layoutType: b = H.INLINE,
|
|
@@ -1883,7 +1886,7 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1883
1886
|
} = C;
|
|
1884
1887
|
if (A({
|
|
1885
1888
|
distT: R,
|
|
1886
|
-
distL:
|
|
1889
|
+
distL: y,
|
|
1887
1890
|
distB: B,
|
|
1888
1891
|
distR: k
|
|
1889
1892
|
}), M($), p(b !== H.WRAP_SQUARE), b === H.WRAP_NONE || b === H.INLINE ? v(!0) : v(!1), b === H.WRAP_NONE || b === H.INLINE || b === H.WRAP_TOP_AND_BOTTOM ? S(!0) : S(!1), b === H.WRAP_NONE)
|
|
@@ -1921,17 +1924,17 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1921
1924
|
/* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelTitle), children: /* @__PURE__ */ f("div", { children: n.t("image-text-wrap.title") }) }) }),
|
|
1922
1925
|
/* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSubtitle), children: /* @__PURE__ */ f("div", { children: n.t("image-text-wrap.wrappingStyle") }) }) }),
|
|
1923
1926
|
/* @__PURE__ */ f("div", { className: j(u.imageCommonPanelRow), children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn), children: /* @__PURE__ */ X(Un, { value: O, onChange: I, direction: "vertical", children: [
|
|
1924
|
-
/* @__PURE__ */ f(
|
|
1925
|
-
/* @__PURE__ */ f(
|
|
1926
|
-
/* @__PURE__ */ f(
|
|
1927
|
-
/* @__PURE__ */ f(
|
|
1928
|
-
/* @__PURE__ */ f(
|
|
1927
|
+
/* @__PURE__ */ f(ye, { value: ue.INLINE, children: n.t("image-text-wrap.inline") }),
|
|
1928
|
+
/* @__PURE__ */ f(ye, { value: ue.WRAP_SQUARE, children: n.t("image-text-wrap.square") }),
|
|
1929
|
+
/* @__PURE__ */ f(ye, { value: ue.WRAP_TOP_AND_BOTTOM, children: n.t("image-text-wrap.topAndBottom") }),
|
|
1930
|
+
/* @__PURE__ */ f(ye, { value: ue.BEHIND_TEXT, children: n.t("image-text-wrap.behindText") }),
|
|
1931
|
+
/* @__PURE__ */ f(ye, { value: ue.IN_FRONT_OF_TEXT, children: n.t("image-text-wrap.inFrontText") })
|
|
1929
1932
|
] }) }) }),
|
|
1930
1933
|
/* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSubtitle), children: /* @__PURE__ */ f("div", { children: n.t("image-text-wrap.wrapText") }) }) }),
|
|
1931
1934
|
/* @__PURE__ */ f("div", { className: j(u.imageCommonPanelRow), children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn), children: /* @__PURE__ */ X(Un, { disabled: g, value: T, onChange: L, direction: "horizontal", children: [
|
|
1932
|
-
/* @__PURE__ */ f(
|
|
1933
|
-
/* @__PURE__ */ f(
|
|
1934
|
-
/* @__PURE__ */ f(
|
|
1935
|
+
/* @__PURE__ */ f(ye, { value: $e.BOTH_SIDES, children: n.t("image-text-wrap.bothSide") }),
|
|
1936
|
+
/* @__PURE__ */ f(ye, { value: $e.LEFT, children: n.t("image-text-wrap.leftOnly") }),
|
|
1937
|
+
/* @__PURE__ */ f(ye, { value: $e.RIGHT, children: n.t("image-text-wrap.rightOnly") })
|
|
1935
1938
|
] }) }) }),
|
|
1936
1939
|
/* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSubtitle), children: /* @__PURE__ */ f("div", { children: n.t("image-text-wrap.distanceFromText") }) }) }),
|
|
1937
1940
|
/* @__PURE__ */ X("div", { className: u.imageCommonPanelRow, children: [
|
|
@@ -1944,7 +1947,7 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1944
1947
|
max: en,
|
|
1945
1948
|
disabled: h,
|
|
1946
1949
|
precision: 1,
|
|
1947
|
-
value:
|
|
1950
|
+
value: P.distT,
|
|
1948
1951
|
onChange: (_) => {
|
|
1949
1952
|
W(_, "distT");
|
|
1950
1953
|
},
|
|
@@ -1961,7 +1964,7 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1961
1964
|
max: en,
|
|
1962
1965
|
disabled: w,
|
|
1963
1966
|
precision: 1,
|
|
1964
|
-
value:
|
|
1967
|
+
value: P.distL,
|
|
1965
1968
|
onChange: (_) => {
|
|
1966
1969
|
W(_, "distL");
|
|
1967
1970
|
},
|
|
@@ -1980,7 +1983,7 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1980
1983
|
max: en,
|
|
1981
1984
|
disabled: h,
|
|
1982
1985
|
precision: 1,
|
|
1983
|
-
value:
|
|
1986
|
+
value: P.distB,
|
|
1984
1987
|
onChange: (_) => {
|
|
1985
1988
|
W(_, "distB");
|
|
1986
1989
|
},
|
|
@@ -1997,7 +2000,7 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
1997
2000
|
max: en,
|
|
1998
2001
|
disabled: w,
|
|
1999
2002
|
precision: 1,
|
|
2000
|
-
value:
|
|
2003
|
+
value: P.distR,
|
|
2001
2004
|
onChange: (_) => {
|
|
2002
2005
|
W(_, "distR");
|
|
2003
2006
|
},
|
|
@@ -2028,10 +2031,10 @@ const Wi = "univer-image-common-panel", Gi = "univer-image-common-panel-grid", V
|
|
|
2028
2031
|
var s;
|
|
2029
2032
|
const o = e.getActiveTextRange();
|
|
2030
2033
|
if (o) {
|
|
2031
|
-
const { segmentId:
|
|
2034
|
+
const { segmentId: a, startOffset: d, endOffset: c } = o, l = n.getCurrentUniverDocInstance(), m = (s = l == null ? void 0 : l.getSelfOrHeaderFooterModel(a).getBody()) == null ? void 0 : s.tables;
|
|
2032
2035
|
if (m && m.length && m.some((g) => {
|
|
2033
2036
|
const { startIndex: p, endIndex: h } = g;
|
|
2034
|
-
return d >= p && d < h ||
|
|
2037
|
+
return d >= p && d < h || c >= p && c < h;
|
|
2035
2038
|
})) {
|
|
2036
2039
|
t.next(!0);
|
|
2037
2040
|
return;
|
|
@@ -2235,14 +2238,14 @@ let cn = class extends Nt {
|
|
|
2235
2238
|
const s = t.getSelectedObjectMap();
|
|
2236
2239
|
if (r.forEach((w) => w.dispose()), r.length = 0, s.size > 1)
|
|
2237
2240
|
return;
|
|
2238
|
-
const
|
|
2239
|
-
if (!c)
|
|
2240
|
-
return;
|
|
2241
|
-
const d = c.oKey, a = this._drawingManagerService.getDrawingOKey(d);
|
|
2241
|
+
const a = s.values().next().value;
|
|
2242
2242
|
if (!a)
|
|
2243
2243
|
return;
|
|
2244
|
-
const
|
|
2245
|
-
|
|
2244
|
+
const d = a.oKey, c = this._drawingManagerService.getDrawingOKey(d);
|
|
2245
|
+
if (!c)
|
|
2246
|
+
return;
|
|
2247
|
+
const { unitId: l, subUnitId: m, drawingId: g } = c, p = this._canvasPopManagerService.attachPopupToObject(
|
|
2248
|
+
a,
|
|
2246
2249
|
{
|
|
2247
2250
|
componentKey: Yt,
|
|
2248
2251
|
direction: "horizontal",
|
|
@@ -2328,10 +2331,10 @@ var mr = Object.getOwnPropertyDescriptor, ur = (i, e, n, t) => {
|
|
|
2328
2331
|
return r;
|
|
2329
2332
|
}, xe = (i, e) => (n, t) => e(n, t, i);
|
|
2330
2333
|
let wn = class extends Xe {
|
|
2331
|
-
constructor(e, n, t, r, o, s,
|
|
2334
|
+
constructor(e, n, t, r, o, s, a, d) {
|
|
2332
2335
|
super();
|
|
2333
2336
|
Ce(this, "_liquid", new jn());
|
|
2334
|
-
this._context = e, this._docSkeletonManagerService = n, this._commandService = t, this._editorService = r, this._drawingManagerService = o, this._docRefreshDrawingsService = s, this._univerInstanceService =
|
|
2337
|
+
this._context = e, this._docSkeletonManagerService = n, this._commandService = t, this._editorService = r, this._drawingManagerService = o, this._docRefreshDrawingsService = s, this._univerInstanceService = a, this._lifecycleService = d, this._initialize(), this._commandExecutedListener();
|
|
2335
2338
|
}
|
|
2336
2339
|
_initialize() {
|
|
2337
2340
|
this._initialRenderRefresh(), this._drawingInitializeListener(), this._initResize();
|
|
@@ -2351,14 +2354,14 @@ let wn = class extends Xe {
|
|
|
2351
2354
|
const t = n.params, { unitId: r } = t, { unitId: o, mainComponent: s } = this._context;
|
|
2352
2355
|
if (r !== o)
|
|
2353
2356
|
return;
|
|
2354
|
-
const
|
|
2355
|
-
if (
|
|
2357
|
+
const a = this._docSkeletonManagerService.getSkeleton();
|
|
2358
|
+
if (a == null)
|
|
2356
2359
|
return;
|
|
2357
2360
|
if (this._editorService.isEditor(o) && o !== xt) {
|
|
2358
2361
|
s == null || s.makeDirty();
|
|
2359
2362
|
return;
|
|
2360
2363
|
}
|
|
2361
|
-
this._refreshDrawing(
|
|
2364
|
+
this._refreshDrawing(a);
|
|
2362
2365
|
}
|
|
2363
2366
|
})
|
|
2364
2367
|
);
|
|
@@ -2380,20 +2383,20 @@ let wn = class extends Xe {
|
|
|
2380
2383
|
const n = e == null ? void 0 : e.getSkeletonData(), { mainComponent: t, unitId: r } = this._context, o = t;
|
|
2381
2384
|
if (!n)
|
|
2382
2385
|
return;
|
|
2383
|
-
const { left: s, top:
|
|
2386
|
+
const { left: s, top: a, pageLayoutType: d, pageMarginLeft: c, pageMarginTop: l } = o, { pages: m, skeHeaders: g, skeFooters: p } = n, h = {};
|
|
2384
2387
|
this._liquid.reset();
|
|
2385
2388
|
for (let T = 0, M = m.length; T < M; T++) {
|
|
2386
|
-
const
|
|
2389
|
+
const P = m[T], { headerId: A, footerId: U, pageWidth: N } = P;
|
|
2387
2390
|
if (A) {
|
|
2388
2391
|
const I = (O = g.get(A)) == null ? void 0 : O.get(N);
|
|
2389
2392
|
I && this._calculateDrawingPosition(
|
|
2390
2393
|
r,
|
|
2391
2394
|
I,
|
|
2392
2395
|
s,
|
|
2393
|
-
|
|
2396
|
+
a,
|
|
2394
2397
|
h,
|
|
2395
2398
|
I.marginTop,
|
|
2396
|
-
|
|
2399
|
+
P.marginLeft
|
|
2397
2400
|
);
|
|
2398
2401
|
}
|
|
2399
2402
|
if (U) {
|
|
@@ -2402,13 +2405,13 @@ let wn = class extends Xe {
|
|
|
2402
2405
|
r,
|
|
2403
2406
|
I,
|
|
2404
2407
|
s,
|
|
2405
|
-
|
|
2408
|
+
a,
|
|
2406
2409
|
h,
|
|
2407
|
-
|
|
2408
|
-
|
|
2410
|
+
P.pageHeight - P.marginBottom + I.marginTop,
|
|
2411
|
+
P.marginLeft
|
|
2409
2412
|
);
|
|
2410
2413
|
}
|
|
2411
|
-
this._calculateDrawingPosition(r,
|
|
2414
|
+
this._calculateDrawingPosition(r, P, s, a, h, P.marginTop, P.marginLeft), this._liquid.translatePage(P, d, c, l);
|
|
2412
2415
|
}
|
|
2413
2416
|
const v = Object.values(h), w = v.filter((T) => !T.isMultiTransform), S = v.filter((T) => T.isMultiTransform);
|
|
2414
2417
|
w.length > 0 && this._drawingManagerService.refreshTransform(w), this._handleMultiDrawingsTransform(S);
|
|
@@ -2416,23 +2419,23 @@ let wn = class extends Xe {
|
|
|
2416
2419
|
_handleMultiDrawingsTransform(e) {
|
|
2417
2420
|
const { scene: n, unitId: t } = this._context, r = n.getTransformerByCreate();
|
|
2418
2421
|
e.forEach((d) => {
|
|
2419
|
-
const
|
|
2420
|
-
|
|
2422
|
+
const c = this._drawingManagerService.getDrawingByParam(d);
|
|
2423
|
+
c != null && (c.transform = d.transform, c.transforms = d.transforms, c.isMultiTransform = d.isMultiTransform);
|
|
2421
2424
|
});
|
|
2422
|
-
const s = [...r.getSelectedObjectMap().keys()],
|
|
2423
|
-
this._drawingManagerService.removeNotification(
|
|
2425
|
+
const s = [...r.getSelectedObjectMap().keys()], a = Object.values(this._drawingManagerService.getDrawingData(t, t)).filter((d) => d.isMultiTransform === oe.TRUE);
|
|
2426
|
+
this._drawingManagerService.removeNotification(a), e.length > 0 && this._drawingManagerService.addNotification(e);
|
|
2424
2427
|
for (const d of s) {
|
|
2425
|
-
const
|
|
2426
|
-
|
|
2428
|
+
const c = n.getObject(d);
|
|
2429
|
+
c && r.setSelectedControl(c);
|
|
2427
2430
|
}
|
|
2428
2431
|
}
|
|
2429
|
-
_calculateDrawingPosition(e, n, t, r, o, s,
|
|
2432
|
+
_calculateDrawingPosition(e, n, t, r, o, s, a) {
|
|
2430
2433
|
const { skeDrawings: d } = n;
|
|
2431
2434
|
this._liquid.translatePagePadding({
|
|
2432
2435
|
marginTop: s,
|
|
2433
|
-
marginLeft:
|
|
2434
|
-
}), d.forEach((
|
|
2435
|
-
const { aLeft: l, aTop: m, height: g, width: p, angle: h, drawingId: v, drawingOrigin: w } =
|
|
2436
|
+
marginLeft: a
|
|
2437
|
+
}), d.forEach((c) => {
|
|
2438
|
+
const { aLeft: l, aTop: m, height: g, width: p, angle: h, drawingId: v, drawingOrigin: w } = c, S = w.layoutType === H.WRAP_NONE && w.behindDoc === oe.TRUE, { isMultiTransform: O = oe.FALSE } = w, D = {
|
|
2436
2439
|
left: l + t + this._liquid.x,
|
|
2437
2440
|
top: m + r + this._liquid.y,
|
|
2438
2441
|
width: p,
|
|
@@ -2450,7 +2453,7 @@ let wn = class extends Xe {
|
|
|
2450
2453
|
} : O === oe.TRUE && o[v].transforms.push(D);
|
|
2451
2454
|
}), this._liquid.restorePagePadding({
|
|
2452
2455
|
marginTop: s,
|
|
2453
|
-
marginLeft:
|
|
2456
|
+
marginLeft: a
|
|
2454
2457
|
});
|
|
2455
2458
|
}
|
|
2456
2459
|
_drawingInitializeListener() {
|