@leafer/miniapp 2.0.1 → 2.0.2
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/miniapp.module.js +119 -54
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +22 -22
package/dist/miniapp.module.js
CHANGED
|
@@ -1897,7 +1897,10 @@ const UICreator = {
|
|
|
1897
1897
|
list$3[tag] = UI;
|
|
1898
1898
|
},
|
|
1899
1899
|
get(tag, data, x, y, width, height) {
|
|
1900
|
-
if (!list$3[tag])
|
|
1900
|
+
if (!list$3[tag]) {
|
|
1901
|
+
debug$h.warn("not register " + tag);
|
|
1902
|
+
return undefined;
|
|
1903
|
+
}
|
|
1901
1904
|
const ui = new list$3[tag](data);
|
|
1902
1905
|
if (!isUndefined(x)) {
|
|
1903
1906
|
ui.x = x;
|
|
@@ -3754,10 +3757,10 @@ function canvasPatch(drawer) {
|
|
|
3754
3757
|
const FileHelper = {
|
|
3755
3758
|
alphaPixelTypes: [ "png", "webp", "svg" ],
|
|
3756
3759
|
upperCaseTypeMap: {},
|
|
3757
|
-
|
|
3758
|
-
if (!type || type.startsWith(
|
|
3760
|
+
mimeType(type, base = "image") {
|
|
3761
|
+
if (!type || type.startsWith(base)) return type;
|
|
3759
3762
|
if (type === "jpg") type = "jpeg";
|
|
3760
|
-
return "
|
|
3763
|
+
return base + "/" + type;
|
|
3761
3764
|
},
|
|
3762
3765
|
fileType(filename) {
|
|
3763
3766
|
const l = filename.split(".");
|
|
@@ -3790,6 +3793,8 @@ const FileHelper = {
|
|
|
3790
3793
|
|
|
3791
3794
|
const F$2 = FileHelper;
|
|
3792
3795
|
|
|
3796
|
+
F$2.mineType = F$2.mimeType;
|
|
3797
|
+
|
|
3793
3798
|
F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3794
3799
|
|
|
3795
3800
|
const debug$c = Debug.get("TaskProcessor");
|
|
@@ -4034,6 +4039,9 @@ const debug$b = Debug.get("Resource");
|
|
|
4034
4039
|
|
|
4035
4040
|
const Resource = {
|
|
4036
4041
|
tasker: new TaskProcessor,
|
|
4042
|
+
queue: new TaskProcessor({
|
|
4043
|
+
parallel: 1
|
|
4044
|
+
}),
|
|
4037
4045
|
map: {},
|
|
4038
4046
|
get isComplete() {
|
|
4039
4047
|
return R.tasker.isComplete;
|
|
@@ -4070,6 +4078,12 @@ const Resource = {
|
|
|
4070
4078
|
R.set(key, value);
|
|
4071
4079
|
return value;
|
|
4072
4080
|
},
|
|
4081
|
+
loadFilm(_key, _format) {
|
|
4082
|
+
return undefined;
|
|
4083
|
+
},
|
|
4084
|
+
loadVideo(_key, _format) {
|
|
4085
|
+
return undefined;
|
|
4086
|
+
},
|
|
4073
4087
|
destroy() {
|
|
4074
4088
|
R.map = {};
|
|
4075
4089
|
}
|
|
@@ -4080,12 +4094,10 @@ const R = Resource;
|
|
|
4080
4094
|
const ImageManager = {
|
|
4081
4095
|
maxRecycled: 10,
|
|
4082
4096
|
recycledList: [],
|
|
4083
|
-
patternTasker:
|
|
4084
|
-
|
|
4085
|
-
}),
|
|
4086
|
-
get(config) {
|
|
4097
|
+
patternTasker: Resource.queue,
|
|
4098
|
+
get(config, type) {
|
|
4087
4099
|
let image = Resource.get(config.url);
|
|
4088
|
-
if (!image) Resource.set(config.url, image = Creator.image(config));
|
|
4100
|
+
if (!image) Resource.set(config.url, image = type === "film" ? Creator.film(config) : Creator.image(config));
|
|
4089
4101
|
image.use++;
|
|
4090
4102
|
return image;
|
|
4091
4103
|
},
|
|
@@ -4120,7 +4132,7 @@ const ImageManager = {
|
|
|
4120
4132
|
if (config.format) return config.format === format;
|
|
4121
4133
|
const {url: url} = config;
|
|
4122
4134
|
if (url.startsWith("data:")) {
|
|
4123
|
-
if (url.startsWith("data:" + FileHelper.
|
|
4135
|
+
if (url.startsWith("data:" + FileHelper.mimeType(format))) return true;
|
|
4124
4136
|
} else {
|
|
4125
4137
|
if (url.includes("." + format) || url.includes("." + FileHelper.upperCaseTypeMap[format])) return true; else if (format === "png" && !url.includes(".")) return true;
|
|
4126
4138
|
}
|
|
@@ -4136,6 +4148,9 @@ const I$1 = ImageManager;
|
|
|
4136
4148
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
4137
4149
|
|
|
4138
4150
|
class LeaferImage {
|
|
4151
|
+
get tag() {
|
|
4152
|
+
return "Image";
|
|
4153
|
+
}
|
|
4139
4154
|
get url() {
|
|
4140
4155
|
return this.config.url;
|
|
4141
4156
|
}
|
|
@@ -4164,7 +4179,7 @@ class LeaferImage {
|
|
|
4164
4179
|
if (!this.loading) {
|
|
4165
4180
|
this.loading = true;
|
|
4166
4181
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
4167
|
-
return yield Platform.origin.
|
|
4182
|
+
return yield Platform.origin["load" + this.tag](this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
|
|
4168
4183
|
if (thumbSize) this.setThumbView(img);
|
|
4169
4184
|
this.setView(img);
|
|
4170
4185
|
}).catch(e => {
|
|
@@ -4238,6 +4253,9 @@ class LeaferImage {
|
|
|
4238
4253
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
4239
4254
|
return pattern;
|
|
4240
4255
|
}
|
|
4256
|
+
render(canvas, x, y, width, height, _leaf, _paint, _imageScaleX, _imageScaleY) {
|
|
4257
|
+
canvas.drawImage(this.view, x, y, width, height);
|
|
4258
|
+
}
|
|
4241
4259
|
getLoadUrl(_thumbSize) {
|
|
4242
4260
|
return this.url;
|
|
4243
4261
|
}
|
|
@@ -4264,6 +4282,18 @@ class LeaferImage {
|
|
|
4264
4282
|
}
|
|
4265
4283
|
}
|
|
4266
4284
|
|
|
4285
|
+
class LeaferFilm extends LeaferImage {
|
|
4286
|
+
get tag() {
|
|
4287
|
+
return "Film";
|
|
4288
|
+
}
|
|
4289
|
+
}
|
|
4290
|
+
|
|
4291
|
+
class LeaferVideo extends LeaferImage {
|
|
4292
|
+
get tag() {
|
|
4293
|
+
return "Video";
|
|
4294
|
+
}
|
|
4295
|
+
}
|
|
4296
|
+
|
|
4267
4297
|
function defineKey(target, key, descriptor, noConfigurable) {
|
|
4268
4298
|
if (!noConfigurable) descriptor.configurable = descriptor.enumerable = true;
|
|
4269
4299
|
Object.defineProperty(target, key, descriptor);
|
|
@@ -6152,9 +6182,11 @@ const BranchRender = {
|
|
|
6152
6182
|
if (this.__hasMask) {
|
|
6153
6183
|
this.__renderMask(canvas, options);
|
|
6154
6184
|
} else {
|
|
6185
|
+
let child;
|
|
6155
6186
|
const {children: children} = this;
|
|
6156
6187
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6157
|
-
|
|
6188
|
+
child = children[i];
|
|
6189
|
+
excludeRenderBounds$1(child, options) || (child.__.complex ? child.__renderComplex(canvas, options) : child.__render(canvas, options));
|
|
6158
6190
|
}
|
|
6159
6191
|
}
|
|
6160
6192
|
},
|
|
@@ -6635,6 +6667,7 @@ let Leaf = class Leaf {
|
|
|
6635
6667
|
__drawHitPath(_canvas) {}
|
|
6636
6668
|
__updateHitCanvas() {}
|
|
6637
6669
|
__render(_canvas, _options) {}
|
|
6670
|
+
__renderComplex(_canvas, _options) {}
|
|
6638
6671
|
__drawFast(_canvas, _options) {}
|
|
6639
6672
|
__draw(_canvas, _options, _originCanvas) {}
|
|
6640
6673
|
__clip(_canvas, _options) {}
|
|
@@ -6754,6 +6787,7 @@ let Branch = class Branch extends Leaf {
|
|
|
6754
6787
|
this.add(item, index);
|
|
6755
6788
|
noIndex || index++;
|
|
6756
6789
|
}); else child = UICreator.get(child.tag, child);
|
|
6790
|
+
if (!child) return;
|
|
6757
6791
|
}
|
|
6758
6792
|
if (child.parent) child.parent.remove(child);
|
|
6759
6793
|
child.parent = this;
|
|
@@ -6979,7 +7013,7 @@ class LeafLevelList {
|
|
|
6979
7013
|
}
|
|
6980
7014
|
}
|
|
6981
7015
|
|
|
6982
|
-
const version = "2.0.
|
|
7016
|
+
const version = "2.0.2";
|
|
6983
7017
|
|
|
6984
7018
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6985
7019
|
get allowBackgroundColor() {
|
|
@@ -7084,8 +7118,6 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
7084
7118
|
}
|
|
7085
7119
|
}
|
|
7086
7120
|
|
|
7087
|
-
const {mineType: mineType, fileType: fileType} = FileHelper;
|
|
7088
|
-
|
|
7089
7121
|
Object.assign(Creator, {
|
|
7090
7122
|
canvas: (options, manager) => new LeaferCanvas(options, manager),
|
|
7091
7123
|
image: options => new LeaferImage(options)
|
|
@@ -7101,12 +7133,12 @@ function useCanvas(_canvasType, app) {
|
|
|
7101
7133
|
};
|
|
7102
7134
|
return app.createOffscreenCanvas ? app.createOffscreenCanvas(data) : app.createOffScreenCanvas(data);
|
|
7103
7135
|
},
|
|
7104
|
-
canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(
|
|
7136
|
+
canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(FileHelper.mimeType(type), quality),
|
|
7105
7137
|
canvasToBolb: (canvas, type, quality) => canvas.toBuffer(type, {
|
|
7106
7138
|
quality: quality
|
|
7107
7139
|
}),
|
|
7108
7140
|
canvasSaveAs: (canvas, filePath, quality) => {
|
|
7109
|
-
let data = canvas.toDataURL(
|
|
7141
|
+
let data = canvas.toDataURL(FileHelper.mimeType(FileHelper.fileType(filePath)), quality);
|
|
7110
7142
|
data = data.substring(data.indexOf("64,") + 3);
|
|
7111
7143
|
return Platform.origin.download(data, filePath);
|
|
7112
7144
|
},
|
|
@@ -7140,7 +7172,7 @@ function useCanvas(_canvasType, app) {
|
|
|
7140
7172
|
});
|
|
7141
7173
|
});
|
|
7142
7174
|
},
|
|
7143
|
-
loadImage(src) {
|
|
7175
|
+
loadImage(src, _crossOrigin, _leaferImage) {
|
|
7144
7176
|
return new Promise((resolve, reject) => {
|
|
7145
7177
|
const img = Platform.canvas.view.createImage();
|
|
7146
7178
|
img.onload = () => {
|
|
@@ -7152,6 +7184,14 @@ function useCanvas(_canvasType, app) {
|
|
|
7152
7184
|
img.src = Platform.image.getRealURL(src);
|
|
7153
7185
|
});
|
|
7154
7186
|
},
|
|
7187
|
+
loadContent(url, responseType = "text") {
|
|
7188
|
+
return new Promise((resolve, reject) => app.request({
|
|
7189
|
+
url: url,
|
|
7190
|
+
responseType: responseType === "arrayBuffer" ? "arraybuffer" : "text",
|
|
7191
|
+
success: res => resolve(responseType === "json" && typeof res.data === "string" ? JSON.parse(res.data) : res.data),
|
|
7192
|
+
fail: reject
|
|
7193
|
+
}));
|
|
7194
|
+
},
|
|
7155
7195
|
noRepeat: "repeat-x"
|
|
7156
7196
|
};
|
|
7157
7197
|
Platform.miniapp = {
|
|
@@ -7703,7 +7743,7 @@ class Renderer {
|
|
|
7703
7743
|
getCellList() {
|
|
7704
7744
|
return undefined;
|
|
7705
7745
|
}
|
|
7706
|
-
addBlock(block) {
|
|
7746
|
+
addBlock(block, _leafList) {
|
|
7707
7747
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
7708
7748
|
this.updateBlocks.push(block);
|
|
7709
7749
|
}
|
|
@@ -7751,7 +7791,8 @@ class Renderer {
|
|
|
7751
7791
|
__onLayoutEnd(event) {
|
|
7752
7792
|
if (event.data) event.data.map(item => {
|
|
7753
7793
|
let empty;
|
|
7754
|
-
|
|
7794
|
+
const {updatedList: updatedList} = item;
|
|
7795
|
+
if (updatedList) updatedList.list.some(leaf => {
|
|
7755
7796
|
empty = !leaf.__world.width || !leaf.__world.height;
|
|
7756
7797
|
if (empty) {
|
|
7757
7798
|
if (!leaf.isLeafer) debug$6.tip(leaf.innerName, ": empty");
|
|
@@ -7759,7 +7800,7 @@ class Renderer {
|
|
|
7759
7800
|
}
|
|
7760
7801
|
return empty;
|
|
7761
7802
|
});
|
|
7762
|
-
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds);
|
|
7803
|
+
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds, updatedList);
|
|
7763
7804
|
});
|
|
7764
7805
|
}
|
|
7765
7806
|
emitRender(type, bounds, options) {
|
|
@@ -8367,13 +8408,16 @@ class TextData extends UIData {
|
|
|
8367
8408
|
}
|
|
8368
8409
|
|
|
8369
8410
|
class ImageData extends RectData {
|
|
8411
|
+
get __urlType() {
|
|
8412
|
+
return "image";
|
|
8413
|
+
}
|
|
8370
8414
|
setUrl(value) {
|
|
8371
8415
|
this.__setImageFill(value);
|
|
8372
8416
|
this._url = value;
|
|
8373
8417
|
}
|
|
8374
8418
|
__setImageFill(value) {
|
|
8375
8419
|
this.fill = value ? {
|
|
8376
|
-
type:
|
|
8420
|
+
type: this.__urlType,
|
|
8377
8421
|
mode: "stretch",
|
|
8378
8422
|
url: value
|
|
8379
8423
|
} : undefined;
|
|
@@ -8873,7 +8917,10 @@ let Group = class Group extends UI {
|
|
|
8873
8917
|
}
|
|
8874
8918
|
toJSON(options) {
|
|
8875
8919
|
const data = super.toJSON(options);
|
|
8876
|
-
if (!this.childlessJSON)
|
|
8920
|
+
if (!this.childlessJSON) {
|
|
8921
|
+
const children = data.children = [];
|
|
8922
|
+
this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
|
|
8923
|
+
}
|
|
8877
8924
|
return data;
|
|
8878
8925
|
}
|
|
8879
8926
|
pick(_hitPoint, _options) {
|
|
@@ -9022,12 +9069,12 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
9022
9069
|
this.emitLeafer(LeaferEvent.STOP);
|
|
9023
9070
|
}
|
|
9024
9071
|
}
|
|
9025
|
-
unlockLayout() {
|
|
9072
|
+
unlockLayout(updateLayout = true) {
|
|
9026
9073
|
this.layouter.start();
|
|
9027
|
-
this.updateLayout();
|
|
9074
|
+
if (updateLayout) this.updateLayout();
|
|
9028
9075
|
}
|
|
9029
|
-
lockLayout() {
|
|
9030
|
-
this.updateLayout();
|
|
9076
|
+
lockLayout(updateLayout = true) {
|
|
9077
|
+
if (updateLayout) this.updateLayout();
|
|
9031
9078
|
this.layouter.stop();
|
|
9032
9079
|
}
|
|
9033
9080
|
resize(size) {
|
|
@@ -10820,6 +10867,7 @@ class InteractionBase {
|
|
|
10820
10867
|
this.checkPath(data, useDefaultPath);
|
|
10821
10868
|
this.downTime = Date.now();
|
|
10822
10869
|
this.emit(PointerEvent.BEFORE_DOWN, data);
|
|
10870
|
+
if (data.path.needUpdate) this.updateDownData(data);
|
|
10823
10871
|
this.emit(PointerEvent.DOWN, data);
|
|
10824
10872
|
if (PointerButton.left(data)) {
|
|
10825
10873
|
this.tapWait();
|
|
@@ -11829,11 +11877,14 @@ function compute(attrName, ui) {
|
|
|
11829
11877
|
function getLeafPaint(attrName, paint, ui) {
|
|
11830
11878
|
if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
|
|
11831
11879
|
let leafPaint;
|
|
11832
|
-
const {boxBounds: boxBounds} = ui.__layout;
|
|
11833
|
-
switch (
|
|
11880
|
+
const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
|
|
11881
|
+
switch (type) {
|
|
11834
11882
|
case "image":
|
|
11883
|
+
case "film":
|
|
11884
|
+
case "video":
|
|
11835
11885
|
if (!paint.url) return undefined;
|
|
11836
11886
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
11887
|
+
if (type !== "image") PaintImage[type](leafPaint);
|
|
11837
11888
|
break;
|
|
11838
11889
|
|
|
11839
11890
|
case "linear":
|
|
@@ -11849,7 +11900,7 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
11849
11900
|
break;
|
|
11850
11901
|
|
|
11851
11902
|
case "solid":
|
|
11852
|
-
const {
|
|
11903
|
+
const {color: color, opacity: opacity} = paint;
|
|
11853
11904
|
leafPaint = {
|
|
11854
11905
|
type: type,
|
|
11855
11906
|
style: ColorConvert.string(color, opacity)
|
|
@@ -11893,7 +11944,7 @@ const {isSame: isSame} = BoundsHelper;
|
|
|
11893
11944
|
|
|
11894
11945
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
11895
11946
|
let leafPaint, event;
|
|
11896
|
-
const image = ImageManager.get(paint);
|
|
11947
|
+
const image = ImageManager.get(paint, paint.type);
|
|
11897
11948
|
if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
|
|
11898
11949
|
leafPaint = cache$1.leafPaint;
|
|
11899
11950
|
} else {
|
|
@@ -11954,8 +12005,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11954
12005
|
}
|
|
11955
12006
|
|
|
11956
12007
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
11957
|
-
|
|
11958
|
-
|
|
12008
|
+
const data = ui.__;
|
|
12009
|
+
if (attrName === "fill" && !data.__naturalWidth) {
|
|
11959
12010
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
11960
12011
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
11961
12012
|
if (data.__autoSide) {
|
|
@@ -11967,7 +12018,12 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
11967
12018
|
return false;
|
|
11968
12019
|
}
|
|
11969
12020
|
}
|
|
11970
|
-
if (!leafPaint.data)
|
|
12021
|
+
if (!leafPaint.data) {
|
|
12022
|
+
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
12023
|
+
const {transform: transform} = leafPaint.data, {opacity: opacity, blendMode: blendMode} = paint;
|
|
12024
|
+
const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
|
|
12025
|
+
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
12026
|
+
}
|
|
11971
12027
|
return true;
|
|
11972
12028
|
}
|
|
11973
12029
|
|
|
@@ -12010,7 +12066,7 @@ function getPatternData(paint, box, image) {
|
|
|
12010
12066
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
12011
12067
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
12012
12068
|
const {width: width, height: height} = image;
|
|
12013
|
-
const {
|
|
12069
|
+
const {mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, interlace: interlace} = paint;
|
|
12014
12070
|
const sameBox = box.width === width && box.height === height;
|
|
12015
12071
|
const data = {
|
|
12016
12072
|
mode: mode
|
|
@@ -12073,8 +12129,6 @@ function getPatternData(paint, box, image) {
|
|
|
12073
12129
|
data.scaleX = scaleX;
|
|
12074
12130
|
data.scaleY = scaleY;
|
|
12075
12131
|
}
|
|
12076
|
-
if (opacity && opacity < 1) data.opacity = opacity;
|
|
12077
|
-
if (filters) data.filters = filters;
|
|
12078
12132
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
12079
12133
|
if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
|
|
12080
12134
|
type: "x",
|
|
@@ -12105,7 +12159,7 @@ const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translat
|
|
|
12105
12159
|
|
|
12106
12160
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
12107
12161
|
const transform = get$2(), {x: x, y: y} = box;
|
|
12108
|
-
if (x || y) translate(transform, x, y); else transform.onlyScale = true;
|
|
12162
|
+
if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
|
|
12109
12163
|
scaleHelper(transform, scaleX, scaleY);
|
|
12110
12164
|
data.transform = transform;
|
|
12111
12165
|
}
|
|
@@ -12194,10 +12248,10 @@ function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
|
12194
12248
|
}
|
|
12195
12249
|
|
|
12196
12250
|
function createPattern(paint, ui, canvas, renderOptions) {
|
|
12197
|
-
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
|
|
12251
|
+
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
12198
12252
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
12199
12253
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
12200
|
-
const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
12254
|
+
const {image: image, data: data} = paint, {opacity: opacity, filters: filters} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
12201
12255
|
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
12202
12256
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
12203
12257
|
width *= scaleX;
|
|
@@ -12213,7 +12267,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
12213
12267
|
if (transform) copy$4(imageMatrix, transform);
|
|
12214
12268
|
scale$1(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
12215
12269
|
}
|
|
12216
|
-
const imageCanvas = image.getCanvas(width, height,
|
|
12270
|
+
const imageCanvas = image.getCanvas(width, height, opacity, filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
12217
12271
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
12218
12272
|
paint.style = pattern;
|
|
12219
12273
|
paint.patternId = id;
|
|
@@ -12234,15 +12288,15 @@ function getPatternFixScale(paint, imageScaleX, imageScaleY) {
|
|
|
12234
12288
|
}
|
|
12235
12289
|
|
|
12236
12290
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
12237
|
-
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
12291
|
+
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
12238
12292
|
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
12239
|
-
if (!data || paint.patternId ===
|
|
12293
|
+
if (!data || paint.patternId === id && !exporting || snapshot) {
|
|
12240
12294
|
return false;
|
|
12241
12295
|
} else {
|
|
12242
12296
|
if (drawImage) {
|
|
12243
12297
|
if (data.repeat) {
|
|
12244
12298
|
drawImage = false;
|
|
12245
|
-
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
12299
|
+
} else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
12246
12300
|
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
12247
12301
|
}
|
|
12248
12302
|
}
|
|
@@ -12260,20 +12314,21 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
12260
12314
|
}
|
|
12261
12315
|
}
|
|
12262
12316
|
|
|
12263
|
-
function drawImage(paint,
|
|
12264
|
-
const {data: data, image: image
|
|
12265
|
-
let {width: width, height: height} = image
|
|
12266
|
-
if (
|
|
12317
|
+
function drawImage(paint, imageScaleX, imageScaleY, ui, canvas, _renderOptions) {
|
|
12318
|
+
const {data: data, image: image, complex: complex} = paint;
|
|
12319
|
+
let {width: width, height: height} = image;
|
|
12320
|
+
if (complex) {
|
|
12321
|
+
const {blendMode: blendMode, opacity: opacity} = paint.originPaint, {transform: transform} = data;
|
|
12267
12322
|
canvas.save();
|
|
12268
|
-
|
|
12323
|
+
complex === 2 && canvas.clipUI(ui);
|
|
12269
12324
|
blendMode && (canvas.blendMode = blendMode);
|
|
12270
12325
|
opacity && (canvas.opacity *= opacity);
|
|
12271
12326
|
transform && canvas.transform(transform);
|
|
12272
|
-
|
|
12327
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
12273
12328
|
canvas.restore();
|
|
12274
12329
|
} else {
|
|
12275
12330
|
if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
|
|
12276
|
-
|
|
12331
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
12277
12332
|
}
|
|
12278
12333
|
}
|
|
12279
12334
|
|
|
@@ -13564,6 +13619,7 @@ class EditSelect extends Group {
|
|
|
13564
13619
|
} else {
|
|
13565
13620
|
editor.target = find;
|
|
13566
13621
|
}
|
|
13622
|
+
e.path.needUpdate = true;
|
|
13567
13623
|
} else if (this.allow(e.target)) {
|
|
13568
13624
|
if (!this.isHoldMultipleSelectKey(e) && !this.editor.mergedConfig.selectKeep) editor.target = null;
|
|
13569
13625
|
}
|
|
@@ -14782,6 +14838,7 @@ class SimulateElement extends Rect {
|
|
|
14782
14838
|
this.checkChange = true;
|
|
14783
14839
|
this.canChange = true;
|
|
14784
14840
|
this.visible = this.hittable = false;
|
|
14841
|
+
this.skipJSON = true;
|
|
14785
14842
|
this.on(PropertyEvent.CHANGE, event => {
|
|
14786
14843
|
if (this.checkChange && checkMap[event.attrName]) {
|
|
14787
14844
|
const {attrName: attrName, newValue: newValue, oldValue: oldValue} = event;
|
|
@@ -15984,9 +16041,14 @@ function addViewport(leafer, mergeConfig, custom) {
|
|
|
15984
16041
|
}), leafer.on_(MoveEvent.END, e => {
|
|
15985
16042
|
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
15986
16043
|
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
|
|
15987
|
-
const {zoomLayer: zoomLayer} = leafer;
|
|
16044
|
+
const {zoomLayer: zoomLayer, layouter: layouter} = leafer;
|
|
15988
16045
|
const changeScale = leafer.getValidScale(e.scale);
|
|
15989
|
-
if (changeScale !== 1)
|
|
16046
|
+
if (changeScale !== 1) {
|
|
16047
|
+
layouter.stop();
|
|
16048
|
+
LeafHelper.updateMatrix(leafer);
|
|
16049
|
+
zoomLayer.scaleOfWorld(e, changeScale);
|
|
16050
|
+
layouter.start();
|
|
16051
|
+
}
|
|
15990
16052
|
}));
|
|
15991
16053
|
}
|
|
15992
16054
|
|
|
@@ -19502,6 +19564,9 @@ let Robot = class Robot extends UI {
|
|
|
19502
19564
|
constructor(data) {
|
|
19503
19565
|
super(data);
|
|
19504
19566
|
}
|
|
19567
|
+
togglePlay() {
|
|
19568
|
+
this.running ? this.pause() : this.play();
|
|
19569
|
+
}
|
|
19505
19570
|
play() {
|
|
19506
19571
|
this.running = true;
|
|
19507
19572
|
}
|
|
@@ -20307,4 +20372,4 @@ Scroller.registerTheme("dark", {
|
|
|
20307
20372
|
}
|
|
20308
20373
|
});
|
|
20309
20374
|
|
|
20310
|
-
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
20375
|
+
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|