@leafer-ui/draw 1.7.0 → 1.9.0

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