@leafer-draw/worker 2.0.1 → 2.0.3
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.cjs +96 -67
- package/dist/worker.esm.js +84 -69
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +234 -127
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +241 -133
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +7 -9
- package/src/index.ts +2 -2
- package/types/index.d.ts +1 -8
- package/src/core.ts +0 -86
package/dist/worker.js
CHANGED
|
@@ -7,6 +7,42 @@ var LeaferUI = function(exports) {
|
|
|
7
7
|
PathNodeHandleType[PathNodeHandleType["mirrorAngle"] = 3] = "mirrorAngle";
|
|
8
8
|
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
9
9
|
})(exports.PathNodeHandleType || (exports.PathNodeHandleType = {}));
|
|
10
|
+
function __decorate(decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
}
|
|
15
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
16
|
+
function adopt(value) {
|
|
17
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
18
|
+
resolve(value);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
22
|
+
function fulfilled(value) {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function rejected(value) {
|
|
30
|
+
try {
|
|
31
|
+
step(generator["throw"](value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function step(result) {
|
|
37
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
38
|
+
}
|
|
39
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
43
|
+
var e = new Error(message);
|
|
44
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
45
|
+
};
|
|
10
46
|
exports.Answer = void 0;
|
|
11
47
|
(function(Answer) {
|
|
12
48
|
Answer[Answer["No"] = 0] = "No";
|
|
@@ -197,6 +233,7 @@ var LeaferUI = function(exports) {
|
|
|
197
233
|
}
|
|
198
234
|
destroy() {
|
|
199
235
|
this.__input = this.__middle = null;
|
|
236
|
+
if (this.__complexData) this.__complexData.destroy();
|
|
200
237
|
}
|
|
201
238
|
}
|
|
202
239
|
const IncrementId = {
|
|
@@ -287,6 +324,7 @@ var LeaferUI = function(exports) {
|
|
|
287
324
|
};
|
|
288
325
|
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
289
326
|
const {round: round$3, pow: pow$1, max: max$3, floor: floor$2, PI: PI$3} = Math;
|
|
327
|
+
const tempScaleData$1 = {};
|
|
290
328
|
const MathHelper = {
|
|
291
329
|
within(value, min, max) {
|
|
292
330
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -330,6 +368,24 @@ var LeaferUI = function(exports) {
|
|
|
330
368
|
} else if (scale) MathHelper.assignScale(scaleData, scale);
|
|
331
369
|
return scaleData;
|
|
332
370
|
},
|
|
371
|
+
getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
|
|
372
|
+
let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
|
|
373
|
+
if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
374
|
+
if (scaleFixed) {
|
|
375
|
+
if (scaleFixed === true) {
|
|
376
|
+
scaleX = scaleY = unscale ? 1 : 1 / scaleX;
|
|
377
|
+
} else {
|
|
378
|
+
let minScale;
|
|
379
|
+
if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
|
|
380
|
+
if (minScale) {
|
|
381
|
+
if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
tempScaleData$1.scaleX = scaleX;
|
|
386
|
+
tempScaleData$1.scaleY = scaleY;
|
|
387
|
+
return tempScaleData$1;
|
|
388
|
+
},
|
|
333
389
|
assignScale(scaleData, scale) {
|
|
334
390
|
if (isNumber(scale)) {
|
|
335
391
|
scaleData.scaleX = scaleData.scaleY = scale;
|
|
@@ -809,8 +865,8 @@ var LeaferUI = function(exports) {
|
|
|
809
865
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
810
866
|
return points;
|
|
811
867
|
},
|
|
812
|
-
isSame(t, point) {
|
|
813
|
-
return float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
868
|
+
isSame(t, point, quick) {
|
|
869
|
+
return quick ? t.x === point.x && t.y === point.y : float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
814
870
|
},
|
|
815
871
|
reset(t) {
|
|
816
872
|
P$5.reset(t);
|
|
@@ -882,8 +938,8 @@ var LeaferUI = function(exports) {
|
|
|
882
938
|
getAtan2(to) {
|
|
883
939
|
return PointHelper.getAtan2(this, to);
|
|
884
940
|
}
|
|
885
|
-
isSame(point) {
|
|
886
|
-
return PointHelper.isSame(this, point);
|
|
941
|
+
isSame(point, quick) {
|
|
942
|
+
return PointHelper.isSame(this, point, quick);
|
|
887
943
|
}
|
|
888
944
|
reset() {
|
|
889
945
|
PointHelper.reset(this);
|
|
@@ -1127,9 +1183,9 @@ var LeaferUI = function(exports) {
|
|
|
1127
1183
|
}
|
|
1128
1184
|
if (!onlyBoxSize) to.x += box.x, to.y += box.y;
|
|
1129
1185
|
},
|
|
1130
|
-
getPoint(around, box, to) {
|
|
1186
|
+
getPoint(around, box, to, onlyBoxSize = true) {
|
|
1131
1187
|
if (!to) to = {};
|
|
1132
|
-
AroundHelper.toPoint(around, box, to,
|
|
1188
|
+
AroundHelper.toPoint(around, box, to, onlyBoxSize);
|
|
1133
1189
|
return to;
|
|
1134
1190
|
}
|
|
1135
1191
|
};
|
|
@@ -1384,6 +1440,9 @@ var LeaferUI = function(exports) {
|
|
|
1384
1440
|
y: y + height
|
|
1385
1441
|
} ];
|
|
1386
1442
|
},
|
|
1443
|
+
getPoint(t, around, onlyBoxSize = false, to) {
|
|
1444
|
+
return AroundHelper.getPoint(around, t, to, onlyBoxSize);
|
|
1445
|
+
},
|
|
1387
1446
|
hitRadiusPoint(t, point, pointMatrix) {
|
|
1388
1447
|
if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
|
|
1389
1448
|
return point.x >= t.x - point.radiusX && point.x <= t.x + t.width + point.radiusX && (point.y >= t.y - point.radiusY && point.y <= t.y + t.height + point.radiusY);
|
|
@@ -1552,6 +1611,9 @@ var LeaferUI = function(exports) {
|
|
|
1552
1611
|
getPoints() {
|
|
1553
1612
|
return BoundsHelper.getPoints(this);
|
|
1554
1613
|
}
|
|
1614
|
+
getPoint(around, onlyBoxSize, to) {
|
|
1615
|
+
return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
|
|
1616
|
+
}
|
|
1555
1617
|
hitPoint(point, pointMatrix) {
|
|
1556
1618
|
return BoundsHelper.hitPoint(this, point, pointMatrix);
|
|
1557
1619
|
}
|
|
@@ -1803,7 +1865,10 @@ var LeaferUI = function(exports) {
|
|
|
1803
1865
|
list$1[tag] = UI;
|
|
1804
1866
|
},
|
|
1805
1867
|
get(tag, data, x, y, width, height) {
|
|
1806
|
-
if (!list$1[tag])
|
|
1868
|
+
if (!list$1[tag]) {
|
|
1869
|
+
debug$d.warn("not register " + tag);
|
|
1870
|
+
return undefined;
|
|
1871
|
+
}
|
|
1807
1872
|
const ui = new list$1[tag](data);
|
|
1808
1873
|
if (!isUndefined(x)) {
|
|
1809
1874
|
ui.x = x;
|
|
@@ -1888,42 +1953,6 @@ var LeaferUI = function(exports) {
|
|
|
1888
1953
|
this.clear();
|
|
1889
1954
|
}
|
|
1890
1955
|
}
|
|
1891
|
-
function __decorate(decorators, target, key, desc) {
|
|
1892
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1893
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1894
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1895
|
-
}
|
|
1896
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1897
|
-
function adopt(value) {
|
|
1898
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1899
|
-
resolve(value);
|
|
1900
|
-
});
|
|
1901
|
-
}
|
|
1902
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1903
|
-
function fulfilled(value) {
|
|
1904
|
-
try {
|
|
1905
|
-
step(generator.next(value));
|
|
1906
|
-
} catch (e) {
|
|
1907
|
-
reject(e);
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
function rejected(value) {
|
|
1911
|
-
try {
|
|
1912
|
-
step(generator["throw"](value));
|
|
1913
|
-
} catch (e) {
|
|
1914
|
-
reject(e);
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
function step(result) {
|
|
1918
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1919
|
-
}
|
|
1920
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1921
|
-
});
|
|
1922
|
-
}
|
|
1923
|
-
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
1924
|
-
var e = new Error(message);
|
|
1925
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1926
|
-
};
|
|
1927
1956
|
function contextAttr(realName) {
|
|
1928
1957
|
return (target, key) => {
|
|
1929
1958
|
if (!realName) realName = key;
|
|
@@ -3523,10 +3552,10 @@ var LeaferUI = function(exports) {
|
|
|
3523
3552
|
const FileHelper = {
|
|
3524
3553
|
alphaPixelTypes: [ "png", "webp", "svg" ],
|
|
3525
3554
|
upperCaseTypeMap: {},
|
|
3526
|
-
|
|
3527
|
-
if (!type || type.startsWith(
|
|
3555
|
+
mimeType(type, base = "image") {
|
|
3556
|
+
if (!type || type.startsWith(base)) return type;
|
|
3528
3557
|
if (type === "jpg") type = "jpeg";
|
|
3529
|
-
return "
|
|
3558
|
+
return base + "/" + type;
|
|
3530
3559
|
},
|
|
3531
3560
|
fileType(filename) {
|
|
3532
3561
|
const l = filename.split(".");
|
|
@@ -3557,6 +3586,7 @@ var LeaferUI = function(exports) {
|
|
|
3557
3586
|
}
|
|
3558
3587
|
};
|
|
3559
3588
|
const F = FileHelper;
|
|
3589
|
+
F.mineType = F.mimeType;
|
|
3560
3590
|
F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3561
3591
|
const debug$8 = Debug.get("TaskProcessor");
|
|
3562
3592
|
class TaskItem {
|
|
@@ -3796,6 +3826,9 @@ var LeaferUI = function(exports) {
|
|
|
3796
3826
|
const debug$7 = Debug.get("Resource");
|
|
3797
3827
|
const Resource = {
|
|
3798
3828
|
tasker: new TaskProcessor,
|
|
3829
|
+
queue: new TaskProcessor({
|
|
3830
|
+
parallel: 1
|
|
3831
|
+
}),
|
|
3799
3832
|
map: {},
|
|
3800
3833
|
get isComplete() {
|
|
3801
3834
|
return R.tasker.isComplete;
|
|
@@ -3832,6 +3865,12 @@ var LeaferUI = function(exports) {
|
|
|
3832
3865
|
R.set(key, value);
|
|
3833
3866
|
return value;
|
|
3834
3867
|
},
|
|
3868
|
+
loadFilm(_key, _format) {
|
|
3869
|
+
return undefined;
|
|
3870
|
+
},
|
|
3871
|
+
loadVideo(_key, _format) {
|
|
3872
|
+
return undefined;
|
|
3873
|
+
},
|
|
3835
3874
|
destroy() {
|
|
3836
3875
|
R.map = {};
|
|
3837
3876
|
}
|
|
@@ -3840,16 +3879,15 @@ var LeaferUI = function(exports) {
|
|
|
3840
3879
|
const ImageManager = {
|
|
3841
3880
|
maxRecycled: 10,
|
|
3842
3881
|
recycledList: [],
|
|
3843
|
-
patternTasker:
|
|
3844
|
-
|
|
3845
|
-
}),
|
|
3846
|
-
get(config) {
|
|
3882
|
+
patternTasker: Resource.queue,
|
|
3883
|
+
get(config, type) {
|
|
3847
3884
|
let image = Resource.get(config.url);
|
|
3848
|
-
if (!image) Resource.set(config.url, image = Creator.image(config));
|
|
3885
|
+
if (!image) Resource.set(config.url, image = type === "film" ? Creator.film(config) : Creator.image(config));
|
|
3849
3886
|
image.use++;
|
|
3850
3887
|
return image;
|
|
3851
3888
|
},
|
|
3852
3889
|
recycle(image) {
|
|
3890
|
+
if (image.parent) image = image.parent;
|
|
3853
3891
|
image.use--;
|
|
3854
3892
|
setTimeout(() => {
|
|
3855
3893
|
if (!image.use) {
|
|
@@ -3880,7 +3918,7 @@ var LeaferUI = function(exports) {
|
|
|
3880
3918
|
if (config.format) return config.format === format;
|
|
3881
3919
|
const {url: url} = config;
|
|
3882
3920
|
if (url.startsWith("data:")) {
|
|
3883
|
-
if (url.startsWith("data:" + FileHelper.
|
|
3921
|
+
if (url.startsWith("data:" + FileHelper.mimeType(format))) return true;
|
|
3884
3922
|
} else {
|
|
3885
3923
|
if (url.includes("." + format) || url.includes("." + FileHelper.upperCaseTypeMap[format])) return true; else if (format === "png" && !url.includes(".")) return true;
|
|
3886
3924
|
}
|
|
@@ -3893,6 +3931,9 @@ var LeaferUI = function(exports) {
|
|
|
3893
3931
|
const I = ImageManager;
|
|
3894
3932
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3895
3933
|
class LeaferImage {
|
|
3934
|
+
get tag() {
|
|
3935
|
+
return "Image";
|
|
3936
|
+
}
|
|
3896
3937
|
get url() {
|
|
3897
3938
|
return this.config.url;
|
|
3898
3939
|
}
|
|
@@ -3921,7 +3962,7 @@ var LeaferUI = function(exports) {
|
|
|
3921
3962
|
if (!this.loading) {
|
|
3922
3963
|
this.loading = true;
|
|
3923
3964
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
3924
|
-
return yield Platform.origin.
|
|
3965
|
+
return yield Platform.origin["load" + this.tag](this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
|
|
3925
3966
|
if (thumbSize) this.setThumbView(img);
|
|
3926
3967
|
this.setView(img);
|
|
3927
3968
|
}).catch(e => {
|
|
@@ -3995,6 +4036,9 @@ var LeaferUI = function(exports) {
|
|
|
3995
4036
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
3996
4037
|
return pattern;
|
|
3997
4038
|
}
|
|
4039
|
+
render(canvas, x, y, width, height, _leaf, _paint, _imageScaleX, _imageScaleY) {
|
|
4040
|
+
canvas.drawImage(this.view, x, y, width, height);
|
|
4041
|
+
}
|
|
3998
4042
|
getLoadUrl(_thumbSize) {
|
|
3999
4043
|
return this.url;
|
|
4000
4044
|
}
|
|
@@ -4009,8 +4053,10 @@ var LeaferUI = function(exports) {
|
|
|
4009
4053
|
return undefined;
|
|
4010
4054
|
}
|
|
4011
4055
|
clearLevels(_checkUse) {}
|
|
4056
|
+
destroyFilter() {}
|
|
4012
4057
|
destroy() {
|
|
4013
4058
|
this.clearLevels();
|
|
4059
|
+
this.destroyFilter();
|
|
4014
4060
|
const {view: view} = this;
|
|
4015
4061
|
if (view && view.close) view.close();
|
|
4016
4062
|
this.config = {
|
|
@@ -4020,6 +4066,16 @@ var LeaferUI = function(exports) {
|
|
|
4020
4066
|
this.waitComplete.length = 0;
|
|
4021
4067
|
}
|
|
4022
4068
|
}
|
|
4069
|
+
class LeaferFilm extends LeaferImage {
|
|
4070
|
+
get tag() {
|
|
4071
|
+
return "Film";
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
class LeaferVideo extends LeaferImage {
|
|
4075
|
+
get tag() {
|
|
4076
|
+
return "Video";
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4023
4079
|
function defineKey(target, key, descriptor, noConfigurable) {
|
|
4024
4080
|
if (!noConfigurable) descriptor.configurable = descriptor.enumerable = true;
|
|
4025
4081
|
Object.defineProperty(target, key, descriptor);
|
|
@@ -4171,7 +4227,6 @@ var LeaferUI = function(exports) {
|
|
|
4171
4227
|
if (this.__setAttr(key, value)) {
|
|
4172
4228
|
const data = this.__;
|
|
4173
4229
|
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4174
|
-
this.__layout.surfaceChange();
|
|
4175
4230
|
}
|
|
4176
4231
|
}
|
|
4177
4232
|
}));
|
|
@@ -4216,7 +4271,6 @@ var LeaferUI = function(exports) {
|
|
|
4216
4271
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4217
4272
|
set(value) {
|
|
4218
4273
|
if (this.__setAttr(key, value)) {
|
|
4219
|
-
this.__layout.surfaceChange();
|
|
4220
4274
|
this.waitParent(() => {
|
|
4221
4275
|
this.parent.__layout.childrenSortChange();
|
|
4222
4276
|
});
|
|
@@ -4250,7 +4304,6 @@ var LeaferUI = function(exports) {
|
|
|
4250
4304
|
set(value) {
|
|
4251
4305
|
if (this.__setAttr(key, value)) {
|
|
4252
4306
|
this.__layout.hitCanvasChanged = true;
|
|
4253
|
-
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4254
4307
|
if (this.leafer) this.leafer.updateCursor();
|
|
4255
4308
|
}
|
|
4256
4309
|
}
|
|
@@ -4438,6 +4491,10 @@ var LeaferUI = function(exports) {
|
|
|
4438
4491
|
if (layout.stateStyleChanged) leaf.updateState();
|
|
4439
4492
|
if (layout.opacityChanged) updateAllWorldOpacity(leaf);
|
|
4440
4493
|
leaf.__updateChange();
|
|
4494
|
+
if (layout.surfaceChanged) {
|
|
4495
|
+
if (leaf.__hasComplex) L.updateComplex(leaf);
|
|
4496
|
+
layout.surfaceChanged = false;
|
|
4497
|
+
}
|
|
4441
4498
|
},
|
|
4442
4499
|
updateAllChange(leaf) {
|
|
4443
4500
|
updateChange$1(leaf);
|
|
@@ -4462,6 +4519,9 @@ var LeaferUI = function(exports) {
|
|
|
4462
4519
|
if (!fromWorld) fromWorld = leaf.__nowWorld;
|
|
4463
4520
|
if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4464
4521
|
},
|
|
4522
|
+
renderComplex(_leaf, _canvas, _options) {},
|
|
4523
|
+
updateComplex(_leaf) {},
|
|
4524
|
+
checkComplex(_leaf) {},
|
|
4465
4525
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4466
4526
|
const local = isObject(x) ? Object.assign({}, x) : {
|
|
4467
4527
|
x: x,
|
|
@@ -4573,6 +4633,9 @@ var LeaferUI = function(exports) {
|
|
|
4573
4633
|
divideParent(matrix, relative.scrollWorldTransform);
|
|
4574
4634
|
return temp ? matrix : Object.assign({}, matrix);
|
|
4575
4635
|
},
|
|
4636
|
+
updateScaleFixedWorld(_t) {},
|
|
4637
|
+
updateOuterBounds(_t) {},
|
|
4638
|
+
cacheId(_t) {},
|
|
4576
4639
|
drop(t, parent, index, resize) {
|
|
4577
4640
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4578
4641
|
parent.add(t, index);
|
|
@@ -4619,7 +4682,8 @@ var LeaferUI = function(exports) {
|
|
|
4619
4682
|
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4620
4683
|
},
|
|
4621
4684
|
localRenderBounds(target) {
|
|
4622
|
-
|
|
4685
|
+
const {__: __, __layout: __layout} = target;
|
|
4686
|
+
return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
|
|
4623
4687
|
},
|
|
4624
4688
|
maskLocalBoxBounds(target, index) {
|
|
4625
4689
|
return checkMask(target, index) && target.__localBoxBounds;
|
|
@@ -4628,7 +4692,8 @@ var LeaferUI = function(exports) {
|
|
|
4628
4692
|
return checkMask(target, index) && target.__layout.localStrokeBounds;
|
|
4629
4693
|
},
|
|
4630
4694
|
maskLocalRenderBounds(target, index) {
|
|
4631
|
-
|
|
4695
|
+
const {__layout: __layout} = target;
|
|
4696
|
+
return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
|
|
4632
4697
|
},
|
|
4633
4698
|
excludeRenderBounds(child, options) {
|
|
4634
4699
|
if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
|
|
@@ -5137,7 +5202,6 @@ var LeaferUI = function(exports) {
|
|
|
5137
5202
|
}
|
|
5138
5203
|
opacityChange() {
|
|
5139
5204
|
this.opacityChanged = true;
|
|
5140
|
-
this.surfaceChanged || this.surfaceChange();
|
|
5141
5205
|
}
|
|
5142
5206
|
childrenSortChange() {
|
|
5143
5207
|
if (!this.childrenSortChanged) {
|
|
@@ -5552,6 +5616,7 @@ var LeaferUI = function(exports) {
|
|
|
5552
5616
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5553
5617
|
multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5554
5618
|
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
5619
|
+
if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
|
|
5555
5620
|
},
|
|
5556
5621
|
__updateLocalMatrix() {
|
|
5557
5622
|
if (this.__local) {
|
|
@@ -5580,6 +5645,7 @@ var LeaferUI = function(exports) {
|
|
|
5580
5645
|
__updateWorldBounds() {
|
|
5581
5646
|
const {__layout: __layout, __world: __world} = this;
|
|
5582
5647
|
toOuterOf$2(__layout.renderBounds, __world, __world);
|
|
5648
|
+
if (this.__hasComplex) LeafHelper.checkComplex(this);
|
|
5583
5649
|
if (__layout.resized) {
|
|
5584
5650
|
if (__layout.resized === "inner") this.__onUpdateSize();
|
|
5585
5651
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -5629,6 +5695,7 @@ var LeaferUI = function(exports) {
|
|
|
5629
5695
|
layout.renderChanged = undefined;
|
|
5630
5696
|
if (this.parent) this.parent.__layout.renderChange();
|
|
5631
5697
|
}
|
|
5698
|
+
if (layout.outerScale) LeafHelper.updateOuterBounds(this);
|
|
5632
5699
|
layout.resized || (layout.resized = "local");
|
|
5633
5700
|
layout.boundsChanged = undefined;
|
|
5634
5701
|
},
|
|
@@ -5694,7 +5761,7 @@ var LeaferUI = function(exports) {
|
|
|
5694
5761
|
const data = this.__;
|
|
5695
5762
|
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
5696
5763
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5697
|
-
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5764
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5698
5765
|
if (this.__.__single) {
|
|
5699
5766
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5700
5767
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
@@ -5746,7 +5813,7 @@ var LeaferUI = function(exports) {
|
|
|
5746
5813
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5747
5814
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
5748
5815
|
this.__renderBranch(tempCanvas, options);
|
|
5749
|
-
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
5816
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
5750
5817
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
5751
5818
|
tempCanvas.recycle(nowWorld);
|
|
5752
5819
|
} else {
|
|
@@ -5758,9 +5825,11 @@ var LeaferUI = function(exports) {
|
|
|
5758
5825
|
if (this.__hasMask) {
|
|
5759
5826
|
this.__renderMask(canvas, options);
|
|
5760
5827
|
} else {
|
|
5828
|
+
let child;
|
|
5761
5829
|
const {children: children} = this;
|
|
5762
5830
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5763
|
-
|
|
5831
|
+
child = children[i];
|
|
5832
|
+
excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
|
|
5764
5833
|
}
|
|
5765
5834
|
}
|
|
5766
5835
|
},
|
|
@@ -5773,12 +5842,12 @@ var LeaferUI = function(exports) {
|
|
|
5773
5842
|
}
|
|
5774
5843
|
}
|
|
5775
5844
|
};
|
|
5776
|
-
const tempScaleData$1 = {};
|
|
5777
5845
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5778
5846
|
const {stintSet: stintSet$4} = DataHelper;
|
|
5779
5847
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5780
5848
|
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5781
5849
|
const {copy: copy$2, move: move$2} = PointHelper;
|
|
5850
|
+
const {getScaleFixedData: getScaleFixedData} = MathHelper;
|
|
5782
5851
|
const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
|
|
5783
5852
|
exports.Leaf = class Leaf {
|
|
5784
5853
|
get tag() {
|
|
@@ -5936,6 +6005,7 @@ var LeaferUI = function(exports) {
|
|
|
5936
6005
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
5937
6006
|
if (this.animation) this.__runAnimation("in");
|
|
5938
6007
|
if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
6008
|
+
if (leafer.cacheId) LeafHelper.cacheId(this);
|
|
5939
6009
|
} else {
|
|
5940
6010
|
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
5941
6011
|
}
|
|
@@ -6065,13 +6135,8 @@ var LeaferUI = function(exports) {
|
|
|
6065
6135
|
if (scaleX < 0) scaleX = -scaleX;
|
|
6066
6136
|
return scaleX > 1 ? scaleX : 1;
|
|
6067
6137
|
}
|
|
6068
|
-
getRenderScaleData(abs, scaleFixed) {
|
|
6069
|
-
|
|
6070
|
-
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
6071
|
-
if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
|
|
6072
|
-
tempScaleData$1.scaleX = scaleX;
|
|
6073
|
-
tempScaleData$1.scaleY = scaleY;
|
|
6074
|
-
return tempScaleData$1;
|
|
6138
|
+
getRenderScaleData(abs, scaleFixed, unscale = true) {
|
|
6139
|
+
return getScaleFixedData(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
|
|
6075
6140
|
}
|
|
6076
6141
|
getTransform(relative) {
|
|
6077
6142
|
return this.__layout.getTransform(relative || "local");
|
|
@@ -6243,7 +6308,7 @@ var LeaferUI = function(exports) {
|
|
|
6243
6308
|
__drawPath(_canvas) {}
|
|
6244
6309
|
__drawRenderPath(_canvas) {}
|
|
6245
6310
|
__updatePath() {}
|
|
6246
|
-
__updateRenderPath() {}
|
|
6311
|
+
__updateRenderPath(_updateCache) {}
|
|
6247
6312
|
getMotionPathData() {
|
|
6248
6313
|
return Plugin.need("path");
|
|
6249
6314
|
}
|
|
@@ -6311,9 +6376,11 @@ var LeaferUI = function(exports) {
|
|
|
6311
6376
|
return 0;
|
|
6312
6377
|
}
|
|
6313
6378
|
__updateRenderSpread() {
|
|
6379
|
+
let layout;
|
|
6314
6380
|
const {children: children} = this;
|
|
6315
6381
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6316
|
-
|
|
6382
|
+
layout = children[i].__layout;
|
|
6383
|
+
if (layout.renderSpread || layout.localOuterBounds) return 1;
|
|
6317
6384
|
}
|
|
6318
6385
|
return 0;
|
|
6319
6386
|
}
|
|
@@ -6346,6 +6413,7 @@ var LeaferUI = function(exports) {
|
|
|
6346
6413
|
this.add(item, index);
|
|
6347
6414
|
noIndex || index++;
|
|
6348
6415
|
}); else child = UICreator.get(child.tag, child);
|
|
6416
|
+
if (!child) return;
|
|
6349
6417
|
}
|
|
6350
6418
|
if (child.parent) child.parent.remove(child);
|
|
6351
6419
|
child.parent = this;
|
|
@@ -6567,7 +6635,7 @@ var LeaferUI = function(exports) {
|
|
|
6567
6635
|
this.levelMap = null;
|
|
6568
6636
|
}
|
|
6569
6637
|
}
|
|
6570
|
-
const version = "2.0.
|
|
6638
|
+
const version = "2.0.3";
|
|
6571
6639
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6572
6640
|
get allowBackgroundColor() {
|
|
6573
6641
|
return true;
|
|
@@ -6589,7 +6657,6 @@ var LeaferUI = function(exports) {
|
|
|
6589
6657
|
}
|
|
6590
6658
|
canvasPatch(OffscreenCanvasRenderingContext2D.prototype);
|
|
6591
6659
|
canvasPatch(Path2D.prototype);
|
|
6592
|
-
const {mineType: mineType} = FileHelper;
|
|
6593
6660
|
Object.assign(Creator, {
|
|
6594
6661
|
canvas: (options, manager) => new LeaferCanvas(options, manager),
|
|
6595
6662
|
image: options => new LeaferImage(options)
|
|
@@ -6599,7 +6666,7 @@ var LeaferUI = function(exports) {
|
|
|
6599
6666
|
createCanvas: (width, height) => new OffscreenCanvas(width, height),
|
|
6600
6667
|
canvasToDataURL: (canvas, type, quality) => new Promise((resolve, reject) => {
|
|
6601
6668
|
canvas.convertToBlob({
|
|
6602
|
-
type:
|
|
6669
|
+
type: FileHelper.mimeType(type),
|
|
6603
6670
|
quality: quality
|
|
6604
6671
|
}).then(blob => {
|
|
6605
6672
|
var reader = new FileReader;
|
|
@@ -6611,14 +6678,14 @@ var LeaferUI = function(exports) {
|
|
|
6611
6678
|
});
|
|
6612
6679
|
}),
|
|
6613
6680
|
canvasToBolb: (canvas, type, quality) => canvas.convertToBlob({
|
|
6614
|
-
type:
|
|
6681
|
+
type: FileHelper.mimeType(type),
|
|
6615
6682
|
quality: quality
|
|
6616
6683
|
}),
|
|
6617
6684
|
canvasSaveAs: (_canvas, _filename, _quality) => new Promise(resolve => resolve()),
|
|
6618
6685
|
download(_url, _filename) {
|
|
6619
6686
|
return undefined;
|
|
6620
6687
|
},
|
|
6621
|
-
loadImage(src) {
|
|
6688
|
+
loadImage(src, _crossOrigin, _leaferImage) {
|
|
6622
6689
|
return new Promise((resolve, reject) => {
|
|
6623
6690
|
let req = new XMLHttpRequest;
|
|
6624
6691
|
req.open("GET", Platform.image.getRealURL(src), true);
|
|
@@ -6633,6 +6700,13 @@ var LeaferUI = function(exports) {
|
|
|
6633
6700
|
req.onerror = e => reject(e);
|
|
6634
6701
|
req.send();
|
|
6635
6702
|
});
|
|
6703
|
+
},
|
|
6704
|
+
loadContent(url_1) {
|
|
6705
|
+
return __awaiter(this, arguments, void 0, function*(url, responseType = "text") {
|
|
6706
|
+
const response = yield fetch(url);
|
|
6707
|
+
if (!response.ok) throw new Error(`${response.status}`);
|
|
6708
|
+
return yield response[responseType]();
|
|
6709
|
+
});
|
|
6636
6710
|
}
|
|
6637
6711
|
};
|
|
6638
6712
|
Platform.canvas = Creator.canvas();
|
|
@@ -7111,7 +7185,7 @@ var LeaferUI = function(exports) {
|
|
|
7111
7185
|
getCellList() {
|
|
7112
7186
|
return undefined;
|
|
7113
7187
|
}
|
|
7114
|
-
addBlock(block) {
|
|
7188
|
+
addBlock(block, _leafList) {
|
|
7115
7189
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
7116
7190
|
this.updateBlocks.push(block);
|
|
7117
7191
|
}
|
|
@@ -7159,7 +7233,8 @@ var LeaferUI = function(exports) {
|
|
|
7159
7233
|
__onLayoutEnd(event) {
|
|
7160
7234
|
if (event.data) event.data.map(item => {
|
|
7161
7235
|
let empty;
|
|
7162
|
-
|
|
7236
|
+
const {updatedList: updatedList} = item;
|
|
7237
|
+
if (updatedList) updatedList.list.some(leaf => {
|
|
7163
7238
|
empty = !leaf.__world.width || !leaf.__world.height;
|
|
7164
7239
|
if (empty) {
|
|
7165
7240
|
if (!leaf.isLeafer) debug$2.tip(leaf.innerName, ": empty");
|
|
@@ -7167,7 +7242,7 @@ var LeaferUI = function(exports) {
|
|
|
7167
7242
|
}
|
|
7168
7243
|
return empty;
|
|
7169
7244
|
});
|
|
7170
|
-
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds);
|
|
7245
|
+
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds, updatedList);
|
|
7171
7246
|
});
|
|
7172
7247
|
}
|
|
7173
7248
|
emitRender(type, bounds, options) {
|
|
@@ -7210,7 +7285,9 @@ var LeaferUI = function(exports) {
|
|
|
7210
7285
|
set(value) {
|
|
7211
7286
|
this.__setAttr(key, value);
|
|
7212
7287
|
if (value) this.__.__useEffect = true;
|
|
7213
|
-
|
|
7288
|
+
const layout = this.__layout;
|
|
7289
|
+
layout.renderChanged || layout.renderChange();
|
|
7290
|
+
layout.surfaceChange();
|
|
7214
7291
|
}
|
|
7215
7292
|
}));
|
|
7216
7293
|
}
|
|
@@ -7403,15 +7480,16 @@ var LeaferUI = function(exports) {
|
|
|
7403
7480
|
this.__needComputePaint = undefined;
|
|
7404
7481
|
}
|
|
7405
7482
|
__getRealStrokeWidth(childStyle) {
|
|
7406
|
-
let {strokeWidth: strokeWidth,
|
|
7483
|
+
let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
|
|
7407
7484
|
if (childStyle) {
|
|
7408
7485
|
if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
|
|
7409
|
-
if (!isUndefined(childStyle.
|
|
7486
|
+
if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
|
|
7487
|
+
}
|
|
7488
|
+
if (strokeScaleFixed) {
|
|
7489
|
+
const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
|
|
7490
|
+
if (scaleX !== 1) return strokeWidth * scaleX;
|
|
7410
7491
|
}
|
|
7411
|
-
|
|
7412
|
-
const scale = this.__leaf.getClampRenderScale();
|
|
7413
|
-
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
7414
|
-
} else return strokeWidth;
|
|
7492
|
+
return strokeWidth;
|
|
7415
7493
|
}
|
|
7416
7494
|
__setPaint(attrName, value) {
|
|
7417
7495
|
this.__setInput(attrName, value);
|
|
@@ -7534,13 +7612,16 @@ var LeaferUI = function(exports) {
|
|
|
7534
7612
|
}
|
|
7535
7613
|
}
|
|
7536
7614
|
class ImageData extends RectData {
|
|
7615
|
+
get __urlType() {
|
|
7616
|
+
return "image";
|
|
7617
|
+
}
|
|
7537
7618
|
setUrl(value) {
|
|
7538
7619
|
this.__setImageFill(value);
|
|
7539
7620
|
this._url = value;
|
|
7540
7621
|
}
|
|
7541
7622
|
__setImageFill(value) {
|
|
7542
7623
|
this.fill = value ? {
|
|
7543
|
-
type:
|
|
7624
|
+
type: this.__urlType,
|
|
7544
7625
|
mode: "stretch",
|
|
7545
7626
|
url: value
|
|
7546
7627
|
} : undefined;
|
|
@@ -7576,7 +7657,7 @@ var LeaferUI = function(exports) {
|
|
|
7576
7657
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
7577
7658
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
7578
7659
|
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
7579
|
-
if (!data.__boxStroke) {
|
|
7660
|
+
if (!data.__boxStroke || data.__useArrow) {
|
|
7580
7661
|
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
7581
7662
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
7582
7663
|
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
@@ -7727,6 +7808,12 @@ var LeaferUI = function(exports) {
|
|
|
7727
7808
|
get isFrame() {
|
|
7728
7809
|
return false;
|
|
7729
7810
|
}
|
|
7811
|
+
set strokeWidthFixed(value) {
|
|
7812
|
+
this.strokeScaleFixed = value;
|
|
7813
|
+
}
|
|
7814
|
+
get strokeWidthFixed() {
|
|
7815
|
+
return this.strokeScaleFixed;
|
|
7816
|
+
}
|
|
7730
7817
|
set scale(value) {
|
|
7731
7818
|
MathHelper.assignScale(this, value);
|
|
7732
7819
|
}
|
|
@@ -7782,6 +7869,9 @@ var LeaferUI = function(exports) {
|
|
|
7782
7869
|
getPathString(curve, pathForRender, floatLength) {
|
|
7783
7870
|
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
7784
7871
|
}
|
|
7872
|
+
asPath(curve, pathForRender) {
|
|
7873
|
+
this.path = this.getPath(curve, pathForRender);
|
|
7874
|
+
}
|
|
7785
7875
|
load() {
|
|
7786
7876
|
this.__.__computePaint();
|
|
7787
7877
|
}
|
|
@@ -7791,16 +7881,18 @@ var LeaferUI = function(exports) {
|
|
|
7791
7881
|
data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
|
|
7792
7882
|
}
|
|
7793
7883
|
}
|
|
7794
|
-
__updateRenderPath() {
|
|
7884
|
+
__updateRenderPath(updateCache) {
|
|
7795
7885
|
const data = this.__;
|
|
7796
7886
|
if (data.path) {
|
|
7797
7887
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
7798
|
-
if (data.__useArrow) PathArrow.addArrows(this);
|
|
7888
|
+
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
7799
7889
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
7800
7890
|
}
|
|
7801
7891
|
__drawRenderPath(canvas) {
|
|
7892
|
+
const data = this.__;
|
|
7802
7893
|
canvas.beginPath();
|
|
7803
|
-
|
|
7894
|
+
if (data.__useArrow) PathArrow.updateArrow(this);
|
|
7895
|
+
this.__drawPathByData(canvas, data.__pathForRender);
|
|
7804
7896
|
}
|
|
7805
7897
|
__drawPath(canvas) {
|
|
7806
7898
|
canvas.beginPath();
|
|
@@ -7849,6 +7941,7 @@ var LeaferUI = function(exports) {
|
|
|
7849
7941
|
static setEditOuter(_toolName) {}
|
|
7850
7942
|
static setEditInner(_editorName) {}
|
|
7851
7943
|
destroy() {
|
|
7944
|
+
this.__.__willDestroy = true;
|
|
7852
7945
|
this.fill = this.stroke = null;
|
|
7853
7946
|
if (this.__animate) this.killAnimate();
|
|
7854
7947
|
super.destroy();
|
|
@@ -7909,7 +8002,7 @@ var LeaferUI = function(exports) {
|
|
|
7909
8002
|
__decorate([ strokeType(undefined, true) ], exports.UI.prototype, "stroke", void 0);
|
|
7910
8003
|
__decorate([ strokeType("inside") ], exports.UI.prototype, "strokeAlign", void 0);
|
|
7911
8004
|
__decorate([ strokeType(1, true) ], exports.UI.prototype, "strokeWidth", void 0);
|
|
7912
|
-
__decorate([ strokeType(false) ], exports.UI.prototype, "
|
|
8005
|
+
__decorate([ strokeType(false) ], exports.UI.prototype, "strokeScaleFixed", void 0);
|
|
7913
8006
|
__decorate([ strokeType("none") ], exports.UI.prototype, "strokeCap", void 0);
|
|
7914
8007
|
__decorate([ strokeType("miter") ], exports.UI.prototype, "strokeJoin", void 0);
|
|
7915
8008
|
__decorate([ strokeType() ], exports.UI.prototype, "dashPattern", void 0);
|
|
@@ -7956,7 +8049,10 @@ var LeaferUI = function(exports) {
|
|
|
7956
8049
|
}
|
|
7957
8050
|
toJSON(options) {
|
|
7958
8051
|
const data = super.toJSON(options);
|
|
7959
|
-
if (!this.childlessJSON)
|
|
8052
|
+
if (!this.childlessJSON) {
|
|
8053
|
+
const children = data.children = [];
|
|
8054
|
+
this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
|
|
8055
|
+
}
|
|
7960
8056
|
return data;
|
|
7961
8057
|
}
|
|
7962
8058
|
pick(_hitPoint, _options) {
|
|
@@ -8098,12 +8194,12 @@ var LeaferUI = function(exports) {
|
|
|
8098
8194
|
this.emitLeafer(LeaferEvent.STOP);
|
|
8099
8195
|
}
|
|
8100
8196
|
}
|
|
8101
|
-
unlockLayout() {
|
|
8197
|
+
unlockLayout(updateLayout = true) {
|
|
8102
8198
|
this.layouter.start();
|
|
8103
|
-
this.updateLayout();
|
|
8199
|
+
if (updateLayout) this.updateLayout();
|
|
8104
8200
|
}
|
|
8105
|
-
lockLayout() {
|
|
8106
|
-
this.updateLayout();
|
|
8201
|
+
lockLayout(updateLayout = true) {
|
|
8202
|
+
if (updateLayout) this.updateLayout();
|
|
8107
8203
|
this.layouter.stop();
|
|
8108
8204
|
}
|
|
8109
8205
|
resize(size) {
|
|
@@ -8480,9 +8576,9 @@ var LeaferUI = function(exports) {
|
|
|
8480
8576
|
return "Ellipse";
|
|
8481
8577
|
}
|
|
8482
8578
|
__updatePath() {
|
|
8483
|
-
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} =
|
|
8579
|
+
const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
|
|
8484
8580
|
const rx = width / 2, ry = height / 2;
|
|
8485
|
-
const path =
|
|
8581
|
+
const path = data.path = [];
|
|
8486
8582
|
let open;
|
|
8487
8583
|
if (innerRadius) {
|
|
8488
8584
|
if (startAngle || endAngle) {
|
|
@@ -8504,7 +8600,7 @@ var LeaferUI = function(exports) {
|
|
|
8504
8600
|
}
|
|
8505
8601
|
}
|
|
8506
8602
|
if (!open) closePath$2(path);
|
|
8507
|
-
if (Platform.ellipseToCurve)
|
|
8603
|
+
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
8508
8604
|
}
|
|
8509
8605
|
};
|
|
8510
8606
|
__decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
|
|
@@ -8894,8 +8990,8 @@ var LeaferUI = function(exports) {
|
|
|
8894
8990
|
canvas.save();
|
|
8895
8991
|
if (item.transform) canvas.transform(item.transform);
|
|
8896
8992
|
if (originPaint.scaleFixed) {
|
|
8897
|
-
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
8898
|
-
if (
|
|
8993
|
+
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, originPaint.scaleFixed, false);
|
|
8994
|
+
if (scaleX !== 1) canvas.scale(scaleX, scaleY);
|
|
8899
8995
|
}
|
|
8900
8996
|
if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
|
|
8901
8997
|
fillPathOrText(ui, canvas, renderOptions);
|
|
@@ -9150,11 +9246,14 @@ var LeaferUI = function(exports) {
|
|
|
9150
9246
|
function getLeafPaint(attrName, paint, ui) {
|
|
9151
9247
|
if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
|
|
9152
9248
|
let leafPaint;
|
|
9153
|
-
const {boxBounds: boxBounds} = ui.__layout;
|
|
9154
|
-
switch (
|
|
9249
|
+
const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
|
|
9250
|
+
switch (type) {
|
|
9155
9251
|
case "image":
|
|
9252
|
+
case "film":
|
|
9253
|
+
case "video":
|
|
9156
9254
|
if (!paint.url) return undefined;
|
|
9157
9255
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
9256
|
+
if (type !== "image") PaintImage[type](leafPaint);
|
|
9158
9257
|
break;
|
|
9159
9258
|
|
|
9160
9259
|
case "linear":
|
|
@@ -9170,7 +9269,7 @@ var LeaferUI = function(exports) {
|
|
|
9170
9269
|
break;
|
|
9171
9270
|
|
|
9172
9271
|
case "solid":
|
|
9173
|
-
const {
|
|
9272
|
+
const {color: color, opacity: opacity} = paint;
|
|
9174
9273
|
leafPaint = {
|
|
9175
9274
|
type: type,
|
|
9176
9275
|
style: ColorConvert.string(color, opacity)
|
|
@@ -9210,7 +9309,7 @@ var LeaferUI = function(exports) {
|
|
|
9210
9309
|
const {isSame: isSame} = BoundsHelper;
|
|
9211
9310
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
9212
9311
|
let leafPaint, event;
|
|
9213
|
-
const image = ImageManager.get(paint);
|
|
9312
|
+
const image = ImageManager.get(paint, paint.type);
|
|
9214
9313
|
if (cache && paint === cache.paint && isSame(boxBounds, cache.boxBounds)) {
|
|
9215
9314
|
leafPaint = cache.leafPaint;
|
|
9216
9315
|
} else {
|
|
@@ -9270,8 +9369,8 @@ var LeaferUI = function(exports) {
|
|
|
9270
9369
|
return leafPaint;
|
|
9271
9370
|
}
|
|
9272
9371
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
9273
|
-
|
|
9274
|
-
|
|
9372
|
+
const data = ui.__;
|
|
9373
|
+
if (attrName === "fill" && !data.__naturalWidth) {
|
|
9275
9374
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
9276
9375
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
9277
9376
|
if (data.__autoSide) {
|
|
@@ -9283,7 +9382,13 @@ var LeaferUI = function(exports) {
|
|
|
9283
9382
|
return false;
|
|
9284
9383
|
}
|
|
9285
9384
|
}
|
|
9286
|
-
if (!leafPaint.data)
|
|
9385
|
+
if (!leafPaint.data) {
|
|
9386
|
+
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
9387
|
+
const {transform: transform} = leafPaint.data, {opacity: opacity, blendMode: blendMode} = paint;
|
|
9388
|
+
const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
|
|
9389
|
+
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
9390
|
+
}
|
|
9391
|
+
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
9287
9392
|
return true;
|
|
9288
9393
|
}
|
|
9289
9394
|
function onLoad(ui, event) {
|
|
@@ -9315,7 +9420,7 @@ var LeaferUI = function(exports) {
|
|
|
9315
9420
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
9316
9421
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
9317
9422
|
const {width: width, height: height} = image;
|
|
9318
|
-
const {
|
|
9423
|
+
const {mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, interlace: interlace} = paint;
|
|
9319
9424
|
const sameBox = box.width === width && box.height === height;
|
|
9320
9425
|
const data = {
|
|
9321
9426
|
mode: mode
|
|
@@ -9378,8 +9483,6 @@ var LeaferUI = function(exports) {
|
|
|
9378
9483
|
data.scaleX = scaleX;
|
|
9379
9484
|
data.scaleY = scaleY;
|
|
9380
9485
|
}
|
|
9381
|
-
if (opacity && opacity < 1) data.opacity = opacity;
|
|
9382
|
-
if (filters) data.filters = filters;
|
|
9383
9486
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
9384
9487
|
if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
|
|
9385
9488
|
type: "x",
|
|
@@ -9405,7 +9508,7 @@ var LeaferUI = function(exports) {
|
|
|
9405
9508
|
const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9406
9509
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
9407
9510
|
const transform = get$2(), {x: x, y: y} = box;
|
|
9408
|
-
if (x || y) translate(transform, x, y); else transform.onlyScale = true;
|
|
9511
|
+
if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
|
|
9409
9512
|
scaleHelper(transform, scaleX, scaleY);
|
|
9410
9513
|
data.transform = transform;
|
|
9411
9514
|
}
|
|
@@ -9486,10 +9589,10 @@ var LeaferUI = function(exports) {
|
|
|
9486
9589
|
}
|
|
9487
9590
|
}
|
|
9488
9591
|
function createPattern(paint, ui, canvas, renderOptions) {
|
|
9489
|
-
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
|
|
9592
|
+
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
9490
9593
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
9491
9594
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
9492
|
-
const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
9595
|
+
const {image: image, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
9493
9596
|
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
9494
9597
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
9495
9598
|
width *= scaleX;
|
|
@@ -9505,7 +9608,7 @@ var LeaferUI = function(exports) {
|
|
|
9505
9608
|
if (transform) copy$1(imageMatrix, transform);
|
|
9506
9609
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
9507
9610
|
}
|
|
9508
|
-
const imageCanvas = image.getCanvas(width, height,
|
|
9611
|
+
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
9509
9612
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
9510
9613
|
paint.style = pattern;
|
|
9511
9614
|
paint.patternId = id;
|
|
@@ -9524,15 +9627,15 @@ var LeaferUI = function(exports) {
|
|
|
9524
9627
|
return fixScale;
|
|
9525
9628
|
}
|
|
9526
9629
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
9527
|
-
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
9630
|
+
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
9528
9631
|
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
9529
|
-
if (!data || paint.patternId ===
|
|
9632
|
+
if (!data || paint.patternId === id && !exporting || snapshot) {
|
|
9530
9633
|
return false;
|
|
9531
9634
|
} else {
|
|
9532
9635
|
if (drawImage) {
|
|
9533
9636
|
if (data.repeat) {
|
|
9534
9637
|
drawImage = false;
|
|
9535
|
-
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
9638
|
+
} else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
9536
9639
|
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
9537
9640
|
}
|
|
9538
9641
|
}
|
|
@@ -9549,20 +9652,21 @@ var LeaferUI = function(exports) {
|
|
|
9549
9652
|
}
|
|
9550
9653
|
}
|
|
9551
9654
|
}
|
|
9552
|
-
function drawImage(paint,
|
|
9553
|
-
const {data: data, image: image
|
|
9554
|
-
let {width: width, height: height} = image
|
|
9555
|
-
if (
|
|
9655
|
+
function drawImage(paint, imageScaleX, imageScaleY, ui, canvas, _renderOptions) {
|
|
9656
|
+
const {data: data, image: image, complex: complex} = paint;
|
|
9657
|
+
let {width: width, height: height} = image;
|
|
9658
|
+
if (complex) {
|
|
9659
|
+
const {blendMode: blendMode, opacity: opacity} = paint.originPaint, {transform: transform} = data;
|
|
9556
9660
|
canvas.save();
|
|
9557
|
-
|
|
9661
|
+
complex === 2 && canvas.clipUI(ui);
|
|
9558
9662
|
blendMode && (canvas.blendMode = blendMode);
|
|
9559
9663
|
opacity && (canvas.opacity *= opacity);
|
|
9560
9664
|
transform && canvas.transform(transform);
|
|
9561
|
-
|
|
9665
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
9562
9666
|
canvas.restore();
|
|
9563
9667
|
} else {
|
|
9564
9668
|
if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
|
|
9565
|
-
|
|
9669
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
9566
9670
|
}
|
|
9567
9671
|
}
|
|
9568
9672
|
function getImageRenderScaleData(paint, ui, canvas, _renderOptions) {
|
|
@@ -9590,6 +9694,7 @@ var LeaferUI = function(exports) {
|
|
|
9590
9694
|
if (!recycleMap) recycleMap = {};
|
|
9591
9695
|
recycleMap[url] = true;
|
|
9592
9696
|
ImageManager.recyclePaint(paint);
|
|
9697
|
+
if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf);
|
|
9593
9698
|
if (image.loading) {
|
|
9594
9699
|
if (!input) {
|
|
9595
9700
|
input = data.__input && data.__input[attrName] || [];
|
|
@@ -10449,7 +10554,9 @@ var LeaferUI = function(exports) {
|
|
|
10449
10554
|
exports.LeaferCanvasBase = LeaferCanvasBase;
|
|
10450
10555
|
exports.LeaferData = LeaferData;
|
|
10451
10556
|
exports.LeaferEvent = LeaferEvent;
|
|
10557
|
+
exports.LeaferFilm = LeaferFilm;
|
|
10452
10558
|
exports.LeaferImage = LeaferImage;
|
|
10559
|
+
exports.LeaferVideo = LeaferVideo;
|
|
10453
10560
|
exports.LineData = LineData;
|
|
10454
10561
|
exports.MathHelper = MathHelper;
|
|
10455
10562
|
exports.Matrix = Matrix;
|