@leafer/worker 1.9.12 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.js +621 -561
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +642 -576
- 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.1";
|
|
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(_paint, 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,95 +10283,151 @@ 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) {
|
|
10287
|
-
let item;
|
|
10290
|
+
function fills(fills, ui, canvas, renderOptions) {
|
|
10291
|
+
let item, originPaint, countImage;
|
|
10288
10292
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
10289
|
-
item = fills[i];
|
|
10293
|
+
item = fills[i], originPaint = item.originPaint;
|
|
10290
10294
|
if (item.image) {
|
|
10291
|
-
|
|
10295
|
+
countImage ? countImage++ : countImage = 1;
|
|
10296
|
+
if (PaintImage.checkImage(item, !ui.__.__font, ui, canvas, renderOptions)) continue;
|
|
10292
10297
|
if (!item.style) {
|
|
10293
|
-
if (
|
|
10298
|
+
if (countImage === 1 && item.image.isPlacehold) ui.drawImagePlaceholder(item, canvas, renderOptions);
|
|
10294
10299
|
continue;
|
|
10295
10300
|
}
|
|
10296
10301
|
}
|
|
10297
10302
|
canvas.fillStyle = item.style;
|
|
10298
|
-
if (item.transform ||
|
|
10303
|
+
if (item.transform || originPaint.scaleFixed) {
|
|
10299
10304
|
canvas.save();
|
|
10300
10305
|
if (item.transform) canvas.transform(item.transform);
|
|
10301
|
-
if (
|
|
10306
|
+
if (originPaint.scaleFixed) {
|
|
10302
10307
|
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
10303
|
-
if (
|
|
10308
|
+
if (originPaint.scaleFixed === true || originPaint.scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) canvas.scale(1 / scaleX, 1 / scaleY);
|
|
10304
10309
|
}
|
|
10305
|
-
if (
|
|
10306
|
-
fillPathOrText(ui, canvas);
|
|
10310
|
+
if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
|
|
10311
|
+
fillPathOrText(ui, canvas, renderOptions);
|
|
10307
10312
|
canvas.restore();
|
|
10308
10313
|
} else {
|
|
10309
|
-
if (
|
|
10310
|
-
canvas.saveBlendMode(
|
|
10311
|
-
fillPathOrText(ui, canvas);
|
|
10314
|
+
if (originPaint.blendMode) {
|
|
10315
|
+
canvas.saveBlendMode(originPaint.blendMode);
|
|
10316
|
+
fillPathOrText(ui, canvas, renderOptions);
|
|
10312
10317
|
canvas.restoreBlendMode();
|
|
10313
|
-
} else fillPathOrText(ui, canvas);
|
|
10318
|
+
} else fillPathOrText(ui, canvas, renderOptions);
|
|
10319
|
+
}
|
|
10320
|
+
}
|
|
10321
|
+
}
|
|
10322
|
+
function fillPathOrText(ui, canvas, renderOptions) {
|
|
10323
|
+
ui.__.__font ? Paint.fillText(ui, canvas, renderOptions) : ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill();
|
|
10324
|
+
}
|
|
10325
|
+
function fillText(ui, canvas, _renderOptions) {
|
|
10326
|
+
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
10327
|
+
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
10328
|
+
let row;
|
|
10329
|
+
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10330
|
+
row = rows[i];
|
|
10331
|
+
if (row.text) canvas.fillText(row.text, row.x, row.y); else if (row.data) row.data.forEach(charData => {
|
|
10332
|
+
canvas.fillText(charData.char, charData.x, row.y);
|
|
10333
|
+
});
|
|
10334
|
+
}
|
|
10335
|
+
if (decorationY) {
|
|
10336
|
+
const {decorationColor: decorationColor, decorationHeight: decorationHeight} = data.__textDrawData;
|
|
10337
|
+
if (decorationColor) canvas.fillStyle = decorationColor;
|
|
10338
|
+
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
10339
|
+
}
|
|
10340
|
+
}
|
|
10341
|
+
function stroke(stroke, ui, canvas, renderOptions) {
|
|
10342
|
+
const data = ui.__;
|
|
10343
|
+
if (!data.__strokeWidth) return;
|
|
10344
|
+
if (data.__font) {
|
|
10345
|
+
Paint.strokeText(stroke, ui, canvas, renderOptions);
|
|
10346
|
+
} else {
|
|
10347
|
+
switch (data.strokeAlign) {
|
|
10348
|
+
case "center":
|
|
10349
|
+
drawCenter$1(stroke, 1, ui, canvas, renderOptions);
|
|
10350
|
+
break;
|
|
10351
|
+
|
|
10352
|
+
case "inside":
|
|
10353
|
+
drawInside(stroke, ui, canvas, renderOptions);
|
|
10354
|
+
break;
|
|
10355
|
+
|
|
10356
|
+
case "outside":
|
|
10357
|
+
drawOutside(stroke, ui, canvas, renderOptions);
|
|
10358
|
+
break;
|
|
10314
10359
|
}
|
|
10315
10360
|
}
|
|
10316
10361
|
}
|
|
10317
|
-
function
|
|
10318
|
-
|
|
10362
|
+
function strokes(strokes, ui, canvas, renderOptions) {
|
|
10363
|
+
Paint.stroke(strokes, ui, canvas, renderOptions);
|
|
10364
|
+
}
|
|
10365
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas, renderOptions) {
|
|
10366
|
+
const data = ui.__;
|
|
10367
|
+
if (isObject(stroke)) {
|
|
10368
|
+
Paint.drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas, renderOptions);
|
|
10369
|
+
} else {
|
|
10370
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10371
|
+
canvas.stroke();
|
|
10372
|
+
}
|
|
10373
|
+
if (data.__useArrow) Paint.strokeArrow(stroke, ui, canvas, renderOptions);
|
|
10374
|
+
}
|
|
10375
|
+
function drawInside(stroke, ui, canvas, renderOptions) {
|
|
10376
|
+
canvas.save();
|
|
10377
|
+
canvas.clipUI(ui);
|
|
10378
|
+
drawCenter$1(stroke, 2, ui, canvas, renderOptions);
|
|
10379
|
+
canvas.restore();
|
|
10380
|
+
}
|
|
10381
|
+
function drawOutside(stroke, ui, canvas, renderOptions) {
|
|
10382
|
+
const data = ui.__;
|
|
10383
|
+
if (data.__fillAfterStroke) {
|
|
10384
|
+
drawCenter$1(stroke, 2, ui, canvas, renderOptions);
|
|
10385
|
+
} else {
|
|
10386
|
+
const {renderBounds: renderBounds} = ui.__layout;
|
|
10387
|
+
const out = canvas.getSameCanvas(true, true);
|
|
10388
|
+
ui.__drawRenderPath(out);
|
|
10389
|
+
drawCenter$1(stroke, 2, ui, out, renderOptions);
|
|
10390
|
+
out.clipUI(data);
|
|
10391
|
+
out.clearWorld(renderBounds);
|
|
10392
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
10393
|
+
out.recycle(ui.__nowWorld);
|
|
10394
|
+
}
|
|
10319
10395
|
}
|
|
10320
|
-
function strokeText(stroke, ui, canvas) {
|
|
10396
|
+
function strokeText(stroke, ui, canvas, renderOptions) {
|
|
10321
10397
|
switch (ui.__.strokeAlign) {
|
|
10322
10398
|
case "center":
|
|
10323
|
-
drawCenter
|
|
10399
|
+
drawCenter(stroke, 1, ui, canvas, renderOptions);
|
|
10324
10400
|
break;
|
|
10325
10401
|
|
|
10326
10402
|
case "inside":
|
|
10327
|
-
drawAlign(stroke, "inside", ui, canvas);
|
|
10403
|
+
drawAlign(stroke, "inside", ui, canvas, renderOptions);
|
|
10328
10404
|
break;
|
|
10329
10405
|
|
|
10330
10406
|
case "outside":
|
|
10331
|
-
ui.__.__fillAfterStroke ? drawCenter
|
|
10407
|
+
ui.__.__fillAfterStroke ? drawCenter(stroke, 2, ui, canvas, renderOptions) : drawAlign(stroke, "outside", ui, canvas, renderOptions);
|
|
10332
10408
|
break;
|
|
10333
10409
|
}
|
|
10334
10410
|
}
|
|
10335
|
-
function drawCenter
|
|
10411
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas, renderOptions) {
|
|
10336
10412
|
const data = ui.__;
|
|
10337
10413
|
if (isObject(stroke)) {
|
|
10338
|
-
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
10414
|
+
Paint.drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas, renderOptions);
|
|
10339
10415
|
} else {
|
|
10340
10416
|
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10341
|
-
drawTextStroke(ui, canvas);
|
|
10417
|
+
Paint.drawTextStroke(ui, canvas, renderOptions);
|
|
10342
10418
|
}
|
|
10343
10419
|
}
|
|
10344
|
-
function drawAlign(stroke, align, ui, canvas) {
|
|
10420
|
+
function drawAlign(stroke, align, ui, canvas, renderOptions) {
|
|
10345
10421
|
const out = canvas.getSameCanvas(true, true);
|
|
10346
10422
|
out.font = ui.__.__font;
|
|
10347
|
-
drawCenter
|
|
10423
|
+
drawCenter(stroke, 2, ui, out, renderOptions);
|
|
10348
10424
|
out.blendMode = align === "outside" ? "destination-out" : "destination-in";
|
|
10349
|
-
fillText(ui, out);
|
|
10425
|
+
Paint.fillText(ui, out, renderOptions);
|
|
10350
10426
|
out.blendMode = "normal";
|
|
10351
10427
|
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
10352
10428
|
out.recycle(ui.__nowWorld);
|
|
10353
10429
|
}
|
|
10354
|
-
function drawTextStroke(ui, canvas) {
|
|
10430
|
+
function drawTextStroke(ui, canvas, _renderOptions) {
|
|
10355
10431
|
let row, data = ui.__.__textDrawData;
|
|
10356
10432
|
const {rows: rows, decorationY: decorationY} = data;
|
|
10357
10433
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
@@ -10365,83 +10441,28 @@ var LeaferUI = function(exports) {
|
|
|
10365
10441
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
10366
10442
|
}
|
|
10367
10443
|
}
|
|
10368
|
-
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
10444
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas, renderOptions) {
|
|
10369
10445
|
let item;
|
|
10370
10446
|
const data = ui.__, {__hasMultiStrokeStyle: __hasMultiStrokeStyle} = data;
|
|
10371
10447
|
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
10372
10448
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
10373
10449
|
item = strokes[i];
|
|
10374
|
-
if (item.image && PaintImage.checkImage(ui, canvas,
|
|
10450
|
+
if (item.image && PaintImage.checkImage(item, false, ui, canvas, renderOptions)) continue;
|
|
10375
10451
|
if (item.style) {
|
|
10376
10452
|
if (__hasMultiStrokeStyle) {
|
|
10377
10453
|
const {strokeStyle: strokeStyle} = item;
|
|
10378
10454
|
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
10379
10455
|
} else canvas.strokeStyle = item.style;
|
|
10380
|
-
if (item.blendMode) {
|
|
10381
|
-
canvas.saveBlendMode(item.blendMode);
|
|
10382
|
-
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
10456
|
+
if (item.originPaint.blendMode) {
|
|
10457
|
+
canvas.saveBlendMode(item.originPaint.blendMode);
|
|
10458
|
+
isText ? Paint.drawTextStroke(ui, canvas, renderOptions) : canvas.stroke();
|
|
10383
10459
|
canvas.restoreBlendMode();
|
|
10384
10460
|
} else {
|
|
10385
|
-
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
10461
|
+
isText ? Paint.drawTextStroke(ui, canvas, renderOptions) : canvas.stroke();
|
|
10386
10462
|
}
|
|
10387
10463
|
}
|
|
10388
10464
|
}
|
|
10389
10465
|
}
|
|
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
10466
|
const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
|
|
10446
10467
|
const tempBounds$1 = {};
|
|
10447
10468
|
function shape(ui, current, options) {
|
|
@@ -10524,61 +10545,62 @@ var LeaferUI = function(exports) {
|
|
|
10524
10545
|
if (leafPaints.some(item => item.image)) isAlphaPixel = true;
|
|
10525
10546
|
isTransparent = true;
|
|
10526
10547
|
}
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10548
|
+
if (attrName === "fill") {
|
|
10549
|
+
stintSet(data, "__isAlphaPixelFill", isAlphaPixel);
|
|
10550
|
+
stintSet(data, "__isTransparentFill", isTransparent);
|
|
10551
|
+
} else {
|
|
10552
|
+
stintSet(data, "__isAlphaPixelStroke", isAlphaPixel);
|
|
10553
|
+
stintSet(data, "__isTransparentStroke", isTransparent);
|
|
10554
|
+
stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
|
|
10555
|
+
}
|
|
10531
10556
|
} else {
|
|
10532
|
-
|
|
10533
|
-
stintSet(data, "__isTransparentStroke", isTransparent);
|
|
10534
|
-
stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
|
|
10557
|
+
data.__removePaint(attrName, false);
|
|
10535
10558
|
}
|
|
10536
10559
|
}
|
|
10537
10560
|
function getLeafPaint(attrName, paint, ui) {
|
|
10538
10561
|
if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
|
|
10539
|
-
let
|
|
10562
|
+
let leafPaint;
|
|
10540
10563
|
const {boxBounds: boxBounds} = ui.__layout;
|
|
10541
10564
|
switch (paint.type) {
|
|
10542
10565
|
case "image":
|
|
10543
|
-
|
|
10566
|
+
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
10544
10567
|
break;
|
|
10545
10568
|
|
|
10546
10569
|
case "linear":
|
|
10547
|
-
|
|
10570
|
+
leafPaint = PaintGradient.linearGradient(paint, boxBounds);
|
|
10548
10571
|
break;
|
|
10549
10572
|
|
|
10550
10573
|
case "radial":
|
|
10551
|
-
|
|
10574
|
+
leafPaint = PaintGradient.radialGradient(paint, boxBounds);
|
|
10552
10575
|
break;
|
|
10553
10576
|
|
|
10554
10577
|
case "angular":
|
|
10555
|
-
|
|
10578
|
+
leafPaint = PaintGradient.conicGradient(paint, boxBounds);
|
|
10556
10579
|
break;
|
|
10557
10580
|
|
|
10558
10581
|
case "solid":
|
|
10559
10582
|
const {type: type, color: color, opacity: opacity} = paint;
|
|
10560
|
-
|
|
10583
|
+
leafPaint = {
|
|
10561
10584
|
type: type,
|
|
10562
10585
|
style: ColorConvert.string(color, opacity)
|
|
10563
10586
|
};
|
|
10564
10587
|
break;
|
|
10565
10588
|
|
|
10566
10589
|
default:
|
|
10567
|
-
if (!isUndefined(paint.r))
|
|
10590
|
+
if (!isUndefined(paint.r)) leafPaint = {
|
|
10568
10591
|
type: "solid",
|
|
10569
10592
|
style: ColorConvert.string(paint)
|
|
10570
10593
|
};
|
|
10571
10594
|
}
|
|
10572
|
-
if (
|
|
10573
|
-
|
|
10595
|
+
if (leafPaint) {
|
|
10596
|
+
leafPaint.originPaint = paint;
|
|
10597
|
+
if (isString(leafPaint.style) && hasTransparent$1(leafPaint.style)) leafPaint.isTransparent = true;
|
|
10574
10598
|
if (paint.style) {
|
|
10575
10599
|
if (paint.style.strokeWidth === 0) return undefined;
|
|
10576
|
-
|
|
10600
|
+
leafPaint.strokeStyle = paint.style;
|
|
10577
10601
|
}
|
|
10578
|
-
if (paint.editing) data.editing = paint.editing;
|
|
10579
|
-
if (paint.blendMode) data.blendMode = paint.blendMode;
|
|
10580
10602
|
}
|
|
10581
|
-
return
|
|
10603
|
+
return leafPaint;
|
|
10582
10604
|
}
|
|
10583
10605
|
const PaintModule = {
|
|
10584
10606
|
compute: compute,
|
|
@@ -10590,94 +10612,118 @@ var LeaferUI = function(exports) {
|
|
|
10590
10612
|
strokes: strokes,
|
|
10591
10613
|
strokeText: strokeText,
|
|
10592
10614
|
drawTextStroke: drawTextStroke,
|
|
10615
|
+
drawStrokesStyle: drawStrokesStyle,
|
|
10593
10616
|
shape: shape
|
|
10594
10617
|
};
|
|
10595
|
-
let
|
|
10596
|
-
const {
|
|
10597
|
-
function
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
if (
|
|
10601
|
-
|
|
10602
|
-
}
|
|
10603
|
-
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10604
|
-
const transform = get$3();
|
|
10605
|
-
translate$1(transform, box.x + x, box.y + y);
|
|
10606
|
-
scaleHelper(transform, scaleX, scaleY);
|
|
10607
|
-
if (rotation) rotateOfOuter$1(transform, {
|
|
10608
|
-
x: box.x + box.width / 2,
|
|
10609
|
-
y: box.y + box.height / 2
|
|
10610
|
-
}, rotation);
|
|
10611
|
-
data.transform = transform;
|
|
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);
|
|
10622
|
-
}
|
|
10623
|
-
data.transform = transform;
|
|
10624
|
-
}
|
|
10625
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, skew, align, freeTransform) {
|
|
10626
|
-
const transform = get$3();
|
|
10627
|
-
if (freeTransform) {
|
|
10628
|
-
layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
10618
|
+
let cache$1, box$1 = new Bounds;
|
|
10619
|
+
const {isSame: isSame} = BoundsHelper;
|
|
10620
|
+
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
10621
|
+
let leafPaint, event;
|
|
10622
|
+
const image = ImageManager.get(paint);
|
|
10623
|
+
if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
|
|
10624
|
+
leafPaint = cache$1.leafPaint;
|
|
10629
10625
|
} else {
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10626
|
+
leafPaint = {
|
|
10627
|
+
type: paint.type,
|
|
10628
|
+
image: image
|
|
10629
|
+
};
|
|
10630
|
+
if (image.hasAlphaPixel) leafPaint.isTransparent = true;
|
|
10631
|
+
cache$1 = image.use > 1 ? {
|
|
10632
|
+
leafPaint: leafPaint,
|
|
10633
|
+
paint: paint,
|
|
10634
|
+
boxBounds: box$1.set(boxBounds)
|
|
10635
|
+
} : null;
|
|
10636
|
+
}
|
|
10637
|
+
if (firstUse || image.loading) event = {
|
|
10638
|
+
image: image,
|
|
10639
|
+
attrName: attrName,
|
|
10640
|
+
attrValue: paint
|
|
10641
|
+
};
|
|
10642
|
+
if (image.ready) {
|
|
10643
|
+
checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds);
|
|
10644
|
+
if (firstUse) {
|
|
10645
|
+
onLoad(ui, event);
|
|
10646
|
+
onLoadSuccess(ui, event);
|
|
10647
|
+
}
|
|
10648
|
+
} else if (image.error) {
|
|
10649
|
+
if (firstUse) onLoadError(ui, event, image.error);
|
|
10650
|
+
} else {
|
|
10651
|
+
if (firstUse) {
|
|
10652
|
+
ignoreRender(ui, true);
|
|
10653
|
+
onLoad(ui, event);
|
|
10654
|
+
}
|
|
10655
|
+
leafPaint.loadId = image.load(() => {
|
|
10656
|
+
ignoreRender(ui, false);
|
|
10657
|
+
if (!ui.destroyed) {
|
|
10658
|
+
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
10659
|
+
if (image.hasAlphaPixel) ui.__layout.hitCanvasChanged = true;
|
|
10660
|
+
ui.forceUpdate("surface");
|
|
10650
10661
|
}
|
|
10662
|
+
onLoadSuccess(ui, event);
|
|
10651
10663
|
}
|
|
10664
|
+
leafPaint.loadId = undefined;
|
|
10665
|
+
}, error => {
|
|
10666
|
+
ignoreRender(ui, false);
|
|
10667
|
+
onLoadError(ui, event, error);
|
|
10668
|
+
leafPaint.loadId = undefined;
|
|
10669
|
+
});
|
|
10670
|
+
if (ui.placeholderColor) {
|
|
10671
|
+
if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
|
|
10672
|
+
if (!image.ready) {
|
|
10673
|
+
image.isPlacehold = true;
|
|
10674
|
+
ui.forceUpdate("surface");
|
|
10675
|
+
}
|
|
10676
|
+
}, ui.placeholderDelay);
|
|
10652
10677
|
}
|
|
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
10678
|
}
|
|
10658
|
-
|
|
10679
|
+
return leafPaint;
|
|
10659
10680
|
}
|
|
10660
|
-
function
|
|
10661
|
-
if (
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10681
|
+
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
10682
|
+
if (attrName === "fill" && !ui.__.__naturalWidth) {
|
|
10683
|
+
const data = ui.__;
|
|
10684
|
+
data.__naturalWidth = image.width / data.pixelRatio;
|
|
10685
|
+
data.__naturalHeight = image.height / data.pixelRatio;
|
|
10686
|
+
if (data.__autoSide) {
|
|
10687
|
+
ui.forceUpdate("width");
|
|
10688
|
+
if (ui.__proxyData) {
|
|
10689
|
+
ui.setProxyAttr("width", data.width);
|
|
10690
|
+
ui.setProxyAttr("height", data.height);
|
|
10691
|
+
}
|
|
10692
|
+
return false;
|
|
10693
|
+
}
|
|
10694
|
+
}
|
|
10695
|
+
if (!leafPaint.data) PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
10696
|
+
return true;
|
|
10697
|
+
}
|
|
10698
|
+
function onLoad(ui, event) {
|
|
10699
|
+
emit(ui, ImageEvent.LOAD, event);
|
|
10700
|
+
}
|
|
10701
|
+
function onLoadSuccess(ui, event) {
|
|
10702
|
+
emit(ui, ImageEvent.LOADED, event);
|
|
10665
10703
|
}
|
|
10666
|
-
|
|
10704
|
+
function onLoadError(ui, event, error) {
|
|
10705
|
+
event.error = error;
|
|
10706
|
+
ui.forceUpdate("surface");
|
|
10707
|
+
emit(ui, ImageEvent.ERROR, event);
|
|
10708
|
+
}
|
|
10709
|
+
function emit(ui, type, data) {
|
|
10710
|
+
if (ui.hasEvent(type)) ui.emitEvent(new ImageEvent(type, data));
|
|
10711
|
+
}
|
|
10712
|
+
function ignoreRender(ui, value) {
|
|
10713
|
+
const {leafer: leafer} = ui;
|
|
10714
|
+
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
10715
|
+
}
|
|
10716
|
+
const {get: get$3, translate: translate$1} = MatrixHelper;
|
|
10667
10717
|
const tempBox = new Bounds;
|
|
10668
10718
|
const tempScaleData = {};
|
|
10669
10719
|
const tempImage = {};
|
|
10670
10720
|
function createData(leafPaint, image, paint, box) {
|
|
10671
|
-
|
|
10672
|
-
if (changeful) leafPaint.changeful = changeful;
|
|
10673
|
-
if (sync) leafPaint.sync = sync;
|
|
10674
|
-
if (scaleFixed) leafPaint.scaleFixed = scaleFixed;
|
|
10675
|
-
leafPaint.data = getPatternData(paint, box, image);
|
|
10721
|
+
leafPaint.data = PaintImage.getPatternData(paint, box, image);
|
|
10676
10722
|
}
|
|
10677
10723
|
function getPatternData(paint, box, image) {
|
|
10678
10724
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
10679
10725
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
10680
|
-
|
|
10726
|
+
const {width: width, height: height} = image;
|
|
10681
10727
|
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
10728
|
const sameBox = box.width === width && box.height === height;
|
|
10683
10729
|
const data = {
|
|
@@ -10708,8 +10754,8 @@ var LeaferUI = function(exports) {
|
|
|
10708
10754
|
case "stretch":
|
|
10709
10755
|
if (!sameBox) {
|
|
10710
10756
|
scaleX = box.width / width, scaleY = box.height / height;
|
|
10711
|
-
stretchMode(data, box, scaleX, scaleY);
|
|
10712
|
-
}
|
|
10757
|
+
PaintImage.stretchMode(data, box, scaleX, scaleY);
|
|
10758
|
+
} else if (scaleX) scaleX = scaleY = undefined;
|
|
10713
10759
|
break;
|
|
10714
10760
|
|
|
10715
10761
|
case "normal":
|
|
@@ -10717,13 +10763,13 @@ var LeaferUI = function(exports) {
|
|
|
10717
10763
|
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
10718
10764
|
let clipScaleX, clipScaleY;
|
|
10719
10765
|
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);
|
|
10766
|
+
PaintImage.clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
10721
10767
|
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
10722
10768
|
}
|
|
10723
10769
|
break;
|
|
10724
10770
|
|
|
10725
10771
|
case "repeat":
|
|
10726
|
-
if (!sameBox || scaleX || rotation || skew) repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
|
|
10772
|
+
if (!sameBox || scaleX || rotation || skew) PaintImage.repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
|
|
10727
10773
|
if (!repeat) data.repeat = "repeat";
|
|
10728
10774
|
const count = isObject(repeat);
|
|
10729
10775
|
if (gap || count) data.gap = getGapData(gap, count && repeat, tempImage.width, tempImage.height, box);
|
|
@@ -10732,18 +10778,16 @@ var LeaferUI = function(exports) {
|
|
|
10732
10778
|
case "fit":
|
|
10733
10779
|
case "cover":
|
|
10734
10780
|
default:
|
|
10735
|
-
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10781
|
+
if (scaleX) PaintImage.fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10736
10782
|
}
|
|
10737
10783
|
if (!data.transform) {
|
|
10738
|
-
if (box.x || box.y) translate(data.transform = get$
|
|
10784
|
+
if (box.x || box.y) translate$1(data.transform = get$3(), box.x, box.y);
|
|
10739
10785
|
}
|
|
10740
|
-
data.width = width;
|
|
10741
|
-
data.height = height;
|
|
10742
10786
|
if (scaleX) {
|
|
10743
10787
|
data.scaleX = scaleX;
|
|
10744
10788
|
data.scaleY = scaleY;
|
|
10745
10789
|
}
|
|
10746
|
-
if (opacity) data.opacity = opacity;
|
|
10790
|
+
if (opacity && opacity < 1) data.opacity = opacity;
|
|
10747
10791
|
if (filters) data.filters = filters;
|
|
10748
10792
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
10749
10793
|
return data;
|
|
@@ -10762,221 +10806,180 @@ var LeaferUI = function(exports) {
|
|
|
10762
10806
|
const value = auto ? remain / ((rows || Math.floor(totalSize / size)) - 1) : gap;
|
|
10763
10807
|
return gap === "auto" ? value < 0 ? 0 : value : value;
|
|
10764
10808
|
}
|
|
10765
|
-
let
|
|
10766
|
-
const {
|
|
10767
|
-
function
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10809
|
+
let origin$1 = {}, tempMatrix$1 = getMatrixData();
|
|
10810
|
+
const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
|
|
10811
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
10812
|
+
const transform = get$2(), {x: x, y: y} = box;
|
|
10813
|
+
if (x || y) translate(transform, x, y); else transform.onlyScale = true;
|
|
10814
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
10815
|
+
data.transform = transform;
|
|
10816
|
+
}
|
|
10817
|
+
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10818
|
+
const transform = get$2();
|
|
10819
|
+
translate(transform, box.x + x, box.y + y);
|
|
10820
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
10821
|
+
if (rotation) rotateOfOuter$1(transform, {
|
|
10822
|
+
x: box.x + box.width / 2,
|
|
10823
|
+
y: box.y + box.height / 2
|
|
10824
|
+
}, rotation);
|
|
10825
|
+
data.transform = transform;
|
|
10826
|
+
}
|
|
10827
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
10828
|
+
const transform = get$2();
|
|
10829
|
+
layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
10830
|
+
if (clipScaleX) {
|
|
10831
|
+
if (rotation || skew) {
|
|
10832
|
+
set(tempMatrix$1);
|
|
10833
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
10834
|
+
multiplyParent(transform, tempMatrix$1);
|
|
10835
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
10783
10836
|
}
|
|
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);
|
|
10837
|
+
data.transform = transform;
|
|
10838
|
+
}
|
|
10839
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, skew, align, freeTransform) {
|
|
10840
|
+
const transform = get$2();
|
|
10841
|
+
if (freeTransform) {
|
|
10842
|
+
layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
10797
10843
|
} 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");
|
|
10844
|
+
if (rotation) {
|
|
10845
|
+
if (align === "center") {
|
|
10846
|
+
rotateOfOuter$1(transform, {
|
|
10847
|
+
x: width / 2,
|
|
10848
|
+
y: height / 2
|
|
10849
|
+
}, rotation);
|
|
10850
|
+
} else {
|
|
10851
|
+
rotate$2(transform, rotation);
|
|
10852
|
+
switch (rotation) {
|
|
10853
|
+
case 90:
|
|
10854
|
+
translate(transform, height, 0);
|
|
10855
|
+
break;
|
|
10856
|
+
|
|
10857
|
+
case 180:
|
|
10858
|
+
translate(transform, width, height);
|
|
10859
|
+
break;
|
|
10860
|
+
|
|
10861
|
+
case 270:
|
|
10862
|
+
translate(transform, 0, width);
|
|
10863
|
+
break;
|
|
10822
10864
|
}
|
|
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
10865
|
}
|
|
10839
|
-
return false;
|
|
10840
10866
|
}
|
|
10867
|
+
origin$1.x = box.x + x;
|
|
10868
|
+
origin$1.y = box.y + y;
|
|
10869
|
+
translate(transform, origin$1.x, origin$1.y);
|
|
10870
|
+
if (scaleX) scaleOfOuter$1(transform, origin$1, scaleX, scaleY);
|
|
10841
10871
|
}
|
|
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));
|
|
10872
|
+
data.transform = transform;
|
|
10858
10873
|
}
|
|
10859
|
-
function
|
|
10860
|
-
|
|
10861
|
-
if (
|
|
10874
|
+
function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
10875
|
+
if (rotation) rotate$2(transform, rotation);
|
|
10876
|
+
if (skew) skewHelper(transform, skew.x, skew.y);
|
|
10877
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
10878
|
+
translate(transform, box.x + x, box.y + y);
|
|
10862
10879
|
}
|
|
10863
10880
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
10864
|
-
const {
|
|
10865
|
-
function
|
|
10866
|
-
|
|
10867
|
-
|
|
10881
|
+
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
|
|
10882
|
+
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
10883
|
+
if (!paint.patternTask) {
|
|
10884
|
+
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
10885
|
+
paint.patternTask = null;
|
|
10886
|
+
if (canvas.bounds.hit(ui.__nowWorld)) PaintImage.createPattern(paint, ui, canvas, renderOptions);
|
|
10887
|
+
ui.forceUpdate("surface");
|
|
10888
|
+
}), 300);
|
|
10889
|
+
}
|
|
10890
|
+
}
|
|
10891
|
+
function createPattern(paint, ui, canvas, renderOptions) {
|
|
10892
|
+
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
|
|
10868
10893
|
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) {
|
|
10894
|
+
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
10895
|
+
const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
10896
|
+
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
10897
|
+
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
10898
|
+
width *= scaleX;
|
|
10899
|
+
height *= scaleY;
|
|
10900
|
+
if (gap) {
|
|
10901
|
+
xGap = gap.x * scaleX / abs$6(data.scaleX || 1);
|
|
10902
|
+
yGap = gap.y * scaleY / abs$6(data.scaleY || 1);
|
|
10903
|
+
}
|
|
10904
|
+
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
10905
|
+
scaleX *= getFloorScale(width + (xGap || 0));
|
|
10906
|
+
scaleY *= getFloorScale(height + (yGap || 0));
|
|
10915
10907
|
imageMatrix = get$1();
|
|
10916
10908
|
if (transform) copy$4(imageMatrix, transform);
|
|
10909
|
+
scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10917
10910
|
}
|
|
10918
|
-
|
|
10911
|
+
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
10912
|
+
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
10913
|
+
paint.style = pattern;
|
|
10914
|
+
paint.patternId = id;
|
|
10919
10915
|
}
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10916
|
+
}
|
|
10917
|
+
}
|
|
10918
|
+
function getPatternFixScale(paint, imageScaleX, imageScaleY) {
|
|
10919
|
+
const {image: image} = paint;
|
|
10920
|
+
let fixScale, maxSize = Platform.image.maxPatternSize, imageSize = image.width * image.height;
|
|
10921
|
+
if (image.isSVG) {
|
|
10922
|
+
if (imageScaleX > 1) fixScale = Math.ceil(imageScaleX) / imageScaleX;
|
|
10925
10923
|
} else {
|
|
10926
|
-
|
|
10924
|
+
if (maxSize > imageSize) maxSize = imageSize;
|
|
10927
10925
|
}
|
|
10926
|
+
if ((imageSize *= imageScaleX * imageScaleY) > maxSize) fixScale = Math.sqrt(maxSize / imageSize);
|
|
10927
|
+
return fixScale;
|
|
10928
10928
|
}
|
|
10929
|
-
function checkImage(ui, canvas,
|
|
10930
|
-
const {scaleX: scaleX, scaleY: scaleY} =
|
|
10931
|
-
const {
|
|
10932
|
-
if (!data || paint.patternId === scaleX + "-" + scaleY
|
|
10929
|
+
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
10930
|
+
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
10931
|
+
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting} = renderOptions;
|
|
10932
|
+
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting) {
|
|
10933
10933
|
return false;
|
|
10934
10934
|
} else {
|
|
10935
|
-
if (
|
|
10935
|
+
if (drawImage) {
|
|
10936
10936
|
if (data.repeat) {
|
|
10937
|
-
|
|
10938
|
-
} else if (!(
|
|
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;
|
|
10937
|
+
drawImage = false;
|
|
10938
|
+
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
10939
|
+
drawImage = Platform.image.isLarge(image, scaleX, scaleY);
|
|
10947
10940
|
}
|
|
10948
10941
|
}
|
|
10949
|
-
if (
|
|
10942
|
+
if (drawImage) {
|
|
10950
10943
|
if (ui.__.__isFastShadow) {
|
|
10951
10944
|
canvas.fillStyle = paint.style || "#000";
|
|
10952
10945
|
canvas.fill();
|
|
10953
10946
|
}
|
|
10954
|
-
drawImage(ui, canvas,
|
|
10947
|
+
PaintImage.drawImage(paint, scaleX, scaleY, ui, canvas, renderOptions);
|
|
10955
10948
|
return true;
|
|
10956
10949
|
} else {
|
|
10957
|
-
if (!paint.style ||
|
|
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
|
-
}
|
|
10950
|
+
if (!paint.style || originPaint.sync || exporting) PaintImage.createPattern(paint, ui, canvas, renderOptions); else PaintImage.createPatternTask(paint, ui, canvas, renderOptions);
|
|
10968
10951
|
return false;
|
|
10969
10952
|
}
|
|
10970
10953
|
}
|
|
10971
10954
|
}
|
|
10972
|
-
function drawImage(ui, canvas,
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
if (
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
|
|
10955
|
+
function drawImage(paint, _imageScaleX, _imageScaleY, ui, canvas, _renderOptions) {
|
|
10956
|
+
const {data: data, image: image} = paint, {blendMode: blendMode} = paint.originPaint, {opacity: opacity, transform: transform} = data, view = image.getFull(data.filters), u = ui.__;
|
|
10957
|
+
let {width: width, height: height} = image, clipUI;
|
|
10958
|
+
if ((clipUI = transform && !transform.onlyScale || u.path || u.cornerRadius) || opacity || blendMode) {
|
|
10959
|
+
canvas.save();
|
|
10960
|
+
clipUI && canvas.clipUI(ui);
|
|
10961
|
+
blendMode && (canvas.blendMode = blendMode);
|
|
10962
|
+
opacity && (canvas.opacity *= opacity);
|
|
10963
|
+
transform && canvas.transform(transform);
|
|
10964
|
+
canvas.drawImage(view, 0, 0, width, height);
|
|
10965
|
+
canvas.restore();
|
|
10966
|
+
} else {
|
|
10967
|
+
if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
|
|
10968
|
+
canvas.drawImage(view, 0, 0, width, height);
|
|
10969
|
+
}
|
|
10970
|
+
}
|
|
10971
|
+
function getImageRenderScaleData(paint, ui, canvas, _renderOptions) {
|
|
10972
|
+
const scaleData = ui.getRenderScaleData(true, paint.originPaint.scaleFixed), {data: data} = paint;
|
|
10973
|
+
if (canvas) {
|
|
10974
|
+
const {pixelRatio: pixelRatio} = canvas;
|
|
10975
|
+
scaleData.scaleX *= pixelRatio;
|
|
10976
|
+
scaleData.scaleY *= pixelRatio;
|
|
10977
|
+
}
|
|
10978
|
+
if (data && data.scaleX) {
|
|
10979
|
+
scaleData.scaleX *= Math.abs(data.scaleX);
|
|
10980
|
+
scaleData.scaleY *= Math.abs(data.scaleY);
|
|
10981
|
+
}
|
|
10982
|
+
return scaleData;
|
|
10980
10983
|
}
|
|
10981
10984
|
function recycleImage(attrName, data) {
|
|
10982
10985
|
const paints = data["_" + attrName];
|
|
@@ -11006,8 +11009,12 @@ var LeaferUI = function(exports) {
|
|
|
11006
11009
|
const PaintImageModule = {
|
|
11007
11010
|
image: image,
|
|
11008
11011
|
checkImage: checkImage,
|
|
11009
|
-
|
|
11012
|
+
drawImage: drawImage,
|
|
11013
|
+
getImageRenderScaleData: getImageRenderScaleData,
|
|
11010
11014
|
recycleImage: recycleImage,
|
|
11015
|
+
createPatternTask: createPatternTask,
|
|
11016
|
+
createPattern: createPattern,
|
|
11017
|
+
getPatternFixScale: getPatternFixScale,
|
|
11011
11018
|
createData: createData,
|
|
11012
11019
|
getPatternData: getPatternData,
|
|
11013
11020
|
stretchMode: stretchMode,
|
|
@@ -11394,10 +11401,8 @@ var LeaferUI = function(exports) {
|
|
|
11394
11401
|
bounds$3 = drawData.bounds;
|
|
11395
11402
|
findMaxWidth = !bounds$3.width && !style.autoSizeAlign;
|
|
11396
11403
|
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) {
|
|
11404
|
+
const {canvas: canvas} = Platform, {width: width} = bounds$3;
|
|
11405
|
+
if (style.__isCharMode) {
|
|
11401
11406
|
const wrap = style.textWrap !== "none";
|
|
11402
11407
|
const breakAll = style.textWrap === "break";
|
|
11403
11408
|
paraStart = true;
|
|
@@ -11518,12 +11523,19 @@ var LeaferUI = function(exports) {
|
|
|
11518
11523
|
function layoutChar(drawData, style, width, _height) {
|
|
11519
11524
|
const {rows: rows} = drawData;
|
|
11520
11525
|
const {textAlign: textAlign, paraIndent: paraIndent, letterSpacing: letterSpacing} = style;
|
|
11521
|
-
|
|
11526
|
+
const justifyLast = width && textAlign.includes("both");
|
|
11527
|
+
const justify = justifyLast || width && textAlign.includes("justify");
|
|
11528
|
+
const justifyLetter = justify && textAlign.includes("letter");
|
|
11529
|
+
let charX, remainingWidth, addWordWidth, addLetterWidth, indentWidth, mode, wordChar, wordsLength, isLastWord, canJustify;
|
|
11522
11530
|
rows.forEach(row => {
|
|
11523
11531
|
if (row.words) {
|
|
11524
11532
|
indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
|
|
11525
|
-
|
|
11526
|
-
|
|
11533
|
+
if (justify) {
|
|
11534
|
+
canJustify = !row.paraEnd || justifyLast;
|
|
11535
|
+
remainingWidth = width - row.width - indentWidth;
|
|
11536
|
+
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
|
|
11537
|
+
}
|
|
11538
|
+
mode = letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
|
|
11527
11539
|
if (row.isOverflow && !letterSpacing) row.textMode = true;
|
|
11528
11540
|
if (mode === TextMode) {
|
|
11529
11541
|
row.x += indentWidth;
|
|
@@ -11541,11 +11553,15 @@ var LeaferUI = function(exports) {
|
|
|
11541
11553
|
charX = toWordChar(word.data, charX, wordChar);
|
|
11542
11554
|
if (row.isOverflow || wordChar.char !== " ") row.data.push(wordChar);
|
|
11543
11555
|
} else {
|
|
11544
|
-
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
11556
|
+
charX = toChar(word.data, charX, row.data, row.isOverflow, canJustify && addLetterWidth);
|
|
11545
11557
|
}
|
|
11546
|
-
if (
|
|
11547
|
-
|
|
11548
|
-
|
|
11558
|
+
if (canJustify) {
|
|
11559
|
+
isLastWord = index === wordsLength - 1;
|
|
11560
|
+
if (addWordWidth) {
|
|
11561
|
+
if (!isLastWord) charX += addWordWidth, row.width += addWordWidth;
|
|
11562
|
+
} else if (addLetterWidth) {
|
|
11563
|
+
row.width += addLetterWidth * (word.data.length - (isLastWord ? 1 : 0));
|
|
11564
|
+
}
|
|
11549
11565
|
}
|
|
11550
11566
|
});
|
|
11551
11567
|
}
|
|
@@ -11568,13 +11584,14 @@ var LeaferUI = function(exports) {
|
|
|
11568
11584
|
});
|
|
11569
11585
|
return charX;
|
|
11570
11586
|
}
|
|
11571
|
-
function toChar(data, charX, rowData, isOverflow) {
|
|
11587
|
+
function toChar(data, charX, rowData, isOverflow, addLetterWidth) {
|
|
11572
11588
|
data.forEach(char => {
|
|
11573
11589
|
if (isOverflow || char.char !== " ") {
|
|
11574
11590
|
char.x = charX;
|
|
11575
11591
|
rowData.push(char);
|
|
11576
11592
|
}
|
|
11577
11593
|
charX += char.width;
|
|
11594
|
+
addLetterWidth && (charX += addLetterWidth);
|
|
11578
11595
|
});
|
|
11579
11596
|
return charX;
|
|
11580
11597
|
}
|
|
@@ -11710,10 +11727,10 @@ var LeaferUI = function(exports) {
|
|
|
11710
11727
|
let x = 0, y = 0;
|
|
11711
11728
|
let width = style.__getInput("width") || 0;
|
|
11712
11729
|
let height = style.__getInput("height") || 0;
|
|
11713
|
-
const {
|
|
11730
|
+
const {__padding: padding} = style;
|
|
11714
11731
|
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];
|
|
11732
|
+
if (width) x = padding[left$3], width -= padding[right$3] + padding[left$3], !width && (width = .01); else if (!style.autoSizeAlign) x = padding[left$3];
|
|
11733
|
+
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
11734
|
}
|
|
11718
11735
|
const drawData = {
|
|
11719
11736
|
bounds: {
|
|
@@ -11724,14 +11741,14 @@ var LeaferUI = function(exports) {
|
|
|
11724
11741
|
},
|
|
11725
11742
|
rows: [],
|
|
11726
11743
|
paraNumber: 0,
|
|
11727
|
-
font: Platform.canvas.font = __font
|
|
11744
|
+
font: Platform.canvas.font = style.__font
|
|
11728
11745
|
};
|
|
11729
11746
|
createRows(drawData, content, style);
|
|
11730
11747
|
if (padding) padAutoText(padding, drawData, style, width, height);
|
|
11731
11748
|
layoutText(drawData, style);
|
|
11732
|
-
layoutChar(drawData, style, width);
|
|
11749
|
+
if (style.__isCharMode) layoutChar(drawData, style, width);
|
|
11733
11750
|
if (drawData.overflow) clipText(drawData, style, x, width);
|
|
11734
|
-
if (textDecoration !== "none") decorationText(drawData, style);
|
|
11751
|
+
if (style.textDecoration !== "none") decorationText(drawData, style);
|
|
11735
11752
|
return drawData;
|
|
11736
11753
|
}
|
|
11737
11754
|
function padAutoText(padding, drawData, style, width, height) {
|
|
@@ -11934,8 +11951,8 @@ var LeaferUI = function(exports) {
|
|
|
11934
11951
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
11935
11952
|
data.strokeWidth = strokeWidth / abs$4(worldTransform.scaleX);
|
|
11936
11953
|
}
|
|
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);
|
|
11954
|
+
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
|
|
11955
|
+
if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
|
|
11939
11956
|
}
|
|
11940
11957
|
}
|
|
11941
11958
|
data.strokeWidth = strokeWidth;
|
|
@@ -12343,6 +12360,8 @@ var LeaferUI = function(exports) {
|
|
|
12343
12360
|
scaleX = sign$1(scaleX) * lockScale;
|
|
12344
12361
|
scaleY = sign$1(scaleY) * lockScale;
|
|
12345
12362
|
}
|
|
12363
|
+
isFinite(scaleX) || (scaleX = 1);
|
|
12364
|
+
isFinite(scaleY) || (scaleY = 1);
|
|
12346
12365
|
return {
|
|
12347
12366
|
origin: origin,
|
|
12348
12367
|
scaleX: scaleX,
|
|
@@ -12666,9 +12685,10 @@ var LeaferUI = function(exports) {
|
|
|
12666
12685
|
}
|
|
12667
12686
|
load() {
|
|
12668
12687
|
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints, resizeLines: resizeLines} = this;
|
|
12669
|
-
const {stroke: stroke, strokeWidth: strokeWidth,
|
|
12688
|
+
const {stroke: stroke, strokeWidth: strokeWidth, ignorePixelSnap: ignorePixelSnap} = mergeConfig;
|
|
12670
12689
|
const pointsStyle = this.getPointsStyle();
|
|
12671
12690
|
const middlePointsStyle = this.getMiddlePointsStyle();
|
|
12691
|
+
const resizeLinesStyle = this.getResizeLinesStyle();
|
|
12672
12692
|
this.visible = !target.locked;
|
|
12673
12693
|
let resizeP;
|
|
12674
12694
|
for (let i = 0; i < 8; i++) {
|
|
@@ -12678,12 +12698,13 @@ var LeaferUI = function(exports) {
|
|
|
12678
12698
|
if (i % 2) resizeLines[(i - 1) / 2].set(Object.assign({
|
|
12679
12699
|
pointType: "resize",
|
|
12680
12700
|
rotation: (i - 1) / 2 * 90
|
|
12681
|
-
},
|
|
12701
|
+
}, resizeLinesStyle[(i - 1) / 2 % resizeLinesStyle.length] || {}));
|
|
12682
12702
|
}
|
|
12683
12703
|
circle.set(this.getPointStyle(mergeConfig.circle || mergeConfig.rotatePoint || pointsStyle[0]));
|
|
12684
12704
|
rect.set(Object.assign({
|
|
12685
12705
|
stroke: stroke,
|
|
12686
12706
|
strokeWidth: strokeWidth,
|
|
12707
|
+
opacity: 1,
|
|
12687
12708
|
editConfig: editConfig
|
|
12688
12709
|
}, mergeConfig.rect || {}));
|
|
12689
12710
|
const rectThrough = isNull(mergeConfig.rectThrough) ? single : mergeConfig.rectThrough;
|
|
@@ -12808,6 +12829,7 @@ var LeaferUI = function(exports) {
|
|
|
12808
12829
|
strokeWidth: strokeWidth,
|
|
12809
12830
|
around: "center",
|
|
12810
12831
|
strokeAlign: "center",
|
|
12832
|
+
opacity: 1,
|
|
12811
12833
|
width: pointSize,
|
|
12812
12834
|
height: pointSize,
|
|
12813
12835
|
cornerRadius: pointRadius,
|
|
@@ -12825,6 +12847,10 @@ var LeaferUI = function(exports) {
|
|
|
12825
12847
|
const {middlePoint: middlePoint} = this.mergedConfig;
|
|
12826
12848
|
return isArray(middlePoint) ? middlePoint : middlePoint ? [ middlePoint ] : this.getPointsStyle();
|
|
12827
12849
|
}
|
|
12850
|
+
getResizeLinesStyle() {
|
|
12851
|
+
const {resizeLine: resizeLine} = this.mergedConfig;
|
|
12852
|
+
return isArray(resizeLine) ? resizeLine : [ resizeLine ];
|
|
12853
|
+
}
|
|
12828
12854
|
onDragStart(e) {
|
|
12829
12855
|
this.dragging = true;
|
|
12830
12856
|
const point = this.dragPoint = e.current, {pointType: pointType} = point;
|
|
@@ -12859,7 +12885,7 @@ var LeaferUI = function(exports) {
|
|
|
12859
12885
|
this.dragPoint = null;
|
|
12860
12886
|
}
|
|
12861
12887
|
onTransformStart(e) {
|
|
12862
|
-
if (this.moving) this.editor.opacity = this.mergedConfig.hideOnMove ? 0 : 1;
|
|
12888
|
+
if (this.moving || this.gesturing) this.editor.opacity = this.mergedConfig.hideOnMove ? 0 : 1;
|
|
12863
12889
|
if (this.resizing) ResizeEvent.resizingKeys = this.editor.leafList.keys;
|
|
12864
12890
|
const {dragStartData: dragStartData, target: target} = this;
|
|
12865
12891
|
dragStartData.x = e.x;
|
|
@@ -12884,7 +12910,18 @@ var LeaferUI = function(exports) {
|
|
|
12884
12910
|
e.stop();
|
|
12885
12911
|
if (isString(this.mergedConfig.moveable)) {
|
|
12886
12912
|
this.gesturing = this.moving = true;
|
|
12887
|
-
e.type
|
|
12913
|
+
switch (e.type) {
|
|
12914
|
+
case exports.MoveEvent.START:
|
|
12915
|
+
this.onTransformStart(e);
|
|
12916
|
+
break;
|
|
12917
|
+
|
|
12918
|
+
case exports.MoveEvent.END:
|
|
12919
|
+
this.onTransformEnd(e);
|
|
12920
|
+
break;
|
|
12921
|
+
|
|
12922
|
+
default:
|
|
12923
|
+
this.transformTool.onMove(e);
|
|
12924
|
+
}
|
|
12888
12925
|
}
|
|
12889
12926
|
}
|
|
12890
12927
|
}
|
|
@@ -12893,7 +12930,18 @@ var LeaferUI = function(exports) {
|
|
|
12893
12930
|
e.stop();
|
|
12894
12931
|
if (isString(this.mergedConfig.resizeable)) {
|
|
12895
12932
|
this.gesturing = this.resizing = true;
|
|
12896
|
-
e.type
|
|
12933
|
+
switch (e.type) {
|
|
12934
|
+
case exports.ZoomEvent.START:
|
|
12935
|
+
this.onTransformStart(e);
|
|
12936
|
+
break;
|
|
12937
|
+
|
|
12938
|
+
case exports.ZoomEvent.END:
|
|
12939
|
+
this.onTransformEnd(e);
|
|
12940
|
+
break;
|
|
12941
|
+
|
|
12942
|
+
default:
|
|
12943
|
+
this.transformTool.onScale(e);
|
|
12944
|
+
}
|
|
12897
12945
|
}
|
|
12898
12946
|
}
|
|
12899
12947
|
}
|
|
@@ -12902,16 +12950,21 @@ var LeaferUI = function(exports) {
|
|
|
12902
12950
|
e.stop();
|
|
12903
12951
|
if (isString(this.mergedConfig.rotateable)) {
|
|
12904
12952
|
this.gesturing = this.rotating = true;
|
|
12905
|
-
e.type
|
|
12953
|
+
switch (e.type) {
|
|
12954
|
+
case exports.ZoomEvent.START:
|
|
12955
|
+
this.onTransformStart(e);
|
|
12956
|
+
break;
|
|
12957
|
+
|
|
12958
|
+
case exports.ZoomEvent.END:
|
|
12959
|
+
this.onTransformEnd(e);
|
|
12960
|
+
break;
|
|
12961
|
+
|
|
12962
|
+
default:
|
|
12963
|
+
this.transformTool.onRotate(e);
|
|
12964
|
+
}
|
|
12906
12965
|
}
|
|
12907
12966
|
}
|
|
12908
12967
|
}
|
|
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
12968
|
isHoldRotateKey(e) {
|
|
12916
12969
|
const {rotateKey: rotateKey} = this.mergedConfig;
|
|
12917
12970
|
if (rotateKey) return e.isHoldKeys(rotateKey);
|
|
@@ -12981,7 +13034,7 @@ var LeaferUI = function(exports) {
|
|
|
12981
13034
|
const {rect: rect, editor: editor, __eventIds: events} = this;
|
|
12982
13035
|
events.push(rect.on_([ [ exports.PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ exports.PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
|
|
12983
13036
|
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.
|
|
13037
|
+
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
13038
|
});
|
|
12986
13039
|
}
|
|
12987
13040
|
__removeListenEvents() {
|
|
@@ -13684,6 +13737,9 @@ var LeaferUI = function(exports) {
|
|
|
13684
13737
|
if (this.multiple) simulate(this);
|
|
13685
13738
|
this.update();
|
|
13686
13739
|
}
|
|
13740
|
+
getEditTool(name) {
|
|
13741
|
+
return this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
|
|
13742
|
+
}
|
|
13687
13743
|
updateEditTool() {
|
|
13688
13744
|
this.unloadEditTool();
|
|
13689
13745
|
if (this.editing) {
|
|
@@ -13698,7 +13754,7 @@ var LeaferUI = function(exports) {
|
|
|
13698
13754
|
if (isString(check)) name = check; else if (check === false) return;
|
|
13699
13755
|
}
|
|
13700
13756
|
if (EditToolCreator.list[name]) {
|
|
13701
|
-
const tool = this.editTool = this.
|
|
13757
|
+
const tool = this.editTool = this.getEditTool(name);
|
|
13702
13758
|
this.editBox.load();
|
|
13703
13759
|
tool.load();
|
|
13704
13760
|
this.update();
|
|
@@ -13790,6 +13846,9 @@ var LeaferUI = function(exports) {
|
|
|
13790
13846
|
this.emitEvent(event);
|
|
13791
13847
|
if (group) group.emitEvent(event);
|
|
13792
13848
|
}
|
|
13849
|
+
getInnerEditor(name) {
|
|
13850
|
+
return this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
|
|
13851
|
+
}
|
|
13793
13852
|
openInnerEditor(target, nameOrSelect, select) {
|
|
13794
13853
|
let name;
|
|
13795
13854
|
if (isString(nameOrSelect)) name = nameOrSelect; else if (!select) select = nameOrSelect;
|
|
@@ -13808,7 +13867,7 @@ var LeaferUI = function(exports) {
|
|
|
13808
13867
|
if (EditToolCreator.list[name]) {
|
|
13809
13868
|
this.editTool.unload();
|
|
13810
13869
|
this.innerEditing = true;
|
|
13811
|
-
this.innerEditor = this.
|
|
13870
|
+
this.innerEditor = this.getInnerEditor(name);
|
|
13812
13871
|
this.innerEditor.editTarget = target;
|
|
13813
13872
|
this.emitInnerEvent(InnerEditorEvent.BEFORE_OPEN);
|
|
13814
13873
|
this.innerEditor.load();
|
|
@@ -15735,7 +15794,7 @@ var LeaferUI = function(exports) {
|
|
|
15735
15794
|
exports.UI.addAttr("endArrow", "none", arrowType);
|
|
15736
15795
|
Object.assign(PathArrow, PathArrowModule);
|
|
15737
15796
|
Object.assign(Paint, {
|
|
15738
|
-
strokeArrow(_stroke, ui, canvas) {
|
|
15797
|
+
strokeArrow(_stroke, ui, canvas, _renderOptions) {
|
|
15739
15798
|
if (ui.__.dashPattern) {
|
|
15740
15799
|
canvas.beginPath();
|
|
15741
15800
|
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
@@ -18450,6 +18509,7 @@ var LeaferUI = function(exports) {
|
|
|
18450
18509
|
exports.MyDragEvent = MyDragEvent;
|
|
18451
18510
|
exports.MyImage = MyImage;
|
|
18452
18511
|
exports.MyPointerEvent = MyPointerEvent;
|
|
18512
|
+
exports.MyTouchEvent = MyTouchEvent;
|
|
18453
18513
|
exports.NeedConvertToCanvasCommandMap = NeedConvertToCanvasCommandMap;
|
|
18454
18514
|
exports.OneRadian = OneRadian;
|
|
18455
18515
|
exports.PI2 = PI2;
|
|
@@ -18549,7 +18609,7 @@ var LeaferUI = function(exports) {
|
|
|
18549
18609
|
exports.isArray = isArray;
|
|
18550
18610
|
exports.isData = isData;
|
|
18551
18611
|
exports.isEmptyData = isEmptyData;
|
|
18552
|
-
exports.isFinite = isFinite;
|
|
18612
|
+
exports.isFinite = isFinite$1;
|
|
18553
18613
|
exports.isNull = isNull;
|
|
18554
18614
|
exports.isNumber = isNumber;
|
|
18555
18615
|
exports.isObject = isObject;
|