@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.
@@ -7,6 +7,45 @@ var PathNodeHandleType;
7
7
  PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
8
8
  })(PathNodeHandleType || (PathNodeHandleType = {}));
9
9
 
10
+ function __decorate(decorators, target, key, desc) {
11
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
14
+ }
15
+
16
+ function __awaiter(thisArg, _arguments, P, generator) {
17
+ function adopt(value) {
18
+ return value instanceof P ? value : new P(function(resolve) {
19
+ resolve(value);
20
+ });
21
+ }
22
+ return new (P || (P = Promise))(function(resolve, reject) {
23
+ function fulfilled(value) {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ }
30
+ function rejected(value) {
31
+ try {
32
+ step(generator["throw"](value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ }
37
+ function step(result) {
38
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
39
+ }
40
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
41
+ });
42
+ }
43
+
44
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
45
+ var e = new Error(message);
46
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
47
+ };
48
+
10
49
  var Answer;
11
50
 
12
51
  (function(Answer) {
@@ -213,6 +252,7 @@ class LeafData {
213
252
  }
214
253
  destroy() {
215
254
  this.__input = this.__middle = null;
255
+ if (this.__complexData) this.__complexData.destroy();
216
256
  }
217
257
  }
218
258
 
@@ -311,6 +351,8 @@ const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumbe
311
351
 
312
352
  const {round: round$6, pow: pow$2, max: max$6, floor: floor$3, PI: PI$4} = Math;
313
353
 
354
+ const tempScaleData$1 = {};
355
+
314
356
  const MathHelper = {
315
357
  within(value, min, max) {
316
358
  if (isObject(min)) max = min.max, min = min.min;
@@ -354,6 +396,24 @@ const MathHelper = {
354
396
  } else if (scale) MathHelper.assignScale(scaleData, scale);
355
397
  return scaleData;
356
398
  },
399
+ getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
400
+ let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
401
+ if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
402
+ if (scaleFixed) {
403
+ if (scaleFixed === true) {
404
+ scaleX = scaleY = unscale ? 1 : 1 / scaleX;
405
+ } else {
406
+ let minScale;
407
+ if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
408
+ if (minScale) {
409
+ if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
410
+ }
411
+ }
412
+ }
413
+ tempScaleData$1.scaleX = scaleX;
414
+ tempScaleData$1.scaleY = scaleY;
415
+ return tempScaleData$1;
416
+ },
357
417
  assignScale(scaleData, scale) {
358
418
  if (isNumber(scale)) {
359
419
  scaleData.scaleX = scaleData.scaleY = scale;
@@ -850,8 +910,8 @@ const PointHelper = {
850
910
  if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
851
911
  return points;
852
912
  },
853
- isSame(t, point) {
854
- return float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
913
+ isSame(t, point, quick) {
914
+ 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);
855
915
  },
856
916
  reset(t) {
857
917
  P$7.reset(t);
@@ -926,8 +986,8 @@ class Point {
926
986
  getAtan2(to) {
927
987
  return PointHelper.getAtan2(this, to);
928
988
  }
929
- isSame(point) {
930
- return PointHelper.isSame(this, point);
989
+ isSame(point, quick) {
990
+ return PointHelper.isSame(this, point, quick);
931
991
  }
932
992
  reset() {
933
993
  PointHelper.reset(this);
@@ -1183,9 +1243,9 @@ const AroundHelper = {
1183
1243
  }
1184
1244
  if (!onlyBoxSize) to.x += box.x, to.y += box.y;
1185
1245
  },
1186
- getPoint(around, box, to) {
1246
+ getPoint(around, box, to, onlyBoxSize = true) {
1187
1247
  if (!to) to = {};
1188
- AroundHelper.toPoint(around, box, to, true);
1248
+ AroundHelper.toPoint(around, box, to, onlyBoxSize);
1189
1249
  return to;
1190
1250
  }
1191
1251
  };
@@ -1452,6 +1512,9 @@ const BoundsHelper = {
1452
1512
  y: y + height
1453
1513
  } ];
1454
1514
  },
1515
+ getPoint(t, around, onlyBoxSize = false, to) {
1516
+ return AroundHelper.getPoint(around, t, to, onlyBoxSize);
1517
+ },
1455
1518
  hitRadiusPoint(t, point, pointMatrix) {
1456
1519
  if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
1457
1520
  return point.x >= t.x - point.radiusX && point.x <= t.x + t.width + point.radiusX && (point.y >= t.y - point.radiusY && point.y <= t.y + t.height + point.radiusY);
@@ -1623,6 +1686,9 @@ class Bounds {
1623
1686
  getPoints() {
1624
1687
  return BoundsHelper.getPoints(this);
1625
1688
  }
1689
+ getPoint(around, onlyBoxSize, to) {
1690
+ return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
1691
+ }
1626
1692
  hitPoint(point, pointMatrix) {
1627
1693
  return BoundsHelper.hitPoint(this, point, pointMatrix);
1628
1694
  }
@@ -1897,7 +1963,10 @@ const UICreator = {
1897
1963
  list$3[tag] = UI;
1898
1964
  },
1899
1965
  get(tag, data, x, y, width, height) {
1900
- if (!list$3[tag]) debug$h.error("not register " + tag);
1966
+ if (!list$3[tag]) {
1967
+ debug$h.warn("not register " + tag);
1968
+ return undefined;
1969
+ }
1901
1970
  const ui = new list$3[tag](data);
1902
1971
  if (!isUndefined(x)) {
1903
1972
  ui.x = x;
@@ -1988,45 +2057,6 @@ class CanvasManager {
1988
2057
  }
1989
2058
  }
1990
2059
 
1991
- function __decorate(decorators, target, key, desc) {
1992
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1993
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1994
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1995
- }
1996
-
1997
- function __awaiter(thisArg, _arguments, P, generator) {
1998
- function adopt(value) {
1999
- return value instanceof P ? value : new P(function(resolve) {
2000
- resolve(value);
2001
- });
2002
- }
2003
- return new (P || (P = Promise))(function(resolve, reject) {
2004
- function fulfilled(value) {
2005
- try {
2006
- step(generator.next(value));
2007
- } catch (e) {
2008
- reject(e);
2009
- }
2010
- }
2011
- function rejected(value) {
2012
- try {
2013
- step(generator["throw"](value));
2014
- } catch (e) {
2015
- reject(e);
2016
- }
2017
- }
2018
- function step(result) {
2019
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2020
- }
2021
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2022
- });
2023
- }
2024
-
2025
- typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
2026
- var e = new Error(message);
2027
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2028
- };
2029
-
2030
2060
  function contextAttr(realName) {
2031
2061
  return (target, key) => {
2032
2062
  if (!realName) realName = key;
@@ -3754,10 +3784,10 @@ function canvasPatch(drawer) {
3754
3784
  const FileHelper = {
3755
3785
  alphaPixelTypes: [ "png", "webp", "svg" ],
3756
3786
  upperCaseTypeMap: {},
3757
- mineType(type) {
3758
- if (!type || type.startsWith("image")) return type;
3787
+ mimeType(type, base = "image") {
3788
+ if (!type || type.startsWith(base)) return type;
3759
3789
  if (type === "jpg") type = "jpeg";
3760
- return "image/" + type;
3790
+ return base + "/" + type;
3761
3791
  },
3762
3792
  fileType(filename) {
3763
3793
  const l = filename.split(".");
@@ -3790,6 +3820,8 @@ const FileHelper = {
3790
3820
 
3791
3821
  const F$2 = FileHelper;
3792
3822
 
3823
+ F$2.mineType = F$2.mimeType;
3824
+
3793
3825
  F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
3794
3826
 
3795
3827
  const debug$c = Debug.get("TaskProcessor");
@@ -4034,6 +4066,9 @@ const debug$b = Debug.get("Resource");
4034
4066
 
4035
4067
  const Resource = {
4036
4068
  tasker: new TaskProcessor,
4069
+ queue: new TaskProcessor({
4070
+ parallel: 1
4071
+ }),
4037
4072
  map: {},
4038
4073
  get isComplete() {
4039
4074
  return R.tasker.isComplete;
@@ -4070,6 +4105,12 @@ const Resource = {
4070
4105
  R.set(key, value);
4071
4106
  return value;
4072
4107
  },
4108
+ loadFilm(_key, _format) {
4109
+ return undefined;
4110
+ },
4111
+ loadVideo(_key, _format) {
4112
+ return undefined;
4113
+ },
4073
4114
  destroy() {
4074
4115
  R.map = {};
4075
4116
  }
@@ -4080,16 +4121,15 @@ const R = Resource;
4080
4121
  const ImageManager = {
4081
4122
  maxRecycled: 10,
4082
4123
  recycledList: [],
4083
- patternTasker: new TaskProcessor({
4084
- parallel: 1
4085
- }),
4086
- get(config) {
4124
+ patternTasker: Resource.queue,
4125
+ get(config, type) {
4087
4126
  let image = Resource.get(config.url);
4088
- if (!image) Resource.set(config.url, image = Creator.image(config));
4127
+ if (!image) Resource.set(config.url, image = type === "film" ? Creator.film(config) : Creator.image(config));
4089
4128
  image.use++;
4090
4129
  return image;
4091
4130
  },
4092
4131
  recycle(image) {
4132
+ if (image.parent) image = image.parent;
4093
4133
  image.use--;
4094
4134
  setTimeout(() => {
4095
4135
  if (!image.use) {
@@ -4120,7 +4160,7 @@ const ImageManager = {
4120
4160
  if (config.format) return config.format === format;
4121
4161
  const {url: url} = config;
4122
4162
  if (url.startsWith("data:")) {
4123
- if (url.startsWith("data:" + FileHelper.mineType(format))) return true;
4163
+ if (url.startsWith("data:" + FileHelper.mimeType(format))) return true;
4124
4164
  } else {
4125
4165
  if (url.includes("." + format) || url.includes("." + FileHelper.upperCaseTypeMap[format])) return true; else if (format === "png" && !url.includes(".")) return true;
4126
4166
  }
@@ -4136,6 +4176,9 @@ const I$1 = ImageManager;
4136
4176
  const {IMAGE: IMAGE, create: create$1} = IncrementId;
4137
4177
 
4138
4178
  class LeaferImage {
4179
+ get tag() {
4180
+ return "Image";
4181
+ }
4139
4182
  get url() {
4140
4183
  return this.config.url;
4141
4184
  }
@@ -4164,7 +4207,7 @@ class LeaferImage {
4164
4207
  if (!this.loading) {
4165
4208
  this.loading = true;
4166
4209
  Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
4167
- return yield Platform.origin.loadImage(this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
4210
+ return yield Platform.origin["load" + this.tag](this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
4168
4211
  if (thumbSize) this.setThumbView(img);
4169
4212
  this.setView(img);
4170
4213
  }).catch(e => {
@@ -4238,6 +4281,9 @@ class LeaferImage {
4238
4281
  Platform.image.setPatternTransform(pattern, transform, paint);
4239
4282
  return pattern;
4240
4283
  }
4284
+ render(canvas, x, y, width, height, _leaf, _paint, _imageScaleX, _imageScaleY) {
4285
+ canvas.drawImage(this.view, x, y, width, height);
4286
+ }
4241
4287
  getLoadUrl(_thumbSize) {
4242
4288
  return this.url;
4243
4289
  }
@@ -4252,8 +4298,10 @@ class LeaferImage {
4252
4298
  return undefined;
4253
4299
  }
4254
4300
  clearLevels(_checkUse) {}
4301
+ destroyFilter() {}
4255
4302
  destroy() {
4256
4303
  this.clearLevels();
4304
+ this.destroyFilter();
4257
4305
  const {view: view} = this;
4258
4306
  if (view && view.close) view.close();
4259
4307
  this.config = {
@@ -4264,6 +4312,18 @@ class LeaferImage {
4264
4312
  }
4265
4313
  }
4266
4314
 
4315
+ class LeaferFilm extends LeaferImage {
4316
+ get tag() {
4317
+ return "Film";
4318
+ }
4319
+ }
4320
+
4321
+ class LeaferVideo extends LeaferImage {
4322
+ get tag() {
4323
+ return "Video";
4324
+ }
4325
+ }
4326
+
4267
4327
  function defineKey(target, key, descriptor, noConfigurable) {
4268
4328
  if (!noConfigurable) descriptor.configurable = descriptor.enumerable = true;
4269
4329
  Object.defineProperty(target, key, descriptor);
@@ -4438,7 +4498,6 @@ function dimType(defaultValue) {
4438
4498
  if (this.__setAttr(key, value)) {
4439
4499
  const data = this.__;
4440
4500
  DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
4441
- this.__layout.surfaceChange();
4442
4501
  }
4443
4502
  }
4444
4503
  }));
@@ -4488,7 +4547,6 @@ function sortType(defaultValue) {
4488
4547
  return decorateLeafAttr(defaultValue, key => attr({
4489
4548
  set(value) {
4490
4549
  if (this.__setAttr(key, value)) {
4491
- this.__layout.surfaceChange();
4492
4550
  this.waitParent(() => {
4493
4551
  this.parent.__layout.childrenSortChange();
4494
4552
  });
@@ -4525,7 +4583,6 @@ function hitType(defaultValue) {
4525
4583
  set(value) {
4526
4584
  if (this.__setAttr(key, value)) {
4527
4585
  this.__layout.hitCanvasChanged = true;
4528
- if (Debug.showBounds === "hit") this.__layout.surfaceChange();
4529
4586
  if (this.leafer) this.leafer.updateCursor();
4530
4587
  }
4531
4588
  }
@@ -4731,6 +4788,10 @@ const LeafHelper = {
4731
4788
  if (layout.stateStyleChanged) leaf.updateState();
4732
4789
  if (layout.opacityChanged) updateAllWorldOpacity(leaf);
4733
4790
  leaf.__updateChange();
4791
+ if (layout.surfaceChanged) {
4792
+ if (leaf.__hasComplex) L$4.updateComplex(leaf);
4793
+ layout.surfaceChanged = false;
4794
+ }
4734
4795
  },
4735
4796
  updateAllChange(leaf) {
4736
4797
  updateChange$1(leaf);
@@ -4755,6 +4816,9 @@ const LeafHelper = {
4755
4816
  if (!fromWorld) fromWorld = leaf.__nowWorld;
4756
4817
  if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
4757
4818
  },
4819
+ renderComplex(_leaf, _canvas, _options) {},
4820
+ updateComplex(_leaf) {},
4821
+ checkComplex(_leaf) {},
4758
4822
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4759
4823
  const local = isObject(x) ? Object.assign({}, x) : {
4760
4824
  x: x,
@@ -4866,6 +4930,9 @@ const LeafHelper = {
4866
4930
  divideParent(matrix$3, relative.scrollWorldTransform);
4867
4931
  return temp ? matrix$3 : Object.assign({}, matrix$3);
4868
4932
  },
4933
+ updateScaleFixedWorld(_t) {},
4934
+ updateOuterBounds(_t) {},
4935
+ cacheId(_t) {},
4869
4936
  drop(t, parent, index, resize) {
4870
4937
  t.setTransform(L$4.getRelativeWorld(t, parent, true), resize);
4871
4938
  parent.add(t, index);
@@ -4916,7 +4983,8 @@ const LeafBoundsHelper = {
4916
4983
  return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
4917
4984
  },
4918
4985
  localRenderBounds(target) {
4919
- return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds;
4986
+ const {__: __, __layout: __layout} = target;
4987
+ return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
4920
4988
  },
4921
4989
  maskLocalBoxBounds(target, index) {
4922
4990
  return checkMask(target, index) && target.__localBoxBounds;
@@ -4925,7 +4993,8 @@ const LeafBoundsHelper = {
4925
4993
  return checkMask(target, index) && target.__layout.localStrokeBounds;
4926
4994
  },
4927
4995
  maskLocalRenderBounds(target, index) {
4928
- return checkMask(target, index) && target.__layout.localRenderBounds;
4996
+ const {__layout: __layout} = target;
4997
+ return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
4929
4998
  },
4930
4999
  excludeRenderBounds(child, options) {
4931
5000
  if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
@@ -5049,12 +5118,12 @@ const BranchHelper = {
5049
5118
  w.height *= scaleY;
5050
5119
  w.scaleX *= scaleX;
5051
5120
  w.scaleY *= scaleY;
5052
- if (branch.isBranch) scale$2(branch, x, y, scaleX, scaleY, a, b);
5121
+ if (branch.isBranch) scale$3(branch, x, y, scaleX, scaleY, a, b);
5053
5122
  }
5054
5123
  }
5055
5124
  };
5056
5125
 
5057
- const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$2} = BranchHelper;
5126
+ const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$3} = BranchHelper;
5058
5127
 
5059
5128
  const WaitHelper = {
5060
5129
  run(wait) {
@@ -5445,7 +5514,6 @@ class LeafLayout {
5445
5514
  }
5446
5515
  opacityChange() {
5447
5516
  this.opacityChanged = true;
5448
- this.surfaceChanged || this.surfaceChange();
5449
5517
  }
5450
5518
  childrenSortChange() {
5451
5519
  if (!this.childrenSortChanged) {
@@ -5938,6 +6006,7 @@ const LeafMatrix = {
5938
6006
  const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
5939
6007
  multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
5940
6008
  if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
6009
+ if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
5941
6010
  },
5942
6011
  __updateLocalMatrix() {
5943
6012
  if (this.__local) {
@@ -5963,7 +6032,7 @@ const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafH
5963
6032
 
5964
6033
  const {updateBounds: updateBounds$2} = BranchHelper;
5965
6034
 
5966
- const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$3, copy: copy$6} = BoundsHelper;
6035
+ const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$4, copy: copy$6} = BoundsHelper;
5967
6036
 
5968
6037
  const {toBounds: toBounds$1} = PathBounds;
5969
6038
 
@@ -5971,6 +6040,7 @@ const LeafBounds = {
5971
6040
  __updateWorldBounds() {
5972
6041
  const {__layout: __layout, __world: __world} = this;
5973
6042
  toOuterOf$2(__layout.renderBounds, __world, __world);
6043
+ if (this.__hasComplex) LeafHelper.checkComplex(this);
5974
6044
  if (__layout.resized) {
5975
6045
  if (__layout.resized === "inner") this.__onUpdateSize();
5976
6046
  if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
@@ -6020,6 +6090,7 @@ const LeafBounds = {
6020
6090
  layout.renderChanged = undefined;
6021
6091
  if (this.parent) this.parent.__layout.renderChange();
6022
6092
  }
6093
+ if (layout.outerScale) LeafHelper.updateOuterBounds(this);
6023
6094
  layout.resized || (layout.resized = "local");
6024
6095
  layout.boundsChanged = undefined;
6025
6096
  },
@@ -6070,11 +6141,11 @@ const LeafBounds = {
6070
6141
  },
6071
6142
  __updateStrokeBounds(_bounds) {
6072
6143
  const layout = this.__layout;
6073
- copyAndSpread$3(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
6144
+ copyAndSpread$4(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
6074
6145
  },
6075
6146
  __updateRenderBounds(_bounds) {
6076
6147
  const layout = this.__layout, {renderSpread: renderSpread} = layout;
6077
- isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$3(layout.renderBounds, layout.boxBounds, renderSpread);
6148
+ isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$4(layout.renderBounds, layout.boxBounds, renderSpread);
6078
6149
  }
6079
6150
  };
6080
6151
 
@@ -6086,7 +6157,7 @@ const LeafRender = {
6086
6157
  const data = this.__;
6087
6158
  if (data.bright && !options.topRendering) return options.topList.add(this);
6088
6159
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
6089
- canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
6160
+ canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
6090
6161
  if (this.__.__single) {
6091
6162
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
6092
6163
  const tempCanvas = canvas.getSameCanvas(true, true);
@@ -6140,7 +6211,7 @@ const BranchRender = {
6140
6211
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
6141
6212
  const tempCanvas = canvas.getSameCanvas(false, true);
6142
6213
  this.__renderBranch(tempCanvas, options);
6143
- canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
6214
+ canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
6144
6215
  canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
6145
6216
  tempCanvas.recycle(nowWorld);
6146
6217
  } else {
@@ -6152,9 +6223,11 @@ const BranchRender = {
6152
6223
  if (this.__hasMask) {
6153
6224
  this.__renderMask(canvas, options);
6154
6225
  } else {
6226
+ let child;
6155
6227
  const {children: children} = this;
6156
6228
  for (let i = 0, len = children.length; i < len; i++) {
6157
- excludeRenderBounds$1(children[i], options) || children[i].__render(canvas, options);
6229
+ child = children[i];
6230
+ excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
6158
6231
  }
6159
6232
  }
6160
6233
  },
@@ -6168,11 +6241,9 @@ const BranchRender = {
6168
6241
  }
6169
6242
  };
6170
6243
 
6171
- const tempScaleData$1 = {};
6172
-
6173
6244
  const {LEAF: LEAF, create: create} = IncrementId;
6174
6245
 
6175
- const {stintSet: stintSet$4} = DataHelper;
6246
+ const {stintSet: stintSet$6} = DataHelper;
6176
6247
 
6177
6248
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
6178
6249
 
@@ -6180,6 +6251,8 @@ const {toOuterOf: toOuterOf$1} = BoundsHelper;
6180
6251
 
6181
6252
  const {copy: copy$5, move: move$8} = PointHelper;
6182
6253
 
6254
+ const {getScaleFixedData: getScaleFixedData$1} = MathHelper;
6255
+
6183
6256
  const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
6184
6257
 
6185
6258
  let Leaf = class Leaf {
@@ -6338,6 +6411,7 @@ let Leaf = class Leaf {
6338
6411
  this.__level = this.parent ? this.parent.__level + 1 : 1;
6339
6412
  if (this.animation) this.__runAnimation("in");
6340
6413
  if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
6414
+ if (leafer.cacheId) LeafHelper.cacheId(this);
6341
6415
  } else {
6342
6416
  this.__emitLifeEvent(ChildEvent.UNMOUNTED);
6343
6417
  }
@@ -6455,8 +6529,8 @@ let Leaf = class Leaf {
6455
6529
  const cameraWorld = this.__cameraWorld, world = this.__world;
6456
6530
  multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
6457
6531
  toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
6458
- stintSet$4(cameraWorld, "half", world.half);
6459
- stintSet$4(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6532
+ stintSet$6(cameraWorld, "half", world.half);
6533
+ stintSet$6(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6460
6534
  return cameraWorld;
6461
6535
  } else {
6462
6536
  return this.__world;
@@ -6467,13 +6541,8 @@ let Leaf = class Leaf {
6467
6541
  if (scaleX < 0) scaleX = -scaleX;
6468
6542
  return scaleX > 1 ? scaleX : 1;
6469
6543
  }
6470
- getRenderScaleData(abs, scaleFixed) {
6471
- let {scaleX: scaleX, scaleY: scaleY} = ImageManager.patternLocked ? this.__world : this.__nowWorld;
6472
- if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
6473
- if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
6474
- tempScaleData$1.scaleX = scaleX;
6475
- tempScaleData$1.scaleY = scaleY;
6476
- return tempScaleData$1;
6544
+ getRenderScaleData(abs, scaleFixed, unscale = true) {
6545
+ return getScaleFixedData$1(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
6477
6546
  }
6478
6547
  getTransform(relative) {
6479
6548
  return this.__layout.getTransform(relative || "local");
@@ -6645,7 +6714,7 @@ let Leaf = class Leaf {
6645
6714
  __drawPath(_canvas) {}
6646
6715
  __drawRenderPath(_canvas) {}
6647
6716
  __updatePath() {}
6648
- __updateRenderPath() {}
6717
+ __updateRenderPath(_updateCache) {}
6649
6718
  getMotionPathData() {
6650
6719
  return Plugin.need("path");
6651
6720
  }
@@ -6719,9 +6788,11 @@ let Branch = class Branch extends Leaf {
6719
6788
  return 0;
6720
6789
  }
6721
6790
  __updateRenderSpread() {
6791
+ let layout;
6722
6792
  const {children: children} = this;
6723
6793
  for (let i = 0, len = children.length; i < len; i++) {
6724
- if (children[i].__layout.renderSpread) return 1;
6794
+ layout = children[i].__layout;
6795
+ if (layout.renderSpread || layout.localOuterBounds) return 1;
6725
6796
  }
6726
6797
  return 0;
6727
6798
  }
@@ -6754,6 +6825,7 @@ let Branch = class Branch extends Leaf {
6754
6825
  this.add(item, index);
6755
6826
  noIndex || index++;
6756
6827
  }); else child = UICreator.get(child.tag, child);
6828
+ if (!child) return;
6757
6829
  }
6758
6830
  if (child.parent) child.parent.remove(child);
6759
6831
  child.parent = this;
@@ -6979,7 +7051,7 @@ class LeafLevelList {
6979
7051
  }
6980
7052
  }
6981
7053
 
6982
- const version = "2.0.1";
7054
+ const version = "2.0.3";
6983
7055
 
6984
7056
  class LeaferCanvas extends LeaferCanvasBase {
6985
7057
  get allowBackgroundColor() {
@@ -7005,8 +7077,6 @@ canvasPatch(OffscreenCanvasRenderingContext2D.prototype);
7005
7077
 
7006
7078
  canvasPatch(Path2D.prototype);
7007
7079
 
7008
- const {mineType: mineType} = FileHelper;
7009
-
7010
7080
  Object.assign(Creator, {
7011
7081
  canvas: (options, manager) => new LeaferCanvas(options, manager),
7012
7082
  image: options => new LeaferImage(options)
@@ -7017,7 +7087,7 @@ function useCanvas(_canvasType, _power) {
7017
7087
  createCanvas: (width, height) => new OffscreenCanvas(width, height),
7018
7088
  canvasToDataURL: (canvas, type, quality) => new Promise((resolve, reject) => {
7019
7089
  canvas.convertToBlob({
7020
- type: mineType(type),
7090
+ type: FileHelper.mimeType(type),
7021
7091
  quality: quality
7022
7092
  }).then(blob => {
7023
7093
  var reader = new FileReader;
@@ -7029,14 +7099,14 @@ function useCanvas(_canvasType, _power) {
7029
7099
  });
7030
7100
  }),
7031
7101
  canvasToBolb: (canvas, type, quality) => canvas.convertToBlob({
7032
- type: mineType(type),
7102
+ type: FileHelper.mimeType(type),
7033
7103
  quality: quality
7034
7104
  }),
7035
7105
  canvasSaveAs: (_canvas, _filename, _quality) => new Promise(resolve => resolve()),
7036
7106
  download(_url, _filename) {
7037
7107
  return undefined;
7038
7108
  },
7039
- loadImage(src) {
7109
+ loadImage(src, _crossOrigin, _leaferImage) {
7040
7110
  return new Promise((resolve, reject) => {
7041
7111
  let req = new XMLHttpRequest;
7042
7112
  req.open("GET", Platform.image.getRealURL(src), true);
@@ -7051,6 +7121,13 @@ function useCanvas(_canvasType, _power) {
7051
7121
  req.onerror = e => reject(e);
7052
7122
  req.send();
7053
7123
  });
7124
+ },
7125
+ loadContent(url_1) {
7126
+ return __awaiter(this, arguments, void 0, function*(url, responseType = "text") {
7127
+ const response = yield fetch(url);
7128
+ if (!response.ok) throw new Error(`${response.status}`);
7129
+ return yield response[responseType]();
7130
+ });
7054
7131
  }
7055
7132
  };
7056
7133
  Platform.canvas = Creator.canvas();
@@ -7550,7 +7627,7 @@ class Renderer {
7550
7627
  getCellList() {
7551
7628
  return undefined;
7552
7629
  }
7553
- addBlock(block) {
7630
+ addBlock(block, _leafList) {
7554
7631
  if (!this.updateBlocks) this.updateBlocks = [];
7555
7632
  this.updateBlocks.push(block);
7556
7633
  }
@@ -7598,7 +7675,8 @@ class Renderer {
7598
7675
  __onLayoutEnd(event) {
7599
7676
  if (event.data) event.data.map(item => {
7600
7677
  let empty;
7601
- if (item.updatedList) item.updatedList.list.some(leaf => {
7678
+ const {updatedList: updatedList} = item;
7679
+ if (updatedList) updatedList.list.some(leaf => {
7602
7680
  empty = !leaf.__world.width || !leaf.__world.height;
7603
7681
  if (empty) {
7604
7682
  if (!leaf.isLeafer) debug$6.tip(leaf.innerName, ": empty");
@@ -7606,7 +7684,7 @@ class Renderer {
7606
7684
  }
7607
7685
  return empty;
7608
7686
  });
7609
- this.addBlock(empty ? this.canvas.bounds : item.updatedBounds);
7687
+ this.addBlock(empty ? this.canvas.bounds : item.updatedBounds, updatedList);
7610
7688
  });
7611
7689
  }
7612
7690
  emitRender(type, bounds, options) {
@@ -7812,7 +7890,7 @@ class Selector {
7812
7890
  this.config = {};
7813
7891
  if (userConfig) this.config = DataHelper.default(userConfig, this.config);
7814
7892
  this.picker = new Picker(this.target = target, this);
7815
- this.finder = Creator.finder && Creator.finder();
7893
+ this.finder = Creator.finder && Creator.finder(target, this.config);
7816
7894
  }
7817
7895
  getByPoint(hitPoint, hitRadius, options) {
7818
7896
  const {target: target, picker: picker} = this;
@@ -7854,7 +7932,9 @@ function effectType(defaultValue) {
7854
7932
  set(value) {
7855
7933
  this.__setAttr(key, value);
7856
7934
  if (value) this.__.__useEffect = true;
7857
- this.__layout.renderChanged || this.__layout.renderChange();
7935
+ const layout = this.__layout;
7936
+ layout.renderChanged || layout.renderChange();
7937
+ layout.surfaceChange();
7858
7938
  }
7859
7939
  }));
7860
7940
  }
@@ -7957,7 +8037,7 @@ const Transition = {
7957
8037
 
7958
8038
  const {parse: parse, objectToCanvasData: objectToCanvasData} = PathConvert;
7959
8039
 
7960
- const {stintSet: stintSet$3} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
8040
+ const {stintSet: stintSet$5} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
7961
8041
 
7962
8042
  const emptyPaint = {
7963
8043
  originPaint: {}
@@ -8026,7 +8106,7 @@ class UIData extends LeafData {
8026
8106
  setFill(value) {
8027
8107
  if (this.__naturalWidth) this.__removeNaturalSize();
8028
8108
  if (isString(value) || !value) {
8029
- stintSet$3(this, "__isTransparentFill", hasTransparent$2(value));
8109
+ stintSet$5(this, "__isTransparentFill", hasTransparent$2(value));
8030
8110
  this.__isFills && this.__removePaint("fill", true);
8031
8111
  this._fill = value;
8032
8112
  } else if (isObject(value)) {
@@ -8035,7 +8115,7 @@ class UIData extends LeafData {
8035
8115
  }
8036
8116
  setStroke(value) {
8037
8117
  if (isString(value) || !value) {
8038
- stintSet$3(this, "__isTransparentStroke", hasTransparent$2(value));
8118
+ stintSet$5(this, "__isTransparentStroke", hasTransparent$2(value));
8039
8119
  this.__isStrokes && this.__removePaint("stroke", true);
8040
8120
  this._stroke = value;
8041
8121
  } else if (isObject(value)) {
@@ -8068,15 +8148,16 @@ class UIData extends LeafData {
8068
8148
  this.__needComputePaint = undefined;
8069
8149
  }
8070
8150
  __getRealStrokeWidth(childStyle) {
8071
- let {strokeWidth: strokeWidth, strokeWidthFixed: strokeWidthFixed} = this;
8151
+ let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
8072
8152
  if (childStyle) {
8073
8153
  if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
8074
- if (!isUndefined(childStyle.strokeWidthFixed)) strokeWidthFixed = childStyle.strokeWidthFixed;
8154
+ if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
8075
8155
  }
8076
- if (strokeWidthFixed) {
8077
- const scale = this.__leaf.getClampRenderScale();
8078
- return scale > 1 ? strokeWidth / scale : strokeWidth;
8079
- } else return strokeWidth;
8156
+ if (strokeScaleFixed) {
8157
+ const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
8158
+ if (scaleX !== 1) return strokeWidth * scaleX;
8159
+ }
8160
+ return strokeWidth;
8080
8161
  }
8081
8162
  __setPaint(attrName, value) {
8082
8163
  this.__setInput(attrName, value);
@@ -8093,11 +8174,11 @@ class UIData extends LeafData {
8093
8174
  if (removeInput) this.__removeInput(attrName);
8094
8175
  PaintImage.recycleImage(attrName, this);
8095
8176
  if (attrName === "fill") {
8096
- stintSet$3(this, "__isAlphaPixelFill", undefined);
8177
+ stintSet$5(this, "__isAlphaPixelFill", undefined);
8097
8178
  this._fill = this.__isFills = undefined;
8098
8179
  } else {
8099
- stintSet$3(this, "__isAlphaPixelStroke", undefined);
8100
- stintSet$3(this, "__hasMultiStrokeStyle", undefined);
8180
+ stintSet$5(this, "__isAlphaPixelStroke", undefined);
8181
+ stintSet$5(this, "__hasMultiStrokeStyle", undefined);
8101
8182
  this._stroke = this.__isStrokes = undefined;
8102
8183
  }
8103
8184
  }
@@ -8214,13 +8295,16 @@ class TextData extends UIData {
8214
8295
  }
8215
8296
 
8216
8297
  class ImageData extends RectData {
8298
+ get __urlType() {
8299
+ return "image";
8300
+ }
8217
8301
  setUrl(value) {
8218
8302
  this.__setImageFill(value);
8219
8303
  this._url = value;
8220
8304
  }
8221
8305
  __setImageFill(value) {
8222
8306
  this.fill = value ? {
8223
- type: "image",
8307
+ type: this.__urlType,
8224
8308
  mode: "stretch",
8225
8309
  url: value
8226
8310
  } : undefined;
@@ -8259,7 +8343,7 @@ const UIBounds = {
8259
8343
  const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
8260
8344
  if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
8261
8345
  boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
8262
- if (!data.__boxStroke) {
8346
+ if (!data.__boxStroke || data.__useArrow) {
8263
8347
  const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
8264
8348
  const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
8265
8349
  spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
@@ -8289,23 +8373,23 @@ const UIBounds = {
8289
8373
  }
8290
8374
  };
8291
8375
 
8292
- const {stintSet: stintSet$2} = DataHelper;
8376
+ const {stintSet: stintSet$4} = DataHelper;
8293
8377
 
8294
8378
  const UIRender = {
8295
8379
  __updateChange() {
8296
8380
  const data = this.__;
8297
8381
  if (data.__useStroke) {
8298
8382
  const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
8299
- stintSet$2(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
8300
- stintSet$2(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
8383
+ stintSet$4(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
8384
+ stintSet$4(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
8301
8385
  }
8302
8386
  if (data.__useEffect) {
8303
8387
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8304
- 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"));
8388
+ 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"));
8305
8389
  data.__useEffect = !!(shadow || otherEffect);
8306
8390
  }
8307
8391
  data.__checkSingle();
8308
- stintSet$2(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
8392
+ stintSet$4(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
8309
8393
  },
8310
8394
  __drawFast(canvas, options) {
8311
8395
  drawFast(this, canvas, options);
@@ -8416,6 +8500,12 @@ let UI = UI_1 = class UI extends Leaf {
8416
8500
  get isFrame() {
8417
8501
  return false;
8418
8502
  }
8503
+ set strokeWidthFixed(value) {
8504
+ this.strokeScaleFixed = value;
8505
+ }
8506
+ get strokeWidthFixed() {
8507
+ return this.strokeScaleFixed;
8508
+ }
8419
8509
  set scale(value) {
8420
8510
  MathHelper.assignScale(this, value);
8421
8511
  }
@@ -8471,6 +8561,9 @@ let UI = UI_1 = class UI extends Leaf {
8471
8561
  getPathString(curve, pathForRender, floatLength) {
8472
8562
  return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
8473
8563
  }
8564
+ asPath(curve, pathForRender) {
8565
+ this.path = this.getPath(curve, pathForRender);
8566
+ }
8474
8567
  load() {
8475
8568
  this.__.__computePaint();
8476
8569
  }
@@ -8480,16 +8573,18 @@ let UI = UI_1 = class UI extends Leaf {
8480
8573
  data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
8481
8574
  }
8482
8575
  }
8483
- __updateRenderPath() {
8576
+ __updateRenderPath(updateCache) {
8484
8577
  const data = this.__;
8485
8578
  if (data.path) {
8486
8579
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
8487
- if (data.__useArrow) PathArrow.addArrows(this);
8580
+ if (data.__useArrow) PathArrow.addArrows(this, updateCache);
8488
8581
  } else data.__pathForRender && (data.__pathForRender = undefined);
8489
8582
  }
8490
8583
  __drawRenderPath(canvas) {
8584
+ const data = this.__;
8491
8585
  canvas.beginPath();
8492
- this.__drawPathByData(canvas, this.__.__pathForRender);
8586
+ if (data.__useArrow) PathArrow.updateArrow(this);
8587
+ this.__drawPathByData(canvas, data.__pathForRender);
8493
8588
  }
8494
8589
  __drawPath(canvas) {
8495
8590
  canvas.beginPath();
@@ -8538,6 +8633,7 @@ let UI = UI_1 = class UI extends Leaf {
8538
8633
  static setEditOuter(_toolName) {}
8539
8634
  static setEditInner(_editorName) {}
8540
8635
  destroy() {
8636
+ this.__.__willDestroy = true;
8541
8637
  this.fill = this.stroke = null;
8542
8638
  if (this.__animate) this.killAnimate();
8543
8639
  super.destroy();
@@ -8654,7 +8750,7 @@ __decorate([ strokeType("inside") ], UI.prototype, "strokeAlign", void 0);
8654
8750
 
8655
8751
  __decorate([ strokeType(1, true) ], UI.prototype, "strokeWidth", void 0);
8656
8752
 
8657
- __decorate([ strokeType(false) ], UI.prototype, "strokeWidthFixed", void 0);
8753
+ __decorate([ strokeType(false) ], UI.prototype, "strokeScaleFixed", void 0);
8658
8754
 
8659
8755
  __decorate([ strokeType("none") ], UI.prototype, "strokeCap", void 0);
8660
8756
 
@@ -8720,7 +8816,10 @@ let Group = class Group extends UI {
8720
8816
  }
8721
8817
  toJSON(options) {
8722
8818
  const data = super.toJSON(options);
8723
- if (!this.childlessJSON) data.children = this.children.map(child => child.toJSON(options));
8819
+ if (!this.childlessJSON) {
8820
+ const children = data.children = [];
8821
+ this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
8822
+ }
8724
8823
  return data;
8725
8824
  }
8726
8825
  pick(_hitPoint, _options) {
@@ -8869,12 +8968,12 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8869
8968
  this.emitLeafer(LeaferEvent.STOP);
8870
8969
  }
8871
8970
  }
8872
- unlockLayout() {
8971
+ unlockLayout(updateLayout = true) {
8873
8972
  this.layouter.start();
8874
- this.updateLayout();
8973
+ if (updateLayout) this.updateLayout();
8875
8974
  }
8876
- lockLayout() {
8877
- this.updateLayout();
8975
+ lockLayout(updateLayout = true) {
8976
+ if (updateLayout) this.updateLayout();
8878
8977
  this.layouter.stop();
8879
8978
  }
8880
8979
  resize(size) {
@@ -9283,9 +9382,9 @@ let Ellipse = class Ellipse extends UI {
9283
9382
  return "Ellipse";
9284
9383
  }
9285
9384
  __updatePath() {
9286
- const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
9385
+ const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
9287
9386
  const rx = width / 2, ry = height / 2;
9288
- const path = this.__.path = [];
9387
+ const path = data.path = [];
9289
9388
  let open;
9290
9389
  if (innerRadius) {
9291
9390
  if (startAngle || endAngle) {
@@ -9307,7 +9406,7 @@ let Ellipse = class Ellipse extends UI {
9307
9406
  }
9308
9407
  }
9309
9408
  if (!open) closePath$2(path);
9310
- if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
9409
+ if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
9311
9410
  }
9312
9411
  };
9313
9412
 
@@ -9531,7 +9630,7 @@ __decorate([ resizeType() ], Canvas.prototype, "contextSettings", void 0);
9531
9630
 
9532
9631
  Canvas = __decorate([ registerUI() ], Canvas);
9533
9632
 
9534
- const {copyAndSpread: copyAndSpread$2, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet$1} = DataHelper;
9633
+ const {copyAndSpread: copyAndSpread$3, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet$3} = DataHelper;
9535
9634
 
9536
9635
  let Text = class Text extends UI {
9537
9636
  get __tag() {
@@ -9548,9 +9647,9 @@ let Text = class Text extends UI {
9548
9647
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
9549
9648
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
9550
9649
  data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
9551
- stintSet$1(data, "__padding", padding && MathHelper.fourNumber(padding));
9552
- stintSet$1(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
9553
- stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
9650
+ stintSet$3(data, "__padding", padding && MathHelper.fourNumber(padding));
9651
+ stintSet$3(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
9652
+ stintSet$3(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
9554
9653
  data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
9555
9654
  }
9556
9655
  __updateBoxBounds() {
@@ -9585,7 +9684,7 @@ let Text = class Text extends UI {
9585
9684
  }
9586
9685
  __updateRenderBounds() {
9587
9686
  const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
9588
- copyAndSpread$2(renderBounds, this.__.__textBoxBounds, renderSpread);
9687
+ copyAndSpread$3(renderBounds, this.__.__textBoxBounds, renderSpread);
9589
9688
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
9590
9689
  }
9591
9690
  __updateChange() {
@@ -9847,7 +9946,7 @@ let App = class App extends Leafer {
9847
9946
  if (this.viewReady) this.renderer.update();
9848
9947
  }
9849
9948
  __render(canvas, options) {
9850
- if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
9949
+ if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds, undefined, undefined, true));
9851
9950
  }
9852
9951
  __onResize(event) {
9853
9952
  this.forEach(leafer => leafer.resize(event));
@@ -10667,6 +10766,7 @@ class InteractionBase {
10667
10766
  this.checkPath(data, useDefaultPath);
10668
10767
  this.downTime = Date.now();
10669
10768
  this.emit(PointerEvent.BEFORE_DOWN, data);
10769
+ if (data.path.needUpdate) this.updateDownData(data);
10670
10770
  this.emit(PointerEvent.DOWN, data);
10671
10771
  if (PointerButton.left(data)) {
10672
10772
  this.tapWait();
@@ -11289,8 +11389,8 @@ function fills(fills, ui, canvas, renderOptions) {
11289
11389
  canvas.save();
11290
11390
  if (item.transform) canvas.transform(item.transform);
11291
11391
  if (originPaint.scaleFixed) {
11292
- const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
11293
- if (originPaint.scaleFixed === true || originPaint.scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) canvas.scale(1 / scaleX, 1 / scaleY);
11392
+ const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, originPaint.scaleFixed, false);
11393
+ if (scaleX !== 1) canvas.scale(scaleX, scaleY);
11294
11394
  }
11295
11395
  if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
11296
11396
  fillPathOrText(ui, canvas, renderOptions);
@@ -11461,7 +11561,7 @@ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas, renderO
11461
11561
  }
11462
11562
  }
11463
11563
 
11464
- const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
11564
+ const {getSpread: getSpread, copyAndSpread: copyAndSpread$2, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
11465
11565
 
11466
11566
  const tempBounds$2 = {};
11467
11567
 
@@ -11469,7 +11569,7 @@ function shape(ui, current, options) {
11469
11569
  const canvas = current.getSameCanvas();
11470
11570
  const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
11471
11571
  const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
11472
- toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$2, layout.boxBounds, layout.strokeSpread),
11572
+ toOuterOf(layout.strokeSpread ? (copyAndSpread$2(tempBounds$2, layout.boxBounds, layout.strokeSpread),
11473
11573
  tempBounds$2) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
11474
11574
  let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
11475
11575
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
@@ -11525,7 +11625,7 @@ function shape(ui, current, options) {
11525
11625
 
11526
11626
  let recycleMap;
11527
11627
 
11528
- const {stintSet: stintSet} = DataHelper, {hasTransparent: hasTransparent$1} = ColorConvert;
11628
+ const {stintSet: stintSet$2} = DataHelper, {hasTransparent: hasTransparent$1} = ColorConvert;
11529
11629
 
11530
11630
  function compute(attrName, ui) {
11531
11631
  const data = ui.__, leafPaints = [];
@@ -11549,12 +11649,12 @@ function compute(attrName, ui) {
11549
11649
  isTransparent = true;
11550
11650
  }
11551
11651
  if (attrName === "fill") {
11552
- stintSet(data, "__isAlphaPixelFill", isAlphaPixel);
11553
- stintSet(data, "__isTransparentFill", isTransparent);
11652
+ stintSet$2(data, "__isAlphaPixelFill", isAlphaPixel);
11653
+ stintSet$2(data, "__isTransparentFill", isTransparent);
11554
11654
  } else {
11555
- stintSet(data, "__isAlphaPixelStroke", isAlphaPixel);
11556
- stintSet(data, "__isTransparentStroke", isTransparent);
11557
- stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
11655
+ stintSet$2(data, "__isAlphaPixelStroke", isAlphaPixel);
11656
+ stintSet$2(data, "__isTransparentStroke", isTransparent);
11657
+ stintSet$2(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
11558
11658
  }
11559
11659
  } else {
11560
11660
  data.__removePaint(attrName, false);
@@ -11564,11 +11664,14 @@ function compute(attrName, ui) {
11564
11664
  function getLeafPaint(attrName, paint, ui) {
11565
11665
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
11566
11666
  let leafPaint;
11567
- const {boxBounds: boxBounds} = ui.__layout;
11568
- switch (paint.type) {
11667
+ const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
11668
+ switch (type) {
11569
11669
  case "image":
11670
+ case "film":
11671
+ case "video":
11570
11672
  if (!paint.url) return undefined;
11571
11673
  leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
11674
+ if (type !== "image") PaintImage[type](leafPaint);
11572
11675
  break;
11573
11676
 
11574
11677
  case "linear":
@@ -11584,7 +11687,7 @@ function getLeafPaint(attrName, paint, ui) {
11584
11687
  break;
11585
11688
 
11586
11689
  case "solid":
11587
- const {type: type, color: color, opacity: opacity} = paint;
11690
+ const {color: color, opacity: opacity} = paint;
11588
11691
  leafPaint = {
11589
11692
  type: type,
11590
11693
  style: ColorConvert.string(color, opacity)
@@ -11624,12 +11727,12 @@ const PaintModule = {
11624
11727
 
11625
11728
  let cache$1, box$2 = new Bounds;
11626
11729
 
11627
- const {isSame: isSame} = BoundsHelper;
11730
+ const {isSame: isSame$1} = BoundsHelper;
11628
11731
 
11629
11732
  function image(ui, attrName, paint, boxBounds, firstUse) {
11630
11733
  let leafPaint, event;
11631
- const image = ImageManager.get(paint);
11632
- if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
11734
+ const image = ImageManager.get(paint, paint.type);
11735
+ if (cache$1 && paint === cache$1.paint && isSame$1(boxBounds, cache$1.boxBounds)) {
11633
11736
  leafPaint = cache$1.leafPaint;
11634
11737
  } else {
11635
11738
  leafPaint = {
@@ -11689,8 +11792,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
11689
11792
  }
11690
11793
 
11691
11794
  function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
11692
- if (attrName === "fill" && !ui.__.__naturalWidth) {
11693
- const data = ui.__;
11795
+ const data = ui.__;
11796
+ if (attrName === "fill" && !data.__naturalWidth) {
11694
11797
  data.__naturalWidth = image.width / data.pixelRatio;
11695
11798
  data.__naturalHeight = image.height / data.pixelRatio;
11696
11799
  if (data.__autoSide) {
@@ -11702,7 +11805,13 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
11702
11805
  return false;
11703
11806
  }
11704
11807
  }
11705
- if (!leafPaint.data) PaintImage.createData(leafPaint, image, paint, boxBounds);
11808
+ if (!leafPaint.data) {
11809
+ PaintImage.createData(leafPaint, image, paint, boxBounds);
11810
+ const {transform: transform} = leafPaint.data, {opacity: opacity, blendMode: blendMode} = paint;
11811
+ const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
11812
+ if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
11813
+ }
11814
+ if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
11706
11815
  return true;
11707
11816
  }
11708
11817
 
@@ -11745,7 +11854,7 @@ function getPatternData(paint, box, image) {
11745
11854
  if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
11746
11855
  if (paint.mode === "strench") paint.mode = "stretch";
11747
11856
  const {width: width, height: height} = image;
11748
- 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;
11857
+ const {mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, interlace: interlace} = paint;
11749
11858
  const sameBox = box.width === width && box.height === height;
11750
11859
  const data = {
11751
11860
  mode: mode
@@ -11808,8 +11917,6 @@ function getPatternData(paint, box, image) {
11808
11917
  data.scaleX = scaleX;
11809
11918
  data.scaleY = scaleY;
11810
11919
  }
11811
- if (opacity && opacity < 1) data.opacity = opacity;
11812
- if (filters) data.filters = filters;
11813
11920
  if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
11814
11921
  if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
11815
11922
  type: "x",
@@ -11840,7 +11947,7 @@ const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translat
11840
11947
 
11841
11948
  function stretchMode(data, box, scaleX, scaleY) {
11842
11949
  const transform = get$2(), {x: x, y: y} = box;
11843
- if (x || y) translate(transform, x, y); else transform.onlyScale = true;
11950
+ if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
11844
11951
  scaleHelper(transform, scaleX, scaleY);
11845
11952
  data.transform = transform;
11846
11953
  }
@@ -11912,7 +12019,7 @@ function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
11912
12019
  translate(transform, box.x + x, box.y + y);
11913
12020
  }
11914
12021
 
11915
- const {get: get$1, scale: scale$1, copy: copy$4} = MatrixHelper;
12022
+ const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
11916
12023
 
11917
12024
  const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
11918
12025
 
@@ -11929,10 +12036,10 @@ function createPatternTask(paint, ui, canvas, renderOptions) {
11929
12036
  }
11930
12037
 
11931
12038
  function createPattern(paint, ui, canvas, renderOptions) {
11932
- let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
12039
+ let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
11933
12040
  if (paint.patternId !== id && !ui.destroyed) {
11934
12041
  if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
11935
- const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
12042
+ const {image: image, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11936
12043
  let imageMatrix, xGap, yGap, {width: width, height: height} = image;
11937
12044
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
11938
12045
  width *= scaleX;
@@ -11946,9 +12053,9 @@ function createPattern(paint, ui, canvas, renderOptions) {
11946
12053
  scaleY *= getFloorScale(height + (yGap || 0));
11947
12054
  imageMatrix = get$1();
11948
12055
  if (transform) copy$4(imageMatrix, transform);
11949
- scale$1(imageMatrix, 1 / scaleX, 1 / scaleY);
12056
+ scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
11950
12057
  }
11951
- const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
12058
+ const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
11952
12059
  const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
11953
12060
  paint.style = pattern;
11954
12061
  paint.patternId = id;
@@ -11969,15 +12076,15 @@ function getPatternFixScale(paint, imageScaleX, imageScaleY) {
11969
12076
  }
11970
12077
 
11971
12078
  function checkImage(paint, drawImage, ui, canvas, renderOptions) {
11972
- const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
12079
+ const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
11973
12080
  const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
11974
- if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting || snapshot) {
12081
+ if (!data || paint.patternId === id && !exporting || snapshot) {
11975
12082
  return false;
11976
12083
  } else {
11977
12084
  if (drawImage) {
11978
12085
  if (data.repeat) {
11979
12086
  drawImage = false;
11980
- } else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
12087
+ } else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
11981
12088
  drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
11982
12089
  }
11983
12090
  }
@@ -11995,20 +12102,21 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
11995
12102
  }
11996
12103
  }
11997
12104
 
11998
- function drawImage(paint, _imageScaleX, _imageScaleY, ui, canvas, _renderOptions) {
11999
- const {data: data, image: image} = paint, {blendMode: blendMode} = paint.originPaint, {opacity: opacity, transform: transform} = data, view = image.getFull(data.filters), u = ui.__;
12000
- let {width: width, height: height} = image, clipUI;
12001
- if ((clipUI = transform && !transform.onlyScale || u.path || u.cornerRadius) || opacity || blendMode) {
12105
+ function drawImage(paint, imageScaleX, imageScaleY, ui, canvas, _renderOptions) {
12106
+ const {data: data, image: image, complex: complex} = paint;
12107
+ let {width: width, height: height} = image;
12108
+ if (complex) {
12109
+ const {blendMode: blendMode, opacity: opacity} = paint.originPaint, {transform: transform} = data;
12002
12110
  canvas.save();
12003
- clipUI && canvas.clipUI(ui);
12111
+ complex === 2 && canvas.clipUI(ui);
12004
12112
  blendMode && (canvas.blendMode = blendMode);
12005
12113
  opacity && (canvas.opacity *= opacity);
12006
12114
  transform && canvas.transform(transform);
12007
- canvas.drawImage(view, 0, 0, width, height);
12115
+ image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
12008
12116
  canvas.restore();
12009
12117
  } else {
12010
12118
  if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
12011
- canvas.drawImage(view, 0, 0, width, height);
12119
+ image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
12012
12120
  }
12013
12121
  }
12014
12122
 
@@ -12038,6 +12146,7 @@ function recycleImage(attrName, data) {
12038
12146
  if (!recycleMap) recycleMap = {};
12039
12147
  recycleMap[url] = true;
12040
12148
  ImageManager.recyclePaint(paint);
12149
+ if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf);
12041
12150
  if (image.loading) {
12042
12151
  if (!input) {
12043
12152
  input = data.__input && data.__input[attrName] || [];
@@ -13001,8 +13110,11 @@ function targetAttr(fn) {
13001
13110
  });
13002
13111
  if (isObject(check)) value = check; else if (check === false) return;
13003
13112
  }
13004
- t.setDimOthers(false);
13005
- t.setBright(false);
13113
+ const {dimOthers: dimOthers, bright: bright} = t.editBox.mergedConfig || t.config;
13114
+ if (!isUndefined(dimOthers) || !isUndefined(bright)) {
13115
+ t.setDimOthers(false);
13116
+ t.setBright(false);
13117
+ }
13006
13118
  if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
13007
13119
  if (t.single) {
13008
13120
  delete t.element.syncEventer;
@@ -13027,7 +13139,8 @@ function mergeConfigAttr() {
13027
13139
  return (target, key) => {
13028
13140
  defineKey(target, key, {
13029
13141
  get() {
13030
- const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
13142
+ const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, editTool: editTool, innerEditor: innerEditor, app: app} = this, mergeConfig = Object.assign({}, config);
13143
+ if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig); else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig);
13031
13144
  if (element && element.editConfig) {
13032
13145
  let {editConfig: editConfig} = element;
13033
13146
  if (editConfig.hover || editConfig.hoverStyle) {
@@ -13293,6 +13406,7 @@ class EditSelect extends Group {
13293
13406
  } else {
13294
13407
  editor.target = find;
13295
13408
  }
13409
+ e.path.needUpdate = true;
13296
13410
  } else if (this.allow(e.target)) {
13297
13411
  if (!this.isHoldMultipleSelectKey(e) && !this.editor.mergedConfig.selectKeep) editor.target = null;
13298
13412
  }
@@ -13929,8 +14043,10 @@ class EditBox extends Group {
13929
14043
  const {editMask: editMask} = editor;
13930
14044
  const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
13931
14045
  editMask.visible = mask ? true : 0;
13932
- editor.setDimOthers(dimOthers);
13933
- editor.setBright(!!dimOthers || bright);
14046
+ if (!isUndefined(dimOthers) || !isUndefined(bright)) {
14047
+ editor.setDimOthers(dimOthers);
14048
+ editor.setBright(!!dimOthers || bright);
14049
+ }
13934
14050
  if (spread) BoundsHelper.spread(bounds, spread);
13935
14051
  if (this.view.worldOpacity) {
13936
14052
  const {width: width, height: height} = bounds;
@@ -13949,7 +14065,8 @@ class EditBox extends Group {
13949
14065
  resizeL = resizeLines[(i - 1) / 2];
13950
14066
  resizeL.set(point);
13951
14067
  resizeL.visible = resizeP.visible && !hideResizeLines;
13952
- resizeP.visible = rotateP.visible = showPoints && !!middlePoint;
14068
+ if (resizeP.visible) resizeP.visible = !!middlePoint;
14069
+ if (rotateP.visible) rotateP.visible = !!middlePoint;
13953
14070
  if ((i + 1) / 2 % 2) {
13954
14071
  resizeL.width = width + resizeL.height;
13955
14072
  if (hideOnSmall && resizeP.width * 2 > width) resizeP.visible = false;
@@ -14511,6 +14628,7 @@ class SimulateElement extends Rect {
14511
14628
  this.checkChange = true;
14512
14629
  this.canChange = true;
14513
14630
  this.visible = this.hittable = false;
14631
+ this.skipJSON = true;
14514
14632
  this.on(PropertyEvent.CHANGE, event => {
14515
14633
  if (this.checkChange && checkMap[event.attrName]) {
14516
14634
  const {attrName: attrName, newValue: newValue, oldValue: oldValue} = event;
@@ -15749,6 +15867,8 @@ function setFill(style, fill) {
15749
15867
  break;
15750
15868
 
15751
15869
  case "image":
15870
+ case "film":
15871
+ case "video":
15752
15872
  break;
15753
15873
 
15754
15874
  case "linear":
@@ -15967,9 +16087,14 @@ function addViewport(leafer, mergeConfig, custom) {
15967
16087
  }), leafer.on_(MoveEvent.END, e => {
15968
16088
  LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
15969
16089
  }), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
15970
- const {zoomLayer: zoomLayer} = leafer;
16090
+ const {zoomLayer: zoomLayer, layouter: layouter} = leafer;
15971
16091
  const changeScale = leafer.getValidScale(e.scale);
15972
- if (changeScale !== 1) zoomLayer.scaleOfWorld(e, changeScale);
16092
+ if (changeScale !== 1) {
16093
+ layouter.stop();
16094
+ LeafHelper.updateMatrix(leafer);
16095
+ zoomLayer.scaleOfWorld(e, changeScale);
16096
+ layouter.start();
16097
+ }
15973
16098
  }));
15974
16099
  }
15975
16100
 
@@ -16895,7 +17020,7 @@ Arrow = __decorate([ registerUI() ], Arrow);
16895
17020
 
16896
17021
  const {M: M$2, L: L$2, C: C$2, Q: Q$1, O: O$1} = PathCommandMap;
16897
17022
 
16898
- const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale} = PointHelper;
17023
+ const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale$1} = PointHelper;
16899
17024
 
16900
17025
  const point$1 = {};
16901
17026
 
@@ -16942,7 +17067,7 @@ const PathMatrixHelper = {
16942
17067
  function setPoint$2(data, startIndex, x, y, scaleX, scaleY, rotation, origin) {
16943
17068
  copyFrom$1(point$1, data[startIndex], data[startIndex + 1]);
16944
17069
  if (rotation) rotate$1(point$1, rotation, origin);
16945
- if (scaleX) scale(point$1, scaleX, scaleY);
17070
+ if (scaleX) scale$1(point$1, scaleX, scaleY);
16946
17071
  data[startIndex] = x + point$1.x;
16947
17072
  data[startIndex + 1] = y + point$1.y;
16948
17073
  }
@@ -16951,12 +17076,14 @@ const {layout: layout$2, rotate: rotate} = PathMatrixHelper;
16951
17076
 
16952
17077
  const {getAngle: getAngle} = PointHelper;
16953
17078
 
16954
- const half = {
17079
+ const zero = {
17080
+ x: 0
17081
+ }, half = {
16955
17082
  x: -.5
16956
17083
  };
16957
17084
 
16958
17085
  const angle = {
16959
- connect: half,
17086
+ connect: zero,
16960
17087
  offset: {
16961
17088
  x: -.71,
16962
17089
  bevelJoin: .36,
@@ -16977,73 +17104,110 @@ const angleSide = {
16977
17104
 
16978
17105
  const triangleLinePath = [ 1, -3, 0, 2, -3, -2, 2, 0, 0, 2, -3, 2, 2, -3, 0 ];
16979
17106
 
16980
- const triangle = {
16981
- connect: half,
17107
+ const triangleFill = {
17108
+ connect: zero,
16982
17109
  offset: {
16983
17110
  x: -.9,
16984
17111
  bevelJoin: .624,
16985
17112
  roundJoin: .4
16986
17113
  },
16987
- path: [ ...triangleLinePath, 1, -2.05, 1.1, 2, -2.05, -1.1 ],
16988
- dashPath: [ 1, -2, 0, 2, -.5, 0 ]
17114
+ path: [ ...triangleLinePath ]
16989
17115
  };
16990
17116
 
16991
- const arrowLinePath = [ 1, -3, 0, 2, -3.5, -1.8, 2, 0, 0, 2, -3.5, 1.8, 2, -3, 0 ];
17117
+ const triangle = DataHelper.clone(triangleFill);
16992
17118
 
16993
- const arrow = {
16994
- connect: half,
16995
- offset: {
16996
- x: -1.1,
16997
- bevelJoin: .872,
16998
- roundJoin: .6
16999
- },
17000
- path: [ ...arrowLinePath, 1, -2.25, .95, 2, -2.25, -.95 ],
17001
- dashPath: [ 1, -3, 0, 2, -.5, 0 ]
17119
+ triangle.path = [ ...triangleLinePath, 1, -2.05, 1.1, 2, -2.05, -1.1 ];
17120
+
17121
+ triangle.dashPath = [ 1, -2, 0, 2, -.5, 0 ];
17122
+
17123
+ const triangleFlipFill = {
17124
+ connect: zero,
17125
+ offset: half,
17126
+ path: [ ...triangleFill.path ]
17002
17127
  };
17003
17128
 
17004
17129
  const triangleFlip = {
17130
+ connect: zero,
17005
17131
  offset: half,
17006
17132
  path: [ ...triangle.path ],
17007
17133
  dashPath: [ 1, -2.5, 0, 2, -1, 0 ]
17008
17134
  };
17009
17135
 
17136
+ rotate(triangleFlipFill.path, 180, {
17137
+ x: -1.5,
17138
+ y: 0
17139
+ });
17140
+
17010
17141
  rotate(triangleFlip.path, 180, {
17011
17142
  x: -1.5,
17012
17143
  y: 0
17013
17144
  });
17014
17145
 
17146
+ const arrowLinePath = [ 1, -3, 0, 2, -3.5, -1.8, 2, 0, 0, 2, -3.5, 1.8, 2, -3, 0 ];
17147
+
17148
+ const arrowFill = {
17149
+ connect: zero,
17150
+ offset: {
17151
+ x: -1.1,
17152
+ bevelJoin: .872,
17153
+ roundJoin: .6
17154
+ },
17155
+ path: [ ...arrowLinePath ]
17156
+ };
17157
+
17158
+ const arrow = DataHelper.clone(arrowFill);
17159
+
17160
+ arrow.path = [ ...arrowLinePath, 1, -2.25, .95, 2, -2.25, -.95 ];
17161
+
17162
+ arrow.dashPath = [ 1, -3, 0, 2, -.5, 0 ];
17163
+
17015
17164
  const circleLine = {
17016
17165
  connect: {
17017
- x: -1.3
17166
+ x: -1.8
17018
17167
  },
17019
17168
  path: [ 1, 1.8, -.1, 2, 1.8, 0, 26, 0, 0, 1.8, 0, 359, 0 ]
17020
17169
  };
17021
17170
 
17022
- const circle = {
17171
+ const circleFill = {
17023
17172
  connect: {
17024
17173
  x: .5
17025
17174
  },
17026
- path: [ ...circleLine.path, 1, 0, 0, 26, 0, 0, 1, 0, 360, 0 ],
17027
- dashPath: [ 1, -.5, 0, 2, .5, 0 ]
17175
+ path: [ ...circleLine.path ]
17028
17176
  };
17029
17177
 
17178
+ const circle = DataHelper.clone(circleFill);
17179
+
17180
+ circle.path = [ ...circleLine.path, 1, 0, 0, 26, 0, 0, 1, 0, 360, 0 ];
17181
+
17182
+ circle.dashPath = [ 1, -.5, 0, 2, .5, 0 ];
17183
+
17030
17184
  const squareLine = {
17031
17185
  connect: {
17032
- x: -1.3
17186
+ x: -1.4
17033
17187
  },
17034
17188
  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 ]
17035
17189
  };
17036
17190
 
17191
+ const squareFill = {
17192
+ path: [ ...squareLine.path ]
17193
+ };
17194
+
17037
17195
  const square = {
17038
17196
  path: [ ...squareLine.path, 2, -1.4, -.49, 2, 1, -.49, 1, -1.4, .49, 2, 1, .49 ]
17039
17197
  };
17040
17198
 
17041
17199
  const diamondLine = DataHelper.clone(squareLine);
17042
17200
 
17201
+ diamondLine.connect.x = -1.9;
17202
+
17203
+ const diamondFill = DataHelper.clone(squareFill);
17204
+
17043
17205
  const diamond = DataHelper.clone(square);
17044
17206
 
17045
17207
  rotate(diamondLine.path, 45);
17046
17208
 
17209
+ rotate(diamondFill.path, 45);
17210
+
17047
17211
  rotate(diamond.path, 45);
17048
17212
 
17049
17213
  const mark = {
@@ -17066,19 +17230,34 @@ const arrows = {
17066
17230
  mark: mark
17067
17231
  };
17068
17232
 
17233
+ const fillArrows = {
17234
+ triangle: triangleFill,
17235
+ "triangle-flip": triangleFlipFill,
17236
+ arrow: arrowFill,
17237
+ circle: circleFill,
17238
+ square: squareFill,
17239
+ diamond: diamondFill
17240
+ };
17241
+
17069
17242
  function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern) {
17070
- let pathData, scale;
17243
+ let pathData, scale = 1, rotation = 0, fill;
17071
17244
  const {strokeCap: strokeCap, strokeJoin: strokeJoin} = ui.__;
17072
17245
  if (isObject(arrow)) {
17073
17246
  if (arrow.type) {
17074
- scale = arrow.scale;
17247
+ scale = arrow.scale || 1;
17248
+ rotation = arrow.rotation || 0;
17075
17249
  pathData = arrows[arrow.type];
17250
+ if (scale > 1) {
17251
+ const fillData = fillArrows[arrow.type];
17252
+ if (fillData) pathData = fillData, fill = true;
17253
+ }
17076
17254
  } else pathData = arrow;
17077
17255
  } else {
17078
17256
  pathData = arrows[arrow];
17079
17257
  }
17258
+ if (!fill) fill = pathData.fill;
17080
17259
  const {offset: offset, connect: connect, path: path, dashPath: dashPath} = pathData;
17081
- let connectX = connect ? connect.x : 0;
17260
+ let connectX = connect ? connect.x * scale : 0;
17082
17261
  let offsetX = offset ? offset.x : 0;
17083
17262
  const data = [ ...path ];
17084
17263
  if (hasDashPattern && dashPath) data.push(...dashPath);
@@ -17086,28 +17265,38 @@ function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern)
17086
17265
  if (offset) {
17087
17266
  if (strokeJoin === "round" && offset.roundJoin) offsetX += offset.roundJoin; else if (strokeJoin === "bevel" && offset.bevelJoin) offsetX += offset.bevelJoin;
17088
17267
  }
17089
- if (scale) layout$2(data, 0, 0, scale, scale);
17268
+ if (scale !== 1) layout$2(data, 0, 0, scale, scale);
17090
17269
  if (offsetX) layout$2(data, offsetX, 0);
17091
- layout$2(data, to.x, to.y, size, size, getAngle(from, to));
17270
+ layout$2(data, to.x, to.y, size, size, getAngle(from, to) + rotation);
17092
17271
  connectOffset.x = (connectX + offsetX) * size;
17093
- return data;
17272
+ const arrowData = {
17273
+ data: data
17274
+ };
17275
+ if (fill) arrowData.fill = fill;
17276
+ return arrowData;
17094
17277
  }
17095
17278
 
17096
17279
  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;
17097
17280
 
17098
- const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint} = PointHelper;
17281
+ const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
17282
+
17283
+ const {stintSet: stintSet$1} = DataHelper;
17099
17284
 
17100
17285
  const connectPoint = {};
17101
17286
 
17102
17287
  const first = {}, second = {};
17103
17288
 
17104
- const last = {}, now = {};
17289
+ const old = {}, last = {}, now = {};
17105
17290
 
17106
17291
  const PathArrowModule = {
17107
17292
  list: arrows,
17108
- addArrows(ui) {
17109
- const {startArrow: startArrow, endArrow: endArrow, strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data, cornerRadius: cornerRadius} = ui.__;
17293
+ fillList: fillArrows,
17294
+ addArrows(ui, updateCache) {
17295
+ const uData = ui.__;
17296
+ const {startArrow: startArrow, endArrow: endArrow, __strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data, cornerRadius: cornerRadius} = uData;
17110
17297
  const clonePathForArrow = !cornerRadius;
17298
+ if (!updateCache) uData.__strokeWidthCache = strokeWidth;
17299
+ let startArrowPath, singleStartArrow, endArrowPath, singleEndArrow;
17111
17300
  let command, i = 0, len = data.length, count = 0, useStartArrow = startArrow && startArrow !== "none";
17112
17301
  while (i < len) {
17113
17302
  command = data[i];
@@ -17115,6 +17304,7 @@ const PathArrowModule = {
17115
17304
  case M$1:
17116
17305
  case L$1:
17117
17306
  if (count < 2 || i + 6 >= len) {
17307
+ copy(old, now);
17118
17308
  copyFrom(now, data[i + 1], data[i + 2]);
17119
17309
  if (!count && useStartArrow) copy(first, now);
17120
17310
  }
@@ -17122,12 +17312,18 @@ const PathArrowModule = {
17122
17312
  break;
17123
17313
 
17124
17314
  case C$1:
17125
- if (count === 1 || i + 7 >= len - 3) copyPoints(data, last, now, i + 3);
17315
+ if (count === 1 || i + 7 >= len - 3) {
17316
+ copyPoints(data, last, now, i + 3);
17317
+ old.x = data[i + 1], old.y = data[i + 2];
17318
+ }
17126
17319
  i += 7;
17127
17320
  break;
17128
17321
 
17129
17322
  case Q:
17130
- if (count === 1 || i + 5 >= len - 3) copyPoints(data, last, now, i + 1);
17323
+ if (count === 1 || i + 5 >= len - 3) {
17324
+ copyPoints(data, last, now, i + 1);
17325
+ copy(old, last);
17326
+ }
17131
17327
  i += 5;
17132
17328
  break;
17133
17329
 
@@ -17165,6 +17361,7 @@ const PathArrowModule = {
17165
17361
  case U:
17166
17362
  if (count === 1 || i + 6 >= len - 3) {
17167
17363
  copyPoints(data, last, now, i + 1);
17364
+ copy(old, last);
17168
17365
  if (i + 6 !== len) {
17169
17366
  now.x -= (now.x - last.x) / 10;
17170
17367
  now.y -= (now.y - last.y) / 10;
@@ -17175,13 +17372,13 @@ const PathArrowModule = {
17175
17372
  }
17176
17373
  count++;
17177
17374
  if (count === 1 && command !== M$1) return;
17178
- if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : last);
17375
+ if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : isSame(old, first) ? last : old);
17179
17376
  if (i === len) {
17180
- const path = ui.__.__pathForRender = clonePathForArrow ? [ ...data ] : data;
17181
- const pathForArrow = ui.__.__pathForArrow = [];
17377
+ const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
17182
17378
  if (useStartArrow) {
17183
- const startArrowPath = getArrowPath(ui, startArrow, second, first, strokeWidth, connectPoint, !!dashPattern);
17184
- dashPattern ? pathForArrow.push(...startArrowPath) : path.push(...startArrowPath);
17379
+ startArrowPath = getArrowPath(ui, startArrow, second, first, strokeWidth, connectPoint, !!dashPattern);
17380
+ singleStartArrow = startArrowPath.fill || dashPattern;
17381
+ if (!singleStartArrow) path.push(...startArrowPath.data);
17185
17382
  if (connectPoint.x) {
17186
17383
  getDistancePoint(first, second, -connectPoint.x, true);
17187
17384
  path[1] = second.x;
@@ -17189,8 +17386,10 @@ const PathArrowModule = {
17189
17386
  }
17190
17387
  }
17191
17388
  if (endArrow && endArrow !== "none") {
17192
- const endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
17193
- dashPattern ? pathForArrow.push(...endArrowPath) : path.push(...endArrowPath);
17389
+ if (isSame(last, now)) copy(last, old);
17390
+ endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
17391
+ singleEndArrow = endArrowPath.fill || dashPattern;
17392
+ if (!singleEndArrow) path.push(...endArrowPath.data);
17194
17393
  if (connectPoint.x) {
17195
17394
  getDistancePoint(now, last, -connectPoint.x, true);
17196
17395
  let index;
@@ -17217,10 +17416,21 @@ const PathArrowModule = {
17217
17416
  } else {
17218
17417
  copy(last, now);
17219
17418
  }
17419
+ stintSet$1(uData, "__startArrowPath", singleStartArrow && startArrowPath);
17420
+ stintSet$1(uData, "__endArrowPath", singleEndArrow && endArrowPath);
17220
17421
  }
17221
17422
  },
17222
- register(name, data) {
17423
+ updateArrow(ui) {
17424
+ const data = ui.__;
17425
+ if (data.strokeScaleFixed) {
17426
+ if (data.__strokeWidthCache !== data.__strokeWidth) {
17427
+ ui.__updateRenderPath(true);
17428
+ }
17429
+ }
17430
+ },
17431
+ register(name, data, fillData) {
17223
17432
  this.list[name] = data;
17433
+ if (fillData) this.fillList[name] = data;
17224
17434
  },
17225
17435
  get(name) {
17226
17436
  return this.list[name];
@@ -17246,12 +17456,26 @@ UI.addAttr("endArrow", "none", arrowType);
17246
17456
  Object.assign(PathArrow, PathArrowModule);
17247
17457
 
17248
17458
  Object.assign(Paint, {
17249
- strokeArrow(_stroke, ui, canvas, _renderOptions) {
17250
- if (ui.__.dashPattern) {
17459
+ strokeArrow(stroke, ui, canvas, _renderOptions) {
17460
+ const {__startArrowPath: __startArrowPath, __endArrowPath: __endArrowPath, dashPattern: dashPattern} = ui.__;
17461
+ if (dashPattern) canvas.dashPattern = null;
17462
+ if (__startArrowPath) {
17463
+ canvas.beginPath();
17464
+ ui.__drawPathByData(canvas, __startArrowPath.data);
17465
+ canvas.stroke();
17466
+ if (__startArrowPath.fill) {
17467
+ canvas.fillStyle = stroke;
17468
+ canvas.fill();
17469
+ }
17470
+ }
17471
+ if (__endArrowPath) {
17251
17472
  canvas.beginPath();
17252
- ui.__drawPathByData(canvas, ui.__.__pathForArrow);
17253
- canvas.dashPattern = null;
17473
+ ui.__drawPathByData(canvas, __endArrowPath.data);
17254
17474
  canvas.stroke();
17475
+ if (__endArrowPath.fill) {
17476
+ canvas.fillStyle = stroke;
17477
+ canvas.fill();
17478
+ }
17255
17479
  }
17256
17480
  }
17257
17481
  });
@@ -17713,7 +17937,7 @@ UI.addAttr("autoHeight", undefined, autoBoundsType);
17713
17937
 
17714
17938
  UI.addAttr("autoBox", undefined, boundsType);
17715
17939
 
17716
- const {copyAndSpread: copyAndSpread} = BoundsHelper;
17940
+ const {copyAndSpread: copyAndSpread$1} = BoundsHelper;
17717
17941
 
17718
17942
  box$1.__updateFlowLayout = function() {
17719
17943
  const {leaferIsCreated: leaferIsCreated, flow: flow} = this;
@@ -17745,7 +17969,7 @@ box$1.__updateContentBounds = function() {
17745
17969
  const same = layout.contentBounds === layout.boxBounds;
17746
17970
  if (padding) {
17747
17971
  if (same) layout.shrinkContent();
17748
- copyAndSpread(layout.contentBounds, layout.boxBounds, padding, true);
17972
+ copyAndSpread$1(layout.contentBounds, layout.boxBounds, padding, true);
17749
17973
  } else {
17750
17974
  if (!same) layout.shrinkContentCancel();
17751
17975
  }
@@ -17767,7 +17991,7 @@ box$1.__updateBoxBounds = function(secondLayout) {
17767
17991
  boxBounds.width = data.width, boxBounds.x = 0;
17768
17992
  }
17769
17993
  }
17770
- flow && secondLayout && data.padding && copyAndSpread(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : data.__autoWidth ? "width" : "height");
17994
+ flow && secondLayout && data.padding && copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : data.__autoWidth ? "width" : "height");
17771
17995
  this.__updateNaturalSize();
17772
17996
  } else {
17773
17997
  this.__updateRectBoxBounds();
@@ -19624,6 +19848,9 @@ let Robot = class Robot extends UI {
19624
19848
  constructor(data) {
19625
19849
  super(data);
19626
19850
  }
19851
+ togglePlay() {
19852
+ this.running ? this.pause() : this.play();
19853
+ }
19627
19854
  play() {
19628
19855
  this.running = true;
19629
19856
  }
@@ -19748,9 +19975,7 @@ const {Yes: Yes, NoAndSkip: NoAndSkip, YesAndSkip: YesAndSkip} = Answer;
19748
19975
  const idCondition = {}, classNameCondition = {}, tagCondition = {};
19749
19976
 
19750
19977
  class Finder {
19751
- constructor(target) {
19752
- this.innerIdMap = {};
19753
- this.idMap = {};
19978
+ constructor(target, _config) {
19754
19979
  this.methods = {
19755
19980
  id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf),
19756
19981
  1) : 0,
@@ -19760,6 +19985,13 @@ class Finder {
19760
19985
  tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
19761
19986
  tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
19762
19987
  };
19988
+ this.idMap = {};
19989
+ this.innerIdMap = {};
19990
+ const app = target && target.app;
19991
+ if (app) {
19992
+ app.idMap ? this.idMap = app.idMap : app.idMap = this.idMap;
19993
+ app.innerIdMap ? this.innerIdMap = app.innerIdMap : app.innerIdMap = this.innerIdMap;
19994
+ }
19763
19995
  if (this.target = target) this.__listenEvents();
19764
19996
  }
19765
19997
  getBy(condition, branch, one, options) {
@@ -19886,8 +20118,14 @@ ui.findOne = function(condition, options) {
19886
20118
 
19887
20119
  Plugin.add("find");
19888
20120
 
19889
- Creator.finder = function(target) {
19890
- return new Finder(target);
20121
+ Creator.finder = function(target, config) {
20122
+ return new Finder(target, config);
20123
+ };
20124
+
20125
+ LeafHelper.cacheId = function(t) {
20126
+ const {leafer: leafer, id: id} = t;
20127
+ if (id) leafer.app.idMap[id] = t;
20128
+ if (leafer.cacheInnerId) leafer.app.innerIdMap[t.innerId] = t;
19891
20129
  };
19892
20130
 
19893
20131
  const {setPoint: setPoint, addPoint: addPoint, toBounds: toBounds} = TwoPointBoundsHelper;
@@ -20180,7 +20418,7 @@ const config = {
20180
20418
  style: {
20181
20419
  dragBoundsType: "outer",
20182
20420
  strokeAlign: "center",
20183
- strokeWidthFixed: "zoom-in",
20421
+ strokeScaleFixed: "zoom-in",
20184
20422
  width: 6,
20185
20423
  height: 6,
20186
20424
  opacity: .5,
@@ -20429,4 +20667,48 @@ Scroller.registerTheme("dark", {
20429
20667
  }
20430
20668
  });
20431
20669
 
20432
- export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
20670
+ const {stintSet: stintSet} = DataHelper;
20671
+
20672
+ function scaleFixedType(defaultValue) {
20673
+ return decorateLeafAttr(defaultValue, key => attr({
20674
+ set(value) {
20675
+ if (this.__setAttr(key, value)) {
20676
+ const layout = this.__layout;
20677
+ doBoundsType(this);
20678
+ if (!isNumber(value)) value = value ? 1 : 0;
20679
+ stintSet(layout, "scaleFixed", value);
20680
+ stintSet(layout, "outerScale", value ? 1 / value : 0);
20681
+ if (!layout.outerScale && layout.localOuterBounds) layout.localOuterBounds = undefined;
20682
+ }
20683
+ }
20684
+ }));
20685
+ }
20686
+
20687
+ const {scale: scale} = MatrixHelper;
20688
+
20689
+ const {copyAndSpread: copyAndSpread} = BoundsHelper;
20690
+
20691
+ const {getScaleFixedData: getScaleFixedData} = MathHelper;
20692
+
20693
+ LeafHelper.updateScaleFixedWorld = function(t) {
20694
+ const {__world: __world, __: __} = t, {scaleX: scaleX, scaleY: scaleY} = getScaleFixedData(__world, __.scaleFixed);
20695
+ if (scaleX !== 1) {
20696
+ scale(__world, scaleX, scaleY);
20697
+ __world.scaleX *= scaleX, __world.scaleY *= scaleY;
20698
+ }
20699
+ };
20700
+
20701
+ LeafHelper.updateOuterBounds = function(t) {
20702
+ const layout = t.__layout, {localRenderBounds: localRenderBounds} = layout;
20703
+ const localOuterBounds = layout.localOuterBounds || (layout.localOuterBounds = {});
20704
+ const {width: width, height: height} = localRenderBounds;
20705
+ const scale = layout.outerScale - 1;
20706
+ copyAndSpread(localOuterBounds, localRenderBounds, [ height * scale, width * scale ]);
20707
+ if (t.parent) t.parent.__layout.renderChange();
20708
+ };
20709
+
20710
+ Plugin.add("scale-fixed");
20711
+
20712
+ UI.addAttr("scaleFixed", undefined, scaleFixedType);
20713
+
20714
+ export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };