@leafer/worker 1.9.11 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.js +590 -528
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +614 -546
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +23 -23
package/dist/worker.js
CHANGED
|
@@ -1,42 +1,5 @@
|
|
|
1
1
|
var LeaferUI = function(exports) {
|
|
2
2
|
"use strict";
|
|
3
|
-
const Platform = {
|
|
4
|
-
toURL(text, fileType) {
|
|
5
|
-
let url = encodeURIComponent(text);
|
|
6
|
-
if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
|
|
7
|
-
return url;
|
|
8
|
-
},
|
|
9
|
-
image: {
|
|
10
|
-
hitCanvasSize: 100,
|
|
11
|
-
maxCacheSize: 2560 * 1600,
|
|
12
|
-
maxPatternSize: 4096 * 2160,
|
|
13
|
-
crossOrigin: "anonymous",
|
|
14
|
-
getRealURL(url) {
|
|
15
|
-
const {prefix: prefix, suffix: suffix} = Platform.image;
|
|
16
|
-
if (suffix && !url.startsWith("data:") && !url.startsWith("blob:")) url += (url.includes("?") ? "&" : "?") + suffix;
|
|
17
|
-
if (prefix && url[0] === "/") url = prefix + url;
|
|
18
|
-
return url;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const IncrementId = {
|
|
23
|
-
RUNTIME: "runtime",
|
|
24
|
-
LEAF: "leaf",
|
|
25
|
-
TASK: "task",
|
|
26
|
-
CNAVAS: "canvas",
|
|
27
|
-
IMAGE: "image",
|
|
28
|
-
types: {},
|
|
29
|
-
create(typeName) {
|
|
30
|
-
const {types: types} = I$2;
|
|
31
|
-
if (types[typeName]) {
|
|
32
|
-
return types[typeName]++;
|
|
33
|
-
} else {
|
|
34
|
-
types[typeName] = 1;
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const I$2 = IncrementId;
|
|
40
3
|
exports.Answer = void 0;
|
|
41
4
|
(function(Answer) {
|
|
42
5
|
Answer[Answer["No"] = 0] = "No";
|
|
@@ -54,7 +17,7 @@ var LeaferUI = function(exports) {
|
|
|
54
17
|
function isString(value) {
|
|
55
18
|
return typeof value === "string";
|
|
56
19
|
}
|
|
57
|
-
const {isFinite: isFinite} = Number;
|
|
20
|
+
const {isFinite: isFinite$1} = Number;
|
|
58
21
|
function isNumber(value) {
|
|
59
22
|
return typeof value === "number";
|
|
60
23
|
}
|
|
@@ -229,8 +192,74 @@ var LeaferUI = function(exports) {
|
|
|
229
192
|
this.__input = this.__middle = null;
|
|
230
193
|
}
|
|
231
194
|
}
|
|
195
|
+
const {floor: floor$3, max: max$6} = Math;
|
|
196
|
+
const Platform = {
|
|
197
|
+
toURL(text, fileType) {
|
|
198
|
+
let url = encodeURIComponent(text);
|
|
199
|
+
if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
|
|
200
|
+
return url;
|
|
201
|
+
},
|
|
202
|
+
image: {
|
|
203
|
+
hitCanvasSize: 100,
|
|
204
|
+
maxCacheSize: 2560 * 1600,
|
|
205
|
+
maxPatternSize: 4096 * 2160,
|
|
206
|
+
crossOrigin: "anonymous",
|
|
207
|
+
isLarge(size, scaleX, scaleY, largeSize) {
|
|
208
|
+
return size.width * size.height * (scaleX ? scaleX * scaleY : 1) > (largeSize || image$1.maxCacheSize);
|
|
209
|
+
},
|
|
210
|
+
isSuperLarge(size, scaleX, scaleY) {
|
|
211
|
+
return image$1.isLarge(size, scaleX, scaleY, image$1.maxPatternSize);
|
|
212
|
+
},
|
|
213
|
+
getRealURL(url) {
|
|
214
|
+
const {prefix: prefix, suffix: suffix} = Platform.image;
|
|
215
|
+
if (suffix && !url.startsWith("data:") && !url.startsWith("blob:")) url += (url.includes("?") ? "&" : "?") + suffix;
|
|
216
|
+
if (prefix && url[0] === "/") url = prefix + url;
|
|
217
|
+
return url;
|
|
218
|
+
},
|
|
219
|
+
resize(image, width, height, xGap, yGap, clip, smooth, opacity, _filters) {
|
|
220
|
+
const canvas = Platform.origin.createCanvas(max$6(floor$3(width + (xGap || 0)), 1), max$6(floor$3(height + (yGap || 0)), 1));
|
|
221
|
+
const ctx = canvas.getContext("2d");
|
|
222
|
+
if (opacity) ctx.globalAlpha = opacity;
|
|
223
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
224
|
+
if (clip) {
|
|
225
|
+
const scaleX = width / clip.width, scaleY = height / clip.height;
|
|
226
|
+
ctx.setTransform(scaleX, 0, 0, scaleY, -clip.x * scaleX, -clip.y * scaleY);
|
|
227
|
+
ctx.drawImage(image, 0, 0, image.width, image.height);
|
|
228
|
+
} else ctx.drawImage(image, 0, 0, width, height);
|
|
229
|
+
return canvas;
|
|
230
|
+
},
|
|
231
|
+
setPatternTransform(pattern, transform, paint) {
|
|
232
|
+
try {
|
|
233
|
+
if (transform && pattern.setTransform) {
|
|
234
|
+
pattern.setTransform(transform);
|
|
235
|
+
transform = undefined;
|
|
236
|
+
}
|
|
237
|
+
} catch (_a) {}
|
|
238
|
+
if (paint) DataHelper.stintSet(paint, "transform", transform);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const {image: image$1} = Platform;
|
|
243
|
+
const IncrementId = {
|
|
244
|
+
RUNTIME: "runtime",
|
|
245
|
+
LEAF: "leaf",
|
|
246
|
+
TASK: "task",
|
|
247
|
+
CNAVAS: "canvas",
|
|
248
|
+
IMAGE: "image",
|
|
249
|
+
types: {},
|
|
250
|
+
create(typeName) {
|
|
251
|
+
const {types: types} = I$2;
|
|
252
|
+
if (types[typeName]) {
|
|
253
|
+
return types[typeName]++;
|
|
254
|
+
} else {
|
|
255
|
+
types[typeName] = 1;
|
|
256
|
+
return 0;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
const I$2 = IncrementId;
|
|
232
261
|
let tempA, tempB, tempTo;
|
|
233
|
-
const {max: max$
|
|
262
|
+
const {max: max$5} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
234
263
|
const FourNumberHelper = {
|
|
235
264
|
zero: [ ...tempFour ],
|
|
236
265
|
tempFour: tempFour,
|
|
@@ -281,9 +310,9 @@ var LeaferUI = function(exports) {
|
|
|
281
310
|
return data;
|
|
282
311
|
},
|
|
283
312
|
max(t, other, change) {
|
|
284
|
-
if (isNumber(t) && isNumber(other)) return max$
|
|
313
|
+
if (isNumber(t) && isNumber(other)) return max$5(t, other);
|
|
285
314
|
toTempAB(t, other, change);
|
|
286
|
-
return set$2(tempTo, max$
|
|
315
|
+
return set$2(tempTo, max$5(tempA[0], tempB[0]), max$5(tempA[1], tempB[1]), max$5(tempA[2], tempB[2]), max$5(tempA[3], tempB[3]));
|
|
287
316
|
},
|
|
288
317
|
add(t, other, change) {
|
|
289
318
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
@@ -298,7 +327,7 @@ var LeaferUI = function(exports) {
|
|
|
298
327
|
}
|
|
299
328
|
};
|
|
300
329
|
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
301
|
-
const {round: round$6, pow: pow$2, PI: PI$4} = Math;
|
|
330
|
+
const {round: round$6, pow: pow$2, max: max$4, floor: floor$2, PI: PI$4} = Math;
|
|
302
331
|
const MathHelper = {
|
|
303
332
|
within(value, min, max) {
|
|
304
333
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -350,6 +379,9 @@ var LeaferUI = function(exports) {
|
|
|
350
379
|
scaleData.scaleY = scale.y;
|
|
351
380
|
}
|
|
352
381
|
},
|
|
382
|
+
getFloorScale(num, min = 1) {
|
|
383
|
+
return max$4(floor$2(num), min) / num;
|
|
384
|
+
},
|
|
353
385
|
randInt: randInt,
|
|
354
386
|
randColor(opacity) {
|
|
355
387
|
return `rgba(${randInt(255)},${randInt(255)},${randInt(255)},${opacity || 1})`;
|
|
@@ -1141,7 +1173,7 @@ var LeaferUI = function(exports) {
|
|
|
1141
1173
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
|
|
1142
1174
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1143
1175
|
const {float: float$2, fourNumber: fourNumber$1} = MathHelper;
|
|
1144
|
-
const {floor: floor$
|
|
1176
|
+
const {floor: floor$1, ceil: ceil$2} = Math;
|
|
1145
1177
|
let right$4, bottom$3, boundsRight, boundsBottom;
|
|
1146
1178
|
const point$2 = {};
|
|
1147
1179
|
const toPoint$5 = {};
|
|
@@ -1228,20 +1260,20 @@ var LeaferUI = function(exports) {
|
|
|
1228
1260
|
toOuterOf(t, matrix, to) {
|
|
1229
1261
|
to || (to = t);
|
|
1230
1262
|
if (matrix.b === 0 && matrix.c === 0) {
|
|
1231
|
-
const {a: a, d: d} = matrix;
|
|
1263
|
+
const {a: a, d: d, e: e, f: f} = matrix;
|
|
1232
1264
|
if (a > 0) {
|
|
1233
1265
|
to.width = t.width * a;
|
|
1234
|
-
to.x =
|
|
1266
|
+
to.x = e + t.x * a;
|
|
1235
1267
|
} else {
|
|
1236
1268
|
to.width = t.width * -a;
|
|
1237
|
-
to.x =
|
|
1269
|
+
to.x = e + t.x * a - to.width;
|
|
1238
1270
|
}
|
|
1239
1271
|
if (d > 0) {
|
|
1240
1272
|
to.height = t.height * d;
|
|
1241
|
-
to.y =
|
|
1273
|
+
to.y = f + t.y * d;
|
|
1242
1274
|
} else {
|
|
1243
1275
|
to.height = t.height * -d;
|
|
1244
|
-
to.y =
|
|
1276
|
+
to.y = f + t.y * d - to.height;
|
|
1245
1277
|
}
|
|
1246
1278
|
} else {
|
|
1247
1279
|
point$2.x = t.x;
|
|
@@ -1293,10 +1325,10 @@ var LeaferUI = function(exports) {
|
|
|
1293
1325
|
},
|
|
1294
1326
|
ceil(t) {
|
|
1295
1327
|
const {x: x, y: y} = t;
|
|
1296
|
-
t.x = floor$
|
|
1297
|
-
t.y = floor$
|
|
1298
|
-
t.width = x > t.x ? ceil$
|
|
1299
|
-
t.height = y > t.y ? ceil$
|
|
1328
|
+
t.x = floor$1(t.x);
|
|
1329
|
+
t.y = floor$1(t.y);
|
|
1330
|
+
t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
|
|
1331
|
+
t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
|
|
1300
1332
|
},
|
|
1301
1333
|
unsign(t) {
|
|
1302
1334
|
if (t.width < 0) {
|
|
@@ -2417,7 +2449,7 @@ var LeaferUI = function(exports) {
|
|
|
2417
2449
|
data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
|
|
2418
2450
|
}
|
|
2419
2451
|
};
|
|
2420
|
-
const {sin: sin$4, cos: cos$4, hypot: hypot, atan2: atan2$1, ceil: ceil$
|
|
2452
|
+
const {sin: sin$4, cos: cos$4, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$9, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
|
|
2421
2453
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2422
2454
|
const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2423
2455
|
const {M: M$a, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
|
|
@@ -2520,7 +2552,7 @@ var LeaferUI = function(exports) {
|
|
|
2520
2552
|
let totalRadian = endRadian - startRadian;
|
|
2521
2553
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2522
2554
|
if (anticlockwise) totalRadian -= PI2;
|
|
2523
|
-
const parts = ceil$
|
|
2555
|
+
const parts = ceil$1(abs$9(totalRadian / PI_2));
|
|
2524
2556
|
const partRadian = totalRadian / parts;
|
|
2525
2557
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
2526
2558
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
|
|
@@ -3480,7 +3512,9 @@ var LeaferUI = function(exports) {
|
|
|
3480
3512
|
run() {
|
|
3481
3513
|
return __awaiter(this, void 0, void 0, function*() {
|
|
3482
3514
|
try {
|
|
3483
|
-
if (this.
|
|
3515
|
+
if (this.isComplete) return;
|
|
3516
|
+
if (this.canUse && !this.canUse()) return this.cancel();
|
|
3517
|
+
if (this.task && this.parent.running) yield this.task();
|
|
3484
3518
|
} catch (error) {
|
|
3485
3519
|
debug$c.error(error);
|
|
3486
3520
|
}
|
|
@@ -3488,8 +3522,7 @@ var LeaferUI = function(exports) {
|
|
|
3488
3522
|
}
|
|
3489
3523
|
complete() {
|
|
3490
3524
|
this.isComplete = true;
|
|
3491
|
-
this.parent = null;
|
|
3492
|
-
this.task = null;
|
|
3525
|
+
this.parent = this.task = this.canUse = null;
|
|
3493
3526
|
}
|
|
3494
3527
|
cancel() {
|
|
3495
3528
|
this.isCancel = true;
|
|
@@ -3531,7 +3564,7 @@ var LeaferUI = function(exports) {
|
|
|
3531
3564
|
if (config) DataHelper.assign(this.config, config);
|
|
3532
3565
|
this.empty();
|
|
3533
3566
|
}
|
|
3534
|
-
add(taskCallback, options) {
|
|
3567
|
+
add(taskCallback, options, canUse) {
|
|
3535
3568
|
let start, parallel, time, delay;
|
|
3536
3569
|
const task = new TaskItem(taskCallback);
|
|
3537
3570
|
task.parent = this;
|
|
@@ -3542,9 +3575,11 @@ var LeaferUI = function(exports) {
|
|
|
3542
3575
|
start = options.start;
|
|
3543
3576
|
time = options.time;
|
|
3544
3577
|
delay = options.delay;
|
|
3578
|
+
if (!canUse) canUse = options.canUse;
|
|
3545
3579
|
}
|
|
3546
3580
|
if (time) task.time = time;
|
|
3547
3581
|
if (parallel === false) task.parallel = false;
|
|
3582
|
+
if (canUse) task.canUse = canUse;
|
|
3548
3583
|
if (isUndefined(delay)) {
|
|
3549
3584
|
this.push(task, start);
|
|
3550
3585
|
} else {
|
|
@@ -3614,15 +3649,10 @@ var LeaferUI = function(exports) {
|
|
|
3614
3649
|
this.timer = setTimeout(() => this.nextTask());
|
|
3615
3650
|
return;
|
|
3616
3651
|
}
|
|
3617
|
-
if (task.isCancel) {
|
|
3618
|
-
this.index++;
|
|
3619
|
-
this.runTask();
|
|
3620
|
-
return;
|
|
3621
|
-
}
|
|
3622
3652
|
task.run().then(() => {
|
|
3623
3653
|
this.onTask(task);
|
|
3624
3654
|
this.index++;
|
|
3625
|
-
this.nextTask();
|
|
3655
|
+
task.isCancel ? this.runTask() : this.nextTask();
|
|
3626
3656
|
}).catch(error => {
|
|
3627
3657
|
this.onError(error);
|
|
3628
3658
|
});
|
|
@@ -3791,7 +3821,6 @@ var LeaferUI = function(exports) {
|
|
|
3791
3821
|
};
|
|
3792
3822
|
const I$1 = ImageManager;
|
|
3793
3823
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3794
|
-
const {floor: floor$2, max: max$5} = Math;
|
|
3795
3824
|
class LeaferImage {
|
|
3796
3825
|
get url() {
|
|
3797
3826
|
return this.config.url;
|
|
@@ -3816,10 +3845,9 @@ var LeaferUI = function(exports) {
|
|
|
3816
3845
|
load(onSuccess, onError) {
|
|
3817
3846
|
if (!this.loading) {
|
|
3818
3847
|
this.loading = true;
|
|
3819
|
-
|
|
3820
|
-
if (onProgress) loadImage = loadImageWithProgress;
|
|
3848
|
+
const {crossOrigin: crossOrigin} = this.config;
|
|
3821
3849
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
3822
|
-
return yield loadImage(this.url,
|
|
3850
|
+
return yield Platform.origin.loadImage(this.url, isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin, this).then(img => this.setView(img)).catch(e => {
|
|
3823
3851
|
this.error = e;
|
|
3824
3852
|
this.onComplete(false);
|
|
3825
3853
|
});
|
|
@@ -3845,9 +3873,6 @@ var LeaferUI = function(exports) {
|
|
|
3845
3873
|
this.view = img;
|
|
3846
3874
|
this.onComplete(true);
|
|
3847
3875
|
}
|
|
3848
|
-
onProgress(progress) {
|
|
3849
|
-
this.progress = progress;
|
|
3850
|
-
}
|
|
3851
3876
|
onComplete(isSuccess) {
|
|
3852
3877
|
let odd;
|
|
3853
3878
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -3866,7 +3891,7 @@ var LeaferUI = function(exports) {
|
|
|
3866
3891
|
getFull(_filters) {
|
|
3867
3892
|
return this.view;
|
|
3868
3893
|
}
|
|
3869
|
-
getCanvas(width, height, opacity,
|
|
3894
|
+
getCanvas(width, height, opacity, filters, xGap, yGap, smooth) {
|
|
3870
3895
|
width || (width = this.width);
|
|
3871
3896
|
height || (height = this.height);
|
|
3872
3897
|
if (this.cache) {
|
|
@@ -3879,11 +3904,7 @@ var LeaferUI = function(exports) {
|
|
|
3879
3904
|
}
|
|
3880
3905
|
if (data) return data;
|
|
3881
3906
|
}
|
|
3882
|
-
const canvas = Platform.
|
|
3883
|
-
const ctx = canvas.getContext("2d");
|
|
3884
|
-
if (opacity) ctx.globalAlpha = opacity;
|
|
3885
|
-
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
3886
|
-
ctx.drawImage(this.view, 0, 0, width, height);
|
|
3907
|
+
const canvas = Platform.image.resize(this.view, width, height, xGap, yGap, undefined, smooth, opacity, filters);
|
|
3887
3908
|
this.cache = this.use > 1 ? {
|
|
3888
3909
|
data: canvas,
|
|
3889
3910
|
params: arguments
|
|
@@ -3892,13 +3913,7 @@ var LeaferUI = function(exports) {
|
|
|
3892
3913
|
}
|
|
3893
3914
|
getPattern(canvas, repeat, transform, paint) {
|
|
3894
3915
|
const pattern = Platform.canvas.createPattern(canvas, repeat);
|
|
3895
|
-
|
|
3896
|
-
if (transform && pattern.setTransform) {
|
|
3897
|
-
pattern.setTransform(transform);
|
|
3898
|
-
transform = undefined;
|
|
3899
|
-
}
|
|
3900
|
-
} catch (_a) {}
|
|
3901
|
-
if (paint) DataHelper.stintSet(paint, "transform", transform);
|
|
3916
|
+
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
3902
3917
|
return pattern;
|
|
3903
3918
|
}
|
|
3904
3919
|
destroy() {
|
|
@@ -5349,7 +5364,7 @@ var LeaferUI = function(exports) {
|
|
|
5349
5364
|
__setAttr(name, newValue, checkFiniteNumber) {
|
|
5350
5365
|
if (this.leaferIsCreated) {
|
|
5351
5366
|
const oldValue = this.__.__getInput(name);
|
|
5352
|
-
if (checkFiniteNumber && !isFinite(newValue) && !isUndefined(newValue)) {
|
|
5367
|
+
if (checkFiniteNumber && !isFinite$1(newValue) && !isUndefined(newValue)) {
|
|
5353
5368
|
debug$9.warn(this.innerName, name, newValue);
|
|
5354
5369
|
newValue = undefined;
|
|
5355
5370
|
}
|
|
@@ -5424,12 +5439,12 @@ var LeaferUI = function(exports) {
|
|
|
5424
5439
|
const {toBounds: toBounds$1} = PathBounds;
|
|
5425
5440
|
const LeafBounds = {
|
|
5426
5441
|
__updateWorldBounds() {
|
|
5427
|
-
const
|
|
5428
|
-
toOuterOf$2(
|
|
5429
|
-
if (
|
|
5430
|
-
if (
|
|
5442
|
+
const {__layout: __layout, __world: __world} = this;
|
|
5443
|
+
toOuterOf$2(__layout.renderBounds, __world, __world);
|
|
5444
|
+
if (__layout.resized) {
|
|
5445
|
+
if (__layout.resized === "inner") this.__onUpdateSize();
|
|
5431
5446
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
5432
|
-
|
|
5447
|
+
__layout.resized = undefined;
|
|
5433
5448
|
}
|
|
5434
5449
|
if (this.__hasWorldEvent) BoundsEvent.emitWorld(this);
|
|
5435
5450
|
},
|
|
@@ -5621,7 +5636,7 @@ var LeaferUI = function(exports) {
|
|
|
5621
5636
|
};
|
|
5622
5637
|
const tempScaleData$1 = {};
|
|
5623
5638
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5624
|
-
const {stintSet: stintSet$
|
|
5639
|
+
const {stintSet: stintSet$4} = DataHelper;
|
|
5625
5640
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5626
5641
|
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5627
5642
|
const {copy: copy$6, move: move$8} = PointHelper;
|
|
@@ -5899,8 +5914,8 @@ var LeaferUI = function(exports) {
|
|
|
5899
5914
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
5900
5915
|
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
5901
5916
|
toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5902
|
-
stintSet$
|
|
5903
|
-
stintSet$
|
|
5917
|
+
stintSet$4(cameraWorld, "half", world.half);
|
|
5918
|
+
stintSet$4(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
|
|
5904
5919
|
return cameraWorld;
|
|
5905
5920
|
} else {
|
|
5906
5921
|
return this.__world;
|
|
@@ -6413,7 +6428,7 @@ var LeaferUI = function(exports) {
|
|
|
6413
6428
|
this.levelMap = null;
|
|
6414
6429
|
}
|
|
6415
6430
|
}
|
|
6416
|
-
const version = "1.
|
|
6431
|
+
const version = "1.10.0";
|
|
6417
6432
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6418
6433
|
get allowBackgroundColor() {
|
|
6419
6434
|
return true;
|
|
@@ -7158,6 +7173,7 @@ var LeaferUI = function(exports) {
|
|
|
7158
7173
|
hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
|
|
7159
7174
|
if (child.isBranch) {
|
|
7160
7175
|
if (hit || child.__ignoreHitWorld) {
|
|
7176
|
+
if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point)) continue;
|
|
7161
7177
|
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7162
7178
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7163
7179
|
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
@@ -7327,7 +7343,7 @@ var LeaferUI = function(exports) {
|
|
|
7327
7343
|
}
|
|
7328
7344
|
};
|
|
7329
7345
|
const {parse: parse, objectToCanvasData: objectToCanvasData} = PathConvert;
|
|
7330
|
-
const {stintSet: stintSet$
|
|
7346
|
+
const {stintSet: stintSet$3} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
|
|
7331
7347
|
const emptyPaint = {};
|
|
7332
7348
|
const debug$5 = Debug.get("UIData");
|
|
7333
7349
|
class UIData extends LeafData {
|
|
@@ -7391,7 +7407,7 @@ var LeaferUI = function(exports) {
|
|
|
7391
7407
|
setFill(value) {
|
|
7392
7408
|
if (this.__naturalWidth) this.__removeNaturalSize();
|
|
7393
7409
|
if (isString(value) || !value) {
|
|
7394
|
-
stintSet$
|
|
7410
|
+
stintSet$3(this, "__isTransparentFill", hasTransparent$2(value));
|
|
7395
7411
|
this.__isFills && this.__removePaint("fill", true);
|
|
7396
7412
|
this._fill = value;
|
|
7397
7413
|
} else if (isObject(value)) {
|
|
@@ -7400,7 +7416,7 @@ var LeaferUI = function(exports) {
|
|
|
7400
7416
|
}
|
|
7401
7417
|
setStroke(value) {
|
|
7402
7418
|
if (isString(value) || !value) {
|
|
7403
|
-
stintSet$
|
|
7419
|
+
stintSet$3(this, "__isTransparentStroke", hasTransparent$2(value));
|
|
7404
7420
|
this.__isStrokes && this.__removePaint("stroke", true);
|
|
7405
7421
|
this._stroke = value;
|
|
7406
7422
|
} else if (isObject(value)) {
|
|
@@ -7458,11 +7474,11 @@ var LeaferUI = function(exports) {
|
|
|
7458
7474
|
if (removeInput) this.__removeInput(attrName);
|
|
7459
7475
|
PaintImage.recycleImage(attrName, this);
|
|
7460
7476
|
if (attrName === "fill") {
|
|
7461
|
-
stintSet$
|
|
7477
|
+
stintSet$3(this, "__isAlphaPixelFill", undefined);
|
|
7462
7478
|
this._fill = this.__isFills = undefined;
|
|
7463
7479
|
} else {
|
|
7464
|
-
stintSet$
|
|
7465
|
-
stintSet$
|
|
7480
|
+
stintSet$3(this, "__isAlphaPixelStroke", undefined);
|
|
7481
|
+
stintSet$3(this, "__hasMultiStrokeStyle", undefined);
|
|
7466
7482
|
this._stroke = this.__isStrokes = undefined;
|
|
7467
7483
|
}
|
|
7468
7484
|
}
|
|
@@ -7594,7 +7610,7 @@ var LeaferUI = function(exports) {
|
|
|
7594
7610
|
return data;
|
|
7595
7611
|
}
|
|
7596
7612
|
}
|
|
7597
|
-
const {max: max$
|
|
7613
|
+
const {max: max$3, add: add$1} = FourNumberHelper;
|
|
7598
7614
|
const UIBounds = {
|
|
7599
7615
|
__updateStrokeSpread() {
|
|
7600
7616
|
let spread = 0, boxSpread = 0;
|
|
@@ -7609,7 +7625,7 @@ var LeaferUI = function(exports) {
|
|
|
7609
7625
|
}
|
|
7610
7626
|
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7611
7627
|
if (box) {
|
|
7612
|
-
spread = max$
|
|
7628
|
+
spread = max$3(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7613
7629
|
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7614
7630
|
}
|
|
7615
7631
|
this.__layout.strokeBoxSpread = boxSpread;
|
|
@@ -7619,33 +7635,33 @@ var LeaferUI = function(exports) {
|
|
|
7619
7635
|
let spread = 0;
|
|
7620
7636
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
7621
7637
|
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
7622
|
-
if (blur) spread = max$
|
|
7638
|
+
if (blur) spread = max$3(spread, blur);
|
|
7623
7639
|
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
7624
7640
|
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
7625
7641
|
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
7626
7642
|
let shapeSpread = spread;
|
|
7627
|
-
if (innerShadow) shapeSpread = max$
|
|
7628
|
-
if (backgroundBlur) shapeSpread = max$
|
|
7643
|
+
if (innerShadow) shapeSpread = max$3(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
7644
|
+
if (backgroundBlur) shapeSpread = max$3(shapeSpread, backgroundBlur);
|
|
7629
7645
|
this.__layout.renderShapeSpread = shapeSpread;
|
|
7630
|
-
return box ? max$
|
|
7646
|
+
return box ? max$3(box.__updateRenderSpread(), spread) : spread;
|
|
7631
7647
|
}
|
|
7632
7648
|
};
|
|
7633
|
-
const {stintSet: stintSet$
|
|
7649
|
+
const {stintSet: stintSet$2} = DataHelper;
|
|
7634
7650
|
const UIRender = {
|
|
7635
7651
|
__updateChange() {
|
|
7636
7652
|
const data = this.__;
|
|
7637
7653
|
if (data.__useStroke) {
|
|
7638
7654
|
const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
|
|
7639
|
-
stintSet$
|
|
7640
|
-
stintSet$
|
|
7655
|
+
stintSet$2(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
|
|
7656
|
+
stintSet$2(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
|
|
7641
7657
|
}
|
|
7642
7658
|
if (data.__useEffect) {
|
|
7643
7659
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7644
|
-
stintSet$
|
|
7660
|
+
stintSet$2(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
7645
7661
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7646
7662
|
}
|
|
7647
7663
|
data.__checkSingle();
|
|
7648
|
-
stintSet$
|
|
7664
|
+
stintSet$2(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7649
7665
|
},
|
|
7650
7666
|
__drawFast(canvas, options) {
|
|
7651
7667
|
drawFast(this, canvas, options);
|
|
@@ -7661,24 +7677,24 @@ var LeaferUI = function(exports) {
|
|
|
7661
7677
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7662
7678
|
const {shadow: shadow, innerShadow: innerShadow, filter: filter} = data;
|
|
7663
7679
|
if (shadow) Effect.shadow(this, canvas, shape);
|
|
7664
|
-
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7665
|
-
if (fill) data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7680
|
+
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
7681
|
+
if (fill) data.__isFills ? Paint.fills(fill, this, canvas, options) : Paint.fill(fill, this, canvas, options);
|
|
7666
7682
|
if (__drawAfterFill) this.__drawAfterFill(canvas, options);
|
|
7667
7683
|
if (innerShadow) Effect.innerShadow(this, canvas, shape);
|
|
7668
|
-
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7684
|
+
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
7669
7685
|
if (filter) Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
7670
7686
|
if (shape.worldCanvas) shape.worldCanvas.recycle();
|
|
7671
7687
|
shape.canvas.recycle();
|
|
7672
7688
|
} else {
|
|
7673
|
-
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7689
|
+
if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
7674
7690
|
if (__isFastShadow) {
|
|
7675
7691
|
const shadow = data.shadow[0], {scaleX: scaleX, scaleY: scaleY} = this.getRenderScaleData(true, shadow.scaleFixed);
|
|
7676
7692
|
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7677
7693
|
}
|
|
7678
|
-
if (fill) data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7694
|
+
if (fill) data.__isFills ? Paint.fills(fill, this, canvas, options) : Paint.fill(fill, this, canvas, options);
|
|
7679
7695
|
if (__isFastShadow) canvas.restore();
|
|
7680
7696
|
if (__drawAfterFill) this.__drawAfterFill(canvas, options);
|
|
7681
|
-
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7697
|
+
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
7682
7698
|
}
|
|
7683
7699
|
} else {
|
|
7684
7700
|
if (data.__pathInputed) drawFast(this, canvas, options); else this.__drawFast(canvas, options);
|
|
@@ -7687,9 +7703,9 @@ var LeaferUI = function(exports) {
|
|
|
7687
7703
|
__drawShape(canvas, options) {
|
|
7688
7704
|
this.__drawRenderPath(canvas);
|
|
7689
7705
|
const data = this.__, {fill: fill, stroke: stroke} = data;
|
|
7690
|
-
if (fill && !options.ignoreFill) data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill("#000000", this, canvas);
|
|
7706
|
+
if (fill && !options.ignoreFill) data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas, options) : Paint.fill("#000000", this, canvas, options);
|
|
7691
7707
|
if (data.__isCanvas) this.__drawAfterFill(canvas, options);
|
|
7692
|
-
if (stroke && !options.ignoreStroke) data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke("#000000", this, canvas);
|
|
7708
|
+
if (stroke && !options.ignoreStroke) data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke("#000000", this, canvas, options);
|
|
7693
7709
|
},
|
|
7694
7710
|
__drawAfterFill(canvas, options) {
|
|
7695
7711
|
if (this.__.__clipAfterFill) {
|
|
@@ -7703,10 +7719,10 @@ var LeaferUI = function(exports) {
|
|
|
7703
7719
|
function drawFast(ui, canvas, options) {
|
|
7704
7720
|
const {fill: fill, stroke: stroke, __drawAfterFill: __drawAfterFill, __fillAfterStroke: __fillAfterStroke} = ui.__;
|
|
7705
7721
|
ui.__drawRenderPath(canvas);
|
|
7706
|
-
if (__fillAfterStroke) Paint.stroke(stroke, ui, canvas);
|
|
7707
|
-
if (fill) Paint.fill(fill, ui, canvas);
|
|
7722
|
+
if (__fillAfterStroke) Paint.stroke(stroke, ui, canvas, options);
|
|
7723
|
+
if (fill) Paint.fill(fill, ui, canvas, options);
|
|
7708
7724
|
if (__drawAfterFill) ui.__drawAfterFill(canvas, options);
|
|
7709
|
-
if (stroke && !__fillAfterStroke) Paint.stroke(stroke, ui, canvas);
|
|
7725
|
+
if (stroke && !__fillAfterStroke) Paint.stroke(stroke, ui, canvas, options);
|
|
7710
7726
|
}
|
|
7711
7727
|
const RectRender = {
|
|
7712
7728
|
__drawFast(canvas, options) {
|
|
@@ -7841,8 +7857,8 @@ var LeaferUI = function(exports) {
|
|
|
7841
7857
|
drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [ cornerRadius ] : cornerRadius);
|
|
7842
7858
|
} else drawer.rect(x, y, width, height);
|
|
7843
7859
|
}
|
|
7844
|
-
drawImagePlaceholder(canvas,
|
|
7845
|
-
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7860
|
+
drawImagePlaceholder(_image, canvas, renderOptions) {
|
|
7861
|
+
Paint.fill(this.__.placeholderColor, this, canvas, renderOptions);
|
|
7846
7862
|
}
|
|
7847
7863
|
animate(keyframe, _options, _type, _isTemp) {
|
|
7848
7864
|
this.set(keyframe);
|
|
@@ -8705,7 +8721,7 @@ var LeaferUI = function(exports) {
|
|
|
8705
8721
|
__decorate([ dataType(false) ], exports.Canvas.prototype, "safeResize", void 0);
|
|
8706
8722
|
__decorate([ resizeType() ], exports.Canvas.prototype, "contextSettings", void 0);
|
|
8707
8723
|
exports.Canvas = __decorate([ registerUI() ], exports.Canvas);
|
|
8708
|
-
const {copyAndSpread: copyAndSpread$2, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
8724
|
+
const {copyAndSpread: copyAndSpread$2, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet$1} = DataHelper;
|
|
8709
8725
|
exports.Text = class Text extends exports.UI {
|
|
8710
8726
|
get __tag() {
|
|
8711
8727
|
return "Text";
|
|
@@ -8716,13 +8732,14 @@ var LeaferUI = function(exports) {
|
|
|
8716
8732
|
}
|
|
8717
8733
|
__updateTextDrawData() {
|
|
8718
8734
|
const data = this.__;
|
|
8719
|
-
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
8735
|
+
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding, width: width, height: height} = data;
|
|
8720
8736
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
8721
8737
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
8722
|
-
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8723
8738
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
|
|
8724
8739
|
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
8725
|
-
data
|
|
8740
|
+
stintSet$1(data, "__padding", padding && MathHelper.fourNumber(padding));
|
|
8741
|
+
stintSet$1(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
|
|
8742
|
+
stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
|
|
8726
8743
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
8727
8744
|
}
|
|
8728
8745
|
__updateBoxBounds() {
|
|
@@ -9086,7 +9103,7 @@ var LeaferUI = function(exports) {
|
|
|
9086
9103
|
EventCreator.changeName(oldName, newName);
|
|
9087
9104
|
}
|
|
9088
9105
|
}
|
|
9089
|
-
const {min: min, max: max$
|
|
9106
|
+
const {min: min, max: max$2, abs: abs$7} = Math, {float: float$1, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
|
|
9090
9107
|
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9091
9108
|
const DragBoundsHelper = {
|
|
9092
9109
|
limitMove(leaf, move) {
|
|
@@ -9141,7 +9158,7 @@ var LeaferUI = function(exports) {
|
|
|
9141
9158
|
bSize = float$1(tempDragBounds.maxX - tempContent.maxX);
|
|
9142
9159
|
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
9143
9160
|
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
9144
|
-
correctScaleX *= max$
|
|
9161
|
+
correctScaleX *= max$2(aScale, bScale);
|
|
9145
9162
|
} else {
|
|
9146
9163
|
if (scale.x < 0) {
|
|
9147
9164
|
if (float$1(minX(content) - minX(dragBounds)) <= 0 || float$1(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
@@ -9159,9 +9176,9 @@ var LeaferUI = function(exports) {
|
|
|
9159
9176
|
bSize = float$1(tempDragBounds.maxY - tempContent.maxY);
|
|
9160
9177
|
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
9161
9178
|
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
9162
|
-
correctScaleY *= max$
|
|
9179
|
+
correctScaleY *= max$2(aScale, bScale);
|
|
9163
9180
|
if (lockRatio) {
|
|
9164
|
-
aScale = max$
|
|
9181
|
+
aScale = max$2(abs$7(correctScaleX), abs$7(correctScaleY));
|
|
9165
9182
|
correctScaleX = sign$2(correctScaleX) * aScale;
|
|
9166
9183
|
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
9167
9184
|
}
|
|
@@ -9176,8 +9193,8 @@ var LeaferUI = function(exports) {
|
|
|
9176
9193
|
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
9177
9194
|
correctScaleY *= min(aScale, bScale);
|
|
9178
9195
|
}
|
|
9179
|
-
scale.x *= isFinite(correctScaleX) ? correctScaleX : 1;
|
|
9180
|
-
scale.y *= isFinite(correctScaleY) ? correctScaleY : 1;
|
|
9196
|
+
scale.x *= isFinite$1(correctScaleX) ? correctScaleX : 1;
|
|
9197
|
+
scale.y *= isFinite$1(correctScaleY) ? correctScaleY : 1;
|
|
9181
9198
|
return scale;
|
|
9182
9199
|
}
|
|
9183
9200
|
};
|
|
@@ -9282,6 +9299,9 @@ var LeaferUI = function(exports) {
|
|
|
9282
9299
|
exports.MoveEvent.MOVE = "move";
|
|
9283
9300
|
exports.MoveEvent.END = "move.end";
|
|
9284
9301
|
exports.MoveEvent = __decorate([ registerUIEvent() ], exports.MoveEvent);
|
|
9302
|
+
exports.TouchEvent = class TouchEvent extends UIEvent {};
|
|
9303
|
+
exports.TouchEvent = __decorate([ registerUIEvent() ], exports.TouchEvent);
|
|
9304
|
+
const MyTouchEvent = exports.TouchEvent;
|
|
9285
9305
|
exports.RotateEvent = class RotateEvent extends exports.PointerEvent {};
|
|
9286
9306
|
exports.RotateEvent.BEFORE_ROTATE = "rotate.before_rotate";
|
|
9287
9307
|
exports.RotateEvent.START = "rotate.start";
|
|
@@ -10263,34 +10283,18 @@ var LeaferUI = function(exports) {
|
|
|
10263
10283
|
}
|
|
10264
10284
|
return data[3] > 0;
|
|
10265
10285
|
};
|
|
10266
|
-
function
|
|
10267
|
-
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
10268
|
-
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
10269
|
-
let row;
|
|
10270
|
-
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10271
|
-
row = rows[i];
|
|
10272
|
-
if (row.text) canvas.fillText(row.text, row.x, row.y); else if (row.data) row.data.forEach(charData => {
|
|
10273
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
10274
|
-
});
|
|
10275
|
-
}
|
|
10276
|
-
if (decorationY) {
|
|
10277
|
-
const {decorationColor: decorationColor, decorationHeight: decorationHeight} = data.__textDrawData;
|
|
10278
|
-
if (decorationColor) canvas.fillStyle = decorationColor;
|
|
10279
|
-
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
10280
|
-
}
|
|
10281
|
-
}
|
|
10282
|
-
function fill(fill, ui, canvas) {
|
|
10286
|
+
function fill(fill, ui, canvas, renderOptions) {
|
|
10283
10287
|
canvas.fillStyle = fill;
|
|
10284
|
-
fillPathOrText(ui, canvas);
|
|
10288
|
+
fillPathOrText(ui, canvas, renderOptions);
|
|
10285
10289
|
}
|
|
10286
|
-
function fills(fills, ui, canvas) {
|
|
10290
|
+
function fills(fills, ui, canvas, renderOptions) {
|
|
10287
10291
|
let item;
|
|
10288
10292
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
10289
10293
|
item = fills[i];
|
|
10290
10294
|
if (item.image) {
|
|
10291
|
-
if (PaintImage.checkImage(
|
|
10295
|
+
if (PaintImage.checkImage(item, !ui.__.__font, ui, canvas, renderOptions)) continue;
|
|
10292
10296
|
if (!item.style) {
|
|
10293
|
-
if (!i && item.image.isPlacehold) ui.drawImagePlaceholder(canvas,
|
|
10297
|
+
if (!i && item.image.isPlacehold) ui.drawImagePlaceholder(item.image, canvas, renderOptions);
|
|
10294
10298
|
continue;
|
|
10295
10299
|
}
|
|
10296
10300
|
}
|
|
@@ -10303,55 +10307,126 @@ var LeaferUI = function(exports) {
|
|
|
10303
10307
|
if (item.scaleFixed === true || item.scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) canvas.scale(1 / scaleX, 1 / scaleY);
|
|
10304
10308
|
}
|
|
10305
10309
|
if (item.blendMode) canvas.blendMode = item.blendMode;
|
|
10306
|
-
fillPathOrText(ui, canvas);
|
|
10310
|
+
fillPathOrText(ui, canvas, renderOptions);
|
|
10307
10311
|
canvas.restore();
|
|
10308
10312
|
} else {
|
|
10309
10313
|
if (item.blendMode) {
|
|
10310
10314
|
canvas.saveBlendMode(item.blendMode);
|
|
10311
|
-
fillPathOrText(ui, canvas);
|
|
10315
|
+
fillPathOrText(ui, canvas, renderOptions);
|
|
10312
10316
|
canvas.restoreBlendMode();
|
|
10313
|
-
} else fillPathOrText(ui, canvas);
|
|
10317
|
+
} else fillPathOrText(ui, canvas, renderOptions);
|
|
10318
|
+
}
|
|
10319
|
+
}
|
|
10320
|
+
}
|
|
10321
|
+
function fillPathOrText(ui, canvas, renderOptions) {
|
|
10322
|
+
ui.__.__font ? Paint.fillText(ui, canvas, renderOptions) : ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill();
|
|
10323
|
+
}
|
|
10324
|
+
function fillText(ui, canvas, _renderOptions) {
|
|
10325
|
+
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
10326
|
+
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
10327
|
+
let row;
|
|
10328
|
+
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10329
|
+
row = rows[i];
|
|
10330
|
+
if (row.text) canvas.fillText(row.text, row.x, row.y); else if (row.data) row.data.forEach(charData => {
|
|
10331
|
+
canvas.fillText(charData.char, charData.x, row.y);
|
|
10332
|
+
});
|
|
10333
|
+
}
|
|
10334
|
+
if (decorationY) {
|
|
10335
|
+
const {decorationColor: decorationColor, decorationHeight: decorationHeight} = data.__textDrawData;
|
|
10336
|
+
if (decorationColor) canvas.fillStyle = decorationColor;
|
|
10337
|
+
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
10338
|
+
}
|
|
10339
|
+
}
|
|
10340
|
+
function stroke(stroke, ui, canvas, renderOptions) {
|
|
10341
|
+
const data = ui.__;
|
|
10342
|
+
if (!data.__strokeWidth) return;
|
|
10343
|
+
if (data.__font) {
|
|
10344
|
+
Paint.strokeText(stroke, ui, canvas, renderOptions);
|
|
10345
|
+
} else {
|
|
10346
|
+
switch (data.strokeAlign) {
|
|
10347
|
+
case "center":
|
|
10348
|
+
drawCenter$1(stroke, 1, ui, canvas, renderOptions);
|
|
10349
|
+
break;
|
|
10350
|
+
|
|
10351
|
+
case "inside":
|
|
10352
|
+
drawInside(stroke, ui, canvas, renderOptions);
|
|
10353
|
+
break;
|
|
10354
|
+
|
|
10355
|
+
case "outside":
|
|
10356
|
+
drawOutside(stroke, ui, canvas, renderOptions);
|
|
10357
|
+
break;
|
|
10314
10358
|
}
|
|
10315
10359
|
}
|
|
10316
10360
|
}
|
|
10317
|
-
function
|
|
10318
|
-
|
|
10361
|
+
function strokes(strokes, ui, canvas, renderOptions) {
|
|
10362
|
+
Paint.stroke(strokes, ui, canvas, renderOptions);
|
|
10363
|
+
}
|
|
10364
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas, renderOptions) {
|
|
10365
|
+
const data = ui.__;
|
|
10366
|
+
if (isObject(stroke)) {
|
|
10367
|
+
Paint.drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas, renderOptions);
|
|
10368
|
+
} else {
|
|
10369
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10370
|
+
canvas.stroke();
|
|
10371
|
+
}
|
|
10372
|
+
if (data.__useArrow) Paint.strokeArrow(stroke, ui, canvas, renderOptions);
|
|
10373
|
+
}
|
|
10374
|
+
function drawInside(stroke, ui, canvas, renderOptions) {
|
|
10375
|
+
canvas.save();
|
|
10376
|
+
canvas.clipUI(ui);
|
|
10377
|
+
drawCenter$1(stroke, 2, ui, canvas, renderOptions);
|
|
10378
|
+
canvas.restore();
|
|
10379
|
+
}
|
|
10380
|
+
function drawOutside(stroke, ui, canvas, renderOptions) {
|
|
10381
|
+
const data = ui.__;
|
|
10382
|
+
if (data.__fillAfterStroke) {
|
|
10383
|
+
drawCenter$1(stroke, 2, ui, canvas, renderOptions);
|
|
10384
|
+
} else {
|
|
10385
|
+
const {renderBounds: renderBounds} = ui.__layout;
|
|
10386
|
+
const out = canvas.getSameCanvas(true, true);
|
|
10387
|
+
ui.__drawRenderPath(out);
|
|
10388
|
+
drawCenter$1(stroke, 2, ui, out, renderOptions);
|
|
10389
|
+
out.clipUI(data);
|
|
10390
|
+
out.clearWorld(renderBounds);
|
|
10391
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
10392
|
+
out.recycle(ui.__nowWorld);
|
|
10393
|
+
}
|
|
10319
10394
|
}
|
|
10320
|
-
function strokeText(stroke, ui, canvas) {
|
|
10395
|
+
function strokeText(stroke, ui, canvas, renderOptions) {
|
|
10321
10396
|
switch (ui.__.strokeAlign) {
|
|
10322
10397
|
case "center":
|
|
10323
|
-
drawCenter
|
|
10398
|
+
drawCenter(stroke, 1, ui, canvas, renderOptions);
|
|
10324
10399
|
break;
|
|
10325
10400
|
|
|
10326
10401
|
case "inside":
|
|
10327
|
-
drawAlign(stroke, "inside", ui, canvas);
|
|
10402
|
+
drawAlign(stroke, "inside", ui, canvas, renderOptions);
|
|
10328
10403
|
break;
|
|
10329
10404
|
|
|
10330
10405
|
case "outside":
|
|
10331
|
-
ui.__.__fillAfterStroke ? drawCenter
|
|
10406
|
+
ui.__.__fillAfterStroke ? drawCenter(stroke, 2, ui, canvas, renderOptions) : drawAlign(stroke, "outside", ui, canvas, renderOptions);
|
|
10332
10407
|
break;
|
|
10333
10408
|
}
|
|
10334
10409
|
}
|
|
10335
|
-
function drawCenter
|
|
10410
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas, renderOptions) {
|
|
10336
10411
|
const data = ui.__;
|
|
10337
10412
|
if (isObject(stroke)) {
|
|
10338
|
-
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
10413
|
+
Paint.drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas, renderOptions);
|
|
10339
10414
|
} else {
|
|
10340
10415
|
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10341
|
-
drawTextStroke(ui, canvas);
|
|
10416
|
+
Paint.drawTextStroke(ui, canvas, renderOptions);
|
|
10342
10417
|
}
|
|
10343
10418
|
}
|
|
10344
|
-
function drawAlign(stroke, align, ui, canvas) {
|
|
10419
|
+
function drawAlign(stroke, align, ui, canvas, renderOptions) {
|
|
10345
10420
|
const out = canvas.getSameCanvas(true, true);
|
|
10346
10421
|
out.font = ui.__.__font;
|
|
10347
|
-
drawCenter
|
|
10422
|
+
drawCenter(stroke, 2, ui, out, renderOptions);
|
|
10348
10423
|
out.blendMode = align === "outside" ? "destination-out" : "destination-in";
|
|
10349
|
-
fillText(ui, out);
|
|
10424
|
+
Paint.fillText(ui, out, renderOptions);
|
|
10350
10425
|
out.blendMode = "normal";
|
|
10351
10426
|
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
10352
10427
|
out.recycle(ui.__nowWorld);
|
|
10353
10428
|
}
|
|
10354
|
-
function drawTextStroke(ui, canvas) {
|
|
10429
|
+
function drawTextStroke(ui, canvas, _renderOptions) {
|
|
10355
10430
|
let row, data = ui.__.__textDrawData;
|
|
10356
10431
|
const {rows: rows, decorationY: decorationY} = data;
|
|
10357
10432
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
@@ -10365,13 +10440,13 @@ var LeaferUI = function(exports) {
|
|
|
10365
10440
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
10366
10441
|
}
|
|
10367
10442
|
}
|
|
10368
|
-
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
10443
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas, renderOptions) {
|
|
10369
10444
|
let item;
|
|
10370
10445
|
const data = ui.__, {__hasMultiStrokeStyle: __hasMultiStrokeStyle} = data;
|
|
10371
10446
|
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
10372
10447
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
10373
10448
|
item = strokes[i];
|
|
10374
|
-
if (item.image && PaintImage.checkImage(ui, canvas,
|
|
10449
|
+
if (item.image && PaintImage.checkImage(item, false, ui, canvas, renderOptions)) continue;
|
|
10375
10450
|
if (item.style) {
|
|
10376
10451
|
if (__hasMultiStrokeStyle) {
|
|
10377
10452
|
const {strokeStyle: strokeStyle} = item;
|
|
@@ -10379,69 +10454,14 @@ var LeaferUI = function(exports) {
|
|
|
10379
10454
|
} else canvas.strokeStyle = item.style;
|
|
10380
10455
|
if (item.blendMode) {
|
|
10381
10456
|
canvas.saveBlendMode(item.blendMode);
|
|
10382
|
-
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
10457
|
+
isText ? Paint.drawTextStroke(ui, canvas, renderOptions) : canvas.stroke();
|
|
10383
10458
|
canvas.restoreBlendMode();
|
|
10384
10459
|
} else {
|
|
10385
|
-
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
10460
|
+
isText ? Paint.drawTextStroke(ui, canvas, renderOptions) : canvas.stroke();
|
|
10386
10461
|
}
|
|
10387
10462
|
}
|
|
10388
10463
|
}
|
|
10389
10464
|
}
|
|
10390
|
-
function stroke(stroke, ui, canvas) {
|
|
10391
|
-
const data = ui.__;
|
|
10392
|
-
if (!data.__strokeWidth) return;
|
|
10393
|
-
if (data.__font) {
|
|
10394
|
-
strokeText(stroke, ui, canvas);
|
|
10395
|
-
} else {
|
|
10396
|
-
switch (data.strokeAlign) {
|
|
10397
|
-
case "center":
|
|
10398
|
-
drawCenter(stroke, 1, ui, canvas);
|
|
10399
|
-
break;
|
|
10400
|
-
|
|
10401
|
-
case "inside":
|
|
10402
|
-
drawInside(stroke, ui, canvas);
|
|
10403
|
-
break;
|
|
10404
|
-
|
|
10405
|
-
case "outside":
|
|
10406
|
-
drawOutside(stroke, ui, canvas);
|
|
10407
|
-
break;
|
|
10408
|
-
}
|
|
10409
|
-
}
|
|
10410
|
-
}
|
|
10411
|
-
function strokes(strokes, ui, canvas) {
|
|
10412
|
-
stroke(strokes, ui, canvas);
|
|
10413
|
-
}
|
|
10414
|
-
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
10415
|
-
const data = ui.__;
|
|
10416
|
-
if (isObject(stroke)) {
|
|
10417
|
-
drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
|
|
10418
|
-
} else {
|
|
10419
|
-
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10420
|
-
canvas.stroke();
|
|
10421
|
-
}
|
|
10422
|
-
if (data.__useArrow) Paint.strokeArrow(stroke, ui, canvas);
|
|
10423
|
-
}
|
|
10424
|
-
function drawInside(stroke, ui, canvas) {
|
|
10425
|
-
canvas.save();
|
|
10426
|
-
canvas.clipUI(ui);
|
|
10427
|
-
drawCenter(stroke, 2, ui, canvas);
|
|
10428
|
-
canvas.restore();
|
|
10429
|
-
}
|
|
10430
|
-
function drawOutside(stroke, ui, canvas) {
|
|
10431
|
-
const data = ui.__;
|
|
10432
|
-
if (data.__fillAfterStroke) {
|
|
10433
|
-
drawCenter(stroke, 2, ui, canvas);
|
|
10434
|
-
} else {
|
|
10435
|
-
const {renderBounds: renderBounds} = ui.__layout;
|
|
10436
|
-
const out = canvas.getSameCanvas(true, true);
|
|
10437
|
-
ui.__drawRenderPath(out);
|
|
10438
|
-
drawCenter(stroke, 2, ui, out);
|
|
10439
|
-
out.clipUI(data);
|
|
10440
|
-
out.clearWorld(renderBounds);
|
|
10441
|
-
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
10442
|
-
out.recycle(ui.__nowWorld);
|
|
10443
|
-
}
|
|
10444
|
-
}
|
|
10445
10465
|
const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
|
|
10446
10466
|
const tempBounds$1 = {};
|
|
10447
10467
|
function shape(ui, current, options) {
|
|
@@ -10590,80 +10610,108 @@ var LeaferUI = function(exports) {
|
|
|
10590
10610
|
strokes: strokes,
|
|
10591
10611
|
strokeText: strokeText,
|
|
10592
10612
|
drawTextStroke: drawTextStroke,
|
|
10613
|
+
drawStrokesStyle: drawStrokesStyle,
|
|
10593
10614
|
shape: shape
|
|
10594
10615
|
};
|
|
10595
|
-
let
|
|
10596
|
-
const {
|
|
10597
|
-
function
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
if (
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
10613
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
10614
|
-
const transform = get$3();
|
|
10615
|
-
layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
10616
|
-
if (clipScaleX) {
|
|
10617
|
-
if (rotation || skew) {
|
|
10618
|
-
set(tempMatrix$1);
|
|
10619
|
-
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
10620
|
-
multiplyParent(transform, tempMatrix$1);
|
|
10621
|
-
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
10616
|
+
let cache$1, box$1 = new Bounds;
|
|
10617
|
+
const {isSame: isSame} = BoundsHelper;
|
|
10618
|
+
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
10619
|
+
let leafPaint, event;
|
|
10620
|
+
const image = ImageManager.get(paint);
|
|
10621
|
+
if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
|
|
10622
|
+
leafPaint = cache$1.leafPaint;
|
|
10623
|
+
} else {
|
|
10624
|
+
leafPaint = {
|
|
10625
|
+
type: paint.type,
|
|
10626
|
+
image: image
|
|
10627
|
+
};
|
|
10628
|
+
if (image.hasAlphaPixel) leafPaint.isTransparent = true;
|
|
10629
|
+
cache$1 = image.use > 1 ? {
|
|
10630
|
+
leafPaint: leafPaint,
|
|
10631
|
+
paint: paint,
|
|
10632
|
+
boxBounds: box$1.set(boxBounds)
|
|
10633
|
+
} : null;
|
|
10622
10634
|
}
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10635
|
+
if (firstUse || image.loading) event = {
|
|
10636
|
+
image: image,
|
|
10637
|
+
attrName: attrName,
|
|
10638
|
+
attrValue: paint
|
|
10639
|
+
};
|
|
10640
|
+
if (image.ready) {
|
|
10641
|
+
checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds);
|
|
10642
|
+
if (firstUse) {
|
|
10643
|
+
onLoad(ui, event);
|
|
10644
|
+
onLoadSuccess(ui, event);
|
|
10645
|
+
}
|
|
10646
|
+
} else if (image.error) {
|
|
10647
|
+
if (firstUse) onLoadError(ui, event, image.error);
|
|
10629
10648
|
} else {
|
|
10630
|
-
if (
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
translate$1(transform, height, 0);
|
|
10641
|
-
break;
|
|
10642
|
-
|
|
10643
|
-
case 180:
|
|
10644
|
-
translate$1(transform, width, height);
|
|
10645
|
-
break;
|
|
10646
|
-
|
|
10647
|
-
case 270:
|
|
10648
|
-
translate$1(transform, 0, width);
|
|
10649
|
-
break;
|
|
10649
|
+
if (firstUse) {
|
|
10650
|
+
ignoreRender(ui, true);
|
|
10651
|
+
onLoad(ui, event);
|
|
10652
|
+
}
|
|
10653
|
+
leafPaint.loadId = image.load(() => {
|
|
10654
|
+
ignoreRender(ui, false);
|
|
10655
|
+
if (!ui.destroyed) {
|
|
10656
|
+
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
10657
|
+
if (image.hasAlphaPixel) ui.__layout.hitCanvasChanged = true;
|
|
10658
|
+
ui.forceUpdate("surface");
|
|
10650
10659
|
}
|
|
10660
|
+
onLoadSuccess(ui, event);
|
|
10651
10661
|
}
|
|
10662
|
+
leafPaint.loadId = undefined;
|
|
10663
|
+
}, error => {
|
|
10664
|
+
ignoreRender(ui, false);
|
|
10665
|
+
onLoadError(ui, event, error);
|
|
10666
|
+
leafPaint.loadId = undefined;
|
|
10667
|
+
});
|
|
10668
|
+
if (ui.placeholderColor) {
|
|
10669
|
+
if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
|
|
10670
|
+
if (!image.ready) {
|
|
10671
|
+
image.isPlacehold = true;
|
|
10672
|
+
ui.forceUpdate("surface");
|
|
10673
|
+
}
|
|
10674
|
+
}, ui.placeholderDelay);
|
|
10652
10675
|
}
|
|
10653
|
-
origin$1.x = box.x + x;
|
|
10654
|
-
origin$1.y = box.y + y;
|
|
10655
|
-
translate$1(transform, origin$1.x, origin$1.y);
|
|
10656
|
-
if (scaleX) scaleOfOuter$1(transform, origin$1, scaleX, scaleY);
|
|
10657
10676
|
}
|
|
10658
|
-
|
|
10677
|
+
return leafPaint;
|
|
10659
10678
|
}
|
|
10660
|
-
function
|
|
10661
|
-
if (
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10679
|
+
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
10680
|
+
if (attrName === "fill" && !ui.__.__naturalWidth) {
|
|
10681
|
+
const data = ui.__;
|
|
10682
|
+
data.__naturalWidth = image.width / data.pixelRatio;
|
|
10683
|
+
data.__naturalHeight = image.height / data.pixelRatio;
|
|
10684
|
+
if (data.__autoSide) {
|
|
10685
|
+
ui.forceUpdate("width");
|
|
10686
|
+
if (ui.__proxyData) {
|
|
10687
|
+
ui.setProxyAttr("width", data.width);
|
|
10688
|
+
ui.setProxyAttr("height", data.height);
|
|
10689
|
+
}
|
|
10690
|
+
return false;
|
|
10691
|
+
}
|
|
10692
|
+
}
|
|
10693
|
+
if (!leafPaint.data) PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
10694
|
+
return true;
|
|
10665
10695
|
}
|
|
10666
|
-
|
|
10696
|
+
function onLoad(ui, event) {
|
|
10697
|
+
emit(ui, ImageEvent.LOAD, event);
|
|
10698
|
+
}
|
|
10699
|
+
function onLoadSuccess(ui, event) {
|
|
10700
|
+
emit(ui, ImageEvent.LOADED, event);
|
|
10701
|
+
}
|
|
10702
|
+
function onLoadError(ui, event, error) {
|
|
10703
|
+
event.error = error;
|
|
10704
|
+
ui.forceUpdate("surface");
|
|
10705
|
+
emit(ui, ImageEvent.ERROR, event);
|
|
10706
|
+
}
|
|
10707
|
+
function emit(ui, type, data) {
|
|
10708
|
+
if (ui.hasEvent(type)) ui.emitEvent(new ImageEvent(type, data));
|
|
10709
|
+
}
|
|
10710
|
+
function ignoreRender(ui, value) {
|
|
10711
|
+
const {leafer: leafer} = ui;
|
|
10712
|
+
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
10713
|
+
}
|
|
10714
|
+
const {get: get$3, translate: translate$1} = MatrixHelper;
|
|
10667
10715
|
const tempBox = new Bounds;
|
|
10668
10716
|
const tempScaleData = {};
|
|
10669
10717
|
const tempImage = {};
|
|
@@ -10672,12 +10720,12 @@ var LeaferUI = function(exports) {
|
|
|
10672
10720
|
if (changeful) leafPaint.changeful = changeful;
|
|
10673
10721
|
if (sync) leafPaint.sync = sync;
|
|
10674
10722
|
if (scaleFixed) leafPaint.scaleFixed = scaleFixed;
|
|
10675
|
-
leafPaint.data = getPatternData(paint, box, image);
|
|
10723
|
+
leafPaint.data = PaintImage.getPatternData(paint, box, image);
|
|
10676
10724
|
}
|
|
10677
10725
|
function getPatternData(paint, box, image) {
|
|
10678
10726
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
10679
10727
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
10680
|
-
|
|
10728
|
+
const {width: width, height: height} = image;
|
|
10681
10729
|
const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters} = paint;
|
|
10682
10730
|
const sameBox = box.width === width && box.height === height;
|
|
10683
10731
|
const data = {
|
|
@@ -10708,8 +10756,8 @@ var LeaferUI = function(exports) {
|
|
|
10708
10756
|
case "stretch":
|
|
10709
10757
|
if (!sameBox) {
|
|
10710
10758
|
scaleX = box.width / width, scaleY = box.height / height;
|
|
10711
|
-
stretchMode(data, box, scaleX, scaleY);
|
|
10712
|
-
}
|
|
10759
|
+
PaintImage.stretchMode(data, box, scaleX, scaleY);
|
|
10760
|
+
} else if (scaleX) scaleX = scaleY = undefined;
|
|
10713
10761
|
break;
|
|
10714
10762
|
|
|
10715
10763
|
case "normal":
|
|
@@ -10717,13 +10765,13 @@ var LeaferUI = function(exports) {
|
|
|
10717
10765
|
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
10718
10766
|
let clipScaleX, clipScaleY;
|
|
10719
10767
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
10720
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
10768
|
+
PaintImage.clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
10721
10769
|
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
10722
10770
|
}
|
|
10723
10771
|
break;
|
|
10724
10772
|
|
|
10725
10773
|
case "repeat":
|
|
10726
|
-
if (!sameBox || scaleX || rotation || skew) repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
|
|
10774
|
+
if (!sameBox || scaleX || rotation || skew) PaintImage.repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
|
|
10727
10775
|
if (!repeat) data.repeat = "repeat";
|
|
10728
10776
|
const count = isObject(repeat);
|
|
10729
10777
|
if (gap || count) data.gap = getGapData(gap, count && repeat, tempImage.width, tempImage.height, box);
|
|
@@ -10732,18 +10780,16 @@ var LeaferUI = function(exports) {
|
|
|
10732
10780
|
case "fit":
|
|
10733
10781
|
case "cover":
|
|
10734
10782
|
default:
|
|
10735
|
-
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10783
|
+
if (scaleX) PaintImage.fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10736
10784
|
}
|
|
10737
10785
|
if (!data.transform) {
|
|
10738
|
-
if (box.x || box.y) translate(data.transform = get$
|
|
10786
|
+
if (box.x || box.y) translate$1(data.transform = get$3(), box.x, box.y);
|
|
10739
10787
|
}
|
|
10740
|
-
data.width = width;
|
|
10741
|
-
data.height = height;
|
|
10742
10788
|
if (scaleX) {
|
|
10743
10789
|
data.scaleX = scaleX;
|
|
10744
10790
|
data.scaleY = scaleY;
|
|
10745
10791
|
}
|
|
10746
|
-
if (opacity) data.opacity = opacity;
|
|
10792
|
+
if (opacity && opacity < 1) data.opacity = opacity;
|
|
10747
10793
|
if (filters) data.filters = filters;
|
|
10748
10794
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
10749
10795
|
return data;
|
|
@@ -10762,221 +10808,180 @@ var LeaferUI = function(exports) {
|
|
|
10762
10808
|
const value = auto ? remain / ((rows || Math.floor(totalSize / size)) - 1) : gap;
|
|
10763
10809
|
return gap === "auto" ? value < 0 ? 0 : value : value;
|
|
10764
10810
|
}
|
|
10765
|
-
let
|
|
10766
|
-
const {
|
|
10767
|
-
function
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10811
|
+
let origin$1 = {}, tempMatrix$1 = getMatrixData();
|
|
10812
|
+
const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
|
|
10813
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
10814
|
+
const transform = get$2(), {x: x, y: y} = box;
|
|
10815
|
+
if (x || y) translate(transform, x, y); else transform.onlyScale = true;
|
|
10816
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
10817
|
+
data.transform = transform;
|
|
10818
|
+
}
|
|
10819
|
+
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10820
|
+
const transform = get$2();
|
|
10821
|
+
translate(transform, box.x + x, box.y + y);
|
|
10822
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
10823
|
+
if (rotation) rotateOfOuter$1(transform, {
|
|
10824
|
+
x: box.x + box.width / 2,
|
|
10825
|
+
y: box.y + box.height / 2
|
|
10826
|
+
}, rotation);
|
|
10827
|
+
data.transform = transform;
|
|
10828
|
+
}
|
|
10829
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
10830
|
+
const transform = get$2();
|
|
10831
|
+
layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
10832
|
+
if (clipScaleX) {
|
|
10833
|
+
if (rotation || skew) {
|
|
10834
|
+
set(tempMatrix$1);
|
|
10835
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
10836
|
+
multiplyParent(transform, tempMatrix$1);
|
|
10837
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
10783
10838
|
}
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds);
|
|
10791
|
-
if (firstUse) {
|
|
10792
|
-
onLoad(ui, event);
|
|
10793
|
-
onLoadSuccess(ui, event);
|
|
10794
|
-
}
|
|
10795
|
-
} else if (image.error) {
|
|
10796
|
-
if (firstUse) onLoadError(ui, event, image.error);
|
|
10839
|
+
data.transform = transform;
|
|
10840
|
+
}
|
|
10841
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, skew, align, freeTransform) {
|
|
10842
|
+
const transform = get$2();
|
|
10843
|
+
if (freeTransform) {
|
|
10844
|
+
layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
10797
10845
|
} else {
|
|
10798
|
-
if (
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
|
|
10819
|
-
if (!image.ready) {
|
|
10820
|
-
image.isPlacehold = true;
|
|
10821
|
-
ui.forceUpdate("surface");
|
|
10846
|
+
if (rotation) {
|
|
10847
|
+
if (align === "center") {
|
|
10848
|
+
rotateOfOuter$1(transform, {
|
|
10849
|
+
x: width / 2,
|
|
10850
|
+
y: height / 2
|
|
10851
|
+
}, rotation);
|
|
10852
|
+
} else {
|
|
10853
|
+
rotate$2(transform, rotation);
|
|
10854
|
+
switch (rotation) {
|
|
10855
|
+
case 90:
|
|
10856
|
+
translate(transform, height, 0);
|
|
10857
|
+
break;
|
|
10858
|
+
|
|
10859
|
+
case 180:
|
|
10860
|
+
translate(transform, width, height);
|
|
10861
|
+
break;
|
|
10862
|
+
|
|
10863
|
+
case 270:
|
|
10864
|
+
translate(transform, 0, width);
|
|
10865
|
+
break;
|
|
10822
10866
|
}
|
|
10823
|
-
}, ui.placeholderDelay);
|
|
10824
|
-
}
|
|
10825
|
-
}
|
|
10826
|
-
return leafPaint;
|
|
10827
|
-
}
|
|
10828
|
-
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
10829
|
-
if (attrName === "fill" && !ui.__.__naturalWidth) {
|
|
10830
|
-
const data = ui.__;
|
|
10831
|
-
data.__naturalWidth = image.width / data.pixelRatio;
|
|
10832
|
-
data.__naturalHeight = image.height / data.pixelRatio;
|
|
10833
|
-
if (data.__autoSide) {
|
|
10834
|
-
ui.forceUpdate("width");
|
|
10835
|
-
if (ui.__proxyData) {
|
|
10836
|
-
ui.setProxyAttr("width", data.width);
|
|
10837
|
-
ui.setProxyAttr("height", data.height);
|
|
10838
10867
|
}
|
|
10839
|
-
return false;
|
|
10840
10868
|
}
|
|
10869
|
+
origin$1.x = box.x + x;
|
|
10870
|
+
origin$1.y = box.y + y;
|
|
10871
|
+
translate(transform, origin$1.x, origin$1.y);
|
|
10872
|
+
if (scaleX) scaleOfOuter$1(transform, origin$1, scaleX, scaleY);
|
|
10841
10873
|
}
|
|
10842
|
-
|
|
10843
|
-
return true;
|
|
10844
|
-
}
|
|
10845
|
-
function onLoad(ui, event) {
|
|
10846
|
-
emit(ui, ImageEvent.LOAD, event);
|
|
10847
|
-
}
|
|
10848
|
-
function onLoadSuccess(ui, event) {
|
|
10849
|
-
emit(ui, ImageEvent.LOADED, event);
|
|
10850
|
-
}
|
|
10851
|
-
function onLoadError(ui, event, error) {
|
|
10852
|
-
event.error = error;
|
|
10853
|
-
ui.forceUpdate("surface");
|
|
10854
|
-
emit(ui, ImageEvent.ERROR, event);
|
|
10855
|
-
}
|
|
10856
|
-
function emit(ui, type, data) {
|
|
10857
|
-
if (ui.hasEvent(type)) ui.emitEvent(new ImageEvent(type, data));
|
|
10874
|
+
data.transform = transform;
|
|
10858
10875
|
}
|
|
10859
|
-
function
|
|
10860
|
-
|
|
10861
|
-
if (
|
|
10876
|
+
function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
10877
|
+
if (rotation) rotate$2(transform, rotation);
|
|
10878
|
+
if (skew) skewHelper(transform, skew.x, skew.y);
|
|
10879
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
10880
|
+
translate(transform, box.x + x, box.y + y);
|
|
10862
10881
|
}
|
|
10863
10882
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
10864
|
-
const {
|
|
10865
|
-
function
|
|
10866
|
-
|
|
10867
|
-
|
|
10883
|
+
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
|
|
10884
|
+
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
10885
|
+
if (!paint.patternTask) {
|
|
10886
|
+
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
10887
|
+
paint.patternTask = null;
|
|
10888
|
+
if (canvas.bounds.hit(ui.__nowWorld)) PaintImage.createPattern(paint, ui, canvas, renderOptions);
|
|
10889
|
+
ui.forceUpdate("surface");
|
|
10890
|
+
}), 300);
|
|
10891
|
+
}
|
|
10892
|
+
}
|
|
10893
|
+
function createPattern(paint, ui, canvas, renderOptions) {
|
|
10894
|
+
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
|
|
10868
10895
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
scaleX
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
width *= scaleX;
|
|
10883
|
-
height *= scaleY;
|
|
10884
|
-
const size = width * height;
|
|
10885
|
-
if (!repeat) {
|
|
10886
|
-
if (size > Platform.image.maxCacheSize) return false;
|
|
10887
|
-
}
|
|
10888
|
-
let maxSize = Platform.image.maxPatternSize;
|
|
10889
|
-
if (image.isSVG) {
|
|
10890
|
-
const ws = width / image.width;
|
|
10891
|
-
if (ws > 1) imageScale = ws / ceil$1(ws);
|
|
10892
|
-
} else {
|
|
10893
|
-
const imageSize = image.width * image.height;
|
|
10894
|
-
if (maxSize > imageSize) maxSize = imageSize;
|
|
10895
|
-
}
|
|
10896
|
-
if (size > maxSize) imageScale = Math.sqrt(size / maxSize);
|
|
10897
|
-
if (imageScale) {
|
|
10898
|
-
scaleX /= imageScale;
|
|
10899
|
-
scaleY /= imageScale;
|
|
10900
|
-
width /= imageScale;
|
|
10901
|
-
height /= imageScale;
|
|
10902
|
-
}
|
|
10903
|
-
if (sx) {
|
|
10904
|
-
scaleX /= sx;
|
|
10905
|
-
scaleY /= sy;
|
|
10906
|
-
}
|
|
10907
|
-
const xGap = gap && gap.x * scaleX;
|
|
10908
|
-
const yGap = gap && gap.y * scaleY;
|
|
10909
|
-
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
10910
|
-
const canvasWidth = width + (xGap || 0);
|
|
10911
|
-
const canvasHeight = height + (yGap || 0);
|
|
10912
|
-
scaleX /= canvasWidth / max$2(floor$1(canvasWidth), 1);
|
|
10913
|
-
scaleY /= canvasHeight / max$2(floor$1(canvasHeight), 1);
|
|
10914
|
-
if (!imageMatrix) {
|
|
10896
|
+
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
10897
|
+
const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
10898
|
+
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
10899
|
+
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
10900
|
+
width *= scaleX;
|
|
10901
|
+
height *= scaleY;
|
|
10902
|
+
if (gap) {
|
|
10903
|
+
xGap = gap.x * scaleX / abs$6(data.scaleX || 1);
|
|
10904
|
+
yGap = gap.y * scaleY / abs$6(data.scaleY || 1);
|
|
10905
|
+
}
|
|
10906
|
+
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
10907
|
+
scaleX *= getFloorScale(width + (xGap || 0));
|
|
10908
|
+
scaleY *= getFloorScale(height + (yGap || 0));
|
|
10915
10909
|
imageMatrix = get$1();
|
|
10916
10910
|
if (transform) copy$4(imageMatrix, transform);
|
|
10911
|
+
scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10917
10912
|
}
|
|
10918
|
-
|
|
10913
|
+
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
10914
|
+
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
10915
|
+
paint.style = pattern;
|
|
10916
|
+
paint.patternId = id;
|
|
10919
10917
|
}
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10918
|
+
}
|
|
10919
|
+
}
|
|
10920
|
+
function getPatternFixScale(paint, imageScaleX, imageScaleY) {
|
|
10921
|
+
const {image: image} = paint;
|
|
10922
|
+
let fixScale, maxSize = Platform.image.maxPatternSize, imageSize = image.width * image.height;
|
|
10923
|
+
if (image.isSVG) {
|
|
10924
|
+
if (imageScaleX > 1) fixScale = Math.ceil(imageScaleX) / imageScaleX;
|
|
10925
10925
|
} else {
|
|
10926
|
-
|
|
10926
|
+
if (maxSize > imageSize) maxSize = imageSize;
|
|
10927
10927
|
}
|
|
10928
|
+
if ((imageSize *= imageScaleX * imageScaleY) > maxSize) fixScale = Math.sqrt(maxSize / imageSize);
|
|
10929
|
+
return fixScale;
|
|
10928
10930
|
}
|
|
10929
|
-
function checkImage(ui, canvas,
|
|
10930
|
-
const {scaleX: scaleX, scaleY: scaleY} =
|
|
10931
|
-
const {
|
|
10932
|
-
if (!data || paint.patternId === scaleX + "-" + scaleY
|
|
10931
|
+
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
10932
|
+
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
10933
|
+
const {image: image, data: data} = paint, {exporting: exporting} = renderOptions;
|
|
10934
|
+
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting) {
|
|
10933
10935
|
return false;
|
|
10934
10936
|
} else {
|
|
10935
|
-
if (
|
|
10937
|
+
if (drawImage) {
|
|
10936
10938
|
if (data.repeat) {
|
|
10937
|
-
|
|
10938
|
-
} else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) ||
|
|
10939
|
-
|
|
10940
|
-
width *= scaleX * pixelRatio;
|
|
10941
|
-
height *= scaleY * pixelRatio;
|
|
10942
|
-
if (data.scaleX) {
|
|
10943
|
-
width *= data.scaleX;
|
|
10944
|
-
height *= data.scaleY;
|
|
10945
|
-
}
|
|
10946
|
-
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
10939
|
+
drawImage = false;
|
|
10940
|
+
} else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
10941
|
+
drawImage = Platform.image.isLarge(image, scaleX, scaleY);
|
|
10947
10942
|
}
|
|
10948
10943
|
}
|
|
10949
|
-
if (
|
|
10944
|
+
if (drawImage) {
|
|
10950
10945
|
if (ui.__.__isFastShadow) {
|
|
10951
10946
|
canvas.fillStyle = paint.style || "#000";
|
|
10952
10947
|
canvas.fill();
|
|
10953
10948
|
}
|
|
10954
|
-
drawImage(ui, canvas,
|
|
10949
|
+
PaintImage.drawImage(paint, scaleX, scaleY, ui, canvas, renderOptions);
|
|
10955
10950
|
return true;
|
|
10956
10951
|
} else {
|
|
10957
|
-
if (!paint.style || paint.sync ||
|
|
10958
|
-
createPattern(ui, paint, pixelRatio);
|
|
10959
|
-
} else {
|
|
10960
|
-
if (!paint.patternTask) {
|
|
10961
|
-
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
10962
|
-
paint.patternTask = null;
|
|
10963
|
-
if (canvas.bounds.hit(ui.__nowWorld)) createPattern(ui, paint, pixelRatio);
|
|
10964
|
-
ui.forceUpdate("surface");
|
|
10965
|
-
}), 300);
|
|
10966
|
-
}
|
|
10967
|
-
}
|
|
10952
|
+
if (!paint.style || paint.sync || exporting) PaintImage.createPattern(paint, ui, canvas, renderOptions); else PaintImage.createPatternTask(paint, ui, canvas, renderOptions);
|
|
10968
10953
|
return false;
|
|
10969
10954
|
}
|
|
10970
10955
|
}
|
|
10971
10956
|
}
|
|
10972
|
-
function drawImage(ui, canvas,
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
if (
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
|
|
10957
|
+
function drawImage(paint, _imageScaleX, _imageScaleY, ui, canvas, _renderOptions) {
|
|
10958
|
+
const {data: data, image: image, blendMode: blendMode} = paint, {opacity: opacity, transform: transform} = data, view = image.getFull(data.filters), u = ui.__;
|
|
10959
|
+
let {width: width, height: height} = image, clipUI;
|
|
10960
|
+
if (transform && !transform.onlyScale || (clipUI = u.path || u.cornerRadius) || opacity || blendMode) {
|
|
10961
|
+
canvas.save();
|
|
10962
|
+
clipUI && canvas.clipUI(ui);
|
|
10963
|
+
blendMode && (canvas.blendMode = blendMode);
|
|
10964
|
+
opacity && (canvas.opacity *= opacity);
|
|
10965
|
+
transform && canvas.transform(transform);
|
|
10966
|
+
canvas.drawImage(view, 0, 0, width, height);
|
|
10967
|
+
canvas.restore();
|
|
10968
|
+
} else {
|
|
10969
|
+
if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
|
|
10970
|
+
canvas.drawImage(view, 0, 0, width, height);
|
|
10971
|
+
}
|
|
10972
|
+
}
|
|
10973
|
+
function getImageRenderScaleData(paint, ui, canvas, _renderOptions) {
|
|
10974
|
+
const scaleData = ui.getRenderScaleData(true, paint.scaleFixed), {data: data} = paint;
|
|
10975
|
+
if (canvas) {
|
|
10976
|
+
const {pixelRatio: pixelRatio} = canvas;
|
|
10977
|
+
scaleData.scaleX *= pixelRatio;
|
|
10978
|
+
scaleData.scaleY *= pixelRatio;
|
|
10979
|
+
}
|
|
10980
|
+
if (data && data.scaleX) {
|
|
10981
|
+
scaleData.scaleX *= Math.abs(data.scaleX);
|
|
10982
|
+
scaleData.scaleY *= Math.abs(data.scaleY);
|
|
10983
|
+
}
|
|
10984
|
+
return scaleData;
|
|
10980
10985
|
}
|
|
10981
10986
|
function recycleImage(attrName, data) {
|
|
10982
10987
|
const paints = data["_" + attrName];
|
|
@@ -11006,8 +11011,12 @@ var LeaferUI = function(exports) {
|
|
|
11006
11011
|
const PaintImageModule = {
|
|
11007
11012
|
image: image,
|
|
11008
11013
|
checkImage: checkImage,
|
|
11009
|
-
|
|
11014
|
+
drawImage: drawImage,
|
|
11015
|
+
getImageRenderScaleData: getImageRenderScaleData,
|
|
11010
11016
|
recycleImage: recycleImage,
|
|
11017
|
+
createPatternTask: createPatternTask,
|
|
11018
|
+
createPattern: createPattern,
|
|
11019
|
+
getPatternFixScale: getPatternFixScale,
|
|
11011
11020
|
createData: createData,
|
|
11012
11021
|
getPatternData: getPatternData,
|
|
11013
11022
|
stretchMode: stretchMode,
|
|
@@ -11394,10 +11403,8 @@ var LeaferUI = function(exports) {
|
|
|
11394
11403
|
bounds$3 = drawData.bounds;
|
|
11395
11404
|
findMaxWidth = !bounds$3.width && !style.autoSizeAlign;
|
|
11396
11405
|
const {__letterSpacing: __letterSpacing, paraIndent: paraIndent, textCase: textCase} = style;
|
|
11397
|
-
const {canvas: canvas} = Platform;
|
|
11398
|
-
|
|
11399
|
-
const charMode = width || height || __letterSpacing || textCase !== "none";
|
|
11400
|
-
if (charMode) {
|
|
11406
|
+
const {canvas: canvas} = Platform, {width: width} = bounds$3;
|
|
11407
|
+
if (style.__isCharMode) {
|
|
11401
11408
|
const wrap = style.textWrap !== "none";
|
|
11402
11409
|
const breakAll = style.textWrap === "break";
|
|
11403
11410
|
paraStart = true;
|
|
@@ -11518,12 +11525,19 @@ var LeaferUI = function(exports) {
|
|
|
11518
11525
|
function layoutChar(drawData, style, width, _height) {
|
|
11519
11526
|
const {rows: rows} = drawData;
|
|
11520
11527
|
const {textAlign: textAlign, paraIndent: paraIndent, letterSpacing: letterSpacing} = style;
|
|
11521
|
-
|
|
11528
|
+
const justifyLast = width && textAlign.includes("both");
|
|
11529
|
+
const justify = justifyLast || width && textAlign.includes("justify");
|
|
11530
|
+
const justifyLetter = justify && textAlign.includes("letter");
|
|
11531
|
+
let charX, remainingWidth, addWordWidth, addLetterWidth, indentWidth, mode, wordChar, wordsLength, isLastWord, canJustify;
|
|
11522
11532
|
rows.forEach(row => {
|
|
11523
11533
|
if (row.words) {
|
|
11524
11534
|
indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
|
|
11525
|
-
|
|
11526
|
-
|
|
11535
|
+
if (justify) {
|
|
11536
|
+
canJustify = !row.paraEnd || justifyLast;
|
|
11537
|
+
remainingWidth = width - row.width - indentWidth;
|
|
11538
|
+
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
|
|
11539
|
+
}
|
|
11540
|
+
mode = letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
|
|
11527
11541
|
if (row.isOverflow && !letterSpacing) row.textMode = true;
|
|
11528
11542
|
if (mode === TextMode) {
|
|
11529
11543
|
row.x += indentWidth;
|
|
@@ -11541,11 +11555,15 @@ var LeaferUI = function(exports) {
|
|
|
11541
11555
|
charX = toWordChar(word.data, charX, wordChar);
|
|
11542
11556
|
if (row.isOverflow || wordChar.char !== " ") row.data.push(wordChar);
|
|
11543
11557
|
} else {
|
|
11544
|
-
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
11558
|
+
charX = toChar(word.data, charX, row.data, row.isOverflow, canJustify && addLetterWidth);
|
|
11545
11559
|
}
|
|
11546
|
-
if (
|
|
11547
|
-
|
|
11548
|
-
|
|
11560
|
+
if (canJustify) {
|
|
11561
|
+
isLastWord = index === wordsLength - 1;
|
|
11562
|
+
if (addWordWidth) {
|
|
11563
|
+
if (!isLastWord) charX += addWordWidth, row.width += addWordWidth;
|
|
11564
|
+
} else if (addLetterWidth) {
|
|
11565
|
+
row.width += addLetterWidth * (word.data.length - (isLastWord ? 1 : 0));
|
|
11566
|
+
}
|
|
11549
11567
|
}
|
|
11550
11568
|
});
|
|
11551
11569
|
}
|
|
@@ -11568,13 +11586,14 @@ var LeaferUI = function(exports) {
|
|
|
11568
11586
|
});
|
|
11569
11587
|
return charX;
|
|
11570
11588
|
}
|
|
11571
|
-
function toChar(data, charX, rowData, isOverflow) {
|
|
11589
|
+
function toChar(data, charX, rowData, isOverflow, addLetterWidth) {
|
|
11572
11590
|
data.forEach(char => {
|
|
11573
11591
|
if (isOverflow || char.char !== " ") {
|
|
11574
11592
|
char.x = charX;
|
|
11575
11593
|
rowData.push(char);
|
|
11576
11594
|
}
|
|
11577
11595
|
charX += char.width;
|
|
11596
|
+
addLetterWidth && (charX += addLetterWidth);
|
|
11578
11597
|
});
|
|
11579
11598
|
return charX;
|
|
11580
11599
|
}
|
|
@@ -11710,10 +11729,10 @@ var LeaferUI = function(exports) {
|
|
|
11710
11729
|
let x = 0, y = 0;
|
|
11711
11730
|
let width = style.__getInput("width") || 0;
|
|
11712
11731
|
let height = style.__getInput("height") || 0;
|
|
11713
|
-
const {
|
|
11732
|
+
const {__padding: padding} = style;
|
|
11714
11733
|
if (padding) {
|
|
11715
|
-
if (width) x = padding[left$3], width -= padding[right$3] + padding[left$3]; else if (!style.autoSizeAlign) x = padding[left$3];
|
|
11716
|
-
if (height) y = padding[top$2], height -= padding[top$2] + padding[bottom$2]; else if (!style.autoSizeAlign) y = padding[top$2];
|
|
11734
|
+
if (width) x = padding[left$3], width -= padding[right$3] + padding[left$3], !width && (width = .01); else if (!style.autoSizeAlign) x = padding[left$3];
|
|
11735
|
+
if (height) y = padding[top$2], height -= padding[top$2] + padding[bottom$2], !height && (height = .01); else if (!style.autoSizeAlign) y = padding[top$2];
|
|
11717
11736
|
}
|
|
11718
11737
|
const drawData = {
|
|
11719
11738
|
bounds: {
|
|
@@ -11724,14 +11743,14 @@ var LeaferUI = function(exports) {
|
|
|
11724
11743
|
},
|
|
11725
11744
|
rows: [],
|
|
11726
11745
|
paraNumber: 0,
|
|
11727
|
-
font: Platform.canvas.font = __font
|
|
11746
|
+
font: Platform.canvas.font = style.__font
|
|
11728
11747
|
};
|
|
11729
11748
|
createRows(drawData, content, style);
|
|
11730
11749
|
if (padding) padAutoText(padding, drawData, style, width, height);
|
|
11731
11750
|
layoutText(drawData, style);
|
|
11732
|
-
layoutChar(drawData, style, width);
|
|
11751
|
+
if (style.__isCharMode) layoutChar(drawData, style, width);
|
|
11733
11752
|
if (drawData.overflow) clipText(drawData, style, x, width);
|
|
11734
|
-
if (textDecoration !== "none") decorationText(drawData, style);
|
|
11753
|
+
if (style.textDecoration !== "none") decorationText(drawData, style);
|
|
11735
11754
|
return drawData;
|
|
11736
11755
|
}
|
|
11737
11756
|
function padAutoText(padding, drawData, style, width, height) {
|
|
@@ -11934,8 +11953,8 @@ var LeaferUI = function(exports) {
|
|
|
11934
11953
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
11935
11954
|
data.strokeWidth = strokeWidth / abs$4(worldTransform.scaleX);
|
|
11936
11955
|
}
|
|
11937
|
-
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas) : Paint.strokes(stroke, this, canvas);
|
|
11938
|
-
if (fill) isString(fill) ? Paint.fill(fill, this, canvas) : Paint.fills(fill, this, canvas);
|
|
11956
|
+
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
|
|
11957
|
+
if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
|
|
11939
11958
|
}
|
|
11940
11959
|
}
|
|
11941
11960
|
data.strokeWidth = strokeWidth;
|
|
@@ -12343,6 +12362,8 @@ var LeaferUI = function(exports) {
|
|
|
12343
12362
|
scaleX = sign$1(scaleX) * lockScale;
|
|
12344
12363
|
scaleY = sign$1(scaleY) * lockScale;
|
|
12345
12364
|
}
|
|
12365
|
+
isFinite(scaleX) || (scaleX = 1);
|
|
12366
|
+
isFinite(scaleY) || (scaleY = 1);
|
|
12346
12367
|
return {
|
|
12347
12368
|
origin: origin,
|
|
12348
12369
|
scaleX: scaleX,
|
|
@@ -12666,9 +12687,10 @@ var LeaferUI = function(exports) {
|
|
|
12666
12687
|
}
|
|
12667
12688
|
load() {
|
|
12668
12689
|
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints, resizeLines: resizeLines} = this;
|
|
12669
|
-
const {stroke: stroke, strokeWidth: strokeWidth,
|
|
12690
|
+
const {stroke: stroke, strokeWidth: strokeWidth, ignorePixelSnap: ignorePixelSnap} = mergeConfig;
|
|
12670
12691
|
const pointsStyle = this.getPointsStyle();
|
|
12671
12692
|
const middlePointsStyle = this.getMiddlePointsStyle();
|
|
12693
|
+
const resizeLinesStyle = this.getResizeLinesStyle();
|
|
12672
12694
|
this.visible = !target.locked;
|
|
12673
12695
|
let resizeP;
|
|
12674
12696
|
for (let i = 0; i < 8; i++) {
|
|
@@ -12678,12 +12700,13 @@ var LeaferUI = function(exports) {
|
|
|
12678
12700
|
if (i % 2) resizeLines[(i - 1) / 2].set(Object.assign({
|
|
12679
12701
|
pointType: "resize",
|
|
12680
12702
|
rotation: (i - 1) / 2 * 90
|
|
12681
|
-
},
|
|
12703
|
+
}, resizeLinesStyle[(i - 1) / 2 % resizeLinesStyle.length] || {}));
|
|
12682
12704
|
}
|
|
12683
12705
|
circle.set(this.getPointStyle(mergeConfig.circle || mergeConfig.rotatePoint || pointsStyle[0]));
|
|
12684
12706
|
rect.set(Object.assign({
|
|
12685
12707
|
stroke: stroke,
|
|
12686
12708
|
strokeWidth: strokeWidth,
|
|
12709
|
+
opacity: 1,
|
|
12687
12710
|
editConfig: editConfig
|
|
12688
12711
|
}, mergeConfig.rect || {}));
|
|
12689
12712
|
const rectThrough = isNull(mergeConfig.rectThrough) ? single : mergeConfig.rectThrough;
|
|
@@ -12808,6 +12831,7 @@ var LeaferUI = function(exports) {
|
|
|
12808
12831
|
strokeWidth: strokeWidth,
|
|
12809
12832
|
around: "center",
|
|
12810
12833
|
strokeAlign: "center",
|
|
12834
|
+
opacity: 1,
|
|
12811
12835
|
width: pointSize,
|
|
12812
12836
|
height: pointSize,
|
|
12813
12837
|
cornerRadius: pointRadius,
|
|
@@ -12825,6 +12849,10 @@ var LeaferUI = function(exports) {
|
|
|
12825
12849
|
const {middlePoint: middlePoint} = this.mergedConfig;
|
|
12826
12850
|
return isArray(middlePoint) ? middlePoint : middlePoint ? [ middlePoint ] : this.getPointsStyle();
|
|
12827
12851
|
}
|
|
12852
|
+
getResizeLinesStyle() {
|
|
12853
|
+
const {resizeLine: resizeLine} = this.mergedConfig;
|
|
12854
|
+
return isArray(resizeLine) ? resizeLine : [ resizeLine ];
|
|
12855
|
+
}
|
|
12828
12856
|
onDragStart(e) {
|
|
12829
12857
|
this.dragging = true;
|
|
12830
12858
|
const point = this.dragPoint = e.current, {pointType: pointType} = point;
|
|
@@ -12859,7 +12887,7 @@ var LeaferUI = function(exports) {
|
|
|
12859
12887
|
this.dragPoint = null;
|
|
12860
12888
|
}
|
|
12861
12889
|
onTransformStart(e) {
|
|
12862
|
-
if (this.moving) this.editor.opacity = this.mergedConfig.hideOnMove ? 0 : 1;
|
|
12890
|
+
if (this.moving || this.gesturing) this.editor.opacity = this.mergedConfig.hideOnMove ? 0 : 1;
|
|
12863
12891
|
if (this.resizing) ResizeEvent.resizingKeys = this.editor.leafList.keys;
|
|
12864
12892
|
const {dragStartData: dragStartData, target: target} = this;
|
|
12865
12893
|
dragStartData.x = e.x;
|
|
@@ -12884,7 +12912,18 @@ var LeaferUI = function(exports) {
|
|
|
12884
12912
|
e.stop();
|
|
12885
12913
|
if (isString(this.mergedConfig.moveable)) {
|
|
12886
12914
|
this.gesturing = this.moving = true;
|
|
12887
|
-
e.type
|
|
12915
|
+
switch (e.type) {
|
|
12916
|
+
case exports.MoveEvent.START:
|
|
12917
|
+
this.onTransformStart(e);
|
|
12918
|
+
break;
|
|
12919
|
+
|
|
12920
|
+
case exports.MoveEvent.END:
|
|
12921
|
+
this.onTransformEnd(e);
|
|
12922
|
+
break;
|
|
12923
|
+
|
|
12924
|
+
default:
|
|
12925
|
+
this.transformTool.onMove(e);
|
|
12926
|
+
}
|
|
12888
12927
|
}
|
|
12889
12928
|
}
|
|
12890
12929
|
}
|
|
@@ -12893,7 +12932,18 @@ var LeaferUI = function(exports) {
|
|
|
12893
12932
|
e.stop();
|
|
12894
12933
|
if (isString(this.mergedConfig.resizeable)) {
|
|
12895
12934
|
this.gesturing = this.resizing = true;
|
|
12896
|
-
e.type
|
|
12935
|
+
switch (e.type) {
|
|
12936
|
+
case exports.ZoomEvent.START:
|
|
12937
|
+
this.onTransformStart(e);
|
|
12938
|
+
break;
|
|
12939
|
+
|
|
12940
|
+
case exports.ZoomEvent.END:
|
|
12941
|
+
this.onTransformEnd(e);
|
|
12942
|
+
break;
|
|
12943
|
+
|
|
12944
|
+
default:
|
|
12945
|
+
this.transformTool.onScale(e);
|
|
12946
|
+
}
|
|
12897
12947
|
}
|
|
12898
12948
|
}
|
|
12899
12949
|
}
|
|
@@ -12902,16 +12952,21 @@ var LeaferUI = function(exports) {
|
|
|
12902
12952
|
e.stop();
|
|
12903
12953
|
if (isString(this.mergedConfig.rotateable)) {
|
|
12904
12954
|
this.gesturing = this.rotating = true;
|
|
12905
|
-
e.type
|
|
12955
|
+
switch (e.type) {
|
|
12956
|
+
case exports.ZoomEvent.START:
|
|
12957
|
+
this.onTransformStart(e);
|
|
12958
|
+
break;
|
|
12959
|
+
|
|
12960
|
+
case exports.ZoomEvent.END:
|
|
12961
|
+
this.onTransformEnd(e);
|
|
12962
|
+
break;
|
|
12963
|
+
|
|
12964
|
+
default:
|
|
12965
|
+
this.transformTool.onRotate(e);
|
|
12966
|
+
}
|
|
12906
12967
|
}
|
|
12907
12968
|
}
|
|
12908
12969
|
}
|
|
12909
|
-
onGestureStart(e) {
|
|
12910
|
-
if (this.canGesture && e.moveType !== "drag") this.onTransformStart(e);
|
|
12911
|
-
}
|
|
12912
|
-
onGestureEnd(e) {
|
|
12913
|
-
if (this.canGesture && e.moveType !== "drag") this.onTransformEnd(e);
|
|
12914
|
-
}
|
|
12915
12970
|
isHoldRotateKey(e) {
|
|
12916
12971
|
const {rotateKey: rotateKey} = this.mergedConfig;
|
|
12917
12972
|
if (rotateKey) return e.isHoldKeys(rotateKey);
|
|
@@ -12981,7 +13036,7 @@ var LeaferUI = function(exports) {
|
|
|
12981
13036
|
const {rect: rect, editor: editor, __eventIds: events} = this;
|
|
12982
13037
|
events.push(rect.on_([ [ exports.PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ exports.PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
|
|
12983
13038
|
this.waitLeafer(() => {
|
|
12984
|
-
events.push(editor.app.on_([ [ [ exports.KeyEvent.HOLD, exports.KeyEvent.UP ], this.onKey, this ], [ exports.KeyEvent.DOWN, this.onArrow, this ], [ exports.MoveEvent.
|
|
13039
|
+
events.push(editor.app.on_([ [ [ exports.KeyEvent.HOLD, exports.KeyEvent.UP ], this.onKey, this ], [ exports.KeyEvent.DOWN, this.onArrow, this ], [ [ exports.MoveEvent.START, exports.MoveEvent.BEFORE_MOVE, exports.MoveEvent.END ], this.onMove, this, true ], [ [ exports.ZoomEvent.START, exports.ZoomEvent.BEFORE_ZOOM, exports.ZoomEvent.END ], this.onScale, this, true ], [ [ exports.RotateEvent.START, exports.RotateEvent.BEFORE_ROTATE, exports.RotateEvent.END ], this.onRotate, this, true ] ]));
|
|
12985
13040
|
});
|
|
12986
13041
|
}
|
|
12987
13042
|
__removeListenEvents() {
|
|
@@ -13684,6 +13739,9 @@ var LeaferUI = function(exports) {
|
|
|
13684
13739
|
if (this.multiple) simulate(this);
|
|
13685
13740
|
this.update();
|
|
13686
13741
|
}
|
|
13742
|
+
getEditTool(name) {
|
|
13743
|
+
return this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
|
|
13744
|
+
}
|
|
13687
13745
|
updateEditTool() {
|
|
13688
13746
|
this.unloadEditTool();
|
|
13689
13747
|
if (this.editing) {
|
|
@@ -13698,7 +13756,7 @@ var LeaferUI = function(exports) {
|
|
|
13698
13756
|
if (isString(check)) name = check; else if (check === false) return;
|
|
13699
13757
|
}
|
|
13700
13758
|
if (EditToolCreator.list[name]) {
|
|
13701
|
-
const tool = this.editTool = this.
|
|
13759
|
+
const tool = this.editTool = this.getEditTool(name);
|
|
13702
13760
|
this.editBox.load();
|
|
13703
13761
|
tool.load();
|
|
13704
13762
|
this.update();
|
|
@@ -13787,9 +13845,12 @@ var LeaferUI = function(exports) {
|
|
|
13787
13845
|
const event = new EditorGroupEvent(type, {
|
|
13788
13846
|
editTarget: group
|
|
13789
13847
|
});
|
|
13790
|
-
|
|
13848
|
+
this.emitEvent(event);
|
|
13791
13849
|
if (group) group.emitEvent(event);
|
|
13792
13850
|
}
|
|
13851
|
+
getInnerEditor(name) {
|
|
13852
|
+
return this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
|
|
13853
|
+
}
|
|
13793
13854
|
openInnerEditor(target, nameOrSelect, select) {
|
|
13794
13855
|
let name;
|
|
13795
13856
|
if (isString(nameOrSelect)) name = nameOrSelect; else if (!select) select = nameOrSelect;
|
|
@@ -13808,7 +13869,7 @@ var LeaferUI = function(exports) {
|
|
|
13808
13869
|
if (EditToolCreator.list[name]) {
|
|
13809
13870
|
this.editTool.unload();
|
|
13810
13871
|
this.innerEditing = true;
|
|
13811
|
-
this.innerEditor = this.
|
|
13872
|
+
this.innerEditor = this.getInnerEditor(name);
|
|
13812
13873
|
this.innerEditor.editTarget = target;
|
|
13813
13874
|
this.emitInnerEvent(InnerEditorEvent.BEFORE_OPEN);
|
|
13814
13875
|
this.innerEditor.load();
|
|
@@ -13832,7 +13893,7 @@ var LeaferUI = function(exports) {
|
|
|
13832
13893
|
editTarget: editTarget,
|
|
13833
13894
|
innerEditor: innerEditor
|
|
13834
13895
|
});
|
|
13835
|
-
|
|
13896
|
+
this.emitEvent(event);
|
|
13836
13897
|
editTarget.emitEvent(event);
|
|
13837
13898
|
}
|
|
13838
13899
|
lock() {
|
|
@@ -15735,7 +15796,7 @@ var LeaferUI = function(exports) {
|
|
|
15735
15796
|
exports.UI.addAttr("endArrow", "none", arrowType);
|
|
15736
15797
|
Object.assign(PathArrow, PathArrowModule);
|
|
15737
15798
|
Object.assign(Paint, {
|
|
15738
|
-
strokeArrow(_stroke, ui, canvas) {
|
|
15799
|
+
strokeArrow(_stroke, ui, canvas, _renderOptions) {
|
|
15739
15800
|
if (ui.__.dashPattern) {
|
|
15740
15801
|
canvas.beginPath();
|
|
15741
15802
|
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
@@ -18450,6 +18511,7 @@ var LeaferUI = function(exports) {
|
|
|
18450
18511
|
exports.MyDragEvent = MyDragEvent;
|
|
18451
18512
|
exports.MyImage = MyImage;
|
|
18452
18513
|
exports.MyPointerEvent = MyPointerEvent;
|
|
18514
|
+
exports.MyTouchEvent = MyTouchEvent;
|
|
18453
18515
|
exports.NeedConvertToCanvasCommandMap = NeedConvertToCanvasCommandMap;
|
|
18454
18516
|
exports.OneRadian = OneRadian;
|
|
18455
18517
|
exports.PI2 = PI2;
|
|
@@ -18549,7 +18611,7 @@ var LeaferUI = function(exports) {
|
|
|
18549
18611
|
exports.isArray = isArray;
|
|
18550
18612
|
exports.isData = isData;
|
|
18551
18613
|
exports.isEmptyData = isEmptyData;
|
|
18552
|
-
exports.isFinite = isFinite;
|
|
18614
|
+
exports.isFinite = isFinite$1;
|
|
18553
18615
|
exports.isNull = isNull;
|
|
18554
18616
|
exports.isNumber = isNumber;
|
|
18555
18617
|
exports.isObject = isObject;
|