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