@leafer-draw/worker 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.
@@ -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) {
@@ -1897,7 +1936,10 @@ const UICreator = {
1897
1936
  list$1[tag] = UI;
1898
1937
  },
1899
1938
  get(tag, data, x, y, width, height) {
1900
- if (!list$1[tag]) debug$d.error("not register " + tag);
1939
+ if (!list$1[tag]) {
1940
+ debug$d.warn("not register " + tag);
1941
+ return undefined;
1942
+ }
1901
1943
  const ui = new list$1[tag](data);
1902
1944
  if (!isUndefined(x)) {
1903
1945
  ui.x = x;
@@ -1988,45 +2030,6 @@ class CanvasManager {
1988
2030
  }
1989
2031
  }
1990
2032
 
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
2033
  function contextAttr(realName) {
2031
2034
  return (target, key) => {
2032
2035
  if (!realName) realName = key;
@@ -3754,10 +3757,10 @@ function canvasPatch(drawer) {
3754
3757
  const FileHelper = {
3755
3758
  alphaPixelTypes: [ "png", "webp", "svg" ],
3756
3759
  upperCaseTypeMap: {},
3757
- mineType(type) {
3758
- if (!type || type.startsWith("image")) return type;
3760
+ mimeType(type, base = "image") {
3761
+ if (!type || type.startsWith(base)) return type;
3759
3762
  if (type === "jpg") type = "jpeg";
3760
- return "image/" + type;
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 = FileHelper;
3792
3795
 
3796
+ F.mineType = F.mimeType;
3797
+
3793
3798
  F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
3794
3799
 
3795
3800
  const debug$8 = Debug.get("TaskProcessor");
@@ -4034,6 +4039,9 @@ const debug$7 = 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: new TaskProcessor({
4084
- parallel: 1
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.mineType(format))) return true;
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 = 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.loadImage(this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
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
- excludeRenderBounds$1(children[i], options) || children[i].__render(canvas, options);
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.1";
7016
+ const version = "2.0.2";
6983
7017
 
6984
7018
  class LeaferCanvas extends LeaferCanvasBase {
6985
7019
  get allowBackgroundColor() {
@@ -7005,8 +7039,6 @@ canvasPatch(OffscreenCanvasRenderingContext2D.prototype);
7005
7039
 
7006
7040
  canvasPatch(Path2D.prototype);
7007
7041
 
7008
- const {mineType: mineType} = FileHelper;
7009
-
7010
7042
  Object.assign(Creator, {
7011
7043
  canvas: (options, manager) => new LeaferCanvas(options, manager),
7012
7044
  image: options => new LeaferImage(options)
@@ -7017,7 +7049,7 @@ function useCanvas(_canvasType, _power) {
7017
7049
  createCanvas: (width, height) => new OffscreenCanvas(width, height),
7018
7050
  canvasToDataURL: (canvas, type, quality) => new Promise((resolve, reject) => {
7019
7051
  canvas.convertToBlob({
7020
- type: mineType(type),
7052
+ type: FileHelper.mimeType(type),
7021
7053
  quality: quality
7022
7054
  }).then(blob => {
7023
7055
  var reader = new FileReader;
@@ -7029,14 +7061,14 @@ function useCanvas(_canvasType, _power) {
7029
7061
  });
7030
7062
  }),
7031
7063
  canvasToBolb: (canvas, type, quality) => canvas.convertToBlob({
7032
- type: mineType(type),
7064
+ type: FileHelper.mimeType(type),
7033
7065
  quality: quality
7034
7066
  }),
7035
7067
  canvasSaveAs: (_canvas, _filename, _quality) => new Promise(resolve => resolve()),
7036
7068
  download(_url, _filename) {
7037
7069
  return undefined;
7038
7070
  },
7039
- loadImage(src) {
7071
+ loadImage(src, _crossOrigin, _leaferImage) {
7040
7072
  return new Promise((resolve, reject) => {
7041
7073
  let req = new XMLHttpRequest;
7042
7074
  req.open("GET", Platform.image.getRealURL(src), true);
@@ -7051,6 +7083,13 @@ function useCanvas(_canvasType, _power) {
7051
7083
  req.onerror = e => reject(e);
7052
7084
  req.send();
7053
7085
  });
7086
+ },
7087
+ loadContent(url_1) {
7088
+ return __awaiter(this, arguments, void 0, function*(url, responseType = "text") {
7089
+ const response = yield fetch(url);
7090
+ if (!response.ok) throw new Error(`${response.status}`);
7091
+ return yield response[responseType]();
7092
+ });
7054
7093
  }
7055
7094
  };
7056
7095
  Platform.canvas = Creator.canvas();
@@ -7550,7 +7589,7 @@ class Renderer {
7550
7589
  getCellList() {
7551
7590
  return undefined;
7552
7591
  }
7553
- addBlock(block) {
7592
+ addBlock(block, _leafList) {
7554
7593
  if (!this.updateBlocks) this.updateBlocks = [];
7555
7594
  this.updateBlocks.push(block);
7556
7595
  }
@@ -7598,7 +7637,8 @@ class Renderer {
7598
7637
  __onLayoutEnd(event) {
7599
7638
  if (event.data) event.data.map(item => {
7600
7639
  let empty;
7601
- if (item.updatedList) item.updatedList.list.some(leaf => {
7640
+ const {updatedList: updatedList} = item;
7641
+ if (updatedList) updatedList.list.some(leaf => {
7602
7642
  empty = !leaf.__world.width || !leaf.__world.height;
7603
7643
  if (empty) {
7604
7644
  if (!leaf.isLeafer) debug$2.tip(leaf.innerName, ": empty");
@@ -7606,7 +7646,7 @@ class Renderer {
7606
7646
  }
7607
7647
  return empty;
7608
7648
  });
7609
- this.addBlock(empty ? this.canvas.bounds : item.updatedBounds);
7649
+ this.addBlock(empty ? this.canvas.bounds : item.updatedBounds, updatedList);
7610
7650
  });
7611
7651
  }
7612
7652
  emitRender(type, bounds, options) {
@@ -8014,13 +8054,16 @@ class TextData extends UIData {
8014
8054
  }
8015
8055
 
8016
8056
  class ImageData extends RectData {
8057
+ get __urlType() {
8058
+ return "image";
8059
+ }
8017
8060
  setUrl(value) {
8018
8061
  this.__setImageFill(value);
8019
8062
  this._url = value;
8020
8063
  }
8021
8064
  __setImageFill(value) {
8022
8065
  this.fill = value ? {
8023
- type: "image",
8066
+ type: this.__urlType,
8024
8067
  mode: "stretch",
8025
8068
  url: value
8026
8069
  } : undefined;
@@ -8520,7 +8563,10 @@ let Group = class Group extends UI {
8520
8563
  }
8521
8564
  toJSON(options) {
8522
8565
  const data = super.toJSON(options);
8523
- if (!this.childlessJSON) data.children = this.children.map(child => child.toJSON(options));
8566
+ if (!this.childlessJSON) {
8567
+ const children = data.children = [];
8568
+ this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
8569
+ }
8524
8570
  return data;
8525
8571
  }
8526
8572
  pick(_hitPoint, _options) {
@@ -8669,12 +8715,12 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8669
8715
  this.emitLeafer(LeaferEvent.STOP);
8670
8716
  }
8671
8717
  }
8672
- unlockLayout() {
8718
+ unlockLayout(updateLayout = true) {
8673
8719
  this.layouter.start();
8674
- this.updateLayout();
8720
+ if (updateLayout) this.updateLayout();
8675
8721
  }
8676
- lockLayout() {
8677
- this.updateLayout();
8722
+ lockLayout(updateLayout = true) {
8723
+ if (updateLayout) this.updateLayout();
8678
8724
  this.layouter.stop();
8679
8725
  }
8680
8726
  resize(size) {
@@ -9857,11 +9903,14 @@ function compute(attrName, ui) {
9857
9903
  function getLeafPaint(attrName, paint, ui) {
9858
9904
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
9859
9905
  let leafPaint;
9860
- const {boxBounds: boxBounds} = ui.__layout;
9861
- switch (paint.type) {
9906
+ const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
9907
+ switch (type) {
9862
9908
  case "image":
9909
+ case "film":
9910
+ case "video":
9863
9911
  if (!paint.url) return undefined;
9864
9912
  leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
9913
+ if (type !== "image") PaintImage[type](leafPaint);
9865
9914
  break;
9866
9915
 
9867
9916
  case "linear":
@@ -9877,7 +9926,7 @@ function getLeafPaint(attrName, paint, ui) {
9877
9926
  break;
9878
9927
 
9879
9928
  case "solid":
9880
- const {type: type, color: color, opacity: opacity} = paint;
9929
+ const {color: color, opacity: opacity} = paint;
9881
9930
  leafPaint = {
9882
9931
  type: type,
9883
9932
  style: ColorConvert.string(color, opacity)
@@ -9921,7 +9970,7 @@ const {isSame: isSame} = BoundsHelper;
9921
9970
 
9922
9971
  function image(ui, attrName, paint, boxBounds, firstUse) {
9923
9972
  let leafPaint, event;
9924
- const image = ImageManager.get(paint);
9973
+ const image = ImageManager.get(paint, paint.type);
9925
9974
  if (cache && paint === cache.paint && isSame(boxBounds, cache.boxBounds)) {
9926
9975
  leafPaint = cache.leafPaint;
9927
9976
  } else {
@@ -9982,8 +10031,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
9982
10031
  }
9983
10032
 
9984
10033
  function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
9985
- if (attrName === "fill" && !ui.__.__naturalWidth) {
9986
- const data = ui.__;
10034
+ const data = ui.__;
10035
+ if (attrName === "fill" && !data.__naturalWidth) {
9987
10036
  data.__naturalWidth = image.width / data.pixelRatio;
9988
10037
  data.__naturalHeight = image.height / data.pixelRatio;
9989
10038
  if (data.__autoSide) {
@@ -9995,7 +10044,12 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
9995
10044
  return false;
9996
10045
  }
9997
10046
  }
9998
- if (!leafPaint.data) PaintImage.createData(leafPaint, image, paint, boxBounds);
10047
+ if (!leafPaint.data) {
10048
+ PaintImage.createData(leafPaint, image, paint, boxBounds);
10049
+ const {transform: transform} = leafPaint.data, {opacity: opacity, blendMode: blendMode} = paint;
10050
+ const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
10051
+ if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
10052
+ }
9999
10053
  return true;
10000
10054
  }
10001
10055
 
@@ -10038,7 +10092,7 @@ function getPatternData(paint, box, image) {
10038
10092
  if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
10039
10093
  if (paint.mode === "strench") paint.mode = "stretch";
10040
10094
  const {width: width, height: height} = image;
10041
- const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters, interlace: interlace} = paint;
10095
+ const {mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, interlace: interlace} = paint;
10042
10096
  const sameBox = box.width === width && box.height === height;
10043
10097
  const data = {
10044
10098
  mode: mode
@@ -10101,8 +10155,6 @@ function getPatternData(paint, box, image) {
10101
10155
  data.scaleX = scaleX;
10102
10156
  data.scaleY = scaleY;
10103
10157
  }
10104
- if (opacity && opacity < 1) data.opacity = opacity;
10105
- if (filters) data.filters = filters;
10106
10158
  if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
10107
10159
  if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
10108
10160
  type: "x",
@@ -10133,7 +10185,7 @@ const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translat
10133
10185
 
10134
10186
  function stretchMode(data, box, scaleX, scaleY) {
10135
10187
  const transform = get$2(), {x: x, y: y} = box;
10136
- if (x || y) translate(transform, x, y); else transform.onlyScale = true;
10188
+ if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
10137
10189
  scaleHelper(transform, scaleX, scaleY);
10138
10190
  data.transform = transform;
10139
10191
  }
@@ -10222,10 +10274,10 @@ function createPatternTask(paint, ui, canvas, renderOptions) {
10222
10274
  }
10223
10275
 
10224
10276
  function createPattern(paint, ui, canvas, renderOptions) {
10225
- let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
10277
+ let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
10226
10278
  if (paint.patternId !== id && !ui.destroyed) {
10227
10279
  if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
10228
- const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
10280
+ const {image: image, data: data} = paint, {opacity: opacity, filters: filters} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
10229
10281
  let imageMatrix, xGap, yGap, {width: width, height: height} = image;
10230
10282
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
10231
10283
  width *= scaleX;
@@ -10241,7 +10293,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
10241
10293
  if (transform) copy$1(imageMatrix, transform);
10242
10294
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
10243
10295
  }
10244
- const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
10296
+ const imageCanvas = image.getCanvas(width, height, opacity, filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
10245
10297
  const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
10246
10298
  paint.style = pattern;
10247
10299
  paint.patternId = id;
@@ -10262,15 +10314,15 @@ function getPatternFixScale(paint, imageScaleX, imageScaleY) {
10262
10314
  }
10263
10315
 
10264
10316
  function checkImage(paint, drawImage, ui, canvas, renderOptions) {
10265
- const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
10317
+ const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
10266
10318
  const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
10267
- if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting || snapshot) {
10319
+ if (!data || paint.patternId === id && !exporting || snapshot) {
10268
10320
  return false;
10269
10321
  } else {
10270
10322
  if (drawImage) {
10271
10323
  if (data.repeat) {
10272
10324
  drawImage = false;
10273
- } else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
10325
+ } else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
10274
10326
  drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
10275
10327
  }
10276
10328
  }
@@ -10288,20 +10340,21 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
10288
10340
  }
10289
10341
  }
10290
10342
 
10291
- function drawImage(paint, _imageScaleX, _imageScaleY, ui, canvas, _renderOptions) {
10292
- const {data: data, image: image} = paint, {blendMode: blendMode} = paint.originPaint, {opacity: opacity, transform: transform} = data, view = image.getFull(data.filters), u = ui.__;
10293
- let {width: width, height: height} = image, clipUI;
10294
- if ((clipUI = transform && !transform.onlyScale || u.path || u.cornerRadius) || opacity || blendMode) {
10343
+ function drawImage(paint, imageScaleX, imageScaleY, ui, canvas, _renderOptions) {
10344
+ const {data: data, image: image, complex: complex} = paint;
10345
+ let {width: width, height: height} = image;
10346
+ if (complex) {
10347
+ const {blendMode: blendMode, opacity: opacity} = paint.originPaint, {transform: transform} = data;
10295
10348
  canvas.save();
10296
- clipUI && canvas.clipUI(ui);
10349
+ complex === 2 && canvas.clipUI(ui);
10297
10350
  blendMode && (canvas.blendMode = blendMode);
10298
10351
  opacity && (canvas.opacity *= opacity);
10299
10352
  transform && canvas.transform(transform);
10300
- canvas.drawImage(view, 0, 0, width, height);
10353
+ image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
10301
10354
  canvas.restore();
10302
10355
  } else {
10303
10356
  if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
10304
- canvas.drawImage(view, 0, 0, width, height);
10357
+ image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
10305
10358
  }
10306
10359
  }
10307
10360
 
@@ -11240,4 +11293,4 @@ Object.assign(Effect, EffectModule);
11240
11293
 
11241
11294
  useCanvas();
11242
11295
 
11243
- 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, 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 };
11296
+ 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, 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 };