@leafer-ui/core 1.0.0-rc.9 → 1.0.1

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/dist/core.esm.js DELETED
@@ -1,1979 +0,0 @@
1
- import { MoveEvent, LeafHelper, ZoomEvent, Debug, LeafData, PathConvert, defineLeafAttr, OneRadian, Platform, dataProcessor, dataType, surfaceType, opacityType, maskType, eraserType, sortType, positionType, boundsType, scaleType, rotationType, autoLayoutType, hitType, strokeType, cursorType, pathType, rewrite, Leaf, PathDrawer, useModule, rewriteAble, PathCreator, PathCorner, UICreator, MatrixHelper, Branch, registerUI, affectRenderBoundsType, BoundsHelper, PathCommandDataHelper, affectStrokeBoundsType, PathScaler, PointHelper, PathBounds, ImageEvent, Creator, Matrix, MathHelper, ImageManager, DataHelper, CanvasManager, HitCanvasManager, PluginManager, LeaferEvent, canvasSizeAttrs, ResizeEvent, AutoBounds, WaitHelper, Run, LayoutEvent, RenderEvent, WatchEvent, AnimateEvent, PropertyEvent } from '@leafer/core';
2
- export * from '@leafer/core';
3
-
4
- /******************************************************************************
5
- Copyright (c) Microsoft Corporation.
6
-
7
- Permission to use, copy, modify, and/or distribute this software for any
8
- purpose with or without fee is hereby granted.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
- PERFORMANCE OF THIS SOFTWARE.
17
- ***************************************************************************** */
18
- /* global Reflect, Promise, SuppressedError, Symbol */
19
-
20
-
21
- function __decorate(decorators, target, key, desc) {
22
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
24
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
25
- return c > 3 && r && Object.defineProperty(target, key, r), r;
26
- }
27
-
28
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
29
- var e = new Error(message);
30
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
31
- };
32
-
33
- function draw(leafer) {
34
- const { config } = leafer;
35
- config.move.dragOut = false;
36
- }
37
-
38
- function design(leafer) {
39
- if (leafer.isApp)
40
- return;
41
- leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, (e) => { LeafHelper.moveWorld(leafer.zoomLayer, e.moveX, e.moveY); }), leafer.on_(ZoomEvent.BEFORE_ZOOM, (e) => {
42
- const { scaleX } = leafer.zoomLayer.__, { min, max } = leafer.app.config.zoom;
43
- let { scale } = e;
44
- if (scale * Math.abs(scaleX) < min)
45
- scale = min / scaleX;
46
- else if (scale * Math.abs(scaleX) > max)
47
- scale = max / scaleX;
48
- if (scale !== 1)
49
- LeafHelper.zoomOfWorld(leafer.zoomLayer, e, scale);
50
- }));
51
- }
52
-
53
- const debug$2 = Debug.get('LeaferTypeCreator');
54
- const LeaferTypeCreator = {
55
- list: {},
56
- register(name, fn) {
57
- if (list[name]) {
58
- debug$2.repeat(name);
59
- }
60
- else {
61
- list[name] = fn;
62
- }
63
- },
64
- run(name, leafer) {
65
- const fn = LeaferTypeCreator.list[name];
66
- if (fn) {
67
- fn(leafer);
68
- }
69
- else {
70
- debug$2.error('no', name);
71
- }
72
- }
73
- };
74
- const { list } = LeaferTypeCreator;
75
- LeaferTypeCreator.register('draw', draw);
76
- LeaferTypeCreator.register('user', draw);
77
- LeaferTypeCreator.register('design', design);
78
-
79
- const Effect = {};
80
- const Paint = {};
81
- const Animate = {};
82
- const TextConvert = {};
83
- const ColorConvert = {};
84
- const Export = {};
85
-
86
- const emptyPaint = {};
87
- const debug$1 = Debug.get('UIData');
88
- class UIData extends LeafData {
89
- get __autoWidth() { return !this._width; }
90
- get __autoHeight() { return !this._height; }
91
- get __autoBounds() { return !this._width && !this._height; }
92
- setVisible(value) {
93
- if (this.__leaf.leafer)
94
- this.__leaf.leafer.watcher.hasVisible = true;
95
- this._visible = value;
96
- }
97
- setWidth(value) {
98
- if (value < 0) {
99
- this._width = -value;
100
- this.__leaf.scaleX *= -1;
101
- debug$1.warn('width < 0, instead -scaleX ', this);
102
- }
103
- else {
104
- this._width = value;
105
- }
106
- }
107
- setHeight(value) {
108
- if (value < 0) {
109
- this._height = -value;
110
- this.__leaf.scaleY *= -1;
111
- debug$1.warn('height < 0, instead -scaleY', this);
112
- }
113
- else {
114
- this._height = value;
115
- }
116
- }
117
- setFill(value) {
118
- if (this.__naturalWidth)
119
- this.__naturalWidth = this.__naturalHeight = undefined;
120
- if (typeof value === 'string' || !value) {
121
- if (this.__isFills) {
122
- this.__removeInput('fill');
123
- Paint.recycleImage('fill', this);
124
- this.__isFills = false;
125
- if (this.__pixelFill)
126
- this.__pixelFill = false;
127
- }
128
- this._fill = value;
129
- }
130
- else if (typeof value === 'object') {
131
- this.__setInput('fill', value);
132
- this.__leaf.__layout.boxChanged || this.__leaf.__layout.boxChange();
133
- this.__isFills = true;
134
- this._fill || (this._fill = emptyPaint);
135
- }
136
- }
137
- setStroke(value) {
138
- if (typeof value === 'string' || !value) {
139
- if (this.__isStrokes) {
140
- this.__removeInput('stroke');
141
- Paint.recycleImage('stroke', this);
142
- this.__isStrokes = false;
143
- if (this.__pixelStroke)
144
- this.__pixelStroke = false;
145
- }
146
- this._stroke = value;
147
- }
148
- else if (typeof value === 'object') {
149
- this.__setInput('stroke', value);
150
- this.__leaf.__layout.boxChanged || this.__leaf.__layout.boxChange();
151
- this.__isStrokes = true;
152
- this._stroke || (this._stroke = emptyPaint);
153
- }
154
- }
155
- setShadow(value) {
156
- this.__setInput('shadow', value);
157
- if (value instanceof Array) {
158
- if (value.some((item) => item.visible === false))
159
- value = value.filter((item) => item.visible !== false);
160
- this._shadow = value.length ? value : null;
161
- }
162
- else if (value) {
163
- this._shadow = value.visible === false ? null : [value];
164
- }
165
- else {
166
- this._shadow = null;
167
- }
168
- }
169
- setInnerShadow(value) {
170
- this.__setInput('innerShadow', value);
171
- if (value instanceof Array) {
172
- if (value.some((item) => item.visible === false))
173
- value = value.filter((item) => item.visible !== false);
174
- this._innerShadow = value.length ? value : null;
175
- }
176
- else if (value) {
177
- this._innerShadow = value.visible === false ? null : [value];
178
- }
179
- else {
180
- this._innerShadow = null;
181
- }
182
- }
183
- }
184
- const UnitConvert = {
185
- number(value, percentRefer) {
186
- if (typeof value === 'object')
187
- return value.type === 'percent' ? value.value / 100 * percentRefer : value.value;
188
- return value;
189
- }
190
- };
191
-
192
- class GroupData extends UIData {
193
- }
194
-
195
- class BoxData extends GroupData {
196
- get __boxStroke() { return true; }
197
- }
198
-
199
- class LeaferData extends GroupData {
200
- }
201
-
202
- class FrameData extends BoxData {
203
- }
204
-
205
- class LineData extends UIData {
206
- }
207
-
208
- class ArrowData extends LineData {
209
- }
210
-
211
- class RectData extends UIData {
212
- get __boxStroke() { return true; }
213
- }
214
-
215
- class EllipseData extends UIData {
216
- get __boxStroke() { return true; }
217
- }
218
-
219
- class PolygonData extends UIData {
220
- }
221
-
222
- class StarData extends UIData {
223
- }
224
-
225
- const { parse } = PathConvert;
226
- class PathData extends UIData {
227
- setPath(value) {
228
- if (typeof value === 'string') {
229
- this.__setInput('path', value);
230
- this._path = parse(value);
231
- }
232
- else {
233
- if (this.__input)
234
- this.__removeInput('path');
235
- this._path = value;
236
- }
237
- }
238
- }
239
-
240
- class PenData extends GroupData {
241
- }
242
-
243
- const fontWeightMap = {
244
- 'thin': 100,
245
- 'extra-light': 200,
246
- 'light': 300,
247
- 'normal': 400,
248
- 'medium': 500,
249
- 'semi-bold': 600,
250
- 'bold': 700,
251
- 'extra-bold': 800,
252
- 'black': 900
253
- };
254
- class TextData extends UIData {
255
- setFontWeight(value) {
256
- if (typeof value === 'string') {
257
- this.__setInput('fontWeight', value);
258
- this._fontWeight = fontWeightMap[value] || 400;
259
- }
260
- else {
261
- if (this.__input)
262
- this.__removeInput('fontWeight');
263
- this._fontWeight = value;
264
- }
265
- }
266
- }
267
-
268
- class ImageData extends RectData {
269
- setUrl(value) {
270
- this.__setImageFill(value);
271
- this._url = value;
272
- }
273
- __setImageFill(value) {
274
- if (this.__leaf.image)
275
- this.__leaf.image = null;
276
- this.fill = value ? { type: 'image', mode: 'strench', url: value } : undefined;
277
- }
278
- __getData() {
279
- const data = super.__getData();
280
- delete data.fill;
281
- return data;
282
- }
283
- __getInputData() {
284
- const data = super.__getInputData();
285
- delete data.fill;
286
- return data;
287
- }
288
- }
289
-
290
- class CanvasData extends RectData {
291
- }
292
-
293
- function effectType(defaultValue) {
294
- return (target, key) => {
295
- defineLeafAttr(target, key, defaultValue, {
296
- set(value) {
297
- this.__setAttr(key, value);
298
- if (value)
299
- this.__.__useEffect = true;
300
- this.__layout.renderChanged || this.__layout.renderChange();
301
- }
302
- });
303
- };
304
- }
305
- function resizeType(defaultValue) {
306
- return (target, key) => {
307
- defineLeafAttr(target, key, defaultValue, {
308
- set(value) {
309
- this.__setAttr(key, value);
310
- this.__layout.boxChanged || this.__layout.boxChange();
311
- this.__updateSize();
312
- }
313
- });
314
- };
315
- }
316
-
317
- const UIBounds = {
318
- __updateStrokeSpread() {
319
- let width = 0, boxWidth = 0;
320
- const { stroke, hitStroke, strokeAlign, strokeWidth } = this.__;
321
- if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
322
- boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
323
- if (!this.__.__boxStroke) {
324
- const { miterLimit, strokeCap } = this.__;
325
- const miterLimitAddWidth = this.__tag !== 'Line' ? 1 / Math.sin(miterLimit * OneRadian / 2) * Math.sqrt(strokeWidth) - width : 0;
326
- const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
327
- width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
328
- }
329
- }
330
- this.__layout.strokeBoxSpread = boxWidth;
331
- return width;
332
- },
333
- __updateRenderSpread() {
334
- let width = 0;
335
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
336
- if (shadow)
337
- shadow.forEach(item => {
338
- width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5);
339
- });
340
- if (blur)
341
- width = Math.max(width, blur);
342
- let shapeWidth = width = Math.ceil(width);
343
- if (innerShadow)
344
- innerShadow.forEach(item => {
345
- shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5);
346
- });
347
- if (backgroundBlur)
348
- shapeWidth = Math.max(shapeWidth, backgroundBlur);
349
- this.__layout.renderShapeSpread = shapeWidth;
350
- return width;
351
- }
352
- };
353
-
354
- const UIHit = {
355
- __updateHitCanvas() {
356
- if (!this.__hitCanvas)
357
- this.__hitCanvas = this.leafer.hitCanvasManager.getPathType(this);
358
- const h = this.__hitCanvas;
359
- this.__drawHitPath(h);
360
- h.setStrokeOptions(this.__);
361
- },
362
- __hit(inner) {
363
- const { __hitCanvas: h } = this;
364
- if (Platform.name === 'miniapp')
365
- this.__drawHitPath(h);
366
- const { fill, hitFill, windingRule } = this.__;
367
- const needHitFill = (fill && hitFill === 'path') || hitFill === 'all';
368
- const isHitFill = h.hitFill(inner, windingRule);
369
- if (needHitFill && isHitFill)
370
- return true;
371
- const { stroke, hitStroke, strokeWidth, strokeAlign } = this.__;
372
- const needHitStroke = (stroke && hitStroke === 'path') || hitStroke === 'all';
373
- const radiusWidth = inner.radiusX * 2;
374
- let hitWidth = radiusWidth;
375
- if (needHitStroke) {
376
- switch (strokeAlign) {
377
- case 'inside':
378
- hitWidth += strokeWidth * 2;
379
- if (!needHitFill && (isHitFill && h.hitStroke(inner, hitWidth)))
380
- return true;
381
- hitWidth = radiusWidth;
382
- break;
383
- case 'center':
384
- hitWidth += strokeWidth;
385
- break;
386
- case 'outside':
387
- hitWidth += strokeWidth * 2;
388
- if (!needHitFill) {
389
- if (!isHitFill && h.hitStroke(inner, hitWidth))
390
- return true;
391
- hitWidth = radiusWidth;
392
- }
393
- break;
394
- }
395
- }
396
- return hitWidth ? h.hitStroke(inner, hitWidth) : false;
397
- }
398
- };
399
-
400
- const UIRender = {
401
- __updateChange() {
402
- const data = this.__;
403
- if (data.__useEffect) {
404
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
405
- data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur);
406
- }
407
- data.__checkSingle();
408
- const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
409
- if (complex) {
410
- data.__complex = true;
411
- }
412
- else {
413
- data.__complex && (data.__complex = false);
414
- }
415
- },
416
- __drawFast(canvas, options) {
417
- const { fill, stroke, __drawAfterFill } = this.__;
418
- this.__drawRenderPath(canvas);
419
- if (fill)
420
- Paint.fill(fill, this, canvas);
421
- if (__drawAfterFill)
422
- this.__drawAfterFill(canvas, options);
423
- if (stroke)
424
- Paint.stroke(stroke, this, canvas, options);
425
- },
426
- __draw(canvas, options) {
427
- if (this.__.__complex) {
428
- const { fill, stroke, __drawAfterFill } = this.__;
429
- this.__drawRenderPath(canvas);
430
- if (this.__.__useEffect) {
431
- const shape = Paint.shape(this, canvas, options);
432
- const { shadow, innerShadow } = this.__;
433
- if (shadow)
434
- Effect.shadow(this, canvas, shape, options);
435
- if (fill)
436
- this.__.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
437
- if (__drawAfterFill)
438
- this.__drawAfterFill(canvas, options);
439
- if (innerShadow)
440
- Effect.innerShadow(this, canvas, shape, options);
441
- if (stroke)
442
- this.__.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
443
- if (shape.worldCanvas)
444
- shape.worldCanvas.recycle();
445
- shape.canvas.recycle();
446
- }
447
- else {
448
- if (fill)
449
- this.__.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
450
- if (__drawAfterFill)
451
- this.__drawAfterFill(canvas, options);
452
- if (stroke)
453
- this.__.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
454
- }
455
- }
456
- else {
457
- this.__drawFast(canvas, options);
458
- }
459
- },
460
- __renderShape(canvas, renderOptions) {
461
- if (!this.__worldOpacity)
462
- return;
463
- canvas.setWorld(this.__world, renderOptions.matrix);
464
- const { fill, stroke } = this.__;
465
- this.__drawRenderPath(canvas);
466
- if (fill)
467
- this.__.__pixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
468
- if (stroke)
469
- this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas, renderOptions) : Paint.stroke('#000000', this, canvas, renderOptions);
470
- }
471
- };
472
-
473
- const RectRender = {
474
- __drawFast(canvas, options) {
475
- const { width, height, fill, stroke, __drawAfterFill } = this.__;
476
- if (fill) {
477
- canvas.fillStyle = fill;
478
- canvas.fillRect(0, 0, width, height);
479
- }
480
- if (__drawAfterFill)
481
- this.__drawAfterFill(canvas, options);
482
- if (stroke) {
483
- const { strokeAlign, strokeWidth } = this.__;
484
- canvas.setStroke(stroke, strokeWidth, this.__);
485
- const half = strokeWidth / 2;
486
- switch (strokeAlign) {
487
- case 'center':
488
- canvas.strokeRect(0, 0, width, height);
489
- break;
490
- case 'inside':
491
- canvas.strokeRect(half, half, width - strokeWidth, height - strokeWidth);
492
- break;
493
- case 'outside':
494
- canvas.strokeRect(-half, -half, width + strokeWidth, height + strokeWidth);
495
- break;
496
- }
497
- }
498
- }
499
- };
500
-
501
- var UI_1;
502
- let UI = UI_1 = class UI extends Leaf {
503
- get app() { return this.leafer && this.leafer.app; }
504
- set scale(value) {
505
- if (typeof value === 'number') {
506
- this.scaleX = this.scaleY = value;
507
- }
508
- else {
509
- this.scaleX = value.x;
510
- this.scaleY = value.y;
511
- }
512
- }
513
- get scale() {
514
- const { scaleX, scaleY } = this;
515
- return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
516
- }
517
- constructor(data) {
518
- super(data);
519
- }
520
- reset(_data) { }
521
- set(data) {
522
- Object.assign(this, data);
523
- }
524
- get() {
525
- return this.__.__getInputData();
526
- }
527
- createProxyData() { return undefined; }
528
- find(condition, options) {
529
- return this.leafer ? this.leafer.selector.getBy(condition, this, false, options) : [];
530
- }
531
- findOne(condition, options) {
532
- return this.leafer ? this.leafer.selector.getBy(condition, this, true, options) : null;
533
- }
534
- getPath(curve, pathForRender) {
535
- this.__layout.update();
536
- let path = pathForRender ? this.__.__pathForRender : this.__.path;
537
- if (!path)
538
- this.__drawPathByBox(new PathCreator(path = []));
539
- return curve ? PathConvert.toCanvasData(path, true) : path;
540
- }
541
- getPathString(curve, pathForRender) {
542
- return PathConvert.stringify(this.getPath(curve, pathForRender));
543
- }
544
- __onUpdateSize() {
545
- if (this.__.__input) {
546
- const { fill, stroke } = this.__.__input;
547
- if (fill)
548
- Paint.compute('fill', this);
549
- if (stroke)
550
- Paint.compute('stroke', this);
551
- }
552
- }
553
- __updateRenderPath() {
554
- if (this.__.path) {
555
- const { __: data } = this;
556
- data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
557
- }
558
- }
559
- __drawRenderPath(canvas) {
560
- canvas.beginPath();
561
- this.__drawPathByData(canvas, this.__.__pathForRender);
562
- }
563
- __drawPath(canvas) {
564
- canvas.beginPath();
565
- this.__drawPathByData(canvas, this.__.path);
566
- }
567
- __drawPathByData(_drawer, _data) { }
568
- __drawPathByBox(drawer) {
569
- const { x, y, width, height } = this.__layout.boxBounds;
570
- if (this.__.cornerRadius) {
571
- drawer.roundRect(x, y, width, height, this.__.cornerRadius);
572
- }
573
- else {
574
- drawer.rect(x, y, width, height);
575
- }
576
- }
577
- export(filename, options) {
578
- return Export.export(this, filename, options);
579
- }
580
- clone() {
581
- return UI_1.one(this.toJSON());
582
- }
583
- static one(data, x, y, width, height) {
584
- return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height);
585
- }
586
- destroy() {
587
- this.fill = this.stroke = null;
588
- super.destroy();
589
- }
590
- };
591
- __decorate([
592
- dataProcessor(UIData)
593
- ], UI.prototype, "__", void 0);
594
- __decorate([
595
- dataType('')
596
- ], UI.prototype, "id", void 0);
597
- __decorate([
598
- dataType('')
599
- ], UI.prototype, "name", void 0);
600
- __decorate([
601
- dataType('')
602
- ], UI.prototype, "className", void 0);
603
- __decorate([
604
- surfaceType('pass-through')
605
- ], UI.prototype, "blendMode", void 0);
606
- __decorate([
607
- opacityType(1)
608
- ], UI.prototype, "opacity", void 0);
609
- __decorate([
610
- opacityType(true)
611
- ], UI.prototype, "visible", void 0);
612
- __decorate([
613
- maskType(false)
614
- ], UI.prototype, "isMask", void 0);
615
- __decorate([
616
- eraserType(false)
617
- ], UI.prototype, "isEraser", void 0);
618
- __decorate([
619
- dataType(false)
620
- ], UI.prototype, "locked", void 0);
621
- __decorate([
622
- sortType(0)
623
- ], UI.prototype, "zIndex", void 0);
624
- __decorate([
625
- positionType(0)
626
- ], UI.prototype, "x", void 0);
627
- __decorate([
628
- positionType(0)
629
- ], UI.prototype, "y", void 0);
630
- __decorate([
631
- boundsType(100)
632
- ], UI.prototype, "width", void 0);
633
- __decorate([
634
- boundsType(100)
635
- ], UI.prototype, "height", void 0);
636
- __decorate([
637
- scaleType(1)
638
- ], UI.prototype, "scaleX", void 0);
639
- __decorate([
640
- scaleType(1)
641
- ], UI.prototype, "scaleY", void 0);
642
- __decorate([
643
- rotationType(0)
644
- ], UI.prototype, "rotation", void 0);
645
- __decorate([
646
- rotationType(0)
647
- ], UI.prototype, "skewX", void 0);
648
- __decorate([
649
- rotationType(0)
650
- ], UI.prototype, "skewY", void 0);
651
- __decorate([
652
- autoLayoutType()
653
- ], UI.prototype, "around", void 0);
654
- __decorate([
655
- dataType(false)
656
- ], UI.prototype, "draggable", void 0);
657
- __decorate([
658
- dataType(false)
659
- ], UI.prototype, "editable", void 0);
660
- __decorate([
661
- dataType('size')
662
- ], UI.prototype, "editSize", void 0);
663
- __decorate([
664
- hitType(true)
665
- ], UI.prototype, "hittable", void 0);
666
- __decorate([
667
- hitType('path')
668
- ], UI.prototype, "hitFill", void 0);
669
- __decorate([
670
- strokeType('path')
671
- ], UI.prototype, "hitStroke", void 0);
672
- __decorate([
673
- hitType(false)
674
- ], UI.prototype, "hitBox", void 0);
675
- __decorate([
676
- hitType(true)
677
- ], UI.prototype, "hitChildren", void 0);
678
- __decorate([
679
- hitType(true)
680
- ], UI.prototype, "hitSelf", void 0);
681
- __decorate([
682
- hitType()
683
- ], UI.prototype, "hitRadius", void 0);
684
- __decorate([
685
- cursorType('')
686
- ], UI.prototype, "cursor", void 0);
687
- __decorate([
688
- surfaceType()
689
- ], UI.prototype, "fill", void 0);
690
- __decorate([
691
- strokeType()
692
- ], UI.prototype, "stroke", void 0);
693
- __decorate([
694
- strokeType('inside')
695
- ], UI.prototype, "strokeAlign", void 0);
696
- __decorate([
697
- strokeType(1)
698
- ], UI.prototype, "strokeWidth", void 0);
699
- __decorate([
700
- strokeType('none')
701
- ], UI.prototype, "strokeCap", void 0);
702
- __decorate([
703
- strokeType('miter')
704
- ], UI.prototype, "strokeJoin", void 0);
705
- __decorate([
706
- strokeType()
707
- ], UI.prototype, "dashPattern", void 0);
708
- __decorate([
709
- strokeType()
710
- ], UI.prototype, "dashOffset", void 0);
711
- __decorate([
712
- strokeType(10)
713
- ], UI.prototype, "miterLimit", void 0);
714
- __decorate([
715
- strokeType('none')
716
- ], UI.prototype, "startArrow", void 0);
717
- __decorate([
718
- strokeType('none')
719
- ], UI.prototype, "endArrow", void 0);
720
- __decorate([
721
- pathType(0)
722
- ], UI.prototype, "cornerRadius", void 0);
723
- __decorate([
724
- pathType()
725
- ], UI.prototype, "cornerSmoothing", void 0);
726
- __decorate([
727
- effectType()
728
- ], UI.prototype, "shadow", void 0);
729
- __decorate([
730
- effectType()
731
- ], UI.prototype, "innerShadow", void 0);
732
- __decorate([
733
- effectType()
734
- ], UI.prototype, "blur", void 0);
735
- __decorate([
736
- effectType()
737
- ], UI.prototype, "backgroundBlur", void 0);
738
- __decorate([
739
- effectType()
740
- ], UI.prototype, "grayscale", void 0);
741
- __decorate([
742
- rewrite(Leaf.prototype.reset)
743
- ], UI.prototype, "reset", null);
744
- __decorate([
745
- rewrite(PathDrawer.drawPathByData)
746
- ], UI.prototype, "__drawPathByData", null);
747
- UI = UI_1 = __decorate([
748
- useModule(UIBounds),
749
- useModule(UIHit),
750
- useModule(UIRender),
751
- rewriteAble()
752
- ], UI);
753
-
754
- const matrix = MatrixHelper.get();
755
- let Group = class Group extends UI {
756
- get __tag() { return 'Group'; }
757
- set mask(child) {
758
- if (this.__hasMask)
759
- this.__removeMask();
760
- if (child) {
761
- child.isMask = true;
762
- this.addAt(child, 0);
763
- }
764
- }
765
- get mask() {
766
- return this.children.find(item => item.isMask);
767
- }
768
- constructor(data) {
769
- super(data);
770
- this.__setBranch();
771
- }
772
- __setBranch() {
773
- this.isBranch = true;
774
- if (!this.children)
775
- this.children = [];
776
- }
777
- set(data) {
778
- if (data.children) {
779
- const { children } = data;
780
- delete data.children;
781
- if (!this.children) {
782
- this.__setBranch();
783
- }
784
- else {
785
- this.removeAll(true);
786
- }
787
- super.set(data);
788
- let child;
789
- children.forEach(childData => {
790
- child = UICreator.get(childData.tag, childData);
791
- this.add(child);
792
- });
793
- data.children = children;
794
- }
795
- else {
796
- super.set(data);
797
- }
798
- }
799
- toJSON() {
800
- const data = super.toJSON();
801
- data.children = this.children.map(child => child.toJSON());
802
- return data;
803
- }
804
- __scaleResize(scaleX, scaleY) {
805
- const { children } = this;
806
- for (let i = 0; i < children.length; i++) {
807
- matrix.a = scaleX;
808
- matrix.d = scaleY;
809
- children[i].transform(matrix, true);
810
- }
811
- }
812
- addAt(child, index) {
813
- this.add(child, index);
814
- }
815
- addAfter(child, after) {
816
- this.add(child, this.children.indexOf(after) + 1);
817
- }
818
- addBefore(child, before) {
819
- this.add(child, this.children.indexOf(before));
820
- }
821
- add(_child, _index) { }
822
- addMany(..._children) { }
823
- remove(_child, _destroy) { }
824
- removeAll(_destroy) { }
825
- };
826
- __decorate([
827
- dataProcessor(GroupData)
828
- ], Group.prototype, "__", void 0);
829
- Group = __decorate([
830
- useModule(Branch),
831
- registerUI()
832
- ], Group);
833
-
834
- let Rect = class Rect extends UI {
835
- get __tag() { return 'Rect'; }
836
- constructor(data) {
837
- super(data);
838
- }
839
- __drawPathByData(_drawer, _data) { }
840
- };
841
- __decorate([
842
- dataProcessor(RectData)
843
- ], Rect.prototype, "__", void 0);
844
- __decorate([
845
- rewrite(UI.prototype.__drawPathByBox)
846
- ], Rect.prototype, "__drawPathByData", null);
847
- Rect = __decorate([
848
- useModule(RectRender),
849
- rewriteAble(),
850
- registerUI()
851
- ], Rect);
852
-
853
- const rect = Rect.prototype;
854
- const group = Group.prototype;
855
- const bounds = {};
856
- const { copy, add } = BoundsHelper;
857
- let Box = class Box extends Group {
858
- get __tag() { return 'Box'; }
859
- constructor(data) {
860
- super(data);
861
- this.isBranchLeaf = true;
862
- this.__layout.renderChanged || this.__layout.renderChange();
863
- }
864
- __scaleResize(scaleX, scaleY) {
865
- if (this.__.__autoBounds && this.children.length) {
866
- super.__scaleResize(scaleX, scaleY);
867
- }
868
- else {
869
- this.width *= scaleX;
870
- this.height *= scaleY;
871
- }
872
- }
873
- __updateStrokeSpread() { return 0; }
874
- __updateRectRenderSpread() { return 0; }
875
- __updateRenderSpread() {
876
- let width = this.__updateRectRenderSpread() || super.__updateRenderSpread();
877
- this.__.__drawAfterFill = this.__.overflow === 'hide';
878
- if (!width)
879
- width = this.__.__drawAfterFill ? 0 : 1;
880
- return width;
881
- }
882
- __updateRectBoxBounds() { }
883
- __updateBoxBounds() {
884
- if (this.__.__autoBounds && this.children.length) {
885
- super.__updateBoxBounds();
886
- }
887
- else {
888
- this.__updateRectBoxBounds();
889
- }
890
- }
891
- __updateStrokeBounds() { }
892
- __updateRenderBounds() {
893
- this.__updateRectRenderBounds();
894
- if (!this.__.__drawAfterFill) {
895
- const { renderBounds } = this.__layout;
896
- copy(bounds, renderBounds);
897
- super.__updateRenderBounds();
898
- add(renderBounds, bounds);
899
- }
900
- }
901
- __updateRectRenderBounds() { }
902
- __updateRectChange() { }
903
- __updateChange() {
904
- super.__updateChange();
905
- this.__updateRectChange();
906
- }
907
- __drawPathByData(_drawer, _data) { }
908
- __renderRect(_canvas, _options) { }
909
- __renderGroup(_canvas, _options) { }
910
- __render(canvas, options) {
911
- if (this.__.__drawAfterFill) {
912
- this.__renderRect(canvas, options);
913
- }
914
- else {
915
- this.__renderRect(canvas, options);
916
- this.__renderGroup(canvas, options);
917
- }
918
- }
919
- __drawAfterFill(canvas, options) {
920
- canvas.save();
921
- canvas.clip();
922
- this.__renderGroup(canvas, options);
923
- canvas.restore();
924
- if (this.__.stroke)
925
- this.__drawRenderPath(canvas);
926
- }
927
- };
928
- __decorate([
929
- dataProcessor(BoxData)
930
- ], Box.prototype, "__", void 0);
931
- __decorate([
932
- affectRenderBoundsType('show')
933
- ], Box.prototype, "overflow", void 0);
934
- __decorate([
935
- rewrite(rect.__updateStrokeSpread)
936
- ], Box.prototype, "__updateStrokeSpread", null);
937
- __decorate([
938
- rewrite(rect.__updateRenderSpread)
939
- ], Box.prototype, "__updateRectRenderSpread", null);
940
- __decorate([
941
- rewrite(rect.__updateBoxBounds)
942
- ], Box.prototype, "__updateRectBoxBounds", null);
943
- __decorate([
944
- rewrite(rect.__updateStrokeBounds)
945
- ], Box.prototype, "__updateStrokeBounds", null);
946
- __decorate([
947
- rewrite(rect.__updateRenderBounds)
948
- ], Box.prototype, "__updateRectRenderBounds", null);
949
- __decorate([
950
- rewrite(rect.__updateChange)
951
- ], Box.prototype, "__updateRectChange", null);
952
- __decorate([
953
- rewrite(rect.__drawPathByData)
954
- ], Box.prototype, "__drawPathByData", null);
955
- __decorate([
956
- rewrite(rect.__render)
957
- ], Box.prototype, "__renderRect", null);
958
- __decorate([
959
- rewrite(group.__render)
960
- ], Box.prototype, "__renderGroup", null);
961
- Box = __decorate([
962
- rewriteAble(),
963
- registerUI()
964
- ], Box);
965
-
966
- let Frame = class Frame extends Box {
967
- get __tag() { return 'Frame'; }
968
- constructor(data) {
969
- super(data);
970
- this.isFrame = true;
971
- if (!this.__.fill)
972
- this.__.fill = '#FFFFFF';
973
- }
974
- };
975
- __decorate([
976
- dataProcessor(FrameData)
977
- ], Frame.prototype, "__", void 0);
978
- __decorate([
979
- affectRenderBoundsType('hide')
980
- ], Frame.prototype, "overflow", void 0);
981
- Frame = __decorate([
982
- registerUI()
983
- ], Frame);
984
-
985
- const { moveTo: moveTo$3, closePath: closePath$2, ellipse } = PathCommandDataHelper;
986
- let Ellipse = class Ellipse extends UI {
987
- get __tag() { return 'Ellipse'; }
988
- constructor(data) {
989
- super(data);
990
- }
991
- __updatePath() {
992
- const { width, height, innerRadius, startAngle, endAngle } = this.__;
993
- const rx = width / 2, ry = height / 2;
994
- const path = this.__.path = [];
995
- if (innerRadius) {
996
- if (startAngle || endAngle) {
997
- if (innerRadius < 1)
998
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
999
- ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
1000
- if (innerRadius < 1)
1001
- closePath$2(path);
1002
- }
1003
- else {
1004
- if (innerRadius < 1) {
1005
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
1006
- moveTo$3(path, width, ry);
1007
- }
1008
- ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
1009
- }
1010
- if (Platform.ellipseToCurve)
1011
- this.__.path = this.getPath(true);
1012
- }
1013
- else {
1014
- if (startAngle || endAngle) {
1015
- moveTo$3(path, rx, ry);
1016
- ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
1017
- closePath$2(path);
1018
- }
1019
- else {
1020
- ellipse(path, rx, ry, rx, ry);
1021
- }
1022
- }
1023
- }
1024
- };
1025
- __decorate([
1026
- dataProcessor(EllipseData)
1027
- ], Ellipse.prototype, "__", void 0);
1028
- __decorate([
1029
- pathType(0)
1030
- ], Ellipse.prototype, "innerRadius", void 0);
1031
- __decorate([
1032
- pathType(0)
1033
- ], Ellipse.prototype, "startAngle", void 0);
1034
- __decorate([
1035
- pathType(0)
1036
- ], Ellipse.prototype, "endAngle", void 0);
1037
- Ellipse = __decorate([
1038
- registerUI()
1039
- ], Ellipse);
1040
-
1041
- const { moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1 } = PathCommandDataHelper;
1042
- const { rotate, getAngle, getDistance, defaultPoint } = PointHelper;
1043
- const { toBounds: toBounds$1 } = PathBounds;
1044
- let Line = class Line extends UI {
1045
- get __tag() { return 'Line'; }
1046
- get toPoint() {
1047
- const { width, rotation } = this.__;
1048
- const to = { x: 0, y: 0 };
1049
- if (width)
1050
- to.x = width;
1051
- if (rotation)
1052
- rotate(to, rotation);
1053
- return to;
1054
- }
1055
- set toPoint(value) {
1056
- this.width = getDistance(defaultPoint, value);
1057
- this.rotation = getAngle(defaultPoint, value);
1058
- if (this.height)
1059
- this.height = 0;
1060
- }
1061
- constructor(data) {
1062
- super(data);
1063
- }
1064
- __updatePath() {
1065
- const path = this.__.path = [];
1066
- if (this.__.points) {
1067
- drawPoints$1(path, this.__.points, false);
1068
- }
1069
- else {
1070
- moveTo$2(path, 0, 0);
1071
- lineTo$2(path, this.width, 0);
1072
- }
1073
- }
1074
- __updateRenderPath() {
1075
- if (this.__.points && this.__.curve) {
1076
- drawPoints$1(this.__.__pathForRender = [], this.__.points, this.__.curve, this.__tag !== 'Line');
1077
- }
1078
- else {
1079
- super.__updateRenderPath();
1080
- }
1081
- }
1082
- __updateBoxBounds() {
1083
- if (this.points) {
1084
- toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
1085
- }
1086
- else {
1087
- super.__updateBoxBounds();
1088
- }
1089
- }
1090
- __scaleResize(scaleX, scaleY) {
1091
- if (this.points) {
1092
- PathScaler.scalePoints(this.__.points, scaleX, scaleY);
1093
- this.points = this.__.points;
1094
- }
1095
- else {
1096
- if (this.__tag === 'Line') {
1097
- const point = this.toPoint;
1098
- point.x *= scaleX;
1099
- point.y *= scaleY;
1100
- this.toPoint = point;
1101
- }
1102
- else {
1103
- super.__scaleResize(scaleX, scaleY);
1104
- }
1105
- }
1106
- }
1107
- };
1108
- __decorate([
1109
- dataProcessor(LineData)
1110
- ], Line.prototype, "__", void 0);
1111
- __decorate([
1112
- affectStrokeBoundsType('center')
1113
- ], Line.prototype, "strokeAlign", void 0);
1114
- __decorate([
1115
- boundsType(0)
1116
- ], Line.prototype, "height", void 0);
1117
- __decorate([
1118
- pathType()
1119
- ], Line.prototype, "points", void 0);
1120
- __decorate([
1121
- pathType(0)
1122
- ], Line.prototype, "curve", void 0);
1123
- Line = __decorate([
1124
- registerUI()
1125
- ], Line);
1126
-
1127
- const { sin: sin$1, cos: cos$1, PI: PI$1 } = Math;
1128
- const { moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints } = PathCommandDataHelper;
1129
- const line = Line.prototype;
1130
- let Polygon = class Polygon extends UI {
1131
- get __tag() { return 'Polygon'; }
1132
- constructor(data) {
1133
- super(data);
1134
- }
1135
- __updatePath() {
1136
- const path = this.__.path = [];
1137
- if (this.__.points) {
1138
- drawPoints(path, this.__.points, false, true);
1139
- }
1140
- else {
1141
- const { width, height, sides } = this.__;
1142
- const rx = width / 2, ry = height / 2;
1143
- moveTo$1(path, rx, 0);
1144
- for (let i = 1; i < sides; i++) {
1145
- lineTo$1(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
1146
- }
1147
- }
1148
- closePath$1(path);
1149
- }
1150
- __updateRenderPath() { }
1151
- __updateBoxBounds() { }
1152
- __scaleResize(_scaleX, _scaleY) { }
1153
- };
1154
- __decorate([
1155
- dataProcessor(PolygonData)
1156
- ], Polygon.prototype, "__", void 0);
1157
- __decorate([
1158
- pathType(3)
1159
- ], Polygon.prototype, "sides", void 0);
1160
- __decorate([
1161
- pathType()
1162
- ], Polygon.prototype, "points", void 0);
1163
- __decorate([
1164
- pathType(0)
1165
- ], Polygon.prototype, "curve", void 0);
1166
- __decorate([
1167
- rewrite(line.__updateRenderPath)
1168
- ], Polygon.prototype, "__updateRenderPath", null);
1169
- __decorate([
1170
- rewrite(line.__updateBoxBounds)
1171
- ], Polygon.prototype, "__updateBoxBounds", null);
1172
- __decorate([
1173
- rewrite(line.__scaleResize)
1174
- ], Polygon.prototype, "__scaleResize", null);
1175
- Polygon = __decorate([
1176
- rewriteAble(),
1177
- registerUI()
1178
- ], Polygon);
1179
-
1180
- const { sin, cos, PI } = Math;
1181
- const { moveTo, lineTo, closePath } = PathCommandDataHelper;
1182
- let Star = class Star extends UI {
1183
- get __tag() { return 'Star'; }
1184
- constructor(data) {
1185
- super(data);
1186
- }
1187
- __updatePath() {
1188
- const { width, height, corners, innerRadius } = this.__;
1189
- const rx = width / 2, ry = height / 2;
1190
- const path = this.__.path = [];
1191
- moveTo(path, rx, 0);
1192
- for (let i = 1; i < corners * 2; i++) {
1193
- lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin((i * PI) / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos((i * PI) / corners));
1194
- }
1195
- closePath(path);
1196
- }
1197
- };
1198
- __decorate([
1199
- dataProcessor(StarData)
1200
- ], Star.prototype, "__", void 0);
1201
- __decorate([
1202
- pathType(5)
1203
- ], Star.prototype, "corners", void 0);
1204
- __decorate([
1205
- pathType(0.382)
1206
- ], Star.prototype, "innerRadius", void 0);
1207
- Star = __decorate([
1208
- registerUI()
1209
- ], Star);
1210
-
1211
- let Image = class Image extends Rect {
1212
- get __tag() { return 'Image'; }
1213
- get ready() { return this.image ? this.image.ready : false; }
1214
- constructor(data) {
1215
- super(data);
1216
- this.on(ImageEvent.LOADED, (e) => {
1217
- if (e.attrName === 'fill' && e.attrValue.url === this.url)
1218
- this.image = e.image;
1219
- });
1220
- }
1221
- destroy() {
1222
- this.image = null;
1223
- super.destroy();
1224
- }
1225
- };
1226
- __decorate([
1227
- dataProcessor(ImageData)
1228
- ], Image.prototype, "__", void 0);
1229
- __decorate([
1230
- boundsType('')
1231
- ], Image.prototype, "url", void 0);
1232
- Image = __decorate([
1233
- registerUI()
1234
- ], Image);
1235
-
1236
- let Canvas = class Canvas extends Rect {
1237
- get __tag() { return 'Canvas'; }
1238
- constructor(data) {
1239
- super(data);
1240
- this.canvas = Creator.canvas(this.__);
1241
- this.context = this.canvas.context;
1242
- this.__.__drawAfterFill = true;
1243
- }
1244
- draw(ui, offset, scale, rotation) {
1245
- ui.__layout.update();
1246
- const matrix = new Matrix(ui.__world);
1247
- matrix.invert();
1248
- const m = new Matrix();
1249
- if (offset)
1250
- m.translate(offset.x, offset.y);
1251
- if (scale)
1252
- typeof scale === 'number' ? m.scale(scale) : m.scale(scale.x, scale.y);
1253
- if (rotation)
1254
- m.rotate(rotation);
1255
- matrix.multiplyParent(m);
1256
- ui.__render(this.canvas, { matrix });
1257
- this.paint();
1258
- }
1259
- paint() {
1260
- this.forceUpdate('fill');
1261
- }
1262
- __drawAfterFill(canvas, _options) {
1263
- const origin = this.canvas.view;
1264
- const { width, height } = this;
1265
- if (this.__.cornerRadius) {
1266
- canvas.save();
1267
- canvas.clip();
1268
- canvas.drawImage(this.canvas.view, 0, 0, origin.width, origin.height, 0, 0, width, height);
1269
- canvas.restore();
1270
- }
1271
- else {
1272
- canvas.drawImage(this.canvas.view, 0, 0, origin.width, origin.height, 0, 0, width, height);
1273
- }
1274
- }
1275
- __updateSize() {
1276
- const { canvas } = this;
1277
- if (canvas) {
1278
- const { smooth } = this.__;
1279
- if (canvas.smooth !== smooth)
1280
- canvas.smooth = smooth;
1281
- canvas.resize(this.__);
1282
- }
1283
- }
1284
- destroy() {
1285
- if (this.canvas) {
1286
- this.canvas.destroy();
1287
- this.canvas = null;
1288
- this.context = null;
1289
- }
1290
- super.destroy();
1291
- }
1292
- };
1293
- __decorate([
1294
- dataProcessor(ImageData)
1295
- ], Canvas.prototype, "__", void 0);
1296
- __decorate([
1297
- resizeType(100)
1298
- ], Canvas.prototype, "width", void 0);
1299
- __decorate([
1300
- resizeType(100)
1301
- ], Canvas.prototype, "height", void 0);
1302
- __decorate([
1303
- resizeType(Platform.devicePixelRatio)
1304
- ], Canvas.prototype, "pixelRatio", void 0);
1305
- __decorate([
1306
- resizeType(true)
1307
- ], Canvas.prototype, "smooth", void 0);
1308
- __decorate([
1309
- hitType('all')
1310
- ], Canvas.prototype, "hitFill", void 0);
1311
- Canvas = __decorate([
1312
- registerUI()
1313
- ], Canvas);
1314
-
1315
- const { copyAndSpread, includes, spread, setList } = BoundsHelper;
1316
- let Text = class Text extends UI {
1317
- get __tag() { return 'Text'; }
1318
- get textDrawData() {
1319
- this.__layout.update();
1320
- return this.__.__textDrawData;
1321
- }
1322
- constructor(data) {
1323
- super(data);
1324
- }
1325
- __drawHitPath(canvas) {
1326
- const { __lineHeight, __baseLine, __textDrawData: data } = this.__;
1327
- canvas.beginPath();
1328
- if (this.__.__letterSpacing < 0) {
1329
- this.__drawPathByData(canvas);
1330
- }
1331
- else {
1332
- data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight));
1333
- }
1334
- }
1335
- __drawPathByData(drawer, _data) {
1336
- const { x, y, width, height } = this.__layout.boxBounds;
1337
- drawer.rect(x, y, width, height);
1338
- }
1339
- __drawRenderPath(canvas) {
1340
- canvas.font = this.__.__font;
1341
- }
1342
- __updateTextDrawData() {
1343
- const data = this.__;
1344
- data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
1345
- }
1346
- __updateBoxBounds() {
1347
- const data = this.__;
1348
- const layout = this.__layout;
1349
- const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
1350
- const autoWidth = data.__autoWidth;
1351
- const autoHeight = data.__autoHeight;
1352
- data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
1353
- data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
1354
- data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
1355
- data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
1356
- data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
1357
- data.__clipText = textOverflow !== 'show' && !data.__autoBounds;
1358
- this.__updateTextDrawData();
1359
- const { bounds } = data.__textDrawData;
1360
- const b = layout.boxBounds;
1361
- if (data.__lineHeight < fontSize)
1362
- spread(bounds, fontSize / 2);
1363
- if (autoWidth || autoHeight) {
1364
- b.x = autoWidth ? bounds.x : 0;
1365
- b.y = autoHeight ? bounds.y : 0;
1366
- b.width = autoWidth ? bounds.width : data.width;
1367
- b.height = autoHeight ? bounds.height : data.height;
1368
- if (padding) {
1369
- const [top, right, bottom, left] = data.__padding;
1370
- if (autoWidth) {
1371
- b.x -= left;
1372
- b.width += (right + left);
1373
- }
1374
- if (autoHeight) {
1375
- b.y -= top;
1376
- b.height += (bottom + top);
1377
- }
1378
- }
1379
- this.__updateNaturalSize();
1380
- }
1381
- else {
1382
- super.__updateBoxBounds();
1383
- }
1384
- const contentBounds = includes(b, bounds) ? b : bounds;
1385
- if (contentBounds !== layout.contentBounds) {
1386
- layout.contentBounds = contentBounds;
1387
- layout.renderChanged = true;
1388
- setList(data.__textBoxBounds = {}, [b, bounds]);
1389
- }
1390
- else {
1391
- data.__textBoxBounds = contentBounds;
1392
- }
1393
- }
1394
- __updateRenderSpread() {
1395
- let width = super.__updateRenderSpread();
1396
- if (!width)
1397
- width = this.__layout.boxBounds === this.__layout.contentBounds ? 0 : 1;
1398
- return width;
1399
- }
1400
- __updateRenderBounds() {
1401
- copyAndSpread(this.__layout.renderBounds, this.__.__textBoxBounds, this.__layout.renderSpread);
1402
- }
1403
- };
1404
- __decorate([
1405
- dataProcessor(TextData)
1406
- ], Text.prototype, "__", void 0);
1407
- __decorate([
1408
- boundsType(0)
1409
- ], Text.prototype, "width", void 0);
1410
- __decorate([
1411
- boundsType(0)
1412
- ], Text.prototype, "height", void 0);
1413
- __decorate([
1414
- boundsType(0)
1415
- ], Text.prototype, "padding", void 0);
1416
- __decorate([
1417
- surfaceType('#000000')
1418
- ], Text.prototype, "fill", void 0);
1419
- __decorate([
1420
- affectStrokeBoundsType('outside')
1421
- ], Text.prototype, "strokeAlign", void 0);
1422
- __decorate([
1423
- hitType('all')
1424
- ], Text.prototype, "hitFill", void 0);
1425
- __decorate([
1426
- boundsType('')
1427
- ], Text.prototype, "text", void 0);
1428
- __decorate([
1429
- boundsType('L')
1430
- ], Text.prototype, "fontFamily", void 0);
1431
- __decorate([
1432
- boundsType(12)
1433
- ], Text.prototype, "fontSize", void 0);
1434
- __decorate([
1435
- boundsType('normal')
1436
- ], Text.prototype, "fontWeight", void 0);
1437
- __decorate([
1438
- boundsType(false)
1439
- ], Text.prototype, "italic", void 0);
1440
- __decorate([
1441
- boundsType('none')
1442
- ], Text.prototype, "textCase", void 0);
1443
- __decorate([
1444
- boundsType('none')
1445
- ], Text.prototype, "textDecoration", void 0);
1446
- __decorate([
1447
- boundsType(0)
1448
- ], Text.prototype, "letterSpacing", void 0);
1449
- __decorate([
1450
- boundsType({ type: 'percent', value: 150 })
1451
- ], Text.prototype, "lineHeight", void 0);
1452
- __decorate([
1453
- boundsType(0)
1454
- ], Text.prototype, "paraIndent", void 0);
1455
- __decorate([
1456
- boundsType(0)
1457
- ], Text.prototype, "paraSpacing", void 0);
1458
- __decorate([
1459
- boundsType('left')
1460
- ], Text.prototype, "textAlign", void 0);
1461
- __decorate([
1462
- boundsType('top')
1463
- ], Text.prototype, "verticalAlign", void 0);
1464
- __decorate([
1465
- boundsType('normal')
1466
- ], Text.prototype, "textWrap", void 0);
1467
- __decorate([
1468
- boundsType('show')
1469
- ], Text.prototype, "textOverflow", void 0);
1470
- Text = __decorate([
1471
- registerUI()
1472
- ], Text);
1473
-
1474
- const { toBounds } = PathBounds;
1475
- let Path = class Path extends UI {
1476
- get __tag() { return 'Path'; }
1477
- constructor(data) {
1478
- super(data);
1479
- }
1480
- __scaleResize(scaleX, scaleY) {
1481
- PathScaler.scale(this.__.path, scaleX, scaleY);
1482
- this.path = this.__.path;
1483
- }
1484
- __updateBoxBounds() {
1485
- toBounds(this.__.path, this.__layout.boxBounds);
1486
- }
1487
- };
1488
- __decorate([
1489
- dataProcessor(PathData)
1490
- ], Path.prototype, "__", void 0);
1491
- __decorate([
1492
- pathType()
1493
- ], Path.prototype, "path", void 0);
1494
- __decorate([
1495
- pathType()
1496
- ], Path.prototype, "windingRule", void 0);
1497
- __decorate([
1498
- affectStrokeBoundsType('center')
1499
- ], Path.prototype, "strokeAlign", void 0);
1500
- Path = __decorate([
1501
- registerUI()
1502
- ], Path);
1503
-
1504
- let Pen = class Pen extends Group {
1505
- get __tag() { return 'Pen'; }
1506
- constructor(data) {
1507
- super(data);
1508
- }
1509
- setStyle(data) {
1510
- const path = this.pathElement = new Path(data);
1511
- this.pathStyle = data;
1512
- this.path = path.path || (path.path = []);
1513
- this.add(path);
1514
- return this;
1515
- }
1516
- beginPath() {
1517
- this.path.length = 0;
1518
- this.paint();
1519
- return this;
1520
- }
1521
- moveTo(_x, _y) { return this; }
1522
- lineTo(_x, _y) { return this; }
1523
- bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
1524
- quadraticCurveTo(_x1, _y1, _x, _y) { return this; }
1525
- closePath() { return this; }
1526
- rect(_x, _y, _width, _height) { return this; }
1527
- roundRect(_x, _y, _width, _height, _cornerRadius) { return this; }
1528
- ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { return this; }
1529
- arc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) { return this; }
1530
- arcTo(_x1, _y1, _x2, _y2, _radius) { return this; }
1531
- drawEllipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { return this; }
1532
- drawArc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) { return this; }
1533
- drawPoints(_points, _curve, _close) { return this; }
1534
- paint() {
1535
- this.pathElement.forceUpdate('path');
1536
- }
1537
- clear() {
1538
- this.removeAll(true);
1539
- }
1540
- };
1541
- __decorate([
1542
- dataProcessor(PenData)
1543
- ], Pen.prototype, "__", void 0);
1544
- Pen = __decorate([
1545
- useModule(PathCreator, ['beginPath']),
1546
- registerUI()
1547
- ], Pen);
1548
-
1549
- const debug = Debug.get('Leafer');
1550
- let Leafer = class Leafer extends Group {
1551
- get __tag() { return 'Leafer'; }
1552
- get isApp() { return false; }
1553
- get app() { return this.parent || this; }
1554
- get imageReady() { return this.viewReady && ImageManager.isComplete; }
1555
- get layoutLocked() { return !this.layouter.running; }
1556
- get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
1557
- constructor(userConfig, data) {
1558
- super(data);
1559
- this.zoomLayer = this;
1560
- this.config = {
1561
- type: 'design',
1562
- start: true,
1563
- hittable: true,
1564
- smooth: true,
1565
- zoom: {
1566
- min: 0.02,
1567
- max: 256
1568
- },
1569
- move: {
1570
- holdSpaceKey: true,
1571
- dragOut: true,
1572
- autoDistance: 2
1573
- }
1574
- };
1575
- this.leafs = 0;
1576
- this.__eventIds = [];
1577
- this.__controllers = [];
1578
- this.__readyWait = [];
1579
- this.__viewReadyWait = [];
1580
- this.__viewCompletedWait = [];
1581
- this.__nextRenderWait = [];
1582
- this.userConfig = userConfig;
1583
- if (userConfig && (userConfig.view || userConfig.width))
1584
- this.init(userConfig);
1585
- }
1586
- init(userConfig, parentApp) {
1587
- if (this.canvas)
1588
- return;
1589
- this.__setLeafer(this);
1590
- if (userConfig)
1591
- DataHelper.assign(this.config, userConfig);
1592
- let start;
1593
- const { config } = this;
1594
- LeaferTypeCreator.run(config.type, this);
1595
- this.canvas = Creator.canvas(config);
1596
- this.__controllers.push(this.renderer = Creator.renderer(this, this.canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
1597
- if (this.isApp)
1598
- this.__setApp();
1599
- this.__checkAutoLayout(config);
1600
- this.view = this.canvas.view;
1601
- if (parentApp) {
1602
- this.__bindApp(parentApp);
1603
- start = parentApp.running;
1604
- }
1605
- else {
1606
- this.selector = Creator.selector(this);
1607
- this.__controllers.unshift(this.interaction = Creator.interaction(this, this.canvas, this.selector, config));
1608
- this.canvasManager = new CanvasManager();
1609
- this.hitCanvasManager = new HitCanvasManager();
1610
- start = config.start;
1611
- }
1612
- this.hittable = config.hittable;
1613
- this.fill = config.fill;
1614
- this.canvasManager.add(this.canvas);
1615
- this.__listenEvents();
1616
- if (start)
1617
- this.__startTimer = setTimeout(this.start.bind(this));
1618
- PluginManager.onLeafer(this);
1619
- }
1620
- set(data) {
1621
- if (!this.children) {
1622
- setTimeout(() => {
1623
- super.set(data);
1624
- });
1625
- }
1626
- else {
1627
- super.set(data);
1628
- }
1629
- }
1630
- start() {
1631
- clearTimeout(this.__startTimer);
1632
- if (!this.running && this.canvas) {
1633
- this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
1634
- this.__controllers.forEach(item => item.start());
1635
- if (!this.isApp)
1636
- this.renderer.render();
1637
- this.running = true;
1638
- }
1639
- }
1640
- stop() {
1641
- clearTimeout(this.__startTimer);
1642
- if (this.running && this.canvas) {
1643
- this.__controllers.forEach(item => item.stop());
1644
- this.running = false;
1645
- this.emitLeafer(LeaferEvent.STOP);
1646
- }
1647
- }
1648
- unlockLayout() {
1649
- this.layouter.start();
1650
- this.updateLayout();
1651
- }
1652
- lockLayout() {
1653
- this.updateLayout();
1654
- this.layouter.stop();
1655
- }
1656
- resize(size) {
1657
- const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
1658
- Object.keys(data).forEach(key => this[key] = data[key]);
1659
- }
1660
- forceFullRender() {
1661
- this.renderer.addBlock(this.canvas.bounds);
1662
- if (this.viewReady)
1663
- this.renderer.update();
1664
- }
1665
- updateCursor() {
1666
- if (this.interaction)
1667
- this.interaction.updateCursor();
1668
- }
1669
- __doResize(size) {
1670
- if (!this.canvas || this.canvas.isSameSize(size))
1671
- return;
1672
- const old = DataHelper.copyAttrs({}, this.canvas, canvasSizeAttrs);
1673
- this.canvas.resize(size);
1674
- this.__onResize(new ResizeEvent(size, old));
1675
- }
1676
- __onResize(event) {
1677
- this.emitEvent(event);
1678
- DataHelper.copyAttrs(this.__, event, canvasSizeAttrs);
1679
- setTimeout(() => { if (this.canvasManager)
1680
- this.canvasManager.clearRecycled(); }, 0);
1681
- }
1682
- __setApp() { }
1683
- __bindApp(app) {
1684
- this.selector = app.selector;
1685
- this.interaction = app.interaction;
1686
- this.canvasManager = app.canvasManager;
1687
- this.hitCanvasManager = app.hitCanvasManager;
1688
- }
1689
- __setLeafer(leafer) {
1690
- this.leafer = leafer;
1691
- this.isLeafer = !!leafer;
1692
- this.__level = 1;
1693
- }
1694
- setZoomLayer(zoomLayer) {
1695
- this.zoomLayer = zoomLayer;
1696
- }
1697
- __checkAutoLayout(config) {
1698
- if (!config.width || !config.height) {
1699
- this.autoLayout = new AutoBounds(config);
1700
- this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
1701
- }
1702
- }
1703
- __setAttr(attrName, newValue) {
1704
- if (this.canvas) {
1705
- if (canvasSizeAttrs.includes(attrName)) {
1706
- this.__changeCanvasSize(attrName, newValue);
1707
- }
1708
- else if (attrName === 'fill') {
1709
- this.__changeFill(newValue);
1710
- }
1711
- else if (attrName === 'hittable') {
1712
- this.canvas.hittable = newValue;
1713
- }
1714
- }
1715
- super.__setAttr(attrName, newValue);
1716
- }
1717
- __getAttr(attrName) {
1718
- if (this.canvas && canvasSizeAttrs.includes(attrName))
1719
- return this.canvas[attrName];
1720
- return super.__getAttr(attrName);
1721
- }
1722
- __changeCanvasSize(attrName, newValue) {
1723
- const data = DataHelper.copyAttrs({}, this.canvas, canvasSizeAttrs);
1724
- data[attrName] = this.config[attrName] = newValue;
1725
- if (newValue)
1726
- this.canvas.stopAutoLayout();
1727
- this.__doResize(data);
1728
- }
1729
- __changeFill(newValue) {
1730
- this.config.fill = newValue;
1731
- if (this.canvas.allowBackgroundColor) {
1732
- this.canvas.backgroundColor = newValue;
1733
- }
1734
- else {
1735
- this.forceFullRender();
1736
- }
1737
- }
1738
- __onCreated() {
1739
- this.created = true;
1740
- }
1741
- __onReady() {
1742
- if (this.ready)
1743
- return;
1744
- this.ready = true;
1745
- this.emitLeafer(LeaferEvent.BEFORE_READY);
1746
- this.emitLeafer(LeaferEvent.READY);
1747
- this.emitLeafer(LeaferEvent.AFTER_READY);
1748
- WaitHelper.run(this.__readyWait);
1749
- }
1750
- __onViewReady() {
1751
- if (this.viewReady)
1752
- return;
1753
- this.viewReady = true;
1754
- this.emitLeafer(LeaferEvent.VIEW_READY);
1755
- WaitHelper.run(this.__viewReadyWait);
1756
- }
1757
- __onAnimateFrame() {
1758
- if (this.viewReady) {
1759
- if (this.__nextRenderWait.length)
1760
- WaitHelper.run(this.__nextRenderWait);
1761
- const { imageReady } = this;
1762
- if (imageReady && !this.viewCompleted)
1763
- this.__checkViewCompleted();
1764
- if (!imageReady)
1765
- this.viewCompleted = false;
1766
- }
1767
- }
1768
- __checkViewCompleted(emit = true) {
1769
- this.nextRender(() => {
1770
- if (this.imageReady) {
1771
- if (emit)
1772
- this.emitLeafer(LeaferEvent.VIEW_COMPLETED);
1773
- WaitHelper.run(this.__viewCompletedWait);
1774
- this.viewCompleted = true;
1775
- }
1776
- });
1777
- }
1778
- __onWatchData() {
1779
- if (this.watcher.childrenChanged && this.interaction) {
1780
- this.nextRender(() => this.interaction.updateCursor());
1781
- }
1782
- }
1783
- waitReady(item) {
1784
- this.ready ? item() : this.__readyWait.push(item);
1785
- }
1786
- waitViewReady(item) {
1787
- this.viewReady ? item() : this.__viewReadyWait.push(item);
1788
- }
1789
- waitViewCompleted(item) {
1790
- this.__viewCompletedWait.push(item);
1791
- if (this.viewCompleted) {
1792
- this.__checkViewCompleted(false);
1793
- }
1794
- else {
1795
- if (!this.running)
1796
- this.start();
1797
- }
1798
- }
1799
- nextRender(item) {
1800
- this.__nextRenderWait.push(item);
1801
- }
1802
- __checkUpdateLayout() {
1803
- this.__layout.update();
1804
- }
1805
- emitLeafer(type) {
1806
- this.emitEvent(new LeaferEvent(type, this));
1807
- }
1808
- __listenEvents() {
1809
- const runId = Run.start('FirstCreate ' + this.innerName);
1810
- this.once(LeaferEvent.START, () => Run.end(runId));
1811
- this.once(LayoutEvent.END, () => this.__onReady());
1812
- this.once(RenderEvent.START, () => this.__onCreated());
1813
- this.once(RenderEvent.END, () => this.__onViewReady());
1814
- this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(AnimateEvent.FRAME, this.__onAnimateFrame, this), this.on_(LayoutEvent.CHECK_UPDATE, this.__checkUpdateLayout, this));
1815
- }
1816
- __removeListenEvents() {
1817
- this.off_(this.__eventIds);
1818
- this.__eventIds.length = 0;
1819
- }
1820
- destroy() {
1821
- setTimeout(() => {
1822
- if (!this.destroyed) {
1823
- try {
1824
- this.stop();
1825
- this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
1826
- this.__removeListenEvents();
1827
- this.__controllers.forEach(item => {
1828
- if (!(this.parent && item === this.interaction))
1829
- item.destroy();
1830
- });
1831
- this.__controllers.length = 0;
1832
- if (!this.parent) {
1833
- this.selector.destroy();
1834
- this.canvasManager.destroy();
1835
- this.hitCanvasManager.destroy();
1836
- }
1837
- this.canvas.destroy();
1838
- this.config.view = this.view = null;
1839
- if (this.userConfig)
1840
- this.userConfig.view = null;
1841
- super.destroy();
1842
- setTimeout(() => { ImageManager.clearRecycled(); }, 100);
1843
- }
1844
- catch (e) {
1845
- debug.error(e);
1846
- }
1847
- }
1848
- });
1849
- }
1850
- };
1851
- __decorate([
1852
- dataProcessor(LeaferData)
1853
- ], Leafer.prototype, "__", void 0);
1854
- __decorate([
1855
- boundsType()
1856
- ], Leafer.prototype, "pixelRatio", void 0);
1857
- Leafer = __decorate([
1858
- registerUI()
1859
- ], Leafer);
1860
-
1861
- let App = class App extends Leafer {
1862
- get __tag() { return 'App'; }
1863
- get isApp() { return true; }
1864
- constructor(userConfig, data) {
1865
- super(userConfig, data);
1866
- if (userConfig) {
1867
- const { ground, tree, sky, editor } = userConfig;
1868
- if (ground)
1869
- this.ground = this.addLeafer(ground);
1870
- if (tree || editor)
1871
- this.tree = this.addLeafer(tree);
1872
- if (sky || editor)
1873
- this.sky = this.addLeafer(sky || { type: 'draw', usePartRender: false });
1874
- if (editor) {
1875
- this.editor = Creator.editor(editor);
1876
- this.sky.add(this.editor);
1877
- }
1878
- }
1879
- }
1880
- __setApp() {
1881
- const { canvas } = this;
1882
- const { realCanvas, view } = this.config;
1883
- if (realCanvas || view === this.canvas.view || !canvas.parentView) {
1884
- this.realCanvas = true;
1885
- }
1886
- else {
1887
- canvas.unrealCanvas();
1888
- }
1889
- this.leafer = this;
1890
- this.watcher.disable();
1891
- this.layouter.disable();
1892
- this.__eventIds.push(this.on_(PropertyEvent.CHANGE, this.__onPropertyChange, this));
1893
- }
1894
- start() {
1895
- super.start();
1896
- this.children.forEach(leafer => leafer.start());
1897
- }
1898
- stop() {
1899
- this.children.forEach(leafer => leafer.stop());
1900
- super.stop();
1901
- }
1902
- unlockLayout() {
1903
- super.unlockLayout();
1904
- this.children.forEach(leafer => leafer.unlockLayout());
1905
- }
1906
- lockLayout() {
1907
- super.lockLayout();
1908
- this.children.forEach(leafer => leafer.lockLayout());
1909
- }
1910
- addLeafer(merge) {
1911
- const leafer = new Leafer(merge);
1912
- this.add(leafer);
1913
- return leafer;
1914
- }
1915
- add(leafer) {
1916
- if (!leafer.view) {
1917
- if (this.realCanvas && !this.canvas.bounds) {
1918
- setTimeout(() => this.add(leafer), 10);
1919
- return;
1920
- }
1921
- leafer.init(this.__getChildConfig(leafer.userConfig), this);
1922
- }
1923
- super.add(leafer);
1924
- this.__listenChildEvents(leafer);
1925
- }
1926
- __onPropertyChange() {
1927
- if (Debug.showHitView)
1928
- this.children.forEach(leafer => leafer.forceUpdate('surface'));
1929
- }
1930
- __onCreated() {
1931
- this.created = this.children.every(child => child.created);
1932
- }
1933
- __onReady() {
1934
- if (this.children.every(child => child.ready))
1935
- super.__onReady();
1936
- }
1937
- __onViewReady() {
1938
- if (this.children.every(child => child.viewReady))
1939
- super.__onViewReady();
1940
- }
1941
- __onChildRenderEnd(e) {
1942
- this.renderer.addBlock(e.renderBounds);
1943
- if (this.viewReady)
1944
- this.renderer.update();
1945
- }
1946
- __render(canvas, _options) {
1947
- this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
1948
- }
1949
- __onResize(event) {
1950
- this.children.forEach(leafer => leafer.resize(event));
1951
- super.__onResize(event);
1952
- }
1953
- __checkUpdateLayout() {
1954
- this.children.forEach(leafer => leafer.__layout.update());
1955
- }
1956
- __getChildConfig(userConfig) {
1957
- let config = Object.assign({}, this.config);
1958
- config.hittable = config.realCanvas = undefined;
1959
- if (userConfig)
1960
- DataHelper.assign(config, userConfig);
1961
- if (this.autoLayout)
1962
- DataHelper.copyAttrs(config, this, canvasSizeAttrs);
1963
- config.view = this.realCanvas ? undefined : this.view;
1964
- config.fill = undefined;
1965
- return config;
1966
- }
1967
- __listenChildEvents(leafer) {
1968
- leafer.once(LayoutEvent.END, () => this.__onReady());
1969
- leafer.once(RenderEvent.START, () => this.__onCreated());
1970
- leafer.once(RenderEvent.END, () => this.__onViewReady());
1971
- if (this.realCanvas)
1972
- this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
1973
- }
1974
- };
1975
- App = __decorate([
1976
- registerUI()
1977
- ], App);
1978
-
1979
- export { Animate, App, ArrowData, Box, BoxData, Canvas, CanvasData, ColorConvert, Effect, Ellipse, EllipseData, Export, Frame, FrameData, Group, GroupData, Image, ImageData, Leafer, LeaferData, LeaferTypeCreator, Line, LineData, Paint, Path, PathData, Pen, PenData, Polygon, PolygonData, Rect, RectData, RectRender, Star, StarData, Text, TextConvert, TextData, UI, UIBounds, UIData, UIHit, UIRender, UnitConvert, effectType, resizeType };