leafer-draw 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/web.cjs +98 -71
- package/dist/web.esm.js +86 -73
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +236 -131
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +243 -137
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
package/dist/web.module.js
CHANGED
|
@@ -7,6 +7,45 @@ var PathNodeHandleType;
|
|
|
7
7
|
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
8
8
|
})(PathNodeHandleType || (PathNodeHandleType = {}));
|
|
9
9
|
|
|
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
|
+
|
|
16
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) {
|
|
18
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
19
|
+
resolve(value);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
23
|
+
function fulfilled(value) {
|
|
24
|
+
try {
|
|
25
|
+
step(generator.next(value));
|
|
26
|
+
} catch (e) {
|
|
27
|
+
reject(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function rejected(value) {
|
|
31
|
+
try {
|
|
32
|
+
step(generator["throw"](value));
|
|
33
|
+
} catch (e) {
|
|
34
|
+
reject(e);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function step(result) {
|
|
38
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
39
|
+
}
|
|
40
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
45
|
+
var e = new Error(message);
|
|
46
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
47
|
+
};
|
|
48
|
+
|
|
10
49
|
var Answer;
|
|
11
50
|
|
|
12
51
|
(function(Answer) {
|
|
@@ -213,6 +252,7 @@ class LeafData {
|
|
|
213
252
|
}
|
|
214
253
|
destroy() {
|
|
215
254
|
this.__input = this.__middle = null;
|
|
255
|
+
if (this.__complexData) this.__complexData.destroy();
|
|
216
256
|
}
|
|
217
257
|
}
|
|
218
258
|
|
|
@@ -311,6 +351,8 @@ const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumbe
|
|
|
311
351
|
|
|
312
352
|
const {round: round$3, pow: pow$1, max: max$3, floor: floor$2, PI: PI$3} = Math;
|
|
313
353
|
|
|
354
|
+
const tempScaleData$1 = {};
|
|
355
|
+
|
|
314
356
|
const MathHelper = {
|
|
315
357
|
within(value, min, max) {
|
|
316
358
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -354,6 +396,24 @@ const MathHelper = {
|
|
|
354
396
|
} else if (scale) MathHelper.assignScale(scaleData, scale);
|
|
355
397
|
return scaleData;
|
|
356
398
|
},
|
|
399
|
+
getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
|
|
400
|
+
let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
|
|
401
|
+
if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
402
|
+
if (scaleFixed) {
|
|
403
|
+
if (scaleFixed === true) {
|
|
404
|
+
scaleX = scaleY = unscale ? 1 : 1 / scaleX;
|
|
405
|
+
} else {
|
|
406
|
+
let minScale;
|
|
407
|
+
if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
|
|
408
|
+
if (minScale) {
|
|
409
|
+
if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
tempScaleData$1.scaleX = scaleX;
|
|
414
|
+
tempScaleData$1.scaleY = scaleY;
|
|
415
|
+
return tempScaleData$1;
|
|
416
|
+
},
|
|
357
417
|
assignScale(scaleData, scale) {
|
|
358
418
|
if (isNumber(scale)) {
|
|
359
419
|
scaleData.scaleX = scaleData.scaleY = scale;
|
|
@@ -850,8 +910,8 @@ const PointHelper = {
|
|
|
850
910
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
851
911
|
return points;
|
|
852
912
|
},
|
|
853
|
-
isSame(t, point) {
|
|
854
|
-
return float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
913
|
+
isSame(t, point, quick) {
|
|
914
|
+
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);
|
|
855
915
|
},
|
|
856
916
|
reset(t) {
|
|
857
917
|
P$5.reset(t);
|
|
@@ -926,8 +986,8 @@ class Point {
|
|
|
926
986
|
getAtan2(to) {
|
|
927
987
|
return PointHelper.getAtan2(this, to);
|
|
928
988
|
}
|
|
929
|
-
isSame(point) {
|
|
930
|
-
return PointHelper.isSame(this, point);
|
|
989
|
+
isSame(point, quick) {
|
|
990
|
+
return PointHelper.isSame(this, point, quick);
|
|
931
991
|
}
|
|
932
992
|
reset() {
|
|
933
993
|
PointHelper.reset(this);
|
|
@@ -1183,9 +1243,9 @@ const AroundHelper = {
|
|
|
1183
1243
|
}
|
|
1184
1244
|
if (!onlyBoxSize) to.x += box.x, to.y += box.y;
|
|
1185
1245
|
},
|
|
1186
|
-
getPoint(around, box, to) {
|
|
1246
|
+
getPoint(around, box, to, onlyBoxSize = true) {
|
|
1187
1247
|
if (!to) to = {};
|
|
1188
|
-
AroundHelper.toPoint(around, box, to,
|
|
1248
|
+
AroundHelper.toPoint(around, box, to, onlyBoxSize);
|
|
1189
1249
|
return to;
|
|
1190
1250
|
}
|
|
1191
1251
|
};
|
|
@@ -1452,6 +1512,9 @@ const BoundsHelper = {
|
|
|
1452
1512
|
y: y + height
|
|
1453
1513
|
} ];
|
|
1454
1514
|
},
|
|
1515
|
+
getPoint(t, around, onlyBoxSize = false, to) {
|
|
1516
|
+
return AroundHelper.getPoint(around, t, to, onlyBoxSize);
|
|
1517
|
+
},
|
|
1455
1518
|
hitRadiusPoint(t, point, pointMatrix) {
|
|
1456
1519
|
if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
|
|
1457
1520
|
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);
|
|
@@ -1623,6 +1686,9 @@ class Bounds {
|
|
|
1623
1686
|
getPoints() {
|
|
1624
1687
|
return BoundsHelper.getPoints(this);
|
|
1625
1688
|
}
|
|
1689
|
+
getPoint(around, onlyBoxSize, to) {
|
|
1690
|
+
return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
|
|
1691
|
+
}
|
|
1626
1692
|
hitPoint(point, pointMatrix) {
|
|
1627
1693
|
return BoundsHelper.hitPoint(this, point, pointMatrix);
|
|
1628
1694
|
}
|
|
@@ -1897,7 +1963,10 @@ const UICreator = {
|
|
|
1897
1963
|
list$1[tag] = UI;
|
|
1898
1964
|
},
|
|
1899
1965
|
get(tag, data, x, y, width, height) {
|
|
1900
|
-
if (!list$1[tag])
|
|
1966
|
+
if (!list$1[tag]) {
|
|
1967
|
+
debug$e.warn("not register " + tag);
|
|
1968
|
+
return undefined;
|
|
1969
|
+
}
|
|
1901
1970
|
const ui = new list$1[tag](data);
|
|
1902
1971
|
if (!isUndefined(x)) {
|
|
1903
1972
|
ui.x = x;
|
|
@@ -1988,45 +2057,6 @@ class CanvasManager {
|
|
|
1988
2057
|
}
|
|
1989
2058
|
}
|
|
1990
2059
|
|
|
1991
|
-
function __decorate(decorators, target, key, desc) {
|
|
1992
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1993
|
-
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;
|
|
1994
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1995
|
-
}
|
|
1996
|
-
|
|
1997
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1998
|
-
function adopt(value) {
|
|
1999
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
2000
|
-
resolve(value);
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
2004
|
-
function fulfilled(value) {
|
|
2005
|
-
try {
|
|
2006
|
-
step(generator.next(value));
|
|
2007
|
-
} catch (e) {
|
|
2008
|
-
reject(e);
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
function rejected(value) {
|
|
2012
|
-
try {
|
|
2013
|
-
step(generator["throw"](value));
|
|
2014
|
-
} catch (e) {
|
|
2015
|
-
reject(e);
|
|
2016
|
-
}
|
|
2017
|
-
}
|
|
2018
|
-
function step(result) {
|
|
2019
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2020
|
-
}
|
|
2021
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2022
|
-
});
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
2026
|
-
var e = new Error(message);
|
|
2027
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2028
|
-
};
|
|
2029
|
-
|
|
2030
2060
|
function contextAttr(realName) {
|
|
2031
2061
|
return (target, key) => {
|
|
2032
2062
|
if (!realName) realName = key;
|
|
@@ -3754,10 +3784,10 @@ function canvasPatch(drawer) {
|
|
|
3754
3784
|
const FileHelper = {
|
|
3755
3785
|
alphaPixelTypes: [ "png", "webp", "svg" ],
|
|
3756
3786
|
upperCaseTypeMap: {},
|
|
3757
|
-
|
|
3758
|
-
if (!type || type.startsWith(
|
|
3787
|
+
mimeType(type, base = "image") {
|
|
3788
|
+
if (!type || type.startsWith(base)) return type;
|
|
3759
3789
|
if (type === "jpg") type = "jpeg";
|
|
3760
|
-
return "
|
|
3790
|
+
return base + "/" + type;
|
|
3761
3791
|
},
|
|
3762
3792
|
fileType(filename) {
|
|
3763
3793
|
const l = filename.split(".");
|
|
@@ -3790,6 +3820,8 @@ const FileHelper = {
|
|
|
3790
3820
|
|
|
3791
3821
|
const F = FileHelper;
|
|
3792
3822
|
|
|
3823
|
+
F.mineType = F.mimeType;
|
|
3824
|
+
|
|
3793
3825
|
F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3794
3826
|
|
|
3795
3827
|
const debug$9 = Debug.get("TaskProcessor");
|
|
@@ -4034,6 +4066,9 @@ const debug$8 = Debug.get("Resource");
|
|
|
4034
4066
|
|
|
4035
4067
|
const Resource = {
|
|
4036
4068
|
tasker: new TaskProcessor,
|
|
4069
|
+
queue: new TaskProcessor({
|
|
4070
|
+
parallel: 1
|
|
4071
|
+
}),
|
|
4037
4072
|
map: {},
|
|
4038
4073
|
get isComplete() {
|
|
4039
4074
|
return R.tasker.isComplete;
|
|
@@ -4070,6 +4105,12 @@ const Resource = {
|
|
|
4070
4105
|
R.set(key, value);
|
|
4071
4106
|
return value;
|
|
4072
4107
|
},
|
|
4108
|
+
loadFilm(_key, _format) {
|
|
4109
|
+
return undefined;
|
|
4110
|
+
},
|
|
4111
|
+
loadVideo(_key, _format) {
|
|
4112
|
+
return undefined;
|
|
4113
|
+
},
|
|
4073
4114
|
destroy() {
|
|
4074
4115
|
R.map = {};
|
|
4075
4116
|
}
|
|
@@ -4080,16 +4121,15 @@ const R = Resource;
|
|
|
4080
4121
|
const ImageManager = {
|
|
4081
4122
|
maxRecycled: 10,
|
|
4082
4123
|
recycledList: [],
|
|
4083
|
-
patternTasker:
|
|
4084
|
-
|
|
4085
|
-
}),
|
|
4086
|
-
get(config) {
|
|
4124
|
+
patternTasker: Resource.queue,
|
|
4125
|
+
get(config, type) {
|
|
4087
4126
|
let image = Resource.get(config.url);
|
|
4088
|
-
if (!image) Resource.set(config.url, image = Creator.image(config));
|
|
4127
|
+
if (!image) Resource.set(config.url, image = type === "film" ? Creator.film(config) : Creator.image(config));
|
|
4089
4128
|
image.use++;
|
|
4090
4129
|
return image;
|
|
4091
4130
|
},
|
|
4092
4131
|
recycle(image) {
|
|
4132
|
+
if (image.parent) image = image.parent;
|
|
4093
4133
|
image.use--;
|
|
4094
4134
|
setTimeout(() => {
|
|
4095
4135
|
if (!image.use) {
|
|
@@ -4120,7 +4160,7 @@ const ImageManager = {
|
|
|
4120
4160
|
if (config.format) return config.format === format;
|
|
4121
4161
|
const {url: url} = config;
|
|
4122
4162
|
if (url.startsWith("data:")) {
|
|
4123
|
-
if (url.startsWith("data:" + FileHelper.
|
|
4163
|
+
if (url.startsWith("data:" + FileHelper.mimeType(format))) return true;
|
|
4124
4164
|
} else {
|
|
4125
4165
|
if (url.includes("." + format) || url.includes("." + FileHelper.upperCaseTypeMap[format])) return true; else if (format === "png" && !url.includes(".")) return true;
|
|
4126
4166
|
}
|
|
@@ -4136,6 +4176,9 @@ const I = ImageManager;
|
|
|
4136
4176
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
4137
4177
|
|
|
4138
4178
|
class LeaferImage {
|
|
4179
|
+
get tag() {
|
|
4180
|
+
return "Image";
|
|
4181
|
+
}
|
|
4139
4182
|
get url() {
|
|
4140
4183
|
return this.config.url;
|
|
4141
4184
|
}
|
|
@@ -4164,7 +4207,7 @@ class LeaferImage {
|
|
|
4164
4207
|
if (!this.loading) {
|
|
4165
4208
|
this.loading = true;
|
|
4166
4209
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
4167
|
-
return yield Platform.origin.
|
|
4210
|
+
return yield Platform.origin["load" + this.tag](this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
|
|
4168
4211
|
if (thumbSize) this.setThumbView(img);
|
|
4169
4212
|
this.setView(img);
|
|
4170
4213
|
}).catch(e => {
|
|
@@ -4238,6 +4281,9 @@ class LeaferImage {
|
|
|
4238
4281
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
4239
4282
|
return pattern;
|
|
4240
4283
|
}
|
|
4284
|
+
render(canvas, x, y, width, height, _leaf, _paint, _imageScaleX, _imageScaleY) {
|
|
4285
|
+
canvas.drawImage(this.view, x, y, width, height);
|
|
4286
|
+
}
|
|
4241
4287
|
getLoadUrl(_thumbSize) {
|
|
4242
4288
|
return this.url;
|
|
4243
4289
|
}
|
|
@@ -4252,8 +4298,10 @@ class LeaferImage {
|
|
|
4252
4298
|
return undefined;
|
|
4253
4299
|
}
|
|
4254
4300
|
clearLevels(_checkUse) {}
|
|
4301
|
+
destroyFilter() {}
|
|
4255
4302
|
destroy() {
|
|
4256
4303
|
this.clearLevels();
|
|
4304
|
+
this.destroyFilter();
|
|
4257
4305
|
const {view: view} = this;
|
|
4258
4306
|
if (view && view.close) view.close();
|
|
4259
4307
|
this.config = {
|
|
@@ -4264,6 +4312,18 @@ class LeaferImage {
|
|
|
4264
4312
|
}
|
|
4265
4313
|
}
|
|
4266
4314
|
|
|
4315
|
+
class LeaferFilm extends LeaferImage {
|
|
4316
|
+
get tag() {
|
|
4317
|
+
return "Film";
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4320
|
+
|
|
4321
|
+
class LeaferVideo extends LeaferImage {
|
|
4322
|
+
get tag() {
|
|
4323
|
+
return "Video";
|
|
4324
|
+
}
|
|
4325
|
+
}
|
|
4326
|
+
|
|
4267
4327
|
function defineKey(target, key, descriptor, noConfigurable) {
|
|
4268
4328
|
if (!noConfigurable) descriptor.configurable = descriptor.enumerable = true;
|
|
4269
4329
|
Object.defineProperty(target, key, descriptor);
|
|
@@ -4438,7 +4498,6 @@ function dimType(defaultValue) {
|
|
|
4438
4498
|
if (this.__setAttr(key, value)) {
|
|
4439
4499
|
const data = this.__;
|
|
4440
4500
|
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4441
|
-
this.__layout.surfaceChange();
|
|
4442
4501
|
}
|
|
4443
4502
|
}
|
|
4444
4503
|
}));
|
|
@@ -4488,7 +4547,6 @@ function sortType(defaultValue) {
|
|
|
4488
4547
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4489
4548
|
set(value) {
|
|
4490
4549
|
if (this.__setAttr(key, value)) {
|
|
4491
|
-
this.__layout.surfaceChange();
|
|
4492
4550
|
this.waitParent(() => {
|
|
4493
4551
|
this.parent.__layout.childrenSortChange();
|
|
4494
4552
|
});
|
|
@@ -4525,7 +4583,6 @@ function hitType(defaultValue) {
|
|
|
4525
4583
|
set(value) {
|
|
4526
4584
|
if (this.__setAttr(key, value)) {
|
|
4527
4585
|
this.__layout.hitCanvasChanged = true;
|
|
4528
|
-
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4529
4586
|
if (this.leafer) this.leafer.updateCursor();
|
|
4530
4587
|
}
|
|
4531
4588
|
}
|
|
@@ -4731,6 +4788,10 @@ const LeafHelper = {
|
|
|
4731
4788
|
if (layout.stateStyleChanged) leaf.updateState();
|
|
4732
4789
|
if (layout.opacityChanged) updateAllWorldOpacity(leaf);
|
|
4733
4790
|
leaf.__updateChange();
|
|
4791
|
+
if (layout.surfaceChanged) {
|
|
4792
|
+
if (leaf.__hasComplex) L.updateComplex(leaf);
|
|
4793
|
+
layout.surfaceChanged = false;
|
|
4794
|
+
}
|
|
4734
4795
|
},
|
|
4735
4796
|
updateAllChange(leaf) {
|
|
4736
4797
|
updateChange$1(leaf);
|
|
@@ -4755,6 +4816,9 @@ const LeafHelper = {
|
|
|
4755
4816
|
if (!fromWorld) fromWorld = leaf.__nowWorld;
|
|
4756
4817
|
if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4757
4818
|
},
|
|
4819
|
+
renderComplex(_leaf, _canvas, _options) {},
|
|
4820
|
+
updateComplex(_leaf) {},
|
|
4821
|
+
checkComplex(_leaf) {},
|
|
4758
4822
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4759
4823
|
const local = isObject(x) ? Object.assign({}, x) : {
|
|
4760
4824
|
x: x,
|
|
@@ -4866,6 +4930,9 @@ const LeafHelper = {
|
|
|
4866
4930
|
divideParent(matrix, relative.scrollWorldTransform);
|
|
4867
4931
|
return temp ? matrix : Object.assign({}, matrix);
|
|
4868
4932
|
},
|
|
4933
|
+
updateScaleFixedWorld(_t) {},
|
|
4934
|
+
updateOuterBounds(_t) {},
|
|
4935
|
+
cacheId(_t) {},
|
|
4869
4936
|
drop(t, parent, index, resize) {
|
|
4870
4937
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4871
4938
|
parent.add(t, index);
|
|
@@ -4916,7 +4983,8 @@ const LeafBoundsHelper = {
|
|
|
4916
4983
|
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4917
4984
|
},
|
|
4918
4985
|
localRenderBounds(target) {
|
|
4919
|
-
|
|
4986
|
+
const {__: __, __layout: __layout} = target;
|
|
4987
|
+
return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
|
|
4920
4988
|
},
|
|
4921
4989
|
maskLocalBoxBounds(target, index) {
|
|
4922
4990
|
return checkMask(target, index) && target.__localBoxBounds;
|
|
@@ -4925,7 +4993,8 @@ const LeafBoundsHelper = {
|
|
|
4925
4993
|
return checkMask(target, index) && target.__layout.localStrokeBounds;
|
|
4926
4994
|
},
|
|
4927
4995
|
maskLocalRenderBounds(target, index) {
|
|
4928
|
-
|
|
4996
|
+
const {__layout: __layout} = target;
|
|
4997
|
+
return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
|
|
4929
4998
|
},
|
|
4930
4999
|
excludeRenderBounds(child, options) {
|
|
4931
5000
|
if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
|
|
@@ -5445,7 +5514,6 @@ class LeafLayout {
|
|
|
5445
5514
|
}
|
|
5446
5515
|
opacityChange() {
|
|
5447
5516
|
this.opacityChanged = true;
|
|
5448
|
-
this.surfaceChanged || this.surfaceChange();
|
|
5449
5517
|
}
|
|
5450
5518
|
childrenSortChange() {
|
|
5451
5519
|
if (!this.childrenSortChanged) {
|
|
@@ -5938,6 +6006,7 @@ const LeafMatrix = {
|
|
|
5938
6006
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5939
6007
|
multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5940
6008
|
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
6009
|
+
if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
|
|
5941
6010
|
},
|
|
5942
6011
|
__updateLocalMatrix() {
|
|
5943
6012
|
if (this.__local) {
|
|
@@ -5971,6 +6040,7 @@ const LeafBounds = {
|
|
|
5971
6040
|
__updateWorldBounds() {
|
|
5972
6041
|
const {__layout: __layout, __world: __world} = this;
|
|
5973
6042
|
toOuterOf$2(__layout.renderBounds, __world, __world);
|
|
6043
|
+
if (this.__hasComplex) LeafHelper.checkComplex(this);
|
|
5974
6044
|
if (__layout.resized) {
|
|
5975
6045
|
if (__layout.resized === "inner") this.__onUpdateSize();
|
|
5976
6046
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -6020,6 +6090,7 @@ const LeafBounds = {
|
|
|
6020
6090
|
layout.renderChanged = undefined;
|
|
6021
6091
|
if (this.parent) this.parent.__layout.renderChange();
|
|
6022
6092
|
}
|
|
6093
|
+
if (layout.outerScale) LeafHelper.updateOuterBounds(this);
|
|
6023
6094
|
layout.resized || (layout.resized = "local");
|
|
6024
6095
|
layout.boundsChanged = undefined;
|
|
6025
6096
|
},
|
|
@@ -6086,7 +6157,7 @@ const LeafRender = {
|
|
|
6086
6157
|
const data = this.__;
|
|
6087
6158
|
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
6088
6159
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
6089
|
-
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
6160
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
6090
6161
|
if (this.__.__single) {
|
|
6091
6162
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6092
6163
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
@@ -6140,7 +6211,7 @@ const BranchRender = {
|
|
|
6140
6211
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6141
6212
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
6142
6213
|
this.__renderBranch(tempCanvas, options);
|
|
6143
|
-
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6214
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6144
6215
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
6145
6216
|
tempCanvas.recycle(nowWorld);
|
|
6146
6217
|
} else {
|
|
@@ -6152,9 +6223,11 @@ const BranchRender = {
|
|
|
6152
6223
|
if (this.__hasMask) {
|
|
6153
6224
|
this.__renderMask(canvas, options);
|
|
6154
6225
|
} else {
|
|
6226
|
+
let child;
|
|
6155
6227
|
const {children: children} = this;
|
|
6156
6228
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6157
|
-
|
|
6229
|
+
child = children[i];
|
|
6230
|
+
excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
|
|
6158
6231
|
}
|
|
6159
6232
|
}
|
|
6160
6233
|
},
|
|
@@ -6168,8 +6241,6 @@ const BranchRender = {
|
|
|
6168
6241
|
}
|
|
6169
6242
|
};
|
|
6170
6243
|
|
|
6171
|
-
const tempScaleData$1 = {};
|
|
6172
|
-
|
|
6173
6244
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
6174
6245
|
|
|
6175
6246
|
const {stintSet: stintSet$4} = DataHelper;
|
|
@@ -6180,6 +6251,8 @@ const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
|
6180
6251
|
|
|
6181
6252
|
const {copy: copy$2, move: move$2} = PointHelper;
|
|
6182
6253
|
|
|
6254
|
+
const {getScaleFixedData: getScaleFixedData} = MathHelper;
|
|
6255
|
+
|
|
6183
6256
|
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;
|
|
6184
6257
|
|
|
6185
6258
|
let Leaf = class Leaf {
|
|
@@ -6338,6 +6411,7 @@ let Leaf = class Leaf {
|
|
|
6338
6411
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
6339
6412
|
if (this.animation) this.__runAnimation("in");
|
|
6340
6413
|
if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
6414
|
+
if (leafer.cacheId) LeafHelper.cacheId(this);
|
|
6341
6415
|
} else {
|
|
6342
6416
|
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
6343
6417
|
}
|
|
@@ -6467,13 +6541,8 @@ let Leaf = class Leaf {
|
|
|
6467
6541
|
if (scaleX < 0) scaleX = -scaleX;
|
|
6468
6542
|
return scaleX > 1 ? scaleX : 1;
|
|
6469
6543
|
}
|
|
6470
|
-
getRenderScaleData(abs, scaleFixed) {
|
|
6471
|
-
|
|
6472
|
-
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
6473
|
-
if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
|
|
6474
|
-
tempScaleData$1.scaleX = scaleX;
|
|
6475
|
-
tempScaleData$1.scaleY = scaleY;
|
|
6476
|
-
return tempScaleData$1;
|
|
6544
|
+
getRenderScaleData(abs, scaleFixed, unscale = true) {
|
|
6545
|
+
return getScaleFixedData(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
|
|
6477
6546
|
}
|
|
6478
6547
|
getTransform(relative) {
|
|
6479
6548
|
return this.__layout.getTransform(relative || "local");
|
|
@@ -6645,7 +6714,7 @@ let Leaf = class Leaf {
|
|
|
6645
6714
|
__drawPath(_canvas) {}
|
|
6646
6715
|
__drawRenderPath(_canvas) {}
|
|
6647
6716
|
__updatePath() {}
|
|
6648
|
-
__updateRenderPath() {}
|
|
6717
|
+
__updateRenderPath(_updateCache) {}
|
|
6649
6718
|
getMotionPathData() {
|
|
6650
6719
|
return Plugin.need("path");
|
|
6651
6720
|
}
|
|
@@ -6719,9 +6788,11 @@ let Branch = class Branch extends Leaf {
|
|
|
6719
6788
|
return 0;
|
|
6720
6789
|
}
|
|
6721
6790
|
__updateRenderSpread() {
|
|
6791
|
+
let layout;
|
|
6722
6792
|
const {children: children} = this;
|
|
6723
6793
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6724
|
-
|
|
6794
|
+
layout = children[i].__layout;
|
|
6795
|
+
if (layout.renderSpread || layout.localOuterBounds) return 1;
|
|
6725
6796
|
}
|
|
6726
6797
|
return 0;
|
|
6727
6798
|
}
|
|
@@ -6754,6 +6825,7 @@ let Branch = class Branch extends Leaf {
|
|
|
6754
6825
|
this.add(item, index);
|
|
6755
6826
|
noIndex || index++;
|
|
6756
6827
|
}); else child = UICreator.get(child.tag, child);
|
|
6828
|
+
if (!child) return;
|
|
6757
6829
|
}
|
|
6758
6830
|
if (child.parent) child.parent.remove(child);
|
|
6759
6831
|
child.parent = this;
|
|
@@ -6979,7 +7051,7 @@ class LeafLevelList {
|
|
|
6979
7051
|
}
|
|
6980
7052
|
}
|
|
6981
7053
|
|
|
6982
|
-
const version = "2.0.
|
|
7054
|
+
const version = "2.0.3";
|
|
6983
7055
|
|
|
6984
7056
|
const debug$4 = Debug.get("LeaferCanvas");
|
|
6985
7057
|
|
|
@@ -7184,8 +7256,6 @@ canvasPatch(CanvasRenderingContext2D.prototype);
|
|
|
7184
7256
|
|
|
7185
7257
|
canvasPatch(Path2D.prototype);
|
|
7186
7258
|
|
|
7187
|
-
const {mineType: mineType, fileType: fileType} = FileHelper;
|
|
7188
|
-
|
|
7189
7259
|
Object.assign(Creator, {
|
|
7190
7260
|
canvas: (options, manager) => new LeaferCanvas(options, manager),
|
|
7191
7261
|
image: options => new LeaferImage(options)
|
|
@@ -7200,29 +7270,27 @@ function useCanvas(_canvasType, _power) {
|
|
|
7200
7270
|
return canvas;
|
|
7201
7271
|
},
|
|
7202
7272
|
canvasToDataURL: (canvas, type, quality) => {
|
|
7203
|
-
const imageType =
|
|
7273
|
+
const imageType = FileHelper.mimeType(type), url = canvas.toDataURL(imageType, quality);
|
|
7204
7274
|
return imageType === "image/bmp" ? url.replace("image/png;", "image/bmp;") : url;
|
|
7205
7275
|
},
|
|
7206
|
-
canvasToBolb: (canvas, type, quality) => new Promise(resolve => canvas.toBlob(resolve,
|
|
7276
|
+
canvasToBolb: (canvas, type, quality) => new Promise(resolve => canvas.toBlob(resolve, FileHelper.mimeType(type), quality)),
|
|
7207
7277
|
canvasSaveAs: (canvas, filename, quality) => {
|
|
7208
|
-
const url = canvas.toDataURL(
|
|
7278
|
+
const url = canvas.toDataURL(FileHelper.mimeType(FileHelper.fileType(filename)), quality);
|
|
7209
7279
|
return Platform.origin.download(url, filename);
|
|
7210
7280
|
},
|
|
7211
7281
|
download(url, filename) {
|
|
7212
|
-
return
|
|
7282
|
+
return __awaiter(this, void 0, void 0, function*() {
|
|
7213
7283
|
let el = document.createElement("a");
|
|
7214
7284
|
el.href = url;
|
|
7215
7285
|
el.download = filename;
|
|
7216
7286
|
document.body.appendChild(el);
|
|
7217
7287
|
el.click();
|
|
7218
7288
|
document.body.removeChild(el);
|
|
7219
|
-
resolve();
|
|
7220
7289
|
});
|
|
7221
7290
|
},
|
|
7222
|
-
loadImage(src) {
|
|
7291
|
+
loadImage(src, crossOrigin, _leaferImage) {
|
|
7223
7292
|
return new Promise((resolve, reject) => {
|
|
7224
7293
|
const img = new Platform.origin.Image;
|
|
7225
|
-
const {crossOrigin: crossOrigin} = Platform.image;
|
|
7226
7294
|
if (crossOrigin) {
|
|
7227
7295
|
img.setAttribute("crossOrigin", crossOrigin);
|
|
7228
7296
|
img.crossOrigin = crossOrigin;
|
|
@@ -7236,6 +7304,13 @@ function useCanvas(_canvasType, _power) {
|
|
|
7236
7304
|
img.src = Platform.image.getRealURL(src);
|
|
7237
7305
|
});
|
|
7238
7306
|
},
|
|
7307
|
+
loadContent(url_1) {
|
|
7308
|
+
return __awaiter(this, arguments, void 0, function*(url, responseType = "text") {
|
|
7309
|
+
const response = yield fetch(url);
|
|
7310
|
+
if (!response.ok) throw new Error(`${response.status}`);
|
|
7311
|
+
return yield response[responseType]();
|
|
7312
|
+
});
|
|
7313
|
+
},
|
|
7239
7314
|
Image: Image,
|
|
7240
7315
|
PointerEvent: PointerEvent,
|
|
7241
7316
|
DragEvent: DragEvent
|
|
@@ -7747,7 +7822,7 @@ class Renderer {
|
|
|
7747
7822
|
getCellList() {
|
|
7748
7823
|
return undefined;
|
|
7749
7824
|
}
|
|
7750
|
-
addBlock(block) {
|
|
7825
|
+
addBlock(block, _leafList) {
|
|
7751
7826
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
7752
7827
|
this.updateBlocks.push(block);
|
|
7753
7828
|
}
|
|
@@ -7795,7 +7870,8 @@ class Renderer {
|
|
|
7795
7870
|
__onLayoutEnd(event) {
|
|
7796
7871
|
if (event.data) event.data.map(item => {
|
|
7797
7872
|
let empty;
|
|
7798
|
-
|
|
7873
|
+
const {updatedList: updatedList} = item;
|
|
7874
|
+
if (updatedList) updatedList.list.some(leaf => {
|
|
7799
7875
|
empty = !leaf.__world.width || !leaf.__world.height;
|
|
7800
7876
|
if (empty) {
|
|
7801
7877
|
if (!leaf.isLeafer) debug$2.tip(leaf.innerName, ": empty");
|
|
@@ -7803,7 +7879,7 @@ class Renderer {
|
|
|
7803
7879
|
}
|
|
7804
7880
|
return empty;
|
|
7805
7881
|
});
|
|
7806
|
-
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds);
|
|
7882
|
+
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds, updatedList);
|
|
7807
7883
|
});
|
|
7808
7884
|
}
|
|
7809
7885
|
emitRender(type, bounds, options) {
|
|
@@ -7851,7 +7927,9 @@ function effectType(defaultValue) {
|
|
|
7851
7927
|
set(value) {
|
|
7852
7928
|
this.__setAttr(key, value);
|
|
7853
7929
|
if (value) this.__.__useEffect = true;
|
|
7854
|
-
|
|
7930
|
+
const layout = this.__layout;
|
|
7931
|
+
layout.renderChanged || layout.renderChange();
|
|
7932
|
+
layout.surfaceChange();
|
|
7855
7933
|
}
|
|
7856
7934
|
}));
|
|
7857
7935
|
}
|
|
@@ -8065,15 +8143,16 @@ class UIData extends LeafData {
|
|
|
8065
8143
|
this.__needComputePaint = undefined;
|
|
8066
8144
|
}
|
|
8067
8145
|
__getRealStrokeWidth(childStyle) {
|
|
8068
|
-
let {strokeWidth: strokeWidth,
|
|
8146
|
+
let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
|
|
8069
8147
|
if (childStyle) {
|
|
8070
8148
|
if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
|
|
8071
|
-
if (!isUndefined(childStyle.
|
|
8149
|
+
if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
|
|
8072
8150
|
}
|
|
8073
|
-
if (
|
|
8074
|
-
const
|
|
8075
|
-
|
|
8076
|
-
}
|
|
8151
|
+
if (strokeScaleFixed) {
|
|
8152
|
+
const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
|
|
8153
|
+
if (scaleX !== 1) return strokeWidth * scaleX;
|
|
8154
|
+
}
|
|
8155
|
+
return strokeWidth;
|
|
8077
8156
|
}
|
|
8078
8157
|
__setPaint(attrName, value) {
|
|
8079
8158
|
this.__setInput(attrName, value);
|
|
@@ -8211,13 +8290,16 @@ class TextData extends UIData {
|
|
|
8211
8290
|
}
|
|
8212
8291
|
|
|
8213
8292
|
class ImageData extends RectData {
|
|
8293
|
+
get __urlType() {
|
|
8294
|
+
return "image";
|
|
8295
|
+
}
|
|
8214
8296
|
setUrl(value) {
|
|
8215
8297
|
this.__setImageFill(value);
|
|
8216
8298
|
this._url = value;
|
|
8217
8299
|
}
|
|
8218
8300
|
__setImageFill(value) {
|
|
8219
8301
|
this.fill = value ? {
|
|
8220
|
-
type:
|
|
8302
|
+
type: this.__urlType,
|
|
8221
8303
|
mode: "stretch",
|
|
8222
8304
|
url: value
|
|
8223
8305
|
} : undefined;
|
|
@@ -8256,7 +8338,7 @@ const UIBounds = {
|
|
|
8256
8338
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
8257
8339
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
8258
8340
|
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
8259
|
-
if (!data.__boxStroke) {
|
|
8341
|
+
if (!data.__boxStroke || data.__useArrow) {
|
|
8260
8342
|
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
8261
8343
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
8262
8344
|
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
@@ -8413,6 +8495,12 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8413
8495
|
get isFrame() {
|
|
8414
8496
|
return false;
|
|
8415
8497
|
}
|
|
8498
|
+
set strokeWidthFixed(value) {
|
|
8499
|
+
this.strokeScaleFixed = value;
|
|
8500
|
+
}
|
|
8501
|
+
get strokeWidthFixed() {
|
|
8502
|
+
return this.strokeScaleFixed;
|
|
8503
|
+
}
|
|
8416
8504
|
set scale(value) {
|
|
8417
8505
|
MathHelper.assignScale(this, value);
|
|
8418
8506
|
}
|
|
@@ -8468,6 +8556,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8468
8556
|
getPathString(curve, pathForRender, floatLength) {
|
|
8469
8557
|
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
8470
8558
|
}
|
|
8559
|
+
asPath(curve, pathForRender) {
|
|
8560
|
+
this.path = this.getPath(curve, pathForRender);
|
|
8561
|
+
}
|
|
8471
8562
|
load() {
|
|
8472
8563
|
this.__.__computePaint();
|
|
8473
8564
|
}
|
|
@@ -8477,16 +8568,18 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8477
8568
|
data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
|
|
8478
8569
|
}
|
|
8479
8570
|
}
|
|
8480
|
-
__updateRenderPath() {
|
|
8571
|
+
__updateRenderPath(updateCache) {
|
|
8481
8572
|
const data = this.__;
|
|
8482
8573
|
if (data.path) {
|
|
8483
8574
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8484
|
-
if (data.__useArrow) PathArrow.addArrows(this);
|
|
8575
|
+
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
8485
8576
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8486
8577
|
}
|
|
8487
8578
|
__drawRenderPath(canvas) {
|
|
8579
|
+
const data = this.__;
|
|
8488
8580
|
canvas.beginPath();
|
|
8489
|
-
|
|
8581
|
+
if (data.__useArrow) PathArrow.updateArrow(this);
|
|
8582
|
+
this.__drawPathByData(canvas, data.__pathForRender);
|
|
8490
8583
|
}
|
|
8491
8584
|
__drawPath(canvas) {
|
|
8492
8585
|
canvas.beginPath();
|
|
@@ -8535,6 +8628,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8535
8628
|
static setEditOuter(_toolName) {}
|
|
8536
8629
|
static setEditInner(_editorName) {}
|
|
8537
8630
|
destroy() {
|
|
8631
|
+
this.__.__willDestroy = true;
|
|
8538
8632
|
this.fill = this.stroke = null;
|
|
8539
8633
|
if (this.__animate) this.killAnimate();
|
|
8540
8634
|
super.destroy();
|
|
@@ -8651,7 +8745,7 @@ __decorate([ strokeType("inside") ], UI.prototype, "strokeAlign", void 0);
|
|
|
8651
8745
|
|
|
8652
8746
|
__decorate([ strokeType(1, true) ], UI.prototype, "strokeWidth", void 0);
|
|
8653
8747
|
|
|
8654
|
-
__decorate([ strokeType(false) ], UI.prototype, "
|
|
8748
|
+
__decorate([ strokeType(false) ], UI.prototype, "strokeScaleFixed", void 0);
|
|
8655
8749
|
|
|
8656
8750
|
__decorate([ strokeType("none") ], UI.prototype, "strokeCap", void 0);
|
|
8657
8751
|
|
|
@@ -8717,7 +8811,10 @@ let Group = class Group extends UI {
|
|
|
8717
8811
|
}
|
|
8718
8812
|
toJSON(options) {
|
|
8719
8813
|
const data = super.toJSON(options);
|
|
8720
|
-
if (!this.childlessJSON)
|
|
8814
|
+
if (!this.childlessJSON) {
|
|
8815
|
+
const children = data.children = [];
|
|
8816
|
+
this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
|
|
8817
|
+
}
|
|
8721
8818
|
return data;
|
|
8722
8819
|
}
|
|
8723
8820
|
pick(_hitPoint, _options) {
|
|
@@ -8866,12 +8963,12 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8866
8963
|
this.emitLeafer(LeaferEvent.STOP);
|
|
8867
8964
|
}
|
|
8868
8965
|
}
|
|
8869
|
-
unlockLayout() {
|
|
8966
|
+
unlockLayout(updateLayout = true) {
|
|
8870
8967
|
this.layouter.start();
|
|
8871
|
-
this.updateLayout();
|
|
8968
|
+
if (updateLayout) this.updateLayout();
|
|
8872
8969
|
}
|
|
8873
|
-
lockLayout() {
|
|
8874
|
-
this.updateLayout();
|
|
8970
|
+
lockLayout(updateLayout = true) {
|
|
8971
|
+
if (updateLayout) this.updateLayout();
|
|
8875
8972
|
this.layouter.stop();
|
|
8876
8973
|
}
|
|
8877
8974
|
resize(size) {
|
|
@@ -9280,9 +9377,9 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9280
9377
|
return "Ellipse";
|
|
9281
9378
|
}
|
|
9282
9379
|
__updatePath() {
|
|
9283
|
-
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} =
|
|
9380
|
+
const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
|
|
9284
9381
|
const rx = width / 2, ry = height / 2;
|
|
9285
|
-
const path =
|
|
9382
|
+
const path = data.path = [];
|
|
9286
9383
|
let open;
|
|
9287
9384
|
if (innerRadius) {
|
|
9288
9385
|
if (startAngle || endAngle) {
|
|
@@ -9304,7 +9401,7 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9304
9401
|
}
|
|
9305
9402
|
}
|
|
9306
9403
|
if (!open) closePath$2(path);
|
|
9307
|
-
if (Platform.ellipseToCurve)
|
|
9404
|
+
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
9308
9405
|
}
|
|
9309
9406
|
};
|
|
9310
9407
|
|
|
@@ -9779,8 +9876,8 @@ function fills(fills, ui, canvas, renderOptions) {
|
|
|
9779
9876
|
canvas.save();
|
|
9780
9877
|
if (item.transform) canvas.transform(item.transform);
|
|
9781
9878
|
if (originPaint.scaleFixed) {
|
|
9782
|
-
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
9783
|
-
if (
|
|
9879
|
+
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, originPaint.scaleFixed, false);
|
|
9880
|
+
if (scaleX !== 1) canvas.scale(scaleX, scaleY);
|
|
9784
9881
|
}
|
|
9785
9882
|
if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
|
|
9786
9883
|
fillPathOrText(ui, canvas, renderOptions);
|
|
@@ -10054,11 +10151,14 @@ function compute(attrName, ui) {
|
|
|
10054
10151
|
function getLeafPaint(attrName, paint, ui) {
|
|
10055
10152
|
if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
|
|
10056
10153
|
let leafPaint;
|
|
10057
|
-
const {boxBounds: boxBounds} = ui.__layout;
|
|
10058
|
-
switch (
|
|
10154
|
+
const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
|
|
10155
|
+
switch (type) {
|
|
10059
10156
|
case "image":
|
|
10157
|
+
case "film":
|
|
10158
|
+
case "video":
|
|
10060
10159
|
if (!paint.url) return undefined;
|
|
10061
10160
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
10161
|
+
if (type !== "image") PaintImage[type](leafPaint);
|
|
10062
10162
|
break;
|
|
10063
10163
|
|
|
10064
10164
|
case "linear":
|
|
@@ -10074,7 +10174,7 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
10074
10174
|
break;
|
|
10075
10175
|
|
|
10076
10176
|
case "solid":
|
|
10077
|
-
const {
|
|
10177
|
+
const {color: color, opacity: opacity} = paint;
|
|
10078
10178
|
leafPaint = {
|
|
10079
10179
|
type: type,
|
|
10080
10180
|
style: ColorConvert.string(color, opacity)
|
|
@@ -10118,7 +10218,7 @@ const {isSame: isSame} = BoundsHelper;
|
|
|
10118
10218
|
|
|
10119
10219
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
10120
10220
|
let leafPaint, event;
|
|
10121
|
-
const image = ImageManager.get(paint);
|
|
10221
|
+
const image = ImageManager.get(paint, paint.type);
|
|
10122
10222
|
if (cache && paint === cache.paint && isSame(boxBounds, cache.boxBounds)) {
|
|
10123
10223
|
leafPaint = cache.leafPaint;
|
|
10124
10224
|
} else {
|
|
@@ -10179,8 +10279,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10179
10279
|
}
|
|
10180
10280
|
|
|
10181
10281
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
10182
|
-
|
|
10183
|
-
|
|
10282
|
+
const data = ui.__;
|
|
10283
|
+
if (attrName === "fill" && !data.__naturalWidth) {
|
|
10184
10284
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
10185
10285
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
10186
10286
|
if (data.__autoSide) {
|
|
@@ -10192,7 +10292,13 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
10192
10292
|
return false;
|
|
10193
10293
|
}
|
|
10194
10294
|
}
|
|
10195
|
-
if (!leafPaint.data)
|
|
10295
|
+
if (!leafPaint.data) {
|
|
10296
|
+
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
10297
|
+
const {transform: transform} = leafPaint.data, {opacity: opacity, blendMode: blendMode} = paint;
|
|
10298
|
+
const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
|
|
10299
|
+
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
10300
|
+
}
|
|
10301
|
+
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
10196
10302
|
return true;
|
|
10197
10303
|
}
|
|
10198
10304
|
|
|
@@ -10235,7 +10341,7 @@ function getPatternData(paint, box, image) {
|
|
|
10235
10341
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
10236
10342
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
10237
10343
|
const {width: width, height: height} = image;
|
|
10238
|
-
const {
|
|
10344
|
+
const {mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, interlace: interlace} = paint;
|
|
10239
10345
|
const sameBox = box.width === width && box.height === height;
|
|
10240
10346
|
const data = {
|
|
10241
10347
|
mode: mode
|
|
@@ -10298,8 +10404,6 @@ function getPatternData(paint, box, image) {
|
|
|
10298
10404
|
data.scaleX = scaleX;
|
|
10299
10405
|
data.scaleY = scaleY;
|
|
10300
10406
|
}
|
|
10301
|
-
if (opacity && opacity < 1) data.opacity = opacity;
|
|
10302
|
-
if (filters) data.filters = filters;
|
|
10303
10407
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
10304
10408
|
if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
|
|
10305
10409
|
type: "x",
|
|
@@ -10330,7 +10434,7 @@ const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translat
|
|
|
10330
10434
|
|
|
10331
10435
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
10332
10436
|
const transform = get$2(), {x: x, y: y} = box;
|
|
10333
|
-
if (x || y) translate(transform, x, y); else transform.onlyScale = true;
|
|
10437
|
+
if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
|
|
10334
10438
|
scaleHelper(transform, scaleX, scaleY);
|
|
10335
10439
|
data.transform = transform;
|
|
10336
10440
|
}
|
|
@@ -10419,10 +10523,10 @@ function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
|
10419
10523
|
}
|
|
10420
10524
|
|
|
10421
10525
|
function createPattern(paint, ui, canvas, renderOptions) {
|
|
10422
|
-
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
|
|
10526
|
+
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
10423
10527
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
10424
10528
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
10425
|
-
const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
10529
|
+
const {image: image, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
10426
10530
|
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
10427
10531
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
10428
10532
|
width *= scaleX;
|
|
@@ -10438,7 +10542,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
10438
10542
|
if (transform) copy$1(imageMatrix, transform);
|
|
10439
10543
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10440
10544
|
}
|
|
10441
|
-
const imageCanvas = image.getCanvas(width, height,
|
|
10545
|
+
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
10442
10546
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
10443
10547
|
paint.style = pattern;
|
|
10444
10548
|
paint.patternId = id;
|
|
@@ -10459,15 +10563,15 @@ function getPatternFixScale(paint, imageScaleX, imageScaleY) {
|
|
|
10459
10563
|
}
|
|
10460
10564
|
|
|
10461
10565
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
10462
|
-
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
10566
|
+
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
10463
10567
|
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
10464
|
-
if (!data || paint.patternId ===
|
|
10568
|
+
if (!data || paint.patternId === id && !exporting || snapshot) {
|
|
10465
10569
|
return false;
|
|
10466
10570
|
} else {
|
|
10467
10571
|
if (drawImage) {
|
|
10468
10572
|
if (data.repeat) {
|
|
10469
10573
|
drawImage = false;
|
|
10470
|
-
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
10574
|
+
} else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
10471
10575
|
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
10472
10576
|
}
|
|
10473
10577
|
}
|
|
@@ -10485,20 +10589,21 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
10485
10589
|
}
|
|
10486
10590
|
}
|
|
10487
10591
|
|
|
10488
|
-
function drawImage(paint,
|
|
10489
|
-
const {data: data, image: image
|
|
10490
|
-
let {width: width, height: height} = image
|
|
10491
|
-
if (
|
|
10592
|
+
function drawImage(paint, imageScaleX, imageScaleY, ui, canvas, _renderOptions) {
|
|
10593
|
+
const {data: data, image: image, complex: complex} = paint;
|
|
10594
|
+
let {width: width, height: height} = image;
|
|
10595
|
+
if (complex) {
|
|
10596
|
+
const {blendMode: blendMode, opacity: opacity} = paint.originPaint, {transform: transform} = data;
|
|
10492
10597
|
canvas.save();
|
|
10493
|
-
|
|
10598
|
+
complex === 2 && canvas.clipUI(ui);
|
|
10494
10599
|
blendMode && (canvas.blendMode = blendMode);
|
|
10495
10600
|
opacity && (canvas.opacity *= opacity);
|
|
10496
10601
|
transform && canvas.transform(transform);
|
|
10497
|
-
|
|
10602
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
10498
10603
|
canvas.restore();
|
|
10499
10604
|
} else {
|
|
10500
10605
|
if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
|
|
10501
|
-
|
|
10606
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
10502
10607
|
}
|
|
10503
10608
|
}
|
|
10504
10609
|
|
|
@@ -10528,6 +10633,7 @@ function recycleImage(attrName, data) {
|
|
|
10528
10633
|
if (!recycleMap) recycleMap = {};
|
|
10529
10634
|
recycleMap[url] = true;
|
|
10530
10635
|
ImageManager.recyclePaint(paint);
|
|
10636
|
+
if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf);
|
|
10531
10637
|
if (image.loading) {
|
|
10532
10638
|
if (!input) {
|
|
10533
10639
|
input = data.__input && data.__input[attrName] || [];
|
|
@@ -11437,4 +11543,4 @@ Object.assign(Effect, EffectModule);
|
|
|
11437
11543
|
|
|
11438
11544
|
useCanvas();
|
|
11439
11545
|
|
|
11440
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
11546
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|