@leafer/worker 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/worker.js CHANGED
@@ -7,6 +7,42 @@ var LeaferUI = function(exports) {
7
7
  PathNodeHandleType[PathNodeHandleType["mirrorAngle"] = 3] = "mirrorAngle";
8
8
  PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
9
9
  })(exports.PathNodeHandleType || (exports.PathNodeHandleType = {}));
10
+ function __decorate(decorators, target, key, desc) {
11
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
14
+ }
15
+ function __awaiter(thisArg, _arguments, P, generator) {
16
+ function adopt(value) {
17
+ return value instanceof P ? value : new P(function(resolve) {
18
+ resolve(value);
19
+ });
20
+ }
21
+ return new (P || (P = Promise))(function(resolve, reject) {
22
+ function fulfilled(value) {
23
+ try {
24
+ step(generator.next(value));
25
+ } catch (e) {
26
+ reject(e);
27
+ }
28
+ }
29
+ function rejected(value) {
30
+ try {
31
+ step(generator["throw"](value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ }
36
+ function step(result) {
37
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
38
+ }
39
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
40
+ });
41
+ }
42
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
43
+ var e = new Error(message);
44
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
45
+ };
10
46
  exports.Answer = void 0;
11
47
  (function(Answer) {
12
48
  Answer[Answer["No"] = 0] = "No";
@@ -197,6 +233,7 @@ var LeaferUI = function(exports) {
197
233
  }
198
234
  destroy() {
199
235
  this.__input = this.__middle = null;
236
+ if (this.__complexData) this.__complexData.destroy();
200
237
  }
201
238
  }
202
239
  const IncrementId = {
@@ -287,6 +324,7 @@ var LeaferUI = function(exports) {
287
324
  };
288
325
  const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
289
326
  const {round: round$6, pow: pow$2, max: max$6, floor: floor$3, PI: PI$4} = Math;
327
+ const tempScaleData$1 = {};
290
328
  const MathHelper = {
291
329
  within(value, min, max) {
292
330
  if (isObject(min)) max = min.max, min = min.min;
@@ -330,6 +368,24 @@ var LeaferUI = function(exports) {
330
368
  } else if (scale) MathHelper.assignScale(scaleData, scale);
331
369
  return scaleData;
332
370
  },
371
+ getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
372
+ let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
373
+ if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
374
+ if (scaleFixed) {
375
+ if (scaleFixed === true) {
376
+ scaleX = scaleY = unscale ? 1 : 1 / scaleX;
377
+ } else {
378
+ let minScale;
379
+ if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
380
+ if (minScale) {
381
+ if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
382
+ }
383
+ }
384
+ }
385
+ tempScaleData$1.scaleX = scaleX;
386
+ tempScaleData$1.scaleY = scaleY;
387
+ return tempScaleData$1;
388
+ },
333
389
  assignScale(scaleData, scale) {
334
390
  if (isNumber(scale)) {
335
391
  scaleData.scaleX = scaleData.scaleY = scale;
@@ -809,8 +865,8 @@ var LeaferUI = function(exports) {
809
865
  if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
810
866
  return points;
811
867
  },
812
- isSame(t, point) {
813
- return float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
868
+ isSame(t, point, quick) {
869
+ return quick ? t.x === point.x && t.y === point.y : float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
814
870
  },
815
871
  reset(t) {
816
872
  P$7.reset(t);
@@ -882,8 +938,8 @@ var LeaferUI = function(exports) {
882
938
  getAtan2(to) {
883
939
  return PointHelper.getAtan2(this, to);
884
940
  }
885
- isSame(point) {
886
- return PointHelper.isSame(this, point);
941
+ isSame(point, quick) {
942
+ return PointHelper.isSame(this, point, quick);
887
943
  }
888
944
  reset() {
889
945
  PointHelper.reset(this);
@@ -1127,9 +1183,9 @@ var LeaferUI = function(exports) {
1127
1183
  }
1128
1184
  if (!onlyBoxSize) to.x += box.x, to.y += box.y;
1129
1185
  },
1130
- getPoint(around, box, to) {
1186
+ getPoint(around, box, to, onlyBoxSize = true) {
1131
1187
  if (!to) to = {};
1132
- AroundHelper.toPoint(around, box, to, true);
1188
+ AroundHelper.toPoint(around, box, to, onlyBoxSize);
1133
1189
  return to;
1134
1190
  }
1135
1191
  };
@@ -1384,6 +1440,9 @@ var LeaferUI = function(exports) {
1384
1440
  y: y + height
1385
1441
  } ];
1386
1442
  },
1443
+ getPoint(t, around, onlyBoxSize = false, to) {
1444
+ return AroundHelper.getPoint(around, t, to, onlyBoxSize);
1445
+ },
1387
1446
  hitRadiusPoint(t, point, pointMatrix) {
1388
1447
  if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
1389
1448
  return point.x >= t.x - point.radiusX && point.x <= t.x + t.width + point.radiusX && (point.y >= t.y - point.radiusY && point.y <= t.y + t.height + point.radiusY);
@@ -1552,6 +1611,9 @@ var LeaferUI = function(exports) {
1552
1611
  getPoints() {
1553
1612
  return BoundsHelper.getPoints(this);
1554
1613
  }
1614
+ getPoint(around, onlyBoxSize, to) {
1615
+ return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
1616
+ }
1555
1617
  hitPoint(point, pointMatrix) {
1556
1618
  return BoundsHelper.hitPoint(this, point, pointMatrix);
1557
1619
  }
@@ -1803,7 +1865,10 @@ var LeaferUI = function(exports) {
1803
1865
  list$3[tag] = UI;
1804
1866
  },
1805
1867
  get(tag, data, x, y, width, height) {
1806
- if (!list$3[tag]) debug$h.error("not register " + tag);
1868
+ if (!list$3[tag]) {
1869
+ debug$h.warn("not register " + tag);
1870
+ return undefined;
1871
+ }
1807
1872
  const ui = new list$3[tag](data);
1808
1873
  if (!isUndefined(x)) {
1809
1874
  ui.x = x;
@@ -1888,42 +1953,6 @@ var LeaferUI = function(exports) {
1888
1953
  this.clear();
1889
1954
  }
1890
1955
  }
1891
- function __decorate(decorators, target, key, desc) {
1892
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1893
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1894
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1895
- }
1896
- function __awaiter(thisArg, _arguments, P, generator) {
1897
- function adopt(value) {
1898
- return value instanceof P ? value : new P(function(resolve) {
1899
- resolve(value);
1900
- });
1901
- }
1902
- return new (P || (P = Promise))(function(resolve, reject) {
1903
- function fulfilled(value) {
1904
- try {
1905
- step(generator.next(value));
1906
- } catch (e) {
1907
- reject(e);
1908
- }
1909
- }
1910
- function rejected(value) {
1911
- try {
1912
- step(generator["throw"](value));
1913
- } catch (e) {
1914
- reject(e);
1915
- }
1916
- }
1917
- function step(result) {
1918
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1919
- }
1920
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1921
- });
1922
- }
1923
- typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
1924
- var e = new Error(message);
1925
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1926
- };
1927
1956
  function contextAttr(realName) {
1928
1957
  return (target, key) => {
1929
1958
  if (!realName) realName = key;
@@ -3523,10 +3552,10 @@ var LeaferUI = function(exports) {
3523
3552
  const FileHelper = {
3524
3553
  alphaPixelTypes: [ "png", "webp", "svg" ],
3525
3554
  upperCaseTypeMap: {},
3526
- mineType(type) {
3527
- if (!type || type.startsWith("image")) return type;
3555
+ mimeType(type, base = "image") {
3556
+ if (!type || type.startsWith(base)) return type;
3528
3557
  if (type === "jpg") type = "jpeg";
3529
- return "image/" + type;
3558
+ return base + "/" + type;
3530
3559
  },
3531
3560
  fileType(filename) {
3532
3561
  const l = filename.split(".");
@@ -3557,6 +3586,7 @@ var LeaferUI = function(exports) {
3557
3586
  }
3558
3587
  };
3559
3588
  const F$2 = FileHelper;
3589
+ F$2.mineType = F$2.mimeType;
3560
3590
  F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
3561
3591
  const debug$c = Debug.get("TaskProcessor");
3562
3592
  class TaskItem {
@@ -3796,6 +3826,9 @@ var LeaferUI = function(exports) {
3796
3826
  const debug$b = Debug.get("Resource");
3797
3827
  const Resource = {
3798
3828
  tasker: new TaskProcessor,
3829
+ queue: new TaskProcessor({
3830
+ parallel: 1
3831
+ }),
3799
3832
  map: {},
3800
3833
  get isComplete() {
3801
3834
  return R.tasker.isComplete;
@@ -3832,6 +3865,12 @@ var LeaferUI = function(exports) {
3832
3865
  R.set(key, value);
3833
3866
  return value;
3834
3867
  },
3868
+ loadFilm(_key, _format) {
3869
+ return undefined;
3870
+ },
3871
+ loadVideo(_key, _format) {
3872
+ return undefined;
3873
+ },
3835
3874
  destroy() {
3836
3875
  R.map = {};
3837
3876
  }
@@ -3840,16 +3879,15 @@ var LeaferUI = function(exports) {
3840
3879
  const ImageManager = {
3841
3880
  maxRecycled: 10,
3842
3881
  recycledList: [],
3843
- patternTasker: new TaskProcessor({
3844
- parallel: 1
3845
- }),
3846
- get(config) {
3882
+ patternTasker: Resource.queue,
3883
+ get(config, type) {
3847
3884
  let image = Resource.get(config.url);
3848
- if (!image) Resource.set(config.url, image = Creator.image(config));
3885
+ if (!image) Resource.set(config.url, image = type === "film" ? Creator.film(config) : Creator.image(config));
3849
3886
  image.use++;
3850
3887
  return image;
3851
3888
  },
3852
3889
  recycle(image) {
3890
+ if (image.parent) image = image.parent;
3853
3891
  image.use--;
3854
3892
  setTimeout(() => {
3855
3893
  if (!image.use) {
@@ -3880,7 +3918,7 @@ var LeaferUI = function(exports) {
3880
3918
  if (config.format) return config.format === format;
3881
3919
  const {url: url} = config;
3882
3920
  if (url.startsWith("data:")) {
3883
- if (url.startsWith("data:" + FileHelper.mineType(format))) return true;
3921
+ if (url.startsWith("data:" + FileHelper.mimeType(format))) return true;
3884
3922
  } else {
3885
3923
  if (url.includes("." + format) || url.includes("." + FileHelper.upperCaseTypeMap[format])) return true; else if (format === "png" && !url.includes(".")) return true;
3886
3924
  }
@@ -3893,6 +3931,9 @@ var LeaferUI = function(exports) {
3893
3931
  const I$1 = ImageManager;
3894
3932
  const {IMAGE: IMAGE, create: create$1} = IncrementId;
3895
3933
  class LeaferImage {
3934
+ get tag() {
3935
+ return "Image";
3936
+ }
3896
3937
  get url() {
3897
3938
  return this.config.url;
3898
3939
  }
@@ -3921,7 +3962,7 @@ var LeaferUI = function(exports) {
3921
3962
  if (!this.loading) {
3922
3963
  this.loading = true;
3923
3964
  Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
3924
- return yield Platform.origin.loadImage(this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
3965
+ return yield Platform.origin["load" + this.tag](this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
3925
3966
  if (thumbSize) this.setThumbView(img);
3926
3967
  this.setView(img);
3927
3968
  }).catch(e => {
@@ -3995,6 +4036,9 @@ var LeaferUI = function(exports) {
3995
4036
  Platform.image.setPatternTransform(pattern, transform, paint);
3996
4037
  return pattern;
3997
4038
  }
4039
+ render(canvas, x, y, width, height, _leaf, _paint, _imageScaleX, _imageScaleY) {
4040
+ canvas.drawImage(this.view, x, y, width, height);
4041
+ }
3998
4042
  getLoadUrl(_thumbSize) {
3999
4043
  return this.url;
4000
4044
  }
@@ -4009,8 +4053,10 @@ var LeaferUI = function(exports) {
4009
4053
  return undefined;
4010
4054
  }
4011
4055
  clearLevels(_checkUse) {}
4056
+ destroyFilter() {}
4012
4057
  destroy() {
4013
4058
  this.clearLevels();
4059
+ this.destroyFilter();
4014
4060
  const {view: view} = this;
4015
4061
  if (view && view.close) view.close();
4016
4062
  this.config = {
@@ -4020,6 +4066,16 @@ var LeaferUI = function(exports) {
4020
4066
  this.waitComplete.length = 0;
4021
4067
  }
4022
4068
  }
4069
+ class LeaferFilm extends LeaferImage {
4070
+ get tag() {
4071
+ return "Film";
4072
+ }
4073
+ }
4074
+ class LeaferVideo extends LeaferImage {
4075
+ get tag() {
4076
+ return "Video";
4077
+ }
4078
+ }
4023
4079
  function defineKey(target, key, descriptor, noConfigurable) {
4024
4080
  if (!noConfigurable) descriptor.configurable = descriptor.enumerable = true;
4025
4081
  Object.defineProperty(target, key, descriptor);
@@ -4171,7 +4227,6 @@ var LeaferUI = function(exports) {
4171
4227
  if (this.__setAttr(key, value)) {
4172
4228
  const data = this.__;
4173
4229
  DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
4174
- this.__layout.surfaceChange();
4175
4230
  }
4176
4231
  }
4177
4232
  }));
@@ -4216,7 +4271,6 @@ var LeaferUI = function(exports) {
4216
4271
  return decorateLeafAttr(defaultValue, key => attr({
4217
4272
  set(value) {
4218
4273
  if (this.__setAttr(key, value)) {
4219
- this.__layout.surfaceChange();
4220
4274
  this.waitParent(() => {
4221
4275
  this.parent.__layout.childrenSortChange();
4222
4276
  });
@@ -4250,7 +4304,6 @@ var LeaferUI = function(exports) {
4250
4304
  set(value) {
4251
4305
  if (this.__setAttr(key, value)) {
4252
4306
  this.__layout.hitCanvasChanged = true;
4253
- if (Debug.showBounds === "hit") this.__layout.surfaceChange();
4254
4307
  if (this.leafer) this.leafer.updateCursor();
4255
4308
  }
4256
4309
  }
@@ -4438,6 +4491,10 @@ var LeaferUI = function(exports) {
4438
4491
  if (layout.stateStyleChanged) leaf.updateState();
4439
4492
  if (layout.opacityChanged) updateAllWorldOpacity(leaf);
4440
4493
  leaf.__updateChange();
4494
+ if (layout.surfaceChanged) {
4495
+ if (leaf.__hasComplex) L$4.updateComplex(leaf);
4496
+ layout.surfaceChanged = false;
4497
+ }
4441
4498
  },
4442
4499
  updateAllChange(leaf) {
4443
4500
  updateChange$1(leaf);
@@ -4462,6 +4519,9 @@ var LeaferUI = function(exports) {
4462
4519
  if (!fromWorld) fromWorld = leaf.__nowWorld;
4463
4520
  if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
4464
4521
  },
4522
+ renderComplex(_leaf, _canvas, _options) {},
4523
+ updateComplex(_leaf) {},
4524
+ checkComplex(_leaf) {},
4465
4525
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4466
4526
  const local = isObject(x) ? Object.assign({}, x) : {
4467
4527
  x: x,
@@ -4573,6 +4633,9 @@ var LeaferUI = function(exports) {
4573
4633
  divideParent(matrix$3, relative.scrollWorldTransform);
4574
4634
  return temp ? matrix$3 : Object.assign({}, matrix$3);
4575
4635
  },
4636
+ updateScaleFixedWorld(_t) {},
4637
+ updateOuterBounds(_t) {},
4638
+ cacheId(_t) {},
4576
4639
  drop(t, parent, index, resize) {
4577
4640
  t.setTransform(L$4.getRelativeWorld(t, parent, true), resize);
4578
4641
  parent.add(t, index);
@@ -4619,7 +4682,8 @@ var LeaferUI = function(exports) {
4619
4682
  return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
4620
4683
  },
4621
4684
  localRenderBounds(target) {
4622
- return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds;
4685
+ const {__: __, __layout: __layout} = target;
4686
+ return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
4623
4687
  },
4624
4688
  maskLocalBoxBounds(target, index) {
4625
4689
  return checkMask(target, index) && target.__localBoxBounds;
@@ -4628,7 +4692,8 @@ var LeaferUI = function(exports) {
4628
4692
  return checkMask(target, index) && target.__layout.localStrokeBounds;
4629
4693
  },
4630
4694
  maskLocalRenderBounds(target, index) {
4631
- return checkMask(target, index) && target.__layout.localRenderBounds;
4695
+ const {__layout: __layout} = target;
4696
+ return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
4632
4697
  },
4633
4698
  excludeRenderBounds(child, options) {
4634
4699
  if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
@@ -4748,11 +4813,11 @@ var LeaferUI = function(exports) {
4748
4813
  w.height *= scaleY;
4749
4814
  w.scaleX *= scaleX;
4750
4815
  w.scaleY *= scaleY;
4751
- if (branch.isBranch) scale$2(branch, x, y, scaleX, scaleY, a, b);
4816
+ if (branch.isBranch) scale$3(branch, x, y, scaleX, scaleY, a, b);
4752
4817
  }
4753
4818
  }
4754
4819
  };
4755
- const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$2} = BranchHelper;
4820
+ const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$3} = BranchHelper;
4756
4821
  const WaitHelper = {
4757
4822
  run(wait) {
4758
4823
  if (wait && wait.length) {
@@ -5137,7 +5202,6 @@ var LeaferUI = function(exports) {
5137
5202
  }
5138
5203
  opacityChange() {
5139
5204
  this.opacityChanged = true;
5140
- this.surfaceChanged || this.surfaceChange();
5141
5205
  }
5142
5206
  childrenSortChange() {
5143
5207
  if (!this.childrenSortChanged) {
@@ -5552,6 +5616,7 @@ var LeaferUI = function(exports) {
5552
5616
  const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
5553
5617
  multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
5554
5618
  if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
5619
+ if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
5555
5620
  },
5556
5621
  __updateLocalMatrix() {
5557
5622
  if (this.__local) {
@@ -5574,12 +5639,13 @@ var LeaferUI = function(exports) {
5574
5639
  };
5575
5640
  const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafHelper;
5576
5641
  const {updateBounds: updateBounds$2} = BranchHelper;
5577
- const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$3, copy: copy$6} = BoundsHelper;
5642
+ const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$4, copy: copy$6} = BoundsHelper;
5578
5643
  const {toBounds: toBounds$1} = PathBounds;
5579
5644
  const LeafBounds = {
5580
5645
  __updateWorldBounds() {
5581
5646
  const {__layout: __layout, __world: __world} = this;
5582
5647
  toOuterOf$2(__layout.renderBounds, __world, __world);
5648
+ if (this.__hasComplex) LeafHelper.checkComplex(this);
5583
5649
  if (__layout.resized) {
5584
5650
  if (__layout.resized === "inner") this.__onUpdateSize();
5585
5651
  if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
@@ -5629,6 +5695,7 @@ var LeaferUI = function(exports) {
5629
5695
  layout.renderChanged = undefined;
5630
5696
  if (this.parent) this.parent.__layout.renderChange();
5631
5697
  }
5698
+ if (layout.outerScale) LeafHelper.updateOuterBounds(this);
5632
5699
  layout.resized || (layout.resized = "local");
5633
5700
  layout.boundsChanged = undefined;
5634
5701
  },
@@ -5679,11 +5746,11 @@ var LeaferUI = function(exports) {
5679
5746
  },
5680
5747
  __updateStrokeBounds(_bounds) {
5681
5748
  const layout = this.__layout;
5682
- copyAndSpread$3(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5749
+ copyAndSpread$4(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5683
5750
  },
5684
5751
  __updateRenderBounds(_bounds) {
5685
5752
  const layout = this.__layout, {renderSpread: renderSpread} = layout;
5686
- isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$3(layout.renderBounds, layout.boxBounds, renderSpread);
5753
+ isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$4(layout.renderBounds, layout.boxBounds, renderSpread);
5687
5754
  }
5688
5755
  };
5689
5756
  const LeafRender = {
@@ -5694,7 +5761,7 @@ var LeaferUI = function(exports) {
5694
5761
  const data = this.__;
5695
5762
  if (data.bright && !options.topRendering) return options.topList.add(this);
5696
5763
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5697
- canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
5764
+ canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
5698
5765
  if (this.__.__single) {
5699
5766
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
5700
5767
  const tempCanvas = canvas.getSameCanvas(true, true);
@@ -5746,7 +5813,7 @@ var LeaferUI = function(exports) {
5746
5813
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
5747
5814
  const tempCanvas = canvas.getSameCanvas(false, true);
5748
5815
  this.__renderBranch(tempCanvas, options);
5749
- canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
5816
+ canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
5750
5817
  canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
5751
5818
  tempCanvas.recycle(nowWorld);
5752
5819
  } else {
@@ -5758,9 +5825,11 @@ var LeaferUI = function(exports) {
5758
5825
  if (this.__hasMask) {
5759
5826
  this.__renderMask(canvas, options);
5760
5827
  } else {
5828
+ let child;
5761
5829
  const {children: children} = this;
5762
5830
  for (let i = 0, len = children.length; i < len; i++) {
5763
- excludeRenderBounds$1(children[i], options) || children[i].__render(canvas, options);
5831
+ child = children[i];
5832
+ excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
5764
5833
  }
5765
5834
  }
5766
5835
  },
@@ -5773,12 +5842,12 @@ var LeaferUI = function(exports) {
5773
5842
  }
5774
5843
  }
5775
5844
  };
5776
- const tempScaleData$1 = {};
5777
5845
  const {LEAF: LEAF, create: create} = IncrementId;
5778
- const {stintSet: stintSet$4} = DataHelper;
5846
+ const {stintSet: stintSet$6} = DataHelper;
5779
5847
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
5780
5848
  const {toOuterOf: toOuterOf$1} = BoundsHelper;
5781
5849
  const {copy: copy$5, move: move$8} = PointHelper;
5850
+ const {getScaleFixedData: getScaleFixedData$1} = MathHelper;
5782
5851
  const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
5783
5852
  exports.Leaf = class Leaf {
5784
5853
  get tag() {
@@ -5936,6 +6005,7 @@ var LeaferUI = function(exports) {
5936
6005
  this.__level = this.parent ? this.parent.__level + 1 : 1;
5937
6006
  if (this.animation) this.__runAnimation("in");
5938
6007
  if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
6008
+ if (leafer.cacheId) LeafHelper.cacheId(this);
5939
6009
  } else {
5940
6010
  this.__emitLifeEvent(ChildEvent.UNMOUNTED);
5941
6011
  }
@@ -6053,8 +6123,8 @@ var LeaferUI = function(exports) {
6053
6123
  const cameraWorld = this.__cameraWorld, world = this.__world;
6054
6124
  multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
6055
6125
  toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
6056
- stintSet$4(cameraWorld, "half", world.half);
6057
- stintSet$4(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6126
+ stintSet$6(cameraWorld, "half", world.half);
6127
+ stintSet$6(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6058
6128
  return cameraWorld;
6059
6129
  } else {
6060
6130
  return this.__world;
@@ -6065,13 +6135,8 @@ var LeaferUI = function(exports) {
6065
6135
  if (scaleX < 0) scaleX = -scaleX;
6066
6136
  return scaleX > 1 ? scaleX : 1;
6067
6137
  }
6068
- getRenderScaleData(abs, scaleFixed) {
6069
- let {scaleX: scaleX, scaleY: scaleY} = ImageManager.patternLocked ? this.__world : this.__nowWorld;
6070
- if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
6071
- if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
6072
- tempScaleData$1.scaleX = scaleX;
6073
- tempScaleData$1.scaleY = scaleY;
6074
- return tempScaleData$1;
6138
+ getRenderScaleData(abs, scaleFixed, unscale = true) {
6139
+ return getScaleFixedData$1(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
6075
6140
  }
6076
6141
  getTransform(relative) {
6077
6142
  return this.__layout.getTransform(relative || "local");
@@ -6243,7 +6308,7 @@ var LeaferUI = function(exports) {
6243
6308
  __drawPath(_canvas) {}
6244
6309
  __drawRenderPath(_canvas) {}
6245
6310
  __updatePath() {}
6246
- __updateRenderPath() {}
6311
+ __updateRenderPath(_updateCache) {}
6247
6312
  getMotionPathData() {
6248
6313
  return Plugin.need("path");
6249
6314
  }
@@ -6311,9 +6376,11 @@ var LeaferUI = function(exports) {
6311
6376
  return 0;
6312
6377
  }
6313
6378
  __updateRenderSpread() {
6379
+ let layout;
6314
6380
  const {children: children} = this;
6315
6381
  for (let i = 0, len = children.length; i < len; i++) {
6316
- if (children[i].__layout.renderSpread) return 1;
6382
+ layout = children[i].__layout;
6383
+ if (layout.renderSpread || layout.localOuterBounds) return 1;
6317
6384
  }
6318
6385
  return 0;
6319
6386
  }
@@ -6346,6 +6413,7 @@ var LeaferUI = function(exports) {
6346
6413
  this.add(item, index);
6347
6414
  noIndex || index++;
6348
6415
  }); else child = UICreator.get(child.tag, child);
6416
+ if (!child) return;
6349
6417
  }
6350
6418
  if (child.parent) child.parent.remove(child);
6351
6419
  child.parent = this;
@@ -6567,7 +6635,7 @@ var LeaferUI = function(exports) {
6567
6635
  this.levelMap = null;
6568
6636
  }
6569
6637
  }
6570
- const version = "2.0.1";
6638
+ const version = "2.0.3";
6571
6639
  class LeaferCanvas extends LeaferCanvasBase {
6572
6640
  get allowBackgroundColor() {
6573
6641
  return true;
@@ -6589,7 +6657,6 @@ var LeaferUI = function(exports) {
6589
6657
  }
6590
6658
  canvasPatch(OffscreenCanvasRenderingContext2D.prototype);
6591
6659
  canvasPatch(Path2D.prototype);
6592
- const {mineType: mineType} = FileHelper;
6593
6660
  Object.assign(Creator, {
6594
6661
  canvas: (options, manager) => new LeaferCanvas(options, manager),
6595
6662
  image: options => new LeaferImage(options)
@@ -6599,7 +6666,7 @@ var LeaferUI = function(exports) {
6599
6666
  createCanvas: (width, height) => new OffscreenCanvas(width, height),
6600
6667
  canvasToDataURL: (canvas, type, quality) => new Promise((resolve, reject) => {
6601
6668
  canvas.convertToBlob({
6602
- type: mineType(type),
6669
+ type: FileHelper.mimeType(type),
6603
6670
  quality: quality
6604
6671
  }).then(blob => {
6605
6672
  var reader = new FileReader;
@@ -6611,14 +6678,14 @@ var LeaferUI = function(exports) {
6611
6678
  });
6612
6679
  }),
6613
6680
  canvasToBolb: (canvas, type, quality) => canvas.convertToBlob({
6614
- type: mineType(type),
6681
+ type: FileHelper.mimeType(type),
6615
6682
  quality: quality
6616
6683
  }),
6617
6684
  canvasSaveAs: (_canvas, _filename, _quality) => new Promise(resolve => resolve()),
6618
6685
  download(_url, _filename) {
6619
6686
  return undefined;
6620
6687
  },
6621
- loadImage(src) {
6688
+ loadImage(src, _crossOrigin, _leaferImage) {
6622
6689
  return new Promise((resolve, reject) => {
6623
6690
  let req = new XMLHttpRequest;
6624
6691
  req.open("GET", Platform.image.getRealURL(src), true);
@@ -6633,6 +6700,13 @@ var LeaferUI = function(exports) {
6633
6700
  req.onerror = e => reject(e);
6634
6701
  req.send();
6635
6702
  });
6703
+ },
6704
+ loadContent(url_1) {
6705
+ return __awaiter(this, arguments, void 0, function*(url, responseType = "text") {
6706
+ const response = yield fetch(url);
6707
+ if (!response.ok) throw new Error(`${response.status}`);
6708
+ return yield response[responseType]();
6709
+ });
6636
6710
  }
6637
6711
  };
6638
6712
  Platform.canvas = Creator.canvas();
@@ -7111,7 +7185,7 @@ var LeaferUI = function(exports) {
7111
7185
  getCellList() {
7112
7186
  return undefined;
7113
7187
  }
7114
- addBlock(block) {
7188
+ addBlock(block, _leafList) {
7115
7189
  if (!this.updateBlocks) this.updateBlocks = [];
7116
7190
  this.updateBlocks.push(block);
7117
7191
  }
@@ -7159,7 +7233,8 @@ var LeaferUI = function(exports) {
7159
7233
  __onLayoutEnd(event) {
7160
7234
  if (event.data) event.data.map(item => {
7161
7235
  let empty;
7162
- if (item.updatedList) item.updatedList.list.some(leaf => {
7236
+ const {updatedList: updatedList} = item;
7237
+ if (updatedList) updatedList.list.some(leaf => {
7163
7238
  empty = !leaf.__world.width || !leaf.__world.height;
7164
7239
  if (empty) {
7165
7240
  if (!leaf.isLeafer) debug$6.tip(leaf.innerName, ": empty");
@@ -7167,7 +7242,7 @@ var LeaferUI = function(exports) {
7167
7242
  }
7168
7243
  return empty;
7169
7244
  });
7170
- this.addBlock(empty ? this.canvas.bounds : item.updatedBounds);
7245
+ this.addBlock(empty ? this.canvas.bounds : item.updatedBounds, updatedList);
7171
7246
  });
7172
7247
  }
7173
7248
  emitRender(type, bounds, options) {
@@ -7367,7 +7442,7 @@ var LeaferUI = function(exports) {
7367
7442
  this.config = {};
7368
7443
  if (userConfig) this.config = DataHelper.default(userConfig, this.config);
7369
7444
  this.picker = new Picker(this.target = target, this);
7370
- this.finder = Creator.finder && Creator.finder();
7445
+ this.finder = Creator.finder && Creator.finder(target, this.config);
7371
7446
  }
7372
7447
  getByPoint(hitPoint, hitRadius, options) {
7373
7448
  const {target: target, picker: picker} = this;
@@ -7405,7 +7480,9 @@ var LeaferUI = function(exports) {
7405
7480
  set(value) {
7406
7481
  this.__setAttr(key, value);
7407
7482
  if (value) this.__.__useEffect = true;
7408
- this.__layout.renderChanged || this.__layout.renderChange();
7483
+ const layout = this.__layout;
7484
+ layout.renderChanged || layout.renderChange();
7485
+ layout.surfaceChange();
7409
7486
  }
7410
7487
  }));
7411
7488
  }
@@ -7490,7 +7567,7 @@ var LeaferUI = function(exports) {
7490
7567
  }
7491
7568
  };
7492
7569
  const {parse: parse, objectToCanvasData: objectToCanvasData} = PathConvert;
7493
- const {stintSet: stintSet$3} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
7570
+ const {stintSet: stintSet$5} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
7494
7571
  const emptyPaint = {
7495
7572
  originPaint: {}
7496
7573
  };
@@ -7556,7 +7633,7 @@ var LeaferUI = function(exports) {
7556
7633
  setFill(value) {
7557
7634
  if (this.__naturalWidth) this.__removeNaturalSize();
7558
7635
  if (isString(value) || !value) {
7559
- stintSet$3(this, "__isTransparentFill", hasTransparent$2(value));
7636
+ stintSet$5(this, "__isTransparentFill", hasTransparent$2(value));
7560
7637
  this.__isFills && this.__removePaint("fill", true);
7561
7638
  this._fill = value;
7562
7639
  } else if (isObject(value)) {
@@ -7565,7 +7642,7 @@ var LeaferUI = function(exports) {
7565
7642
  }
7566
7643
  setStroke(value) {
7567
7644
  if (isString(value) || !value) {
7568
- stintSet$3(this, "__isTransparentStroke", hasTransparent$2(value));
7645
+ stintSet$5(this, "__isTransparentStroke", hasTransparent$2(value));
7569
7646
  this.__isStrokes && this.__removePaint("stroke", true);
7570
7647
  this._stroke = value;
7571
7648
  } else if (isObject(value)) {
@@ -7598,15 +7675,16 @@ var LeaferUI = function(exports) {
7598
7675
  this.__needComputePaint = undefined;
7599
7676
  }
7600
7677
  __getRealStrokeWidth(childStyle) {
7601
- let {strokeWidth: strokeWidth, strokeWidthFixed: strokeWidthFixed} = this;
7678
+ let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
7602
7679
  if (childStyle) {
7603
7680
  if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
7604
- if (!isUndefined(childStyle.strokeWidthFixed)) strokeWidthFixed = childStyle.strokeWidthFixed;
7681
+ if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
7682
+ }
7683
+ if (strokeScaleFixed) {
7684
+ const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
7685
+ if (scaleX !== 1) return strokeWidth * scaleX;
7605
7686
  }
7606
- if (strokeWidthFixed) {
7607
- const scale = this.__leaf.getClampRenderScale();
7608
- return scale > 1 ? strokeWidth / scale : strokeWidth;
7609
- } else return strokeWidth;
7687
+ return strokeWidth;
7610
7688
  }
7611
7689
  __setPaint(attrName, value) {
7612
7690
  this.__setInput(attrName, value);
@@ -7623,11 +7701,11 @@ var LeaferUI = function(exports) {
7623
7701
  if (removeInput) this.__removeInput(attrName);
7624
7702
  PaintImage.recycleImage(attrName, this);
7625
7703
  if (attrName === "fill") {
7626
- stintSet$3(this, "__isAlphaPixelFill", undefined);
7704
+ stintSet$5(this, "__isAlphaPixelFill", undefined);
7627
7705
  this._fill = this.__isFills = undefined;
7628
7706
  } else {
7629
- stintSet$3(this, "__isAlphaPixelStroke", undefined);
7630
- stintSet$3(this, "__hasMultiStrokeStyle", undefined);
7707
+ stintSet$5(this, "__isAlphaPixelStroke", undefined);
7708
+ stintSet$5(this, "__hasMultiStrokeStyle", undefined);
7631
7709
  this._stroke = this.__isStrokes = undefined;
7632
7710
  }
7633
7711
  }
@@ -7729,13 +7807,16 @@ var LeaferUI = function(exports) {
7729
7807
  }
7730
7808
  }
7731
7809
  class ImageData extends RectData {
7810
+ get __urlType() {
7811
+ return "image";
7812
+ }
7732
7813
  setUrl(value) {
7733
7814
  this.__setImageFill(value);
7734
7815
  this._url = value;
7735
7816
  }
7736
7817
  __setImageFill(value) {
7737
7818
  this.fill = value ? {
7738
- type: "image",
7819
+ type: this.__urlType,
7739
7820
  mode: "stretch",
7740
7821
  url: value
7741
7822
  } : undefined;
@@ -7771,7 +7852,7 @@ var LeaferUI = function(exports) {
7771
7852
  const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
7772
7853
  if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
7773
7854
  boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
7774
- if (!data.__boxStroke) {
7855
+ if (!data.__boxStroke || data.__useArrow) {
7775
7856
  const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
7776
7857
  const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
7777
7858
  spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
@@ -7800,22 +7881,22 @@ var LeaferUI = function(exports) {
7800
7881
  return box ? max$4(box.__updateRenderSpread(), spread) : spread;
7801
7882
  }
7802
7883
  };
7803
- const {stintSet: stintSet$2} = DataHelper;
7884
+ const {stintSet: stintSet$4} = DataHelper;
7804
7885
  const UIRender = {
7805
7886
  __updateChange() {
7806
7887
  const data = this.__;
7807
7888
  if (data.__useStroke) {
7808
7889
  const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
7809
- stintSet$2(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
7810
- stintSet$2(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
7890
+ stintSet$4(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
7891
+ stintSet$4(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
7811
7892
  }
7812
7893
  if (data.__useEffect) {
7813
7894
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7814
- stintSet$2(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
7895
+ stintSet$4(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
7815
7896
  data.__useEffect = !!(shadow || otherEffect);
7816
7897
  }
7817
7898
  data.__checkSingle();
7818
- stintSet$2(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
7899
+ stintSet$4(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
7819
7900
  },
7820
7901
  __drawFast(canvas, options) {
7821
7902
  drawFast(this, canvas, options);
@@ -7922,6 +8003,12 @@ var LeaferUI = function(exports) {
7922
8003
  get isFrame() {
7923
8004
  return false;
7924
8005
  }
8006
+ set strokeWidthFixed(value) {
8007
+ this.strokeScaleFixed = value;
8008
+ }
8009
+ get strokeWidthFixed() {
8010
+ return this.strokeScaleFixed;
8011
+ }
7925
8012
  set scale(value) {
7926
8013
  MathHelper.assignScale(this, value);
7927
8014
  }
@@ -7977,6 +8064,9 @@ var LeaferUI = function(exports) {
7977
8064
  getPathString(curve, pathForRender, floatLength) {
7978
8065
  return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
7979
8066
  }
8067
+ asPath(curve, pathForRender) {
8068
+ this.path = this.getPath(curve, pathForRender);
8069
+ }
7980
8070
  load() {
7981
8071
  this.__.__computePaint();
7982
8072
  }
@@ -7986,16 +8076,18 @@ var LeaferUI = function(exports) {
7986
8076
  data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
7987
8077
  }
7988
8078
  }
7989
- __updateRenderPath() {
8079
+ __updateRenderPath(updateCache) {
7990
8080
  const data = this.__;
7991
8081
  if (data.path) {
7992
8082
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
7993
- if (data.__useArrow) PathArrow.addArrows(this);
8083
+ if (data.__useArrow) PathArrow.addArrows(this, updateCache);
7994
8084
  } else data.__pathForRender && (data.__pathForRender = undefined);
7995
8085
  }
7996
8086
  __drawRenderPath(canvas) {
8087
+ const data = this.__;
7997
8088
  canvas.beginPath();
7998
- this.__drawPathByData(canvas, this.__.__pathForRender);
8089
+ if (data.__useArrow) PathArrow.updateArrow(this);
8090
+ this.__drawPathByData(canvas, data.__pathForRender);
7999
8091
  }
8000
8092
  __drawPath(canvas) {
8001
8093
  canvas.beginPath();
@@ -8044,6 +8136,7 @@ var LeaferUI = function(exports) {
8044
8136
  static setEditOuter(_toolName) {}
8045
8137
  static setEditInner(_editorName) {}
8046
8138
  destroy() {
8139
+ this.__.__willDestroy = true;
8047
8140
  this.fill = this.stroke = null;
8048
8141
  if (this.__animate) this.killAnimate();
8049
8142
  super.destroy();
@@ -8104,7 +8197,7 @@ var LeaferUI = function(exports) {
8104
8197
  __decorate([ strokeType(undefined, true) ], exports.UI.prototype, "stroke", void 0);
8105
8198
  __decorate([ strokeType("inside") ], exports.UI.prototype, "strokeAlign", void 0);
8106
8199
  __decorate([ strokeType(1, true) ], exports.UI.prototype, "strokeWidth", void 0);
8107
- __decorate([ strokeType(false) ], exports.UI.prototype, "strokeWidthFixed", void 0);
8200
+ __decorate([ strokeType(false) ], exports.UI.prototype, "strokeScaleFixed", void 0);
8108
8201
  __decorate([ strokeType("none") ], exports.UI.prototype, "strokeCap", void 0);
8109
8202
  __decorate([ strokeType("miter") ], exports.UI.prototype, "strokeJoin", void 0);
8110
8203
  __decorate([ strokeType() ], exports.UI.prototype, "dashPattern", void 0);
@@ -8151,7 +8244,10 @@ var LeaferUI = function(exports) {
8151
8244
  }
8152
8245
  toJSON(options) {
8153
8246
  const data = super.toJSON(options);
8154
- if (!this.childlessJSON) data.children = this.children.map(child => child.toJSON(options));
8247
+ if (!this.childlessJSON) {
8248
+ const children = data.children = [];
8249
+ this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
8250
+ }
8155
8251
  return data;
8156
8252
  }
8157
8253
  pick(_hitPoint, _options) {
@@ -8293,12 +8389,12 @@ var LeaferUI = function(exports) {
8293
8389
  this.emitLeafer(LeaferEvent.STOP);
8294
8390
  }
8295
8391
  }
8296
- unlockLayout() {
8392
+ unlockLayout(updateLayout = true) {
8297
8393
  this.layouter.start();
8298
- this.updateLayout();
8394
+ if (updateLayout) this.updateLayout();
8299
8395
  }
8300
- lockLayout() {
8301
- this.updateLayout();
8396
+ lockLayout(updateLayout = true) {
8397
+ if (updateLayout) this.updateLayout();
8302
8398
  this.layouter.stop();
8303
8399
  }
8304
8400
  resize(size) {
@@ -8675,9 +8771,9 @@ var LeaferUI = function(exports) {
8675
8771
  return "Ellipse";
8676
8772
  }
8677
8773
  __updatePath() {
8678
- const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
8774
+ const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
8679
8775
  const rx = width / 2, ry = height / 2;
8680
- const path = this.__.path = [];
8776
+ const path = data.path = [];
8681
8777
  let open;
8682
8778
  if (innerRadius) {
8683
8779
  if (startAngle || endAngle) {
@@ -8699,7 +8795,7 @@ var LeaferUI = function(exports) {
8699
8795
  }
8700
8796
  }
8701
8797
  if (!open) closePath$2(path);
8702
- if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
8798
+ if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
8703
8799
  }
8704
8800
  };
8705
8801
  __decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
@@ -8878,7 +8974,7 @@ var LeaferUI = function(exports) {
8878
8974
  __decorate([ dataType(false) ], exports.Canvas.prototype, "safeResize", void 0);
8879
8975
  __decorate([ resizeType() ], exports.Canvas.prototype, "contextSettings", void 0);
8880
8976
  exports.Canvas = __decorate([ registerUI() ], exports.Canvas);
8881
- const {copyAndSpread: copyAndSpread$2, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet$1} = DataHelper;
8977
+ const {copyAndSpread: copyAndSpread$3, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet$3} = DataHelper;
8882
8978
  exports.Text = class Text extends exports.UI {
8883
8979
  get __tag() {
8884
8980
  return "Text";
@@ -8894,9 +8990,9 @@ var LeaferUI = function(exports) {
8894
8990
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
8895
8991
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
8896
8992
  data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
8897
- stintSet$1(data, "__padding", padding && MathHelper.fourNumber(padding));
8898
- stintSet$1(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
8899
- stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
8993
+ stintSet$3(data, "__padding", padding && MathHelper.fourNumber(padding));
8994
+ stintSet$3(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
8995
+ stintSet$3(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
8900
8996
  data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
8901
8997
  }
8902
8998
  __updateBoxBounds() {
@@ -8931,7 +9027,7 @@ var LeaferUI = function(exports) {
8931
9027
  }
8932
9028
  __updateRenderBounds() {
8933
9029
  const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
8934
- copyAndSpread$2(renderBounds, this.__.__textBoxBounds, renderSpread);
9030
+ copyAndSpread$3(renderBounds, this.__.__textBoxBounds, renderSpread);
8935
9031
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
8936
9032
  }
8937
9033
  __updateChange() {
@@ -9155,7 +9251,7 @@ var LeaferUI = function(exports) {
9155
9251
  if (this.viewReady) this.renderer.update();
9156
9252
  }
9157
9253
  __render(canvas, options) {
9158
- if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
9254
+ if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds, undefined, undefined, true));
9159
9255
  }
9160
9256
  __onResize(event) {
9161
9257
  this.forEach(leafer => leafer.resize(event));
@@ -9877,6 +9973,7 @@ var LeaferUI = function(exports) {
9877
9973
  this.checkPath(data, useDefaultPath);
9878
9974
  this.downTime = Date.now();
9879
9975
  this.emit(exports.PointerEvent.BEFORE_DOWN, data);
9976
+ if (data.path.needUpdate) this.updateDownData(data);
9880
9977
  this.emit(exports.PointerEvent.DOWN, data);
9881
9978
  if (PointerButton.left(data)) {
9882
9979
  this.tapWait();
@@ -10470,8 +10567,8 @@ var LeaferUI = function(exports) {
10470
10567
  canvas.save();
10471
10568
  if (item.transform) canvas.transform(item.transform);
10472
10569
  if (originPaint.scaleFixed) {
10473
- const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
10474
- if (originPaint.scaleFixed === true || originPaint.scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) canvas.scale(1 / scaleX, 1 / scaleY);
10570
+ const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, originPaint.scaleFixed, false);
10571
+ if (scaleX !== 1) canvas.scale(scaleX, scaleY);
10475
10572
  }
10476
10573
  if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
10477
10574
  fillPathOrText(ui, canvas, renderOptions);
@@ -10629,13 +10726,13 @@ var LeaferUI = function(exports) {
10629
10726
  }
10630
10727
  }
10631
10728
  }
10632
- const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
10729
+ const {getSpread: getSpread, copyAndSpread: copyAndSpread$2, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
10633
10730
  const tempBounds$2 = {};
10634
10731
  function shape(ui, current, options) {
10635
10732
  const canvas = current.getSameCanvas();
10636
10733
  const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
10637
10734
  const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
10638
- toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$2, layout.boxBounds, layout.strokeSpread),
10735
+ toOuterOf(layout.strokeSpread ? (copyAndSpread$2(tempBounds$2, layout.boxBounds, layout.strokeSpread),
10639
10736
  tempBounds$2) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
10640
10737
  let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
10641
10738
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
@@ -10689,7 +10786,7 @@ var LeaferUI = function(exports) {
10689
10786
  };
10690
10787
  }
10691
10788
  let recycleMap;
10692
- const {stintSet: stintSet} = DataHelper, {hasTransparent: hasTransparent$1} = ColorConvert;
10789
+ const {stintSet: stintSet$2} = DataHelper, {hasTransparent: hasTransparent$1} = ColorConvert;
10693
10790
  function compute(attrName, ui) {
10694
10791
  const data = ui.__, leafPaints = [];
10695
10792
  let paints = data.__input[attrName], isAlphaPixel, isTransparent;
@@ -10712,12 +10809,12 @@ var LeaferUI = function(exports) {
10712
10809
  isTransparent = true;
10713
10810
  }
10714
10811
  if (attrName === "fill") {
10715
- stintSet(data, "__isAlphaPixelFill", isAlphaPixel);
10716
- stintSet(data, "__isTransparentFill", isTransparent);
10812
+ stintSet$2(data, "__isAlphaPixelFill", isAlphaPixel);
10813
+ stintSet$2(data, "__isTransparentFill", isTransparent);
10717
10814
  } else {
10718
- stintSet(data, "__isAlphaPixelStroke", isAlphaPixel);
10719
- stintSet(data, "__isTransparentStroke", isTransparent);
10720
- stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
10815
+ stintSet$2(data, "__isAlphaPixelStroke", isAlphaPixel);
10816
+ stintSet$2(data, "__isTransparentStroke", isTransparent);
10817
+ stintSet$2(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
10721
10818
  }
10722
10819
  } else {
10723
10820
  data.__removePaint(attrName, false);
@@ -10726,11 +10823,14 @@ var LeaferUI = function(exports) {
10726
10823
  function getLeafPaint(attrName, paint, ui) {
10727
10824
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
10728
10825
  let leafPaint;
10729
- const {boxBounds: boxBounds} = ui.__layout;
10730
- switch (paint.type) {
10826
+ const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
10827
+ switch (type) {
10731
10828
  case "image":
10829
+ case "film":
10830
+ case "video":
10732
10831
  if (!paint.url) return undefined;
10733
10832
  leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
10833
+ if (type !== "image") PaintImage[type](leafPaint);
10734
10834
  break;
10735
10835
 
10736
10836
  case "linear":
@@ -10746,7 +10846,7 @@ var LeaferUI = function(exports) {
10746
10846
  break;
10747
10847
 
10748
10848
  case "solid":
10749
- const {type: type, color: color, opacity: opacity} = paint;
10849
+ const {color: color, opacity: opacity} = paint;
10750
10850
  leafPaint = {
10751
10851
  type: type,
10752
10852
  style: ColorConvert.string(color, opacity)
@@ -10783,11 +10883,11 @@ var LeaferUI = function(exports) {
10783
10883
  shape: shape
10784
10884
  };
10785
10885
  let cache$1, box$2 = new Bounds;
10786
- const {isSame: isSame} = BoundsHelper;
10886
+ const {isSame: isSame$1} = BoundsHelper;
10787
10887
  function image(ui, attrName, paint, boxBounds, firstUse) {
10788
10888
  let leafPaint, event;
10789
- const image = ImageManager.get(paint);
10790
- if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
10889
+ const image = ImageManager.get(paint, paint.type);
10890
+ if (cache$1 && paint === cache$1.paint && isSame$1(boxBounds, cache$1.boxBounds)) {
10791
10891
  leafPaint = cache$1.leafPaint;
10792
10892
  } else {
10793
10893
  leafPaint = {
@@ -10846,8 +10946,8 @@ var LeaferUI = function(exports) {
10846
10946
  return leafPaint;
10847
10947
  }
10848
10948
  function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
10849
- if (attrName === "fill" && !ui.__.__naturalWidth) {
10850
- const data = ui.__;
10949
+ const data = ui.__;
10950
+ if (attrName === "fill" && !data.__naturalWidth) {
10851
10951
  data.__naturalWidth = image.width / data.pixelRatio;
10852
10952
  data.__naturalHeight = image.height / data.pixelRatio;
10853
10953
  if (data.__autoSide) {
@@ -10859,7 +10959,13 @@ var LeaferUI = function(exports) {
10859
10959
  return false;
10860
10960
  }
10861
10961
  }
10862
- if (!leafPaint.data) PaintImage.createData(leafPaint, image, paint, boxBounds);
10962
+ if (!leafPaint.data) {
10963
+ PaintImage.createData(leafPaint, image, paint, boxBounds);
10964
+ const {transform: transform} = leafPaint.data, {opacity: opacity, blendMode: blendMode} = paint;
10965
+ const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
10966
+ if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
10967
+ }
10968
+ if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
10863
10969
  return true;
10864
10970
  }
10865
10971
  function onLoad(ui, event) {
@@ -10891,7 +10997,7 @@ var LeaferUI = function(exports) {
10891
10997
  if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
10892
10998
  if (paint.mode === "strench") paint.mode = "stretch";
10893
10999
  const {width: width, height: height} = image;
10894
- 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;
11000
+ const {mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, interlace: interlace} = paint;
10895
11001
  const sameBox = box.width === width && box.height === height;
10896
11002
  const data = {
10897
11003
  mode: mode
@@ -10954,8 +11060,6 @@ var LeaferUI = function(exports) {
10954
11060
  data.scaleX = scaleX;
10955
11061
  data.scaleY = scaleY;
10956
11062
  }
10957
- if (opacity && opacity < 1) data.opacity = opacity;
10958
- if (filters) data.filters = filters;
10959
11063
  if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
10960
11064
  if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
10961
11065
  type: "x",
@@ -10981,7 +11085,7 @@ var LeaferUI = function(exports) {
10981
11085
  const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
10982
11086
  function stretchMode(data, box, scaleX, scaleY) {
10983
11087
  const transform = get$2(), {x: x, y: y} = box;
10984
- if (x || y) translate(transform, x, y); else transform.onlyScale = true;
11088
+ if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
10985
11089
  scaleHelper(transform, scaleX, scaleY);
10986
11090
  data.transform = transform;
10987
11091
  }
@@ -11048,7 +11152,7 @@ var LeaferUI = function(exports) {
11048
11152
  if (scaleX) scaleHelper(transform, scaleX, scaleY);
11049
11153
  translate(transform, box.x + x, box.y + y);
11050
11154
  }
11051
- const {get: get$1, scale: scale$1, copy: copy$4} = MatrixHelper;
11155
+ const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
11052
11156
  const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
11053
11157
  function createPatternTask(paint, ui, canvas, renderOptions) {
11054
11158
  if (!paint.patternTask) {
@@ -11062,10 +11166,10 @@ var LeaferUI = function(exports) {
11062
11166
  }
11063
11167
  }
11064
11168
  function createPattern(paint, ui, canvas, renderOptions) {
11065
- let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
11169
+ let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
11066
11170
  if (paint.patternId !== id && !ui.destroyed) {
11067
11171
  if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
11068
- const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11172
+ const {image: image, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11069
11173
  let imageMatrix, xGap, yGap, {width: width, height: height} = image;
11070
11174
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
11071
11175
  width *= scaleX;
@@ -11079,9 +11183,9 @@ var LeaferUI = function(exports) {
11079
11183
  scaleY *= getFloorScale(height + (yGap || 0));
11080
11184
  imageMatrix = get$1();
11081
11185
  if (transform) copy$4(imageMatrix, transform);
11082
- scale$1(imageMatrix, 1 / scaleX, 1 / scaleY);
11186
+ scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
11083
11187
  }
11084
- const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
11188
+ const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
11085
11189
  const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
11086
11190
  paint.style = pattern;
11087
11191
  paint.patternId = id;
@@ -11100,15 +11204,15 @@ var LeaferUI = function(exports) {
11100
11204
  return fixScale;
11101
11205
  }
11102
11206
  function checkImage(paint, drawImage, ui, canvas, renderOptions) {
11103
- const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
11207
+ const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
11104
11208
  const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
11105
- if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting || snapshot) {
11209
+ if (!data || paint.patternId === id && !exporting || snapshot) {
11106
11210
  return false;
11107
11211
  } else {
11108
11212
  if (drawImage) {
11109
11213
  if (data.repeat) {
11110
11214
  drawImage = false;
11111
- } else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
11215
+ } else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
11112
11216
  drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
11113
11217
  }
11114
11218
  }
@@ -11125,20 +11229,21 @@ var LeaferUI = function(exports) {
11125
11229
  }
11126
11230
  }
11127
11231
  }
11128
- function drawImage(paint, _imageScaleX, _imageScaleY, ui, canvas, _renderOptions) {
11129
- const {data: data, image: image} = paint, {blendMode: blendMode} = paint.originPaint, {opacity: opacity, transform: transform} = data, view = image.getFull(data.filters), u = ui.__;
11130
- let {width: width, height: height} = image, clipUI;
11131
- if ((clipUI = transform && !transform.onlyScale || u.path || u.cornerRadius) || opacity || blendMode) {
11232
+ function drawImage(paint, imageScaleX, imageScaleY, ui, canvas, _renderOptions) {
11233
+ const {data: data, image: image, complex: complex} = paint;
11234
+ let {width: width, height: height} = image;
11235
+ if (complex) {
11236
+ const {blendMode: blendMode, opacity: opacity} = paint.originPaint, {transform: transform} = data;
11132
11237
  canvas.save();
11133
- clipUI && canvas.clipUI(ui);
11238
+ complex === 2 && canvas.clipUI(ui);
11134
11239
  blendMode && (canvas.blendMode = blendMode);
11135
11240
  opacity && (canvas.opacity *= opacity);
11136
11241
  transform && canvas.transform(transform);
11137
- canvas.drawImage(view, 0, 0, width, height);
11242
+ image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
11138
11243
  canvas.restore();
11139
11244
  } else {
11140
11245
  if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
11141
- canvas.drawImage(view, 0, 0, width, height);
11246
+ image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
11142
11247
  }
11143
11248
  }
11144
11249
  function getImageRenderScaleData(paint, ui, canvas, _renderOptions) {
@@ -11166,6 +11271,7 @@ var LeaferUI = function(exports) {
11166
11271
  if (!recycleMap) recycleMap = {};
11167
11272
  recycleMap[url] = true;
11168
11273
  ImageManager.recyclePaint(paint);
11274
+ if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf);
11169
11275
  if (image.loading) {
11170
11276
  if (!input) {
11171
11277
  input = data.__input && data.__input[attrName] || [];
@@ -12021,8 +12127,11 @@ var LeaferUI = function(exports) {
12021
12127
  });
12022
12128
  if (isObject(check)) value = check; else if (check === false) return;
12023
12129
  }
12024
- t.setDimOthers(false);
12025
- t.setBright(false);
12130
+ const {dimOthers: dimOthers, bright: bright} = t.editBox.mergedConfig || t.config;
12131
+ if (!isUndefined(dimOthers) || !isUndefined(bright)) {
12132
+ t.setDimOthers(false);
12133
+ t.setBright(false);
12134
+ }
12026
12135
  if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
12027
12136
  if (t.single) {
12028
12137
  delete t.element.syncEventer;
@@ -12046,7 +12155,8 @@ var LeaferUI = function(exports) {
12046
12155
  return (target, key) => {
12047
12156
  defineKey(target, key, {
12048
12157
  get() {
12049
- const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
12158
+ const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, editTool: editTool, innerEditor: innerEditor, app: app} = this, mergeConfig = Object.assign({}, config);
12159
+ if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig); else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig);
12050
12160
  if (element && element.editConfig) {
12051
12161
  let {editConfig: editConfig} = element;
12052
12162
  if (editConfig.hover || editConfig.hoverStyle) {
@@ -12297,6 +12407,7 @@ var LeaferUI = function(exports) {
12297
12407
  } else {
12298
12408
  editor.target = find;
12299
12409
  }
12410
+ e.path.needUpdate = true;
12300
12411
  } else if (this.allow(e.target)) {
12301
12412
  if (!this.isHoldMultipleSelectKey(e) && !this.editor.mergedConfig.selectKeep) editor.target = null;
12302
12413
  }
@@ -12923,8 +13034,10 @@ var LeaferUI = function(exports) {
12923
13034
  const {editMask: editMask} = editor;
12924
13035
  const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
12925
13036
  editMask.visible = mask ? true : 0;
12926
- editor.setDimOthers(dimOthers);
12927
- editor.setBright(!!dimOthers || bright);
13037
+ if (!isUndefined(dimOthers) || !isUndefined(bright)) {
13038
+ editor.setDimOthers(dimOthers);
13039
+ editor.setBright(!!dimOthers || bright);
13040
+ }
12928
13041
  if (spread) BoundsHelper.spread(bounds, spread);
12929
13042
  if (this.view.worldOpacity) {
12930
13043
  const {width: width, height: height} = bounds;
@@ -12943,7 +13056,8 @@ var LeaferUI = function(exports) {
12943
13056
  resizeL = resizeLines[(i - 1) / 2];
12944
13057
  resizeL.set(point);
12945
13058
  resizeL.visible = resizeP.visible && !hideResizeLines;
12946
- resizeP.visible = rotateP.visible = showPoints && !!middlePoint;
13059
+ if (resizeP.visible) resizeP.visible = !!middlePoint;
13060
+ if (rotateP.visible) rotateP.visible = !!middlePoint;
12947
13061
  if ((i + 1) / 2 % 2) {
12948
13062
  resizeL.width = width + resizeL.height;
12949
13063
  if (hideOnSmall && resizeP.width * 2 > width) resizeP.visible = false;
@@ -13469,6 +13583,7 @@ var LeaferUI = function(exports) {
13469
13583
  this.checkChange = true;
13470
13584
  this.canChange = true;
13471
13585
  this.visible = this.hittable = false;
13586
+ this.skipJSON = true;
13472
13587
  this.on(PropertyEvent.CHANGE, event => {
13473
13588
  if (this.checkChange && checkMap[event.attrName]) {
13474
13589
  const {attrName: attrName, newValue: newValue, oldValue: oldValue} = event;
@@ -14644,6 +14759,8 @@ var LeaferUI = function(exports) {
14644
14759
  break;
14645
14760
 
14646
14761
  case "image":
14762
+ case "film":
14763
+ case "video":
14647
14764
  break;
14648
14765
 
14649
14766
  case "linear":
@@ -14857,9 +14974,14 @@ var LeaferUI = function(exports) {
14857
14974
  }), leafer.on_(exports.MoveEvent.END, e => {
14858
14975
  LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
14859
14976
  }), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, e => {
14860
- const {zoomLayer: zoomLayer} = leafer;
14977
+ const {zoomLayer: zoomLayer, layouter: layouter} = leafer;
14861
14978
  const changeScale = leafer.getValidScale(e.scale);
14862
- if (changeScale !== 1) zoomLayer.scaleOfWorld(e, changeScale);
14979
+ if (changeScale !== 1) {
14980
+ layouter.stop();
14981
+ LeafHelper.updateMatrix(leafer);
14982
+ zoomLayer.scaleOfWorld(e, changeScale);
14983
+ layouter.start();
14984
+ }
14863
14985
  }));
14864
14986
  }
14865
14987
  function addViewportConfig(leafer, mergeConfig) {
@@ -15720,7 +15842,7 @@ var LeaferUI = function(exports) {
15720
15842
  __decorate([ arrowType("angle") ], exports.Arrow.prototype, "endArrow", void 0);
15721
15843
  exports.Arrow = __decorate([ registerUI() ], exports.Arrow);
15722
15844
  const {M: M$2, L: L$2, C: C$2, Q: Q$1, O: O$1} = PathCommandMap;
15723
- const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale} = PointHelper;
15845
+ const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale$1} = PointHelper;
15724
15846
  const point$1 = {};
15725
15847
  const PathMatrixHelper = {
15726
15848
  layout(data, x, y, scaleX, scaleY, rotation, origin) {
@@ -15764,17 +15886,19 @@ var LeaferUI = function(exports) {
15764
15886
  function setPoint$2(data, startIndex, x, y, scaleX, scaleY, rotation, origin) {
15765
15887
  copyFrom$1(point$1, data[startIndex], data[startIndex + 1]);
15766
15888
  if (rotation) rotate$1(point$1, rotation, origin);
15767
- if (scaleX) scale(point$1, scaleX, scaleY);
15889
+ if (scaleX) scale$1(point$1, scaleX, scaleY);
15768
15890
  data[startIndex] = x + point$1.x;
15769
15891
  data[startIndex + 1] = y + point$1.y;
15770
15892
  }
15771
15893
  const {layout: layout$2, rotate: rotate} = PathMatrixHelper;
15772
15894
  const {getAngle: getAngle} = PointHelper;
15773
- const half = {
15895
+ const zero = {
15896
+ x: 0
15897
+ }, half = {
15774
15898
  x: -.5
15775
15899
  };
15776
15900
  const angle = {
15777
- connect: half,
15901
+ connect: zero,
15778
15902
  offset: {
15779
15903
  x: -.71,
15780
15904
  bevelJoin: .36,
@@ -15792,61 +15916,83 @@ var LeaferUI = function(exports) {
15792
15916
  path: [ 1, -3, -3, 2, 0, 0, 2, -1, 0 ]
15793
15917
  };
15794
15918
  const triangleLinePath = [ 1, -3, 0, 2, -3, -2, 2, 0, 0, 2, -3, 2, 2, -3, 0 ];
15795
- const triangle = {
15796
- connect: half,
15919
+ const triangleFill = {
15920
+ connect: zero,
15797
15921
  offset: {
15798
15922
  x: -.9,
15799
15923
  bevelJoin: .624,
15800
15924
  roundJoin: .4
15801
15925
  },
15802
- path: [ ...triangleLinePath, 1, -2.05, 1.1, 2, -2.05, -1.1 ],
15803
- dashPath: [ 1, -2, 0, 2, -.5, 0 ]
15926
+ path: [ ...triangleLinePath ]
15804
15927
  };
15805
- const arrowLinePath = [ 1, -3, 0, 2, -3.5, -1.8, 2, 0, 0, 2, -3.5, 1.8, 2, -3, 0 ];
15806
- const arrow = {
15807
- connect: half,
15808
- offset: {
15809
- x: -1.1,
15810
- bevelJoin: .872,
15811
- roundJoin: .6
15812
- },
15813
- path: [ ...arrowLinePath, 1, -2.25, .95, 2, -2.25, -.95 ],
15814
- dashPath: [ 1, -3, 0, 2, -.5, 0 ]
15928
+ const triangle = DataHelper.clone(triangleFill);
15929
+ triangle.path = [ ...triangleLinePath, 1, -2.05, 1.1, 2, -2.05, -1.1 ];
15930
+ triangle.dashPath = [ 1, -2, 0, 2, -.5, 0 ];
15931
+ const triangleFlipFill = {
15932
+ connect: zero,
15933
+ offset: half,
15934
+ path: [ ...triangleFill.path ]
15815
15935
  };
15816
15936
  const triangleFlip = {
15937
+ connect: zero,
15817
15938
  offset: half,
15818
15939
  path: [ ...triangle.path ],
15819
15940
  dashPath: [ 1, -2.5, 0, 2, -1, 0 ]
15820
15941
  };
15942
+ rotate(triangleFlipFill.path, 180, {
15943
+ x: -1.5,
15944
+ y: 0
15945
+ });
15821
15946
  rotate(triangleFlip.path, 180, {
15822
15947
  x: -1.5,
15823
15948
  y: 0
15824
15949
  });
15950
+ const arrowLinePath = [ 1, -3, 0, 2, -3.5, -1.8, 2, 0, 0, 2, -3.5, 1.8, 2, -3, 0 ];
15951
+ const arrowFill = {
15952
+ connect: zero,
15953
+ offset: {
15954
+ x: -1.1,
15955
+ bevelJoin: .872,
15956
+ roundJoin: .6
15957
+ },
15958
+ path: [ ...arrowLinePath ]
15959
+ };
15960
+ const arrow = DataHelper.clone(arrowFill);
15961
+ arrow.path = [ ...arrowLinePath, 1, -2.25, .95, 2, -2.25, -.95 ];
15962
+ arrow.dashPath = [ 1, -3, 0, 2, -.5, 0 ];
15825
15963
  const circleLine = {
15826
15964
  connect: {
15827
- x: -1.3
15965
+ x: -1.8
15828
15966
  },
15829
15967
  path: [ 1, 1.8, -.1, 2, 1.8, 0, 26, 0, 0, 1.8, 0, 359, 0 ]
15830
15968
  };
15831
- const circle = {
15969
+ const circleFill = {
15832
15970
  connect: {
15833
15971
  x: .5
15834
15972
  },
15835
- path: [ ...circleLine.path, 1, 0, 0, 26, 0, 0, 1, 0, 360, 0 ],
15836
- dashPath: [ 1, -.5, 0, 2, .5, 0 ]
15973
+ path: [ ...circleLine.path ]
15837
15974
  };
15975
+ const circle = DataHelper.clone(circleFill);
15976
+ circle.path = [ ...circleLine.path, 1, 0, 0, 26, 0, 0, 1, 0, 360, 0 ];
15977
+ circle.dashPath = [ 1, -.5, 0, 2, .5, 0 ];
15838
15978
  const squareLine = {
15839
15979
  connect: {
15840
- x: -1.3
15980
+ x: -1.4
15841
15981
  },
15842
15982
  path: [ 1, -1.4, 0, 2, -1.4, -1.4, 2, 1.4, -1.4, 2, 1.4, 1.4, 2, -1.4, 1.4, 2, -1.4, 0 ]
15843
15983
  };
15984
+ const squareFill = {
15985
+ path: [ ...squareLine.path ]
15986
+ };
15844
15987
  const square = {
15845
15988
  path: [ ...squareLine.path, 2, -1.4, -.49, 2, 1, -.49, 1, -1.4, .49, 2, 1, .49 ]
15846
15989
  };
15847
15990
  const diamondLine = DataHelper.clone(squareLine);
15991
+ diamondLine.connect.x = -1.9;
15992
+ const diamondFill = DataHelper.clone(squareFill);
15848
15993
  const diamond = DataHelper.clone(square);
15849
15994
  rotate(diamondLine.path, 45);
15995
+ rotate(diamondFill.path, 45);
15850
15996
  rotate(diamond.path, 45);
15851
15997
  const mark = {
15852
15998
  offset: half,
@@ -15866,19 +16012,33 @@ var LeaferUI = function(exports) {
15866
16012
  "diamond-line": diamondLine,
15867
16013
  mark: mark
15868
16014
  };
16015
+ const fillArrows = {
16016
+ triangle: triangleFill,
16017
+ "triangle-flip": triangleFlipFill,
16018
+ arrow: arrowFill,
16019
+ circle: circleFill,
16020
+ square: squareFill,
16021
+ diamond: diamondFill
16022
+ };
15869
16023
  function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern) {
15870
- let pathData, scale;
16024
+ let pathData, scale = 1, rotation = 0, fill;
15871
16025
  const {strokeCap: strokeCap, strokeJoin: strokeJoin} = ui.__;
15872
16026
  if (isObject(arrow)) {
15873
16027
  if (arrow.type) {
15874
- scale = arrow.scale;
16028
+ scale = arrow.scale || 1;
16029
+ rotation = arrow.rotation || 0;
15875
16030
  pathData = arrows[arrow.type];
16031
+ if (scale > 1) {
16032
+ const fillData = fillArrows[arrow.type];
16033
+ if (fillData) pathData = fillData, fill = true;
16034
+ }
15876
16035
  } else pathData = arrow;
15877
16036
  } else {
15878
16037
  pathData = arrows[arrow];
15879
16038
  }
16039
+ if (!fill) fill = pathData.fill;
15880
16040
  const {offset: offset, connect: connect, path: path, dashPath: dashPath} = pathData;
15881
- let connectX = connect ? connect.x : 0;
16041
+ let connectX = connect ? connect.x * scale : 0;
15882
16042
  let offsetX = offset ? offset.x : 0;
15883
16043
  const data = [ ...path ];
15884
16044
  if (hasDashPattern && dashPath) data.push(...dashPath);
@@ -15886,22 +16046,31 @@ var LeaferUI = function(exports) {
15886
16046
  if (offset) {
15887
16047
  if (strokeJoin === "round" && offset.roundJoin) offsetX += offset.roundJoin; else if (strokeJoin === "bevel" && offset.bevelJoin) offsetX += offset.bevelJoin;
15888
16048
  }
15889
- if (scale) layout$2(data, 0, 0, scale, scale);
16049
+ if (scale !== 1) layout$2(data, 0, 0, scale, scale);
15890
16050
  if (offsetX) layout$2(data, offsetX, 0);
15891
- layout$2(data, to.x, to.y, size, size, getAngle(from, to));
16051
+ layout$2(data, to.x, to.y, size, size, getAngle(from, to) + rotation);
15892
16052
  connectOffset.x = (connectX + offsetX) * size;
15893
- return data;
16053
+ const arrowData = {
16054
+ data: data
16055
+ };
16056
+ if (fill) arrowData.fill = fill;
16057
+ return arrowData;
15894
16058
  }
15895
16059
  const {M: M$1, L: L$1, C: C$1, Q: Q, Z: Z$1, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = PathCommandMap;
15896
- const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint} = PointHelper;
16060
+ const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
16061
+ const {stintSet: stintSet$1} = DataHelper;
15897
16062
  const connectPoint = {};
15898
16063
  const first = {}, second = {};
15899
- const last = {}, now = {};
16064
+ const old = {}, last = {}, now = {};
15900
16065
  const PathArrowModule = {
15901
16066
  list: arrows,
15902
- addArrows(ui) {
15903
- const {startArrow: startArrow, endArrow: endArrow, strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data, cornerRadius: cornerRadius} = ui.__;
16067
+ fillList: fillArrows,
16068
+ addArrows(ui, updateCache) {
16069
+ const uData = ui.__;
16070
+ const {startArrow: startArrow, endArrow: endArrow, __strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data, cornerRadius: cornerRadius} = uData;
15904
16071
  const clonePathForArrow = !cornerRadius;
16072
+ if (!updateCache) uData.__strokeWidthCache = strokeWidth;
16073
+ let startArrowPath, singleStartArrow, endArrowPath, singleEndArrow;
15905
16074
  let command, i = 0, len = data.length, count = 0, useStartArrow = startArrow && startArrow !== "none";
15906
16075
  while (i < len) {
15907
16076
  command = data[i];
@@ -15909,6 +16078,7 @@ var LeaferUI = function(exports) {
15909
16078
  case M$1:
15910
16079
  case L$1:
15911
16080
  if (count < 2 || i + 6 >= len) {
16081
+ copy(old, now);
15912
16082
  copyFrom(now, data[i + 1], data[i + 2]);
15913
16083
  if (!count && useStartArrow) copy(first, now);
15914
16084
  }
@@ -15916,12 +16086,18 @@ var LeaferUI = function(exports) {
15916
16086
  break;
15917
16087
 
15918
16088
  case C$1:
15919
- if (count === 1 || i + 7 >= len - 3) copyPoints(data, last, now, i + 3);
16089
+ if (count === 1 || i + 7 >= len - 3) {
16090
+ copyPoints(data, last, now, i + 3);
16091
+ old.x = data[i + 1], old.y = data[i + 2];
16092
+ }
15920
16093
  i += 7;
15921
16094
  break;
15922
16095
 
15923
16096
  case Q:
15924
- if (count === 1 || i + 5 >= len - 3) copyPoints(data, last, now, i + 1);
16097
+ if (count === 1 || i + 5 >= len - 3) {
16098
+ copyPoints(data, last, now, i + 1);
16099
+ copy(old, last);
16100
+ }
15925
16101
  i += 5;
15926
16102
  break;
15927
16103
 
@@ -15959,6 +16135,7 @@ var LeaferUI = function(exports) {
15959
16135
  case U:
15960
16136
  if (count === 1 || i + 6 >= len - 3) {
15961
16137
  copyPoints(data, last, now, i + 1);
16138
+ copy(old, last);
15962
16139
  if (i + 6 !== len) {
15963
16140
  now.x -= (now.x - last.x) / 10;
15964
16141
  now.y -= (now.y - last.y) / 10;
@@ -15969,13 +16146,13 @@ var LeaferUI = function(exports) {
15969
16146
  }
15970
16147
  count++;
15971
16148
  if (count === 1 && command !== M$1) return;
15972
- if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : last);
16149
+ if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : isSame(old, first) ? last : old);
15973
16150
  if (i === len) {
15974
- const path = ui.__.__pathForRender = clonePathForArrow ? [ ...data ] : data;
15975
- const pathForArrow = ui.__.__pathForArrow = [];
16151
+ const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
15976
16152
  if (useStartArrow) {
15977
- const startArrowPath = getArrowPath(ui, startArrow, second, first, strokeWidth, connectPoint, !!dashPattern);
15978
- dashPattern ? pathForArrow.push(...startArrowPath) : path.push(...startArrowPath);
16153
+ startArrowPath = getArrowPath(ui, startArrow, second, first, strokeWidth, connectPoint, !!dashPattern);
16154
+ singleStartArrow = startArrowPath.fill || dashPattern;
16155
+ if (!singleStartArrow) path.push(...startArrowPath.data);
15979
16156
  if (connectPoint.x) {
15980
16157
  getDistancePoint(first, second, -connectPoint.x, true);
15981
16158
  path[1] = second.x;
@@ -15983,8 +16160,10 @@ var LeaferUI = function(exports) {
15983
16160
  }
15984
16161
  }
15985
16162
  if (endArrow && endArrow !== "none") {
15986
- const endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
15987
- dashPattern ? pathForArrow.push(...endArrowPath) : path.push(...endArrowPath);
16163
+ if (isSame(last, now)) copy(last, old);
16164
+ endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
16165
+ singleEndArrow = endArrowPath.fill || dashPattern;
16166
+ if (!singleEndArrow) path.push(...endArrowPath.data);
15988
16167
  if (connectPoint.x) {
15989
16168
  getDistancePoint(now, last, -connectPoint.x, true);
15990
16169
  let index;
@@ -16011,10 +16190,21 @@ var LeaferUI = function(exports) {
16011
16190
  } else {
16012
16191
  copy(last, now);
16013
16192
  }
16193
+ stintSet$1(uData, "__startArrowPath", singleStartArrow && startArrowPath);
16194
+ stintSet$1(uData, "__endArrowPath", singleEndArrow && endArrowPath);
16195
+ }
16196
+ },
16197
+ updateArrow(ui) {
16198
+ const data = ui.__;
16199
+ if (data.strokeScaleFixed) {
16200
+ if (data.__strokeWidthCache !== data.__strokeWidth) {
16201
+ ui.__updateRenderPath(true);
16202
+ }
16014
16203
  }
16015
16204
  },
16016
- register(name, data) {
16205
+ register(name, data, fillData) {
16017
16206
  this.list[name] = data;
16207
+ if (fillData) this.fillList[name] = data;
16018
16208
  },
16019
16209
  get(name) {
16020
16210
  return this.list[name];
@@ -16033,12 +16223,26 @@ var LeaferUI = function(exports) {
16033
16223
  exports.UI.addAttr("endArrow", "none", arrowType);
16034
16224
  Object.assign(PathArrow, PathArrowModule);
16035
16225
  Object.assign(Paint, {
16036
- strokeArrow(_stroke, ui, canvas, _renderOptions) {
16037
- if (ui.__.dashPattern) {
16226
+ strokeArrow(stroke, ui, canvas, _renderOptions) {
16227
+ const {__startArrowPath: __startArrowPath, __endArrowPath: __endArrowPath, dashPattern: dashPattern} = ui.__;
16228
+ if (dashPattern) canvas.dashPattern = null;
16229
+ if (__startArrowPath) {
16230
+ canvas.beginPath();
16231
+ ui.__drawPathByData(canvas, __startArrowPath.data);
16232
+ canvas.stroke();
16233
+ if (__startArrowPath.fill) {
16234
+ canvas.fillStyle = stroke;
16235
+ canvas.fill();
16236
+ }
16237
+ }
16238
+ if (__endArrowPath) {
16038
16239
  canvas.beginPath();
16039
- ui.__drawPathByData(canvas, ui.__.__pathForArrow);
16040
- canvas.dashPattern = null;
16240
+ ui.__drawPathByData(canvas, __endArrowPath.data);
16041
16241
  canvas.stroke();
16242
+ if (__endArrowPath.fill) {
16243
+ canvas.fillStyle = stroke;
16244
+ canvas.fill();
16245
+ }
16042
16246
  }
16043
16247
  }
16044
16248
  });
@@ -16451,7 +16655,7 @@ var LeaferUI = function(exports) {
16451
16655
  exports.UI.addAttr("autoWidth", undefined, autoBoundsType);
16452
16656
  exports.UI.addAttr("autoHeight", undefined, autoBoundsType);
16453
16657
  exports.UI.addAttr("autoBox", undefined, boundsType);
16454
- const {copyAndSpread: copyAndSpread} = BoundsHelper;
16658
+ const {copyAndSpread: copyAndSpread$1} = BoundsHelper;
16455
16659
  box$1.__updateFlowLayout = function() {
16456
16660
  const {leaferIsCreated: leaferIsCreated, flow: flow} = this;
16457
16661
  if (leaferIsCreated) this.leafer.created = false;
@@ -16481,7 +16685,7 @@ var LeaferUI = function(exports) {
16481
16685
  const same = layout.contentBounds === layout.boxBounds;
16482
16686
  if (padding) {
16483
16687
  if (same) layout.shrinkContent();
16484
- copyAndSpread(layout.contentBounds, layout.boxBounds, padding, true);
16688
+ copyAndSpread$1(layout.contentBounds, layout.boxBounds, padding, true);
16485
16689
  } else {
16486
16690
  if (!same) layout.shrinkContentCancel();
16487
16691
  }
@@ -16502,7 +16706,7 @@ var LeaferUI = function(exports) {
16502
16706
  boxBounds.width = data.width, boxBounds.x = 0;
16503
16707
  }
16504
16708
  }
16505
- flow && secondLayout && data.padding && copyAndSpread(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : data.__autoWidth ? "width" : "height");
16709
+ flow && secondLayout && data.padding && copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : data.__autoWidth ? "width" : "height");
16506
16710
  this.__updateNaturalSize();
16507
16711
  } else {
16508
16712
  this.__updateRectBoxBounds();
@@ -18190,6 +18394,9 @@ var LeaferUI = function(exports) {
18190
18394
  constructor(data) {
18191
18395
  super(data);
18192
18396
  }
18397
+ togglePlay() {
18398
+ this.running ? this.pause() : this.play();
18399
+ }
18193
18400
  play() {
18194
18401
  this.running = true;
18195
18402
  }
@@ -18302,9 +18509,7 @@ var LeaferUI = function(exports) {
18302
18509
  const {Yes: Yes, NoAndSkip: NoAndSkip, YesAndSkip: YesAndSkip} = exports.Answer;
18303
18510
  const idCondition = {}, classNameCondition = {}, tagCondition = {};
18304
18511
  class Finder {
18305
- constructor(target) {
18306
- this.innerIdMap = {};
18307
- this.idMap = {};
18512
+ constructor(target, _config) {
18308
18513
  this.methods = {
18309
18514
  id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf),
18310
18515
  1) : 0,
@@ -18314,6 +18519,13 @@ var LeaferUI = function(exports) {
18314
18519
  tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
18315
18520
  tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
18316
18521
  };
18522
+ this.idMap = {};
18523
+ this.innerIdMap = {};
18524
+ const app = target && target.app;
18525
+ if (app) {
18526
+ app.idMap ? this.idMap = app.idMap : app.idMap = this.idMap;
18527
+ app.innerIdMap ? this.innerIdMap = app.innerIdMap : app.innerIdMap = this.innerIdMap;
18528
+ }
18317
18529
  if (this.target = target) this.__listenEvents();
18318
18530
  }
18319
18531
  getBy(condition, branch, one, options) {
@@ -18434,8 +18646,13 @@ var LeaferUI = function(exports) {
18434
18646
  return getSelector(this).getBy(condition, this, true, options);
18435
18647
  };
18436
18648
  Plugin.add("find");
18437
- Creator.finder = function(target) {
18438
- return new Finder(target);
18649
+ Creator.finder = function(target, config) {
18650
+ return new Finder(target, config);
18651
+ };
18652
+ LeafHelper.cacheId = function(t) {
18653
+ const {leafer: leafer, id: id} = t;
18654
+ if (id) leafer.app.idMap[id] = t;
18655
+ if (leafer.cacheInnerId) leafer.app.innerIdMap[t.innerId] = t;
18439
18656
  };
18440
18657
  const {setPoint: setPoint, addPoint: addPoint, toBounds: toBounds} = TwoPointBoundsHelper;
18441
18658
  function getTrimBounds(canvas) {
@@ -18707,7 +18924,7 @@ var LeaferUI = function(exports) {
18707
18924
  style: {
18708
18925
  dragBoundsType: "outer",
18709
18926
  strokeAlign: "center",
18710
- strokeWidthFixed: "zoom-in",
18927
+ strokeScaleFixed: "zoom-in",
18711
18928
  width: 6,
18712
18929
  height: 6,
18713
18930
  opacity: .5,
@@ -18944,6 +19161,41 @@ var LeaferUI = function(exports) {
18944
19161
  fill: "white"
18945
19162
  }
18946
19163
  });
19164
+ const {stintSet: stintSet} = DataHelper;
19165
+ function scaleFixedType(defaultValue) {
19166
+ return decorateLeafAttr(defaultValue, key => attr({
19167
+ set(value) {
19168
+ if (this.__setAttr(key, value)) {
19169
+ const layout = this.__layout;
19170
+ doBoundsType(this);
19171
+ if (!isNumber(value)) value = value ? 1 : 0;
19172
+ stintSet(layout, "scaleFixed", value);
19173
+ stintSet(layout, "outerScale", value ? 1 / value : 0);
19174
+ if (!layout.outerScale && layout.localOuterBounds) layout.localOuterBounds = undefined;
19175
+ }
19176
+ }
19177
+ }));
19178
+ }
19179
+ const {scale: scale} = MatrixHelper;
19180
+ const {copyAndSpread: copyAndSpread} = BoundsHelper;
19181
+ const {getScaleFixedData: getScaleFixedData} = MathHelper;
19182
+ LeafHelper.updateScaleFixedWorld = function(t) {
19183
+ const {__world: __world, __: __} = t, {scaleX: scaleX, scaleY: scaleY} = getScaleFixedData(__world, __.scaleFixed);
19184
+ if (scaleX !== 1) {
19185
+ scale(__world, scaleX, scaleY);
19186
+ __world.scaleX *= scaleX, __world.scaleY *= scaleY;
19187
+ }
19188
+ };
19189
+ LeafHelper.updateOuterBounds = function(t) {
19190
+ const layout = t.__layout, {localRenderBounds: localRenderBounds} = layout;
19191
+ const localOuterBounds = layout.localOuterBounds || (layout.localOuterBounds = {});
19192
+ const {width: width, height: height} = localRenderBounds;
19193
+ const scale = layout.outerScale - 1;
19194
+ copyAndSpread(localOuterBounds, localRenderBounds, [ height * scale, width * scale ]);
19195
+ if (t.parent) t.parent.__layout.renderChange();
19196
+ };
19197
+ Plugin.add("scale-fixed");
19198
+ exports.UI.addAttr("scaleFixed", undefined, scaleFixedType);
18947
19199
  exports.AlignHelper = AlignHelper;
18948
19200
  exports.AnimateEasing = AnimateEasing;
18949
19201
  exports.AnimateEvent = AnimateEvent;
@@ -19023,8 +19275,10 @@ var LeaferUI = function(exports) {
19023
19275
  exports.LeaferCanvasBase = LeaferCanvasBase;
19024
19276
  exports.LeaferData = LeaferData;
19025
19277
  exports.LeaferEvent = LeaferEvent;
19278
+ exports.LeaferFilm = LeaferFilm;
19026
19279
  exports.LeaferImage = LeaferImage;
19027
19280
  exports.LeaferTypeCreator = LeaferTypeCreator;
19281
+ exports.LeaferVideo = LeaferVideo;
19028
19282
  exports.LineData = LineData;
19029
19283
  exports.MathHelper = MathHelper;
19030
19284
  exports.Matrix = Matrix;