@univerjs/slides 0.1.15 → 0.1.17
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 +299 -302
- package/lib/umd/index.js +1 -1
- package/package.json +7 -7
package/lib/es/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Registry as
|
|
5
|
-
import { Liquid as
|
|
6
|
-
import { Inject as
|
|
7
|
-
import { takeUntil as
|
|
1
|
+
var Oe = Object.defineProperty;
|
|
2
|
+
var ye = (a, e, r) => e in a ? Oe(a, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[e] = r;
|
|
3
|
+
var g = (a, e, r) => ye(a, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { Registry as xe, LocaleService as ne, PageElementType as F, DocumentDataModel as je, getColorStyle as te, BasicShapes as _e, SlideDataModel as Me, IContextService as Ce, ObjectMatrix as Ve, Styles as Xe, Worksheet as Le, sortRules as ze, OnLifecycle as $e, LifecycleStages as Ne, RxDisposable as Ae, UniverInstanceType as V, debounce as We, IUniverInstanceService as be, Plugin as Ye } from "@univerjs/core";
|
|
5
|
+
import { Liquid as Ue, DocumentViewModel as He, DocumentSkeleton as Fe, Documents as Be, SceneViewer as Pe, Scene as ie, Viewport as $, ScrollBar as ge, Rect as H, Image as me, PageLayoutType as fe, RichText as Ke, Slide as Te, SpreadsheetSkeleton as ke, Spreadsheet as qe, SpreadsheetRowHeader as Ge, SpreadsheetColumnHeader as Ze, getColor as ve, IRenderManagerService as Je, IRenderingEngine as Qe } from "@univerjs/engine-render";
|
|
6
|
+
import { Inject as N, Injector as se } from "@wendellhu/redi";
|
|
7
|
+
import { takeUntil as we } from "rxjs";
|
|
8
8
|
class B {
|
|
9
9
|
constructor() {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
g(this, "zIndex", 0);
|
|
11
|
+
g(this, "viewKey", null);
|
|
12
12
|
}
|
|
13
13
|
check(e) {
|
|
14
14
|
if (e === this.viewKey)
|
|
@@ -17,18 +17,18 @@ class B {
|
|
|
17
17
|
create(e) {
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
var
|
|
22
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
23
|
-
(i = s
|
|
24
|
-
return n && t &&
|
|
25
|
-
},
|
|
20
|
+
const Y = xe.create();
|
|
21
|
+
var et = Object.defineProperty, tt = Object.getOwnPropertyDescriptor, rt = (a, e, r, n) => {
|
|
22
|
+
for (var t = n > 1 ? void 0 : n ? tt(e, r) : e, s = a.length - 1, i; s >= 0; s--)
|
|
23
|
+
(i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
24
|
+
return n && t && et(e, r, t), t;
|
|
25
|
+
}, nt = (a, e) => (r, n) => e(r, n, a);
|
|
26
26
|
let le = class extends B {
|
|
27
27
|
constructor(e) {
|
|
28
28
|
super();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
g(this, "zIndex", 5);
|
|
30
|
+
g(this, "viewKey", F.DOCUMENT);
|
|
31
|
+
g(this, "_liquid", new Ue());
|
|
32
32
|
this._localeService = e;
|
|
33
33
|
}
|
|
34
34
|
check(e) {
|
|
@@ -37,43 +37,43 @@ let le = class extends B {
|
|
|
37
37
|
}
|
|
38
38
|
// eslint-disable-next-line max-lines-per-function
|
|
39
39
|
convert(e, r) {
|
|
40
|
-
var k,
|
|
40
|
+
var k, pe;
|
|
41
41
|
const {
|
|
42
42
|
id: n,
|
|
43
43
|
zIndex: t,
|
|
44
|
-
left:
|
|
44
|
+
left: s = 0,
|
|
45
45
|
top: i = 0,
|
|
46
46
|
width: o,
|
|
47
47
|
height: c,
|
|
48
48
|
angle: l,
|
|
49
49
|
scaleX: f,
|
|
50
50
|
scaleY: h,
|
|
51
|
-
skewX:
|
|
51
|
+
skewX: u,
|
|
52
52
|
skewY: d,
|
|
53
53
|
flipX: p,
|
|
54
54
|
flipY: _,
|
|
55
|
-
title:
|
|
56
|
-
description:
|
|
55
|
+
title: E,
|
|
56
|
+
description: O,
|
|
57
57
|
document: T
|
|
58
58
|
} = e;
|
|
59
59
|
if (T == null)
|
|
60
60
|
return;
|
|
61
|
-
const
|
|
61
|
+
const P = new je(T), w = new He(P), I = Fe.create(w, this._localeService), S = new Be("__DocsRender__", I);
|
|
62
62
|
I.calculate();
|
|
63
|
-
const
|
|
63
|
+
const D = new Pe("__DocsViewer__" + n, {
|
|
64
64
|
top: i,
|
|
65
|
-
left:
|
|
65
|
+
left: s,
|
|
66
66
|
width: o,
|
|
67
67
|
height: c,
|
|
68
68
|
zIndex: t,
|
|
69
69
|
angle: l,
|
|
70
70
|
scaleX: f,
|
|
71
71
|
scaleY: h,
|
|
72
|
-
skewX:
|
|
72
|
+
skewX: u,
|
|
73
73
|
skewY: d,
|
|
74
74
|
flipX: p,
|
|
75
75
|
flipY: _
|
|
76
|
-
}), v = new ie("__DocsScene__" + n,
|
|
76
|
+
}), v = new ie("__DocsScene__" + n, D), b = new $("__DocsViewPort_" + n, v, {
|
|
77
77
|
left: 0,
|
|
78
78
|
top: 0,
|
|
79
79
|
bottom: 0,
|
|
@@ -82,117 +82,117 @@ let le = class extends B {
|
|
|
82
82
|
isRelativeY: !0,
|
|
83
83
|
isWheelPreventDefaultX: !0
|
|
84
84
|
});
|
|
85
|
-
v.attachControl(), v.
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
const z = Math.abs(
|
|
85
|
+
v.attachControl(), v.onMouseWheel$.subscribeEvent((M, W) => {
|
|
86
|
+
const R = M;
|
|
87
|
+
if (R.ctrlKey) {
|
|
88
|
+
const z = Math.abs(R.deltaX);
|
|
89
89
|
let x = z < 40 ? 0.2 : z < 80 ? 0.4 : 0.2;
|
|
90
|
-
x *=
|
|
90
|
+
x *= R.deltaY > 0 ? -1 : 1, v.scaleX < 1 && (x /= 2), v.scaleX + x > 4 ? v.scale(4, 4) : v.scaleX + x < 0.1 ? v.scale(0.1, 0.1) : (R.deltaY > 0, R.preventDefault());
|
|
91
91
|
} else
|
|
92
|
-
|
|
93
|
-
}), new
|
|
92
|
+
b.onMouseWheel(R, W);
|
|
93
|
+
}), new ge(b, {
|
|
94
94
|
mainScene: r
|
|
95
95
|
}), v.addObject(S);
|
|
96
96
|
const m = I.getActualSize();
|
|
97
97
|
S.resize(m.actualWidth, m.actualHeight), v.resize(m.actualWidth, m.actualHeight + 200);
|
|
98
|
-
const
|
|
99
|
-
S.
|
|
100
|
-
const { page: W, pageLeft:
|
|
101
|
-
x.save(), x.translate(
|
|
102
|
-
width: (
|
|
103
|
-
height: (
|
|
98
|
+
const y = (k = S.getSkeleton()) == null ? void 0 : k.getPageSize();
|
|
99
|
+
S.pageRender$.subscribe((M) => {
|
|
100
|
+
const { page: W, pageLeft: R, pageTop: z, ctx: x } = M, { width: q, height: G, marginBottom: ae, marginLeft: C, marginRight: Z, marginTop: J } = W;
|
|
101
|
+
x.save(), x.translate(R - 0.5, z - 0.5), H.drawWith(x, {
|
|
102
|
+
width: (y == null ? void 0 : y.width) || q,
|
|
103
|
+
height: (y == null ? void 0 : y.height) || G,
|
|
104
104
|
strokeWidth: 1,
|
|
105
105
|
stroke: "rgba(198,198,198, 1)",
|
|
106
106
|
fill: "rgba(255,255,255, 1)",
|
|
107
107
|
zIndex: 3
|
|
108
108
|
}), x.restore();
|
|
109
109
|
});
|
|
110
|
-
const { left:
|
|
110
|
+
const { left: U, top: A } = S, X = I.getSkeletonData();
|
|
111
111
|
if (X == null)
|
|
112
112
|
return;
|
|
113
|
-
const { pages:
|
|
113
|
+
const { pages: j } = X, L = [], K = /* @__PURE__ */ new Map();
|
|
114
114
|
this._recalculateSizeBySkeleton(S, v, I);
|
|
115
|
-
for (let
|
|
116
|
-
const
|
|
117
|
-
this._liquid.translatePagePadding(
|
|
118
|
-
const { aLeft: Z, aTop: J, height: Re, width: De, drawingOrigin:
|
|
115
|
+
for (let M = 0, W = j.length; M < W; M++) {
|
|
116
|
+
const R = j[M], { skeDrawings: z, marginLeft: x, marginTop: q, pageWidth: G, pageHeight: ae } = R;
|
|
117
|
+
this._liquid.translatePagePadding(R), z.forEach((C) => {
|
|
118
|
+
const { aLeft: Z, aTop: J, height: Re, width: De, drawingOrigin: Lt } = C, Ee = new me(C.drawingId, {
|
|
119
119
|
// url: docTransform.imageProperties?.contentUrl || '',
|
|
120
|
-
left: Z +
|
|
121
|
-
top: J +
|
|
120
|
+
left: Z + U + this._liquid.x,
|
|
121
|
+
top: J + A + this._liquid.y,
|
|
122
122
|
width: De,
|
|
123
123
|
height: Re,
|
|
124
124
|
zIndex: 11
|
|
125
125
|
});
|
|
126
|
-
K.set(
|
|
126
|
+
K.set(C.drawingId, {
|
|
127
127
|
marginLeft: this._liquid.x,
|
|
128
128
|
marginTop: this._liquid.y
|
|
129
|
-
}), L.push(
|
|
129
|
+
}), L.push(Ee);
|
|
130
130
|
}), this._liquid.translatePage(
|
|
131
|
-
|
|
131
|
+
R,
|
|
132
132
|
S.pageLayoutType,
|
|
133
133
|
S.pageMarginLeft,
|
|
134
134
|
S.pageMarginTop
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
|
-
return v.addObjects(L), L.forEach((
|
|
138
|
-
v.attachTransformerTo(
|
|
139
|
-
}), (
|
|
140
|
-
const { objects: W } =
|
|
141
|
-
W.forEach((
|
|
142
|
-
const { oKey: z, left: x, top: q, height: G, width:
|
|
137
|
+
return v.addObjects(L), L.forEach((M) => {
|
|
138
|
+
v.attachTransformerTo(M);
|
|
139
|
+
}), (pe = v.getTransformer()) == null || pe.changing$.subscribe((M) => {
|
|
140
|
+
const { objects: W } = M;
|
|
141
|
+
W.forEach((R) => {
|
|
142
|
+
const { oKey: z, left: x, top: q, height: G, width: ae } = R, C = K.get(z), Z = (C == null ? void 0 : C.marginLeft) || 0, J = (C == null ? void 0 : C.marginTop) || 0;
|
|
143
143
|
I == null || I.getViewModel().getDataModel().updateDrawing(z, {
|
|
144
|
-
left: x -
|
|
145
|
-
top: q -
|
|
144
|
+
left: x - U - Z,
|
|
145
|
+
top: q - A - J,
|
|
146
146
|
height: G,
|
|
147
|
-
width:
|
|
147
|
+
width: ae
|
|
148
148
|
});
|
|
149
149
|
}), I == null || I.calculate();
|
|
150
|
-
}), this._calculatePagePosition(S, v,
|
|
150
|
+
}), this._calculatePagePosition(S, v, b), D;
|
|
151
151
|
}
|
|
152
152
|
_recalculateSizeBySkeleton(e, r, n) {
|
|
153
153
|
var o;
|
|
154
154
|
const t = (o = n.getSkeletonData()) == null ? void 0 : o.pages;
|
|
155
155
|
if (t == null)
|
|
156
156
|
return;
|
|
157
|
-
let
|
|
157
|
+
let s = 0, i = 0;
|
|
158
158
|
for (let c = 0, l = t.length; c < l; c++) {
|
|
159
|
-
const f = t[c], { pageWidth: h, pageHeight:
|
|
160
|
-
e.pageLayoutType ===
|
|
159
|
+
const f = t[c], { pageWidth: h, pageHeight: u } = f;
|
|
160
|
+
e.pageLayoutType === fe.VERTICAL ? (i += u, i += e.pageMarginTop, c === l - 1 && (i += e.pageMarginTop), s = Math.max(s, h)) : e.pageLayoutType === fe.HORIZONTAL && (s += h, c !== l - 1 && (s += e.pageMarginLeft), i = Math.max(i, u));
|
|
161
161
|
}
|
|
162
|
-
e.resize(
|
|
162
|
+
e.resize(s, i), r.resize(s, i);
|
|
163
163
|
}
|
|
164
164
|
_calculatePagePosition(e, r, n, t = 1) {
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
165
|
+
const s = r == null ? void 0 : r.getParent(), { width: i, height: o, pageMarginLeft: c, pageMarginTop: l } = e;
|
|
166
|
+
if (s == null || i === Number.POSITIVE_INFINITY || o === Number.POSITIVE_INFINITY)
|
|
167
167
|
return;
|
|
168
|
-
const { width: f, height: h } =
|
|
169
|
-
let
|
|
170
|
-
if (f > (i + c * 2) * t ? (
|
|
171
|
-
const
|
|
168
|
+
const { width: f, height: h } = s;
|
|
169
|
+
let u = 0, d = 0, p = 0, _ = 0, E = Number.POSITIVE_INFINITY;
|
|
170
|
+
if (f > (i + c * 2) * t ? (u = f / 2 - i * t / 2, u /= t, p = (f - c * 2) / t, E = 0) : (u = c, p = i + c * 2, E = (p - f / t) / 2), h > o ? (d = h / 2 - o / 2, _ = (h - l * 2) / t) : (d = l, _ = o + l * 2), r.resize(p, _ + 200), e.translate(u, d), E !== Number.POSITIVE_INFINITY && n != null) {
|
|
171
|
+
const O = n.transScroll2ViewportScrollValue(E, 0).x;
|
|
172
172
|
n.scrollTo({
|
|
173
|
-
x:
|
|
173
|
+
x: O
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
return this;
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
|
-
le =
|
|
180
|
-
|
|
179
|
+
le = rt([
|
|
180
|
+
nt(0, N(ne))
|
|
181
181
|
], le);
|
|
182
|
-
class
|
|
182
|
+
class it {
|
|
183
183
|
constructor() {
|
|
184
|
-
|
|
184
|
+
g(this, "zIndex", 5);
|
|
185
185
|
}
|
|
186
186
|
create(e) {
|
|
187
187
|
return e.createInstance(le);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
Y.add(new it());
|
|
191
191
|
class st extends B {
|
|
192
192
|
constructor() {
|
|
193
193
|
super(...arguments);
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
g(this, "zIndex", 1);
|
|
195
|
+
g(this, "viewKey", F.IMAGE);
|
|
196
196
|
}
|
|
197
197
|
check(r) {
|
|
198
198
|
if (r === this.viewKey)
|
|
@@ -202,32 +202,32 @@ class st extends B {
|
|
|
202
202
|
const {
|
|
203
203
|
id: n,
|
|
204
204
|
zIndex: t,
|
|
205
|
-
left:
|
|
205
|
+
left: s = 0,
|
|
206
206
|
top: i = 0,
|
|
207
207
|
width: o,
|
|
208
208
|
height: c,
|
|
209
209
|
angle: l,
|
|
210
210
|
scaleX: f,
|
|
211
211
|
scaleY: h,
|
|
212
|
-
skewX:
|
|
212
|
+
skewX: u,
|
|
213
213
|
skewY: d,
|
|
214
214
|
flipX: p,
|
|
215
215
|
flipY: _,
|
|
216
|
-
title:
|
|
217
|
-
description:
|
|
216
|
+
title: E,
|
|
217
|
+
description: O,
|
|
218
218
|
image: T = {}
|
|
219
|
-
} = r, { imageProperties:
|
|
220
|
-
return new
|
|
219
|
+
} = r, { imageProperties: P, placeholder: w, link: I } = T, S = (P == null ? void 0 : P.contentUrl) || "";
|
|
220
|
+
return new me(n, {
|
|
221
221
|
url: S,
|
|
222
222
|
top: i,
|
|
223
|
-
left:
|
|
223
|
+
left: s,
|
|
224
224
|
width: o,
|
|
225
225
|
height: c,
|
|
226
226
|
zIndex: t,
|
|
227
227
|
angle: l,
|
|
228
228
|
scaleX: f,
|
|
229
229
|
scaleY: h,
|
|
230
|
-
skewX:
|
|
230
|
+
skewX: u,
|
|
231
231
|
skewY: d,
|
|
232
232
|
flipX: p,
|
|
233
233
|
flipY: _,
|
|
@@ -235,25 +235,25 @@ class st extends B {
|
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
class
|
|
238
|
+
class at {
|
|
239
239
|
constructor() {
|
|
240
|
-
|
|
240
|
+
g(this, "zIndex", 4);
|
|
241
241
|
}
|
|
242
242
|
create(e) {
|
|
243
243
|
return e.createInstance(st);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
|
|
247
|
-
var
|
|
248
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
249
|
-
(i = s
|
|
250
|
-
return n && t &&
|
|
251
|
-
},
|
|
246
|
+
Y.add(new at());
|
|
247
|
+
var ct = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, lt = (a, e, r, n) => {
|
|
248
|
+
for (var t = n > 1 ? void 0 : n ? ot(e, r) : e, s = a.length - 1, i; s >= 0; s--)
|
|
249
|
+
(i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
250
|
+
return n && t && ct(e, r, t), t;
|
|
251
|
+
}, dt = (a, e) => (r, n) => e(r, n, a);
|
|
252
252
|
let de = class extends B {
|
|
253
253
|
constructor(e) {
|
|
254
254
|
super();
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
g(this, "zIndex", 2);
|
|
256
|
+
g(this, "viewKey", F.TEXT);
|
|
257
257
|
this._localeService = e;
|
|
258
258
|
}
|
|
259
259
|
check(e) {
|
|
@@ -264,57 +264,57 @@ let de = class extends B {
|
|
|
264
264
|
const {
|
|
265
265
|
id: n,
|
|
266
266
|
zIndex: t,
|
|
267
|
-
left:
|
|
267
|
+
left: s = 0,
|
|
268
268
|
top: i = 0,
|
|
269
269
|
width: o,
|
|
270
270
|
height: c,
|
|
271
271
|
angle: l,
|
|
272
272
|
scaleX: f,
|
|
273
273
|
scaleY: h,
|
|
274
|
-
skewX:
|
|
274
|
+
skewX: u,
|
|
275
275
|
skewY: d,
|
|
276
276
|
flipX: p,
|
|
277
277
|
flipY: _,
|
|
278
|
-
title:
|
|
279
|
-
description:
|
|
278
|
+
title: E,
|
|
279
|
+
description: O,
|
|
280
280
|
richText: T = {}
|
|
281
|
-
} = e, { text:
|
|
282
|
-
let
|
|
281
|
+
} = e, { text: P, ff: w, fs: I, it: S, bl: D, ul: v, st: b, ol: m, bg: y, bd: U, cl: A, rich: X } = T;
|
|
282
|
+
let j = {
|
|
283
283
|
top: i,
|
|
284
|
-
left:
|
|
284
|
+
left: s,
|
|
285
285
|
width: o,
|
|
286
286
|
height: c,
|
|
287
287
|
zIndex: t,
|
|
288
288
|
angle: l,
|
|
289
289
|
scaleX: f,
|
|
290
290
|
scaleY: h,
|
|
291
|
-
skewX:
|
|
291
|
+
skewX: u,
|
|
292
292
|
skewY: d,
|
|
293
293
|
flipX: p,
|
|
294
294
|
flipY: _,
|
|
295
295
|
forceRender: !0
|
|
296
296
|
}, L = !1;
|
|
297
|
-
if (
|
|
298
|
-
return new
|
|
297
|
+
if (P != null ? (j = { ...j, text: P, ff: w, fs: I, it: S, bl: D, ul: v, st: b, ol: m, bg: y, bd: U, cl: A }, L = !0) : X != null && (j = { ...j, richText: X }, L = !0), L !== !1)
|
|
298
|
+
return new Ke(this._localeService, n, j);
|
|
299
299
|
}
|
|
300
300
|
};
|
|
301
|
-
de =
|
|
302
|
-
|
|
301
|
+
de = lt([
|
|
302
|
+
dt(0, N(ne))
|
|
303
303
|
], de);
|
|
304
|
-
class
|
|
304
|
+
class ht {
|
|
305
305
|
constructor() {
|
|
306
|
-
|
|
306
|
+
g(this, "zIndex", 0);
|
|
307
307
|
}
|
|
308
308
|
create(e) {
|
|
309
309
|
return e.createInstance(de);
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
|
|
312
|
+
Y.add(new ht());
|
|
313
313
|
class ut extends B {
|
|
314
314
|
constructor() {
|
|
315
315
|
super(...arguments);
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
g(this, "zIndex", 2);
|
|
317
|
+
g(this, "viewKey", F.SHAPE);
|
|
318
318
|
}
|
|
319
319
|
check(r) {
|
|
320
320
|
if (r === this.viewKey)
|
|
@@ -324,85 +324,85 @@ class ut extends B {
|
|
|
324
324
|
const {
|
|
325
325
|
id: n,
|
|
326
326
|
zIndex: t,
|
|
327
|
-
left:
|
|
327
|
+
left: s = 0,
|
|
328
328
|
top: i = 0,
|
|
329
329
|
width: o,
|
|
330
330
|
height: c,
|
|
331
331
|
angle: l,
|
|
332
332
|
scaleX: f,
|
|
333
333
|
scaleY: h,
|
|
334
|
-
skewX:
|
|
334
|
+
skewX: u,
|
|
335
335
|
skewY: d,
|
|
336
336
|
flipX: p,
|
|
337
337
|
flipY: _,
|
|
338
|
-
title:
|
|
339
|
-
description:
|
|
340
|
-
} = r, { shapeType: T, text:
|
|
338
|
+
title: E,
|
|
339
|
+
description: O
|
|
340
|
+
} = r, { shapeType: T, text: P, shapeProperties: w, placeholder: I, link: S } = r.shape || {}, D = w == null ? "" : te(w.shapeBackgroundFill) || "rgba(255,255,255,1)", v = w == null ? void 0 : w.outline, b = {};
|
|
341
341
|
if (v) {
|
|
342
|
-
const { outlineFill: m, weight:
|
|
343
|
-
|
|
342
|
+
const { outlineFill: m, weight: y } = v;
|
|
343
|
+
b.strokeWidth = y, b.stroke = te(m) || "rgba(0,0,0,1)";
|
|
344
344
|
}
|
|
345
|
-
if (T ===
|
|
345
|
+
if (T === _e.Rect)
|
|
346
346
|
return new H(n, {
|
|
347
|
-
fill:
|
|
347
|
+
fill: D,
|
|
348
348
|
top: i,
|
|
349
|
-
left:
|
|
349
|
+
left: s,
|
|
350
350
|
width: o,
|
|
351
351
|
height: c,
|
|
352
352
|
zIndex: t,
|
|
353
353
|
angle: l,
|
|
354
354
|
scaleX: f,
|
|
355
355
|
scaleY: h,
|
|
356
|
-
skewX:
|
|
356
|
+
skewX: u,
|
|
357
357
|
skewY: d,
|
|
358
358
|
flipX: p,
|
|
359
359
|
flipY: _,
|
|
360
360
|
forceRender: !0,
|
|
361
|
-
...
|
|
361
|
+
...b
|
|
362
362
|
});
|
|
363
|
-
if (T ===
|
|
363
|
+
if (T === _e.RoundRect) {
|
|
364
364
|
const m = (w == null ? void 0 : w.radius) || 0;
|
|
365
365
|
return new H(n, {
|
|
366
|
-
fill:
|
|
366
|
+
fill: D,
|
|
367
367
|
top: i,
|
|
368
|
-
left:
|
|
368
|
+
left: s,
|
|
369
369
|
width: o,
|
|
370
370
|
height: c,
|
|
371
371
|
zIndex: t,
|
|
372
372
|
angle: l,
|
|
373
373
|
scaleX: f,
|
|
374
374
|
scaleY: h,
|
|
375
|
-
skewX:
|
|
375
|
+
skewX: u,
|
|
376
376
|
skewY: d,
|
|
377
377
|
flipX: p,
|
|
378
378
|
flipY: _,
|
|
379
379
|
forceRender: !0,
|
|
380
380
|
radius: m,
|
|
381
|
-
...
|
|
381
|
+
...b
|
|
382
382
|
});
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
class
|
|
386
|
+
class gt {
|
|
387
387
|
constructor() {
|
|
388
|
-
|
|
388
|
+
g(this, "zIndex", 2);
|
|
389
389
|
}
|
|
390
390
|
create(e) {
|
|
391
391
|
return e.createInstance(ut);
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
|
|
395
|
-
var
|
|
396
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
397
|
-
(i = s
|
|
398
|
-
return n && t &&
|
|
399
|
-
},
|
|
394
|
+
Y.add(new gt());
|
|
395
|
+
var pt = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, ft = (a, e, r, n) => {
|
|
396
|
+
for (var t = n > 1 ? void 0 : n ? _t(e, r) : e, s = a.length - 1, i; s >= 0; s--)
|
|
397
|
+
(i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
398
|
+
return n && t && pt(e, r, t), t;
|
|
399
|
+
}, vt = (a, e) => (r, n) => e(r, n, a);
|
|
400
400
|
let he = class extends B {
|
|
401
401
|
constructor(e) {
|
|
402
402
|
super();
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
403
|
+
g(this, "zIndex", 6);
|
|
404
|
+
g(this, "viewKey", F.SLIDE);
|
|
405
|
+
g(this, "_ObjectProvider", null);
|
|
406
406
|
this._injector = e;
|
|
407
407
|
}
|
|
408
408
|
check(e) {
|
|
@@ -413,56 +413,56 @@ let he = class extends B {
|
|
|
413
413
|
const {
|
|
414
414
|
id: n,
|
|
415
415
|
zIndex: t,
|
|
416
|
-
left:
|
|
416
|
+
left: s = 0,
|
|
417
417
|
top: i = 0,
|
|
418
418
|
width: o,
|
|
419
419
|
height: c,
|
|
420
420
|
angle: l,
|
|
421
421
|
scaleX: f,
|
|
422
422
|
scaleY: h,
|
|
423
|
-
skewX:
|
|
423
|
+
skewX: u,
|
|
424
424
|
skewY: d,
|
|
425
425
|
flipX: p,
|
|
426
426
|
flipY: _,
|
|
427
|
-
title:
|
|
428
|
-
description:
|
|
427
|
+
title: E,
|
|
428
|
+
description: O,
|
|
429
429
|
slide: T
|
|
430
430
|
} = e;
|
|
431
431
|
if (T == null)
|
|
432
432
|
return;
|
|
433
|
-
const
|
|
433
|
+
const P = new Me(T), w = new Te("__SLIDERender__" + n, {
|
|
434
434
|
top: i,
|
|
435
|
-
left:
|
|
435
|
+
left: s,
|
|
436
436
|
width: o,
|
|
437
437
|
height: c,
|
|
438
438
|
zIndex: t,
|
|
439
439
|
angle: l,
|
|
440
440
|
scaleX: f,
|
|
441
441
|
scaleY: h,
|
|
442
|
-
skewX:
|
|
442
|
+
skewX: u,
|
|
443
443
|
skewY: d,
|
|
444
444
|
flipX: p,
|
|
445
445
|
flipY: _,
|
|
446
446
|
forceRender: !0
|
|
447
447
|
});
|
|
448
448
|
w.enableNav(), w.enableSelectedClipElement();
|
|
449
|
-
const I =
|
|
449
|
+
const I = P.getPageOrder(), S = P.getPages();
|
|
450
450
|
if (!I || !S)
|
|
451
451
|
return w;
|
|
452
452
|
this._ObjectProvider = new re(this._injector);
|
|
453
|
-
for (let
|
|
454
|
-
const
|
|
455
|
-
w.addPage(this._createScene(m, w,
|
|
453
|
+
for (let D = 0, v = I.length; D < v; D++) {
|
|
454
|
+
const b = S[I[D]], { id: m } = b;
|
|
455
|
+
w.addPage(this._createScene(m, w, b, r, P));
|
|
456
456
|
}
|
|
457
457
|
return w.activeFirstPage(), w;
|
|
458
458
|
}
|
|
459
|
-
_createScene(e, r, n, t,
|
|
459
|
+
_createScene(e, r, n, t, s) {
|
|
460
460
|
var d;
|
|
461
461
|
const { width: i, height: o } = r, c = new ie(e, r, {
|
|
462
462
|
width: i,
|
|
463
463
|
height: o
|
|
464
464
|
});
|
|
465
|
-
new
|
|
465
|
+
new $(`PageViewer_${e}`, c, {
|
|
466
466
|
left: 0,
|
|
467
467
|
top: 0,
|
|
468
468
|
bottom: 0,
|
|
@@ -470,16 +470,16 @@ let he = class extends B {
|
|
|
470
470
|
isRelativeX: !0,
|
|
471
471
|
isRelativeY: !0
|
|
472
472
|
}).closeClip();
|
|
473
|
-
const { pageElements: f, pageBackgroundFill: h } = n,
|
|
474
|
-
return this._addBackgroundRect(c, h,
|
|
473
|
+
const { pageElements: f, pageBackgroundFill: h } = n, u = (d = this._ObjectProvider) == null ? void 0 : d.convertToRenderObjects(f, t);
|
|
474
|
+
return this._addBackgroundRect(c, h, s), c.addObjects(u), u == null || u.forEach((p) => {
|
|
475
475
|
c.attachTransformerTo(p);
|
|
476
476
|
}), c;
|
|
477
477
|
}
|
|
478
478
|
_addBackgroundRect(e, r, n) {
|
|
479
|
-
const t = n.getPageSize(), { width:
|
|
479
|
+
const t = n.getPageSize(), { width: s = 0, height: i = 0 } = t, o = new H("canvas", {
|
|
480
480
|
left: 0,
|
|
481
481
|
top: 0,
|
|
482
|
-
width:
|
|
482
|
+
width: s,
|
|
483
483
|
height: i,
|
|
484
484
|
strokeWidth: 1,
|
|
485
485
|
stroke: "rgba(198,198,198, 1)",
|
|
@@ -490,28 +490,28 @@ let he = class extends B {
|
|
|
490
490
|
e.addObject(o, 0);
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
|
-
he =
|
|
494
|
-
|
|
493
|
+
he = ft([
|
|
494
|
+
vt(0, N(se))
|
|
495
495
|
], he);
|
|
496
|
-
class
|
|
496
|
+
class wt {
|
|
497
497
|
constructor() {
|
|
498
|
-
|
|
498
|
+
g(this, "zIndex", 6);
|
|
499
499
|
}
|
|
500
500
|
create(e) {
|
|
501
501
|
return e.createInstance(he);
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
|
|
505
|
-
var
|
|
506
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
507
|
-
(i = s
|
|
508
|
-
return n && t &&
|
|
509
|
-
},
|
|
510
|
-
let
|
|
504
|
+
Y.add(new wt());
|
|
505
|
+
var St = Object.defineProperty, It = Object.getOwnPropertyDescriptor, bt = (a, e, r, n) => {
|
|
506
|
+
for (var t = n > 1 ? void 0 : n ? It(e, r) : e, s = a.length - 1, i; s >= 0; s--)
|
|
507
|
+
(i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
508
|
+
return n && t && St(e, r, t), t;
|
|
509
|
+
}, Se = (a, e) => (r, n) => e(r, n, a);
|
|
510
|
+
let ue = class extends B {
|
|
511
511
|
constructor(e, r) {
|
|
512
512
|
super();
|
|
513
|
-
|
|
514
|
-
|
|
513
|
+
g(this, "zIndex", 4);
|
|
514
|
+
g(this, "viewKey", F.SPREADSHEET);
|
|
515
515
|
this._localeService = e, this._contextService = r;
|
|
516
516
|
}
|
|
517
517
|
check(e) {
|
|
@@ -523,65 +523,65 @@ let ge = class extends B {
|
|
|
523
523
|
const {
|
|
524
524
|
id: n,
|
|
525
525
|
zIndex: t,
|
|
526
|
-
left:
|
|
526
|
+
left: s = 0,
|
|
527
527
|
top: i = 0,
|
|
528
528
|
width: o,
|
|
529
529
|
height: c,
|
|
530
530
|
angle: l,
|
|
531
531
|
scaleX: f,
|
|
532
532
|
scaleY: h,
|
|
533
|
-
skewX:
|
|
533
|
+
skewX: u,
|
|
534
534
|
skewY: d,
|
|
535
535
|
flipX: p,
|
|
536
536
|
flipY: _,
|
|
537
|
-
spreadsheet:
|
|
537
|
+
spreadsheet: E
|
|
538
538
|
} = e;
|
|
539
|
-
if (
|
|
539
|
+
if (E == null)
|
|
540
540
|
return;
|
|
541
|
-
const { worksheet:
|
|
542
|
-
new
|
|
541
|
+
const { worksheet: O, styles: T } = E, { cellData: P } = O, w = new Ve(P), I = new Xe(T), S = new ke(
|
|
542
|
+
new Le(n, O, I),
|
|
543
543
|
// FIXME: worksheet in slide doesn't has a Worksheet object
|
|
544
|
-
|
|
544
|
+
O,
|
|
545
545
|
w,
|
|
546
546
|
I,
|
|
547
547
|
this._localeService,
|
|
548
548
|
this._contextService
|
|
549
|
-
), { rowTotalHeight:
|
|
549
|
+
), { rowTotalHeight: D, columnTotalWidth: v, rowHeaderWidth: b, columnHeaderHeight: m } = S, y = v + O.rowHeader.width || 0, U = D + O.columnHeader.height || 0, A = new Pe("spreadInSlideSceneViewer" + n, {
|
|
550
550
|
top: i,
|
|
551
|
-
left:
|
|
551
|
+
left: s,
|
|
552
552
|
width: o,
|
|
553
553
|
height: c,
|
|
554
554
|
zIndex: t,
|
|
555
555
|
angle: l,
|
|
556
556
|
scaleX: f,
|
|
557
557
|
scaleY: h,
|
|
558
|
-
skewX:
|
|
558
|
+
skewX: u,
|
|
559
559
|
skewY: d,
|
|
560
560
|
flipX: p,
|
|
561
561
|
flipY: _,
|
|
562
562
|
forceRender: !0
|
|
563
|
-
}), X = new ie("spreadInSlideScene" + n,
|
|
564
|
-
width:
|
|
565
|
-
height:
|
|
563
|
+
}), X = new ie("spreadInSlideScene" + n, A, {
|
|
564
|
+
width: y,
|
|
565
|
+
height: U
|
|
566
566
|
});
|
|
567
|
-
this._updateViewport(n,
|
|
568
|
-
const
|
|
567
|
+
this._updateViewport(n, b, m, X, r);
|
|
568
|
+
const j = new qe("testSheetViewer", S, !1), L = new Ge("spreadInSlideRow", S), K = new Ze("spreadInSlideColumn", S), k = new H("spreadInSlideLeftTop", {
|
|
569
569
|
zIndex: 2,
|
|
570
570
|
left: -1,
|
|
571
571
|
top: -1,
|
|
572
|
-
width:
|
|
572
|
+
width: b,
|
|
573
573
|
height: m,
|
|
574
|
-
fill:
|
|
575
|
-
stroke:
|
|
574
|
+
fill: ve([248, 249, 250]),
|
|
575
|
+
stroke: ve([217, 217, 217]),
|
|
576
576
|
strokeWidth: 1
|
|
577
577
|
});
|
|
578
|
-
return
|
|
578
|
+
return j.zIndex = 10, X.addObjects([j], 1), X.addObjects([L, K, k], 2), A;
|
|
579
579
|
}
|
|
580
580
|
// eslint-disable-next-line max-lines-per-function
|
|
581
|
-
_updateViewport(e, r, n, t,
|
|
582
|
-
if (
|
|
581
|
+
_updateViewport(e, r, n, t, s) {
|
|
582
|
+
if (s == null)
|
|
583
583
|
return;
|
|
584
|
-
const i = r * t.scaleX, o = n * t.scaleY, c = new
|
|
584
|
+
const i = r * t.scaleX, o = n * t.scaleY, c = new $("spreadInSlideViewMain" + e, t, {
|
|
585
585
|
left: i,
|
|
586
586
|
top: o,
|
|
587
587
|
bottom: 0,
|
|
@@ -589,14 +589,14 @@ let ge = class extends B {
|
|
|
589
589
|
isRelativeX: !0,
|
|
590
590
|
isRelativeY: !0,
|
|
591
591
|
isWheelPreventDefaultX: !0
|
|
592
|
-
}), l = new
|
|
592
|
+
}), l = new $("spreadInSlideViewTop" + e, t, {
|
|
593
593
|
left: i,
|
|
594
594
|
height: o,
|
|
595
595
|
top: 0,
|
|
596
596
|
right: 0,
|
|
597
597
|
isRelativeX: !0,
|
|
598
598
|
isWheelPreventDefaultX: !0
|
|
599
|
-
}), f = new
|
|
599
|
+
}), f = new $("spreadInSlideViewLeft" + e, t, {
|
|
600
600
|
left: 0,
|
|
601
601
|
bottom: 0,
|
|
602
602
|
top: o,
|
|
@@ -604,101 +604,101 @@ let ge = class extends B {
|
|
|
604
604
|
isRelativeY: !0,
|
|
605
605
|
isWheelPreventDefaultX: !0
|
|
606
606
|
});
|
|
607
|
-
new
|
|
607
|
+
new $("spreadInSlideViewLeftTop" + e, t, {
|
|
608
608
|
left: 0,
|
|
609
609
|
top: 0,
|
|
610
610
|
width: i,
|
|
611
611
|
height: o,
|
|
612
612
|
isWheelPreventDefaultX: !0
|
|
613
|
-
}), c.
|
|
614
|
-
const { scrollX:
|
|
613
|
+
}), c.onScrollAfter$.subscribeEvent((h) => {
|
|
614
|
+
const { scrollX: u, scrollY: d, viewportScrollX: p, viewportScrollY: _ } = h;
|
|
615
615
|
l.updateScroll({
|
|
616
|
-
scrollX:
|
|
616
|
+
scrollX: u,
|
|
617
617
|
viewportScrollX: p
|
|
618
618
|
}), f.updateScroll({
|
|
619
619
|
scrollY: d,
|
|
620
620
|
viewportScrollY: _
|
|
621
621
|
});
|
|
622
|
-
}), t.attachControl(), new
|
|
623
|
-
mainScene:
|
|
624
|
-
}), t.
|
|
622
|
+
}), t.attachControl(), new ge(c, {
|
|
623
|
+
mainScene: s
|
|
624
|
+
}), t.onMouseWheel$.subscribeEvent((h, u) => {
|
|
625
625
|
const d = h;
|
|
626
626
|
if (d.ctrlKey) {
|
|
627
627
|
const p = Math.abs(d.deltaX);
|
|
628
628
|
let _ = p < 40 ? 0.05 : p < 80 ? 0.02 : 0.01;
|
|
629
629
|
_ *= d.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (_ /= 2), t.scaleX + _ > 4 ? t.scale(4, 4) : t.scaleX + _ < 0.1 ? t.scale(0.1, 0.1) : (t.scaleBy(_, _), d.preventDefault());
|
|
630
630
|
} else
|
|
631
|
-
c.onMouseWheel(d,
|
|
631
|
+
c.onMouseWheel(d, u);
|
|
632
632
|
});
|
|
633
633
|
}
|
|
634
634
|
};
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
],
|
|
639
|
-
class
|
|
635
|
+
ue = bt([
|
|
636
|
+
Se(0, N(ne)),
|
|
637
|
+
Se(1, Ce)
|
|
638
|
+
], ue);
|
|
639
|
+
class Pt {
|
|
640
640
|
constructor() {
|
|
641
|
-
|
|
641
|
+
g(this, "zIndex", 4);
|
|
642
642
|
}
|
|
643
643
|
create(e) {
|
|
644
|
-
return e.createInstance(
|
|
644
|
+
return e.createInstance(ue);
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
|
-
|
|
648
|
-
var
|
|
649
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
650
|
-
(i = s
|
|
651
|
-
return n && t &&
|
|
652
|
-
}, Dt = (
|
|
647
|
+
Y.add(new Pt());
|
|
648
|
+
var mt = Object.defineProperty, Tt = Object.getOwnPropertyDescriptor, Rt = (a, e, r, n) => {
|
|
649
|
+
for (var t = n > 1 ? void 0 : n ? Tt(e, r) : e, s = a.length - 1, i; s >= 0; s--)
|
|
650
|
+
(i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
651
|
+
return n && t && mt(e, r, t), t;
|
|
652
|
+
}, Dt = (a, e) => (r, n) => e(r, n, a);
|
|
653
653
|
let re = class {
|
|
654
|
-
constructor(
|
|
655
|
-
|
|
656
|
-
this._injector =
|
|
654
|
+
constructor(a) {
|
|
655
|
+
g(this, "_adaptors", []);
|
|
656
|
+
this._injector = a, this._adaptorLoader();
|
|
657
657
|
}
|
|
658
|
-
convertToRenderObjects(
|
|
659
|
-
const r = Object.keys(
|
|
658
|
+
convertToRenderObjects(a, e) {
|
|
659
|
+
const r = Object.keys(a), n = [];
|
|
660
660
|
return r.forEach((t) => {
|
|
661
|
-
const
|
|
661
|
+
const s = a[t], i = this._executor(s, e);
|
|
662
662
|
i != null && n.push(i);
|
|
663
663
|
}), n;
|
|
664
664
|
}
|
|
665
|
-
_executor(
|
|
665
|
+
_executor(a, e) {
|
|
666
666
|
var t;
|
|
667
|
-
const { id: r, type: n } =
|
|
668
|
-
for (const
|
|
669
|
-
const i = (t =
|
|
667
|
+
const { id: r, type: n } = a;
|
|
668
|
+
for (const s of this._adaptors) {
|
|
669
|
+
const i = (t = s.check(n)) == null ? void 0 : t.convert(a, e);
|
|
670
670
|
if (i != null)
|
|
671
671
|
return i;
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
674
|
_adaptorLoader() {
|
|
675
|
-
|
|
676
|
-
this._adaptors.push(
|
|
675
|
+
Y.getData().sort(ze).forEach((a) => {
|
|
676
|
+
this._adaptors.push(a.create(this._injector));
|
|
677
677
|
});
|
|
678
678
|
}
|
|
679
679
|
};
|
|
680
680
|
re = Rt([
|
|
681
|
-
Dt(0,
|
|
681
|
+
Dt(0, N(se))
|
|
682
682
|
], re);
|
|
683
|
-
var
|
|
684
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
685
|
-
(i = s
|
|
686
|
-
return n && t &&
|
|
687
|
-
}, ce = (
|
|
688
|
-
let ee = class extends
|
|
683
|
+
var Et = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, yt = (a, e, r, n) => {
|
|
684
|
+
for (var t = n > 1 ? void 0 : n ? Ot(e, r) : e, s = a.length - 1, i; s >= 0; s--)
|
|
685
|
+
(i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
686
|
+
return n && t && Et(e, r, t), t;
|
|
687
|
+
}, ce = (a, e) => (r, n) => e(r, n, a), xt = /* @__PURE__ */ ((a) => (a.COMPONENT = "__slideRender__", a.SCENE = "__mainScene__", a.VIEW = "__mainView__", a))(xt || {});
|
|
688
|
+
let ee = class extends Ae {
|
|
689
689
|
constructor(e, r, n) {
|
|
690
690
|
super();
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
691
|
+
g(this, "_objectProvider", null);
|
|
692
|
+
g(this, "_activePageId", "");
|
|
693
|
+
g(this, "_refreshThumb", We(() => {
|
|
694
694
|
this.createThumbs();
|
|
695
695
|
}, 300));
|
|
696
696
|
this._univerInstanceService = e, this._injector = r, this._renderManagerService = n, this._initializeDependencies(this._injector), this._initialize();
|
|
697
697
|
}
|
|
698
698
|
_initialize() {
|
|
699
|
-
this._renderManagerService.createRender$.pipe(
|
|
699
|
+
this._renderManagerService.createRender$.pipe(we(this.dispose$)).subscribe((e) => {
|
|
700
700
|
this._create(e);
|
|
701
|
-
}), this._univerInstanceService.getCurrentTypeOfUnit$(V.UNIVER_SLIDE).pipe(
|
|
701
|
+
}), this._univerInstanceService.getCurrentTypeOfUnit$(V.UNIVER_SLIDE).pipe(we(this.dispose$)).subscribe((e) => {
|
|
702
702
|
this._create(e == null ? void 0 : e.getUnitId());
|
|
703
703
|
}), this._univerInstanceService.getAllUnitsForType(V.UNIVER_SLIDE).forEach((e) => {
|
|
704
704
|
this._create(e.getUnitId());
|
|
@@ -718,19 +718,18 @@ let ee = class extends We {
|
|
|
718
718
|
const t = this._currentRender();
|
|
719
719
|
if (n == null || t == null || t.mainComponent == null)
|
|
720
720
|
return;
|
|
721
|
-
const { id:
|
|
722
|
-
if (this._activePageId = e, i != null && i.hasPage(
|
|
723
|
-
i.changePage(
|
|
721
|
+
const { id: s } = n, i = t.mainComponent;
|
|
722
|
+
if (this._activePageId = e, i != null && i.hasPage(s)) {
|
|
723
|
+
i.changePage(s);
|
|
724
724
|
return;
|
|
725
725
|
}
|
|
726
|
-
this._createScene(
|
|
726
|
+
this._createScene(s, n);
|
|
727
727
|
}
|
|
728
728
|
_scrollToCenter() {
|
|
729
729
|
var c;
|
|
730
730
|
const e = (c = this._currentRender()) == null ? void 0 : c.scene, r = e == null ? void 0 : e.getViewport("__mainView__"), n = this._getCenterPositionViewPort(e);
|
|
731
|
-
if (!r || !n)
|
|
732
|
-
|
|
733
|
-
const { left: t, top: a } = n, { x: i, y: o } = r.transViewportScroll2ScrollValue(t, a);
|
|
731
|
+
if (!r || !n) return;
|
|
732
|
+
const { left: t, top: s } = n, { x: i, y: o } = r.transViewportScroll2ScrollValue(t, s);
|
|
734
733
|
r.scrollTo({
|
|
735
734
|
x: i,
|
|
736
735
|
y: o
|
|
@@ -752,15 +751,15 @@ let ee = class extends We {
|
|
|
752
751
|
const n = this._renderManagerService.getRenderById(e);
|
|
753
752
|
if (n == null)
|
|
754
753
|
return;
|
|
755
|
-
const { scene: t, engine:
|
|
756
|
-
this._scrollToCenter(), i == null || i.
|
|
754
|
+
const { scene: t, engine: s } = n, i = s.onTransformChange$.subscribeEvent(() => {
|
|
755
|
+
this._scrollToCenter(), i == null || i.unsubscribe();
|
|
757
756
|
});
|
|
758
|
-
|
|
757
|
+
s.onTransformChange$.subscribeEvent(() => {
|
|
759
758
|
setTimeout(() => {
|
|
760
759
|
this.createThumbs();
|
|
761
760
|
}, 300);
|
|
762
761
|
}), t.resize(2400, 1800);
|
|
763
|
-
const o = new
|
|
762
|
+
const o = new $("__mainView__", t, {
|
|
764
763
|
left: 0,
|
|
765
764
|
top: 0,
|
|
766
765
|
bottom: 0,
|
|
@@ -769,26 +768,26 @@ let ee = class extends We {
|
|
|
769
768
|
isRelativeY: !0,
|
|
770
769
|
isWheelPreventDefaultX: !0
|
|
771
770
|
});
|
|
772
|
-
t.attachControl(), t.
|
|
771
|
+
t.attachControl(), t.onMouseWheel$.subscribeEvent((l, f) => {
|
|
773
772
|
const h = l;
|
|
774
773
|
if (h.ctrlKey) {
|
|
775
|
-
const
|
|
776
|
-
let d =
|
|
774
|
+
const u = Math.abs(h.deltaX);
|
|
775
|
+
let d = u < 40 ? 0.2 : u < 80 ? 0.4 : 0.2;
|
|
777
776
|
d *= h.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (d /= 2), t.scaleX + d > 4 ? t.scale(4, 4) : t.scaleX + d < 0.1 ? t.scale(0.1, 0.1) : (h.deltaY > 0, h.preventDefault());
|
|
778
777
|
} else
|
|
779
778
|
o.onMouseWheel(h, f);
|
|
780
|
-
}), t.
|
|
779
|
+
}), t.onFileLoaded$.subscribeEvent(() => {
|
|
781
780
|
this._refreshThumb();
|
|
782
|
-
}),
|
|
781
|
+
}), ge.attachTo(o), this._renderManagerService.setCurrent(e);
|
|
783
782
|
const c = this._createSlide(t);
|
|
784
|
-
n.mainComponent = c, n.components.set("__slideRender__", c), this._createSlidePages(r, c),
|
|
783
|
+
n.mainComponent = c, n.components.set("__slideRender__", c), this._createSlidePages(r, c), s.runRenderLoop(() => {
|
|
785
784
|
t.render();
|
|
786
785
|
const l = document.getElementById("app");
|
|
787
|
-
l && (l.innerText = `fps:${Math.round(
|
|
786
|
+
l && (l.innerText = `fps:${Math.round(s.getFps()).toString()}`);
|
|
788
787
|
});
|
|
789
788
|
}
|
|
790
789
|
_createSlide(e) {
|
|
791
|
-
const r = this._univerInstanceService.getCurrentUnitForType(V.UNIVER_SLIDE), { width: n, height: t } = e,
|
|
790
|
+
const r = this._univerInstanceService.getCurrentUnitForType(V.UNIVER_SLIDE), { width: n, height: t } = e, s = r.getPageSize(), { width: i = 100, height: o = 100 } = s, c = new Te("__slideRender__", {
|
|
792
791
|
left: (n - i) / 2,
|
|
793
792
|
top: (t - o) / 2,
|
|
794
793
|
width: i,
|
|
@@ -798,10 +797,10 @@ let ee = class extends We {
|
|
|
798
797
|
return c.enableNav(), c.enableSelectedClipElement(), e.addObject(c), c;
|
|
799
798
|
}
|
|
800
799
|
_addBackgroundRect(e, r) {
|
|
801
|
-
const t = this._univerInstanceService.getCurrentUnitForType(V.UNIVER_SLIDE).getPageSize(), { width:
|
|
800
|
+
const t = this._univerInstanceService.getCurrentUnitForType(V.UNIVER_SLIDE).getPageSize(), { width: s = 0, height: i = 0 } = t, o = new H("canvas", {
|
|
802
801
|
left: 0,
|
|
803
802
|
top: 0,
|
|
804
|
-
width:
|
|
803
|
+
width: s,
|
|
805
804
|
height: i,
|
|
806
805
|
strokeWidth: 1,
|
|
807
806
|
stroke: "rgba(198,198,198, 1)",
|
|
@@ -812,11 +811,10 @@ let ee = class extends We {
|
|
|
812
811
|
e.addObject(o, 0);
|
|
813
812
|
}
|
|
814
813
|
_getCenterPositionViewPort(e) {
|
|
815
|
-
if (!e)
|
|
816
|
-
|
|
817
|
-
const { width: r, height: n } = e, t = e.getEngine(), a = (t == null ? void 0 : t.width) || 0, i = (t == null ? void 0 : t.height) || 0;
|
|
814
|
+
if (!e) return { left: 0, top: 0 };
|
|
815
|
+
const { width: r, height: n } = e, t = e.getEngine(), s = (t == null ? void 0 : t.width) || 0, i = (t == null ? void 0 : t.height) || 0;
|
|
818
816
|
return {
|
|
819
|
-
left: (r -
|
|
817
|
+
left: (r - s) / 2,
|
|
820
818
|
top: (n - i) / 2
|
|
821
819
|
};
|
|
822
820
|
}
|
|
@@ -827,14 +825,14 @@ let ee = class extends We {
|
|
|
827
825
|
const { engine: t } = n;
|
|
828
826
|
if (t == null)
|
|
829
827
|
return;
|
|
830
|
-
const { width:
|
|
831
|
-
r.renderToThumb(l, e, o /
|
|
828
|
+
const { width: s, height: i } = r, { width: o = s, height: c = i } = t, l = t.getCanvas().getContext();
|
|
829
|
+
r.renderToThumb(l, e, o / s, c / i);
|
|
832
830
|
}
|
|
833
831
|
_createSlidePages(e, r) {
|
|
834
832
|
const n = e.getPages(), t = e.getPageOrder();
|
|
835
833
|
if (!(!n || !t) && t.length !== 0) {
|
|
836
|
-
for (let
|
|
837
|
-
const o = t[
|
|
834
|
+
for (let s = 0, i = t.length; s < i; s++) {
|
|
835
|
+
const o = t[s];
|
|
838
836
|
this._createScene(o, n[o]), this._createThumb(o);
|
|
839
837
|
}
|
|
840
838
|
this._activePageId = t[0], r.activeFirstPage();
|
|
@@ -843,7 +841,7 @@ let ee = class extends We {
|
|
|
843
841
|
createThumbs() {
|
|
844
842
|
const r = this._univerInstanceService.getCurrentUnitForType(V.UNIVER_SLIDE).getPageOrder(), n = this._currentRender();
|
|
845
843
|
if (!(!r || !n) && r.length !== 0)
|
|
846
|
-
for (let t = 0,
|
|
844
|
+
for (let t = 0, s = r.length; t < s; t++) {
|
|
847
845
|
const i = r[t];
|
|
848
846
|
this._thumbSceneRender(i, n.mainComponent);
|
|
849
847
|
}
|
|
@@ -855,11 +853,11 @@ let ee = class extends We {
|
|
|
855
853
|
const n = this._currentRender();
|
|
856
854
|
if (!n || !this._objectProvider)
|
|
857
855
|
return;
|
|
858
|
-
const { scene: t, mainComponent:
|
|
856
|
+
const { scene: t, mainComponent: s } = n, i = s, { width: o, height: c } = i, l = new ie(e, i, {
|
|
859
857
|
width: o,
|
|
860
858
|
height: c
|
|
861
859
|
});
|
|
862
|
-
new
|
|
860
|
+
new $(`PageViewer_${e}`, l, {
|
|
863
861
|
left: 0,
|
|
864
862
|
top: 0,
|
|
865
863
|
bottom: 0,
|
|
@@ -867,16 +865,15 @@ let ee = class extends We {
|
|
|
867
865
|
isRelativeX: !0,
|
|
868
866
|
isRelativeY: !0
|
|
869
867
|
}).closeClip();
|
|
870
|
-
const { pageElements: h, pageBackgroundFill:
|
|
871
|
-
if (!d || !i)
|
|
872
|
-
|
|
873
|
-
this._addBackgroundRect(l, g), l.addObjects(d), d.forEach((_) => {
|
|
868
|
+
const { pageElements: h, pageBackgroundFill: u } = r, d = this._objectProvider.convertToRenderObjects(h, t);
|
|
869
|
+
if (!d || !i) return;
|
|
870
|
+
this._addBackgroundRect(l, u), l.addObjects(d), d.forEach((_) => {
|
|
874
871
|
l.attachTransformerTo(_);
|
|
875
872
|
});
|
|
876
873
|
const p = l.getTransformer();
|
|
877
|
-
return p == null || p.
|
|
874
|
+
return p == null || p.changeEnd$.subscribe(() => {
|
|
878
875
|
this._thumbSceneRender(this._activePageId, i);
|
|
879
|
-
}), p == null || p.
|
|
876
|
+
}), p == null || p.clearControl$.subscribe(() => {
|
|
880
877
|
this._thumbSceneRender(this._activePageId, i);
|
|
881
878
|
}), i.addPage(l), l;
|
|
882
879
|
}
|
|
@@ -884,26 +881,26 @@ let ee = class extends We {
|
|
|
884
881
|
this._objectProvider = e.createInstance(re);
|
|
885
882
|
}
|
|
886
883
|
};
|
|
887
|
-
ee =
|
|
888
|
-
|
|
884
|
+
ee = yt([
|
|
885
|
+
$e(Ne.Ready, ee),
|
|
889
886
|
ce(0, be),
|
|
890
|
-
ce(1,
|
|
891
|
-
ce(2,
|
|
887
|
+
ce(1, N(se)),
|
|
888
|
+
ce(2, Je)
|
|
892
889
|
], ee);
|
|
893
|
-
var jt = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor,
|
|
894
|
-
for (var t = n > 1 ? void 0 : n ? Mt(e, r) : e,
|
|
895
|
-
(i = s
|
|
890
|
+
var jt = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, Ct = (a, e, r, n) => {
|
|
891
|
+
for (var t = n > 1 ? void 0 : n ? Mt(e, r) : e, s = a.length - 1, i; s >= 0; s--)
|
|
892
|
+
(i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
896
893
|
return n && t && jt(e, r, t), t;
|
|
897
|
-
}, oe = (
|
|
898
|
-
const
|
|
894
|
+
}, oe = (a, e) => (r, n) => e(r, n, a);
|
|
895
|
+
const Vt = {}, Xt = "slides";
|
|
899
896
|
var Q;
|
|
900
|
-
let
|
|
897
|
+
let Ie = (Q = class extends Ye {
|
|
901
898
|
constructor(e = {}, r, n, t) {
|
|
902
899
|
super();
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
this._univerInstanceService = r, this._localeService = n, this._injector = t, this._config = Object.assign(
|
|
900
|
+
g(this, "_config");
|
|
901
|
+
g(this, "_canvasEngine", null);
|
|
902
|
+
g(this, "_canvasView", null);
|
|
903
|
+
this._univerInstanceService = r, this._localeService = n, this._injector = t, this._config = Object.assign(Vt, e), this._initializeDependencies(this._injector);
|
|
907
904
|
}
|
|
908
905
|
initialize() {
|
|
909
906
|
this.initCanvasEngine();
|
|
@@ -912,7 +909,7 @@ let Pe = (Q = class extends $e {
|
|
|
912
909
|
return this._config;
|
|
913
910
|
}
|
|
914
911
|
initCanvasEngine() {
|
|
915
|
-
this._canvasEngine = this._injector.get(
|
|
912
|
+
this._canvasEngine = this._injector.get(Qe);
|
|
916
913
|
}
|
|
917
914
|
onRendered() {
|
|
918
915
|
this.initialize();
|
|
@@ -928,14 +925,14 @@ let Pe = (Q = class extends $e {
|
|
|
928
925
|
e.add(n);
|
|
929
926
|
});
|
|
930
927
|
}
|
|
931
|
-
},
|
|
932
|
-
|
|
928
|
+
}, g(Q, "pluginName", Xt), g(Q, "type", V.UNIVER_SLIDE), Q);
|
|
929
|
+
Ie = Ct([
|
|
933
930
|
oe(1, be),
|
|
934
|
-
oe(2,
|
|
935
|
-
oe(3,
|
|
936
|
-
],
|
|
931
|
+
oe(2, N(ne)),
|
|
932
|
+
oe(3, N(se))
|
|
933
|
+
], Ie);
|
|
937
934
|
export {
|
|
938
935
|
ee as CanvasView,
|
|
939
|
-
|
|
940
|
-
|
|
936
|
+
xt as SLIDE_KEY,
|
|
937
|
+
Ie as UniverSlidesPlugin
|
|
941
938
|
};
|