leafer-game 2.2.5 → 2.2.7

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.
@@ -472,7 +472,7 @@ const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
472
472
 
473
473
  const {float: float$5} = MathHelper;
474
474
 
475
- const tempPoint$6 = {};
475
+ const tempPoint$7 = {};
476
476
 
477
477
  function getWorld() {
478
478
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
@@ -531,8 +531,8 @@ const MatrixHelper = {
531
531
  to.f = t.f * pixelRatio;
532
532
  },
533
533
  scaleOfOuter(t, origin, scaleX, scaleY) {
534
- M$7.toInnerPoint(t, origin, tempPoint$6);
535
- M$7.scaleOfInner(t, tempPoint$6, scaleX, scaleY);
534
+ M$7.toInnerPoint(t, origin, tempPoint$7);
535
+ M$7.scaleOfInner(t, tempPoint$7, scaleX, scaleY);
536
536
  },
537
537
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
538
538
  M$7.translateInner(t, origin.x, origin.y);
@@ -550,8 +550,8 @@ const MatrixHelper = {
550
550
  t.d = c * sinR + d * cosR;
551
551
  },
552
552
  rotateOfOuter(t, origin, rotation) {
553
- M$7.toInnerPoint(t, origin, tempPoint$6);
554
- M$7.rotateOfInner(t, tempPoint$6, rotation);
553
+ M$7.toInnerPoint(t, origin, tempPoint$7);
554
+ M$7.rotateOfInner(t, tempPoint$7, rotation);
555
555
  },
556
556
  rotateOfInner(t, origin, rotation) {
557
557
  M$7.translateInner(t, origin.x, origin.y);
@@ -572,8 +572,8 @@ const MatrixHelper = {
572
572
  }
573
573
  },
574
574
  skewOfOuter(t, origin, skewX, skewY) {
575
- M$7.toInnerPoint(t, origin, tempPoint$6);
576
- M$7.skewOfInner(t, tempPoint$6, skewX, skewY);
575
+ M$7.toInnerPoint(t, origin, tempPoint$7);
576
+ M$7.skewOfInner(t, tempPoint$7, skewX, skewY);
577
577
  },
578
578
  skewOfInner(t, origin, skewX, skewY = 0) {
579
579
  M$7.translateInner(t, origin.x, origin.y);
@@ -1000,7 +1000,7 @@ class Point {
1000
1000
  }
1001
1001
  }
1002
1002
 
1003
- const tempPoint$5 = new Point;
1003
+ const tempPoint$6 = new Point;
1004
1004
 
1005
1005
  class Matrix {
1006
1006
  constructor(a, b, c, d, e, f) {
@@ -1904,7 +1904,7 @@ function getNameList(name) {
1904
1904
 
1905
1905
  const D$5 = Debug;
1906
1906
 
1907
- const debug$g = Debug.get("RunTime");
1907
+ const debug$h = Debug.get("RunTime");
1908
1908
 
1909
1909
  const Run = {
1910
1910
  currentId: 0,
@@ -1923,7 +1923,7 @@ const Run = {
1923
1923
  const time = R$1.idMap[id], name = R$1.nameMap[id];
1924
1924
  const duration = microsecond ? (performance.now() - time) / 1e3 : Date.now() - time;
1925
1925
  R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1926
- debug$g.log(name, duration, "ms");
1926
+ debug$h.log(name, duration, "ms");
1927
1927
  },
1928
1928
  endOfName(name, microsecond) {
1929
1929
  const id = R$1.nameToIdMap[name];
@@ -1959,18 +1959,18 @@ const Creator = {
1959
1959
  }
1960
1960
  };
1961
1961
 
1962
- const debug$f = Debug.get("UICreator");
1962
+ const debug$g = Debug.get("UICreator");
1963
1963
 
1964
1964
  const UICreator = {
1965
1965
  list: {},
1966
1966
  register(UI) {
1967
1967
  const {__tag: tag} = UI.prototype;
1968
- if (list$1[tag]) debug$f.repeat(tag);
1968
+ if (list$1[tag]) debug$g.repeat(tag);
1969
1969
  list$1[tag] = UI;
1970
1970
  },
1971
1971
  get(tag, data, x, y, width, height) {
1972
1972
  if (!list$1[tag]) {
1973
- debug$f.warn("not register " + tag);
1973
+ debug$g.warn("not register " + tag);
1974
1974
  return undefined;
1975
1975
  }
1976
1976
  const ui = new list$1[tag](data);
@@ -1986,7 +1986,7 @@ const UICreator = {
1986
1986
 
1987
1987
  const {list: list$1} = UICreator;
1988
1988
 
1989
- const debug$e = Debug.get("EventCreator");
1989
+ const debug$f = Debug.get("EventCreator");
1990
1990
 
1991
1991
  const EventCreator = {
1992
1992
  nameList: {},
@@ -1994,7 +1994,7 @@ const EventCreator = {
1994
1994
  let name;
1995
1995
  Object.keys(Event).forEach(key => {
1996
1996
  name = Event[key];
1997
- if (isString(name)) nameList[name] && debug$e.repeat(name), nameList[name] = Event;
1997
+ if (isString(name)) nameList[name] && debug$f.repeat(name), nameList[name] = Event;
1998
1998
  });
1999
1999
  },
2000
2000
  changeName(oldName, newName) {
@@ -2715,7 +2715,7 @@ const {set: set$3, toNumberPoints: toNumberPoints} = PointHelper;
2715
2715
 
2716
2716
  const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$6} = PathCommandMap;
2717
2717
 
2718
- const tempPoint$4 = {};
2718
+ const tempPoint$5 = {};
2719
2719
 
2720
2720
  const BezierHelper = {
2721
2721
  points(data, originPoints, curve, close) {
@@ -2889,8 +2889,8 @@ const BezierHelper = {
2889
2889
  addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
2890
2890
  addPoint$1(pointBounds, toX, toY);
2891
2891
  for (let i = 0, len = tList.length; i < len; i++) {
2892
- getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$4);
2893
- addPoint$1(pointBounds, tempPoint$4.x, tempPoint$4.y);
2892
+ getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$5);
2893
+ addPoint$1(pointBounds, tempPoint$5.x, tempPoint$5.y);
2894
2894
  }
2895
2895
  },
2896
2896
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
@@ -3003,7 +3003,7 @@ const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse
3003
3003
 
3004
3004
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
3005
3005
 
3006
- const debug$d = Debug.get("PathConvert");
3006
+ const debug$e = Debug.get("PathConvert");
3007
3007
 
3008
3008
  const setEndPoint$1 = {};
3009
3009
 
@@ -3270,7 +3270,7 @@ const PathConvert = {
3270
3270
  break;
3271
3271
 
3272
3272
  default:
3273
- debug$d.error(`command: ${command} [index:${i}]`, old);
3273
+ debug$e.error(`command: ${command} [index:${i}]`, old);
3274
3274
  return data;
3275
3275
  }
3276
3276
  lastCommand = command;
@@ -3333,7 +3333,10 @@ const {tan: tan, min: min$1, abs: abs$5} = Math;
3333
3333
 
3334
3334
  const startPoint = {};
3335
3335
 
3336
+ const debug$d = Debug.get("PointsCurve");
3337
+
3336
3338
  const PathCommandDataHelper = {
3339
+ pointsCurveList: {},
3337
3340
  beginPath(data) {
3338
3341
  data.length = 0;
3339
3342
  },
@@ -3403,12 +3406,22 @@ const PathCommandDataHelper = {
3403
3406
  data.push(M$4, startPoint.x, startPoint.y);
3404
3407
  arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
3405
3408
  },
3406
- drawPoints(data, points, curve, close) {
3407
- BezierHelper.points(data, points, curve, close);
3409
+ drawPoints(data, points, curve, close, options) {
3410
+ let type = "Q";
3411
+ if (isObject(curve)) type = curve.type, curve = curve.value;
3412
+ if (!pointsCurveList[type]) debug$d.warn("not found:", type), type = "Q";
3413
+ pointsCurveList[type](data, points, curve, close, options);
3408
3414
  }
3409
3415
  };
3410
3416
 
3411
- const {ellipse: ellipse$3, arc: arc$2} = PathCommandDataHelper;
3417
+ const {ellipse: ellipse$3, arc: arc$2, pointsCurveList: pointsCurveList} = PathCommandDataHelper;
3418
+
3419
+ function registerPointsCurve(type, fn) {
3420
+ if (pointsCurveList[type]) debug$d.repeat(type);
3421
+ pointsCurveList[type] = fn;
3422
+ }
3423
+
3424
+ registerPointsCurve("Q", BezierHelper.points);
3412
3425
 
3413
3426
  const {moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo: quadraticCurveTo, bezierCurveTo: bezierCurveTo, closePath: closePath$3, beginPath: beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse: drawEllipse, drawArc: drawArc, drawPoints: drawPoints$2} = PathCommandDataHelper;
3414
3427
 
@@ -4801,7 +4814,7 @@ const matrix$1 = {}, {round: round$3} = Math;
4801
4814
  const LeafHelper = {
4802
4815
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
4803
4816
  if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged) waitAutoLayout = true;
4804
- updateMatrix$3(leaf, checkAutoLayout, waitAutoLayout);
4817
+ updateMatrix$2(leaf, checkAutoLayout, waitAutoLayout);
4805
4818
  if (leaf.isBranch) {
4806
4819
  const {children: children} = leaf;
4807
4820
  for (let i = 0, len = children.length; i < len; i++) {
@@ -4822,9 +4835,10 @@ const LeafHelper = {
4822
4835
  if (layout.matrixChanged) leaf.__updateLocalMatrix();
4823
4836
  if (!layout.waitAutoLayout) leaf.__updateWorldMatrix();
4824
4837
  },
4825
- updateBounds(leaf) {
4838
+ updateBounds(leaf, noUpdateSize) {
4826
4839
  const layout = leaf.__layout;
4827
4840
  if (layout.boundsChanged) leaf.__updateLocalBounds();
4841
+ if (noUpdateSize) layout.resized = undefined;
4828
4842
  if (!layout.waitAutoLayout) leaf.__updateWorldBounds();
4829
4843
  },
4830
4844
  updateAllWorldOpacity(leaf) {
@@ -4847,7 +4861,7 @@ const LeafHelper = {
4847
4861
  }
4848
4862
  },
4849
4863
  updateAllChange(leaf) {
4850
- updateChange$1(leaf);
4864
+ updateChange(leaf);
4851
4865
  if (leaf.isBranch) {
4852
4866
  const {children: children} = leaf;
4853
4867
  for (let i = 0, len = children.length; i < len; i++) {
@@ -5019,7 +5033,7 @@ const LeafHelper = {
5019
5033
 
5020
5034
  const L$1 = LeafHelper;
5021
5035
 
5022
- const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$3, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$1;
5036
+ const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange} = L$1;
5023
5037
 
5024
5038
  function getTempLocal(t, worldPoint) {
5025
5039
  t.updateLayout();
@@ -5065,7 +5079,7 @@ function checkMask(target, index) {
5065
5079
  return findMask < 0 ? null : (findMask && (findMask = -1), true);
5066
5080
  }
5067
5081
 
5068
- const {updateBounds: updateBounds$4} = LeafHelper;
5082
+ const {updateBounds: updateBounds$3} = LeafHelper;
5069
5083
 
5070
5084
  const BranchHelper = {
5071
5085
  sort(a, b) {
@@ -5126,10 +5140,10 @@ const BranchHelper = {
5126
5140
  branch = branchStack[i];
5127
5141
  children = branch.children;
5128
5142
  for (let j = 0, len = children.length; j < len; j++) {
5129
- updateBounds$4(children[j]);
5143
+ updateBounds$3(children[j]);
5130
5144
  }
5131
5145
  if (exclude && exclude === branch) continue;
5132
- updateBounds$4(branch);
5146
+ updateBounds$3(branch);
5133
5147
  }
5134
5148
  },
5135
5149
  move(branch, x, y) {
@@ -5191,7 +5205,7 @@ const WaitHelper = {
5191
5205
  }
5192
5206
  };
5193
5207
 
5194
- const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3} = LeafHelper;
5208
+ const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
5195
5209
 
5196
5210
  const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$4} = BoundsHelper;
5197
5211
 
@@ -5299,7 +5313,7 @@ class LeafLayout {
5299
5313
  }
5300
5314
  update() {
5301
5315
  const {leaf: leaf} = this, {leafer: leafer} = leaf;
5302
- if (leaf.isApp) return updateBounds$3(leaf);
5316
+ if (leaf.isApp) return updateBounds$2(leaf);
5303
5317
  if (leafer) {
5304
5318
  if (leafer.ready) leafer.watcher.changed && leafer.layouter.layout(); else leafer.start();
5305
5319
  } else {
@@ -6036,9 +6050,12 @@ const LeafDataProxy = {
6036
6050
  }
6037
6051
  },
6038
6052
  emitPropertyEvent(type, name, oldValue, newValue) {
6039
- const event = new PropertyEvent(type, this, name, oldValue, newValue);
6040
- this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
6041
- this.leafer.emitEvent(event);
6053
+ const {leafer: leafer} = this;
6054
+ if (leafer.config.trackChanges || leafer.zoomLayer === this) {
6055
+ const event = new PropertyEvent(type, this, name, oldValue, newValue);
6056
+ this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
6057
+ leafer.emitEvent(event);
6058
+ } else leafer.watcher.add(this);
6042
6059
  },
6043
6060
  __realSetAttr(name, newValue) {
6044
6061
  const data = this.__;
@@ -6054,7 +6071,7 @@ const LeafDataProxy = {
6054
6071
 
6055
6072
  const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
6056
6073
 
6057
- const {toPoint: toPoint$3, tempPoint: tempPoint$3} = AroundHelper;
6074
+ const {toPoint: toPoint$3, tempPoint: tempPoint$4} = AroundHelper;
6058
6075
 
6059
6076
  const LeafMatrix = {
6060
6077
  __updateWorldMatrix() {
@@ -6075,17 +6092,17 @@ const LeafMatrix = {
6075
6092
  local.e = data.x + data.offsetX;
6076
6093
  local.f = data.y + data.offsetY;
6077
6094
  if (data.around || data.origin) {
6078
- toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$3);
6079
- translateInner(local, -tempPoint$3.x, -tempPoint$3.y, !data.around);
6095
+ toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$4);
6096
+ translateInner(local, -tempPoint$4.x, -tempPoint$4.y, !data.around);
6080
6097
  }
6081
6098
  }
6082
6099
  this.__layout.matrixChanged = undefined;
6083
6100
  }
6084
6101
  };
6085
6102
 
6086
- const {updateMatrix: updateMatrix$2, updateAllMatrix: updateAllMatrix$3} = LeafHelper;
6103
+ const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$3} = LeafHelper;
6087
6104
 
6088
- const {updateBounds: updateBounds$2} = BranchHelper;
6105
+ const {updateBounds: updateBounds$1} = BranchHelper;
6089
6106
 
6090
6107
  const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$3} = BoundsHelper;
6091
6108
 
@@ -6188,14 +6205,14 @@ const LeafBounds = {
6188
6205
  if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6189
6206
  if (this.__layout.boxChanged) this.__updateFlowLayout();
6190
6207
  updateAllMatrix$3(this);
6191
- updateBounds$2(this, this);
6208
+ updateBounds$1(this, this);
6192
6209
  if (this.__.__autoSide) this.__updateBoxBounds(true);
6193
6210
  } else {
6194
6211
  updateAllMatrix$3(this);
6195
- updateBounds$2(this, this);
6212
+ updateBounds$1(this, this);
6196
6213
  }
6197
6214
  } else {
6198
- updateMatrix$2(this);
6215
+ updateMatrix$1(this);
6199
6216
  }
6200
6217
  },
6201
6218
  __updateNaturalSize() {
@@ -6868,9 +6885,12 @@ let Branch = class Branch extends Leaf {
6868
6885
  if (this.isFrame) child.__bindFrame(null);
6869
6886
  }
6870
6887
  __emitChildEvent(type, child) {
6871
- const event = new ChildEvent(type, child, this);
6872
- if (this.hasEvent(type) && !this.isLeafer) this.emitEvent(event);
6873
- this.leafer.emitEvent(event);
6888
+ const {leafer: leafer} = this;
6889
+ if (leafer.config.trackChanges || leafer.zoomLayer === this) {
6890
+ const event = new ChildEvent(type, child, this);
6891
+ if (this.hasEvent(type) && !this.isLeafer) this.emitEvent(event);
6892
+ leafer.emitEvent(event);
6893
+ } else leafer.watcher.addChild(child, this, type);
6874
6894
  }
6875
6895
  };
6876
6896
 
@@ -7023,7 +7043,7 @@ class LeafLevelList {
7023
7043
  }
7024
7044
  }
7025
7045
 
7026
- const version = "2.2.5";
7046
+ const version = "2.2.7";
7027
7047
 
7028
7048
  const debug$5 = Debug.get("LeaferCanvas");
7029
7049
 
@@ -7351,6 +7371,7 @@ class Watcher {
7351
7371
  }
7352
7372
  constructor(target, userConfig) {
7353
7373
  this.totalTimes = 0;
7374
+ this.changed = 0;
7354
7375
  this.config = {};
7355
7376
  this.__updatedList = new LeafList;
7356
7377
  this.target = target;
@@ -7370,8 +7391,10 @@ class Watcher {
7370
7391
  this.disabled = true;
7371
7392
  }
7372
7393
  update() {
7373
- this.changed = true;
7374
- if (this.running) this.target.emit(RenderEvent.REQUEST);
7394
+ if (this.changed < 100) {
7395
+ this.changed++;
7396
+ if (this.running) this.target.emit(RenderEvent.REQUEST);
7397
+ }
7375
7398
  }
7376
7399
  __onAttrChange(event) {
7377
7400
  this.add(event.target);
@@ -7380,18 +7403,21 @@ class Watcher {
7380
7403
  if (this.config.usePartLayout) this.__updatedList.add(leaf);
7381
7404
  this.update();
7382
7405
  }
7383
- __onChildEvent(event) {
7406
+ addChild(child, parent, eventType) {
7384
7407
  if (this.config.usePartLayout) {
7385
- if (event.type === ChildEvent.ADD) {
7408
+ if (eventType === ChildEvent.ADD) {
7386
7409
  this.hasAdd = true;
7387
- this.__pushChild(event.child);
7410
+ this.__pushChild(child);
7388
7411
  } else {
7389
7412
  this.hasRemove = true;
7390
- this.__updatedList.add(event.parent);
7413
+ this.__updatedList.add(parent);
7391
7414
  }
7392
7415
  }
7393
7416
  this.update();
7394
7417
  }
7418
+ __onChildEvent(event) {
7419
+ this.addChild(event.child, event.parent, event.type);
7420
+ }
7395
7421
  __pushChild(child) {
7396
7422
  this.__updatedList.add(child);
7397
7423
  if (child.isBranch) this.__loopChildren(child);
@@ -7406,7 +7432,8 @@ class Watcher {
7406
7432
  }));
7407
7433
  this.__updatedList = new LeafList;
7408
7434
  this.totalTimes++;
7409
- this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
7435
+ this.hasVisible = this.hasRemove = this.hasAdd = false;
7436
+ this.changed = 0;
7410
7437
  }
7411
7438
  __listenEvents() {
7412
7439
  this.__eventIds = [ this.target.on_([ [ PropertyEvent.CHANGE, this.__onAttrChange, this ], [ [ ChildEvent.ADD, ChildEvent.REMOVE ], this.__onChildEvent, this ], [ WatchEvent.REQUEST, this.__onRquestData, this ] ]) ];
@@ -7427,47 +7454,57 @@ const {updateAllMatrix: updateAllMatrix$2, updateBounds: updateOneBounds, update
7427
7454
 
7428
7455
  const {pushAllChildBranch: pushAllChildBranch, pushAllParent: pushAllParent} = BranchHelper;
7429
7456
 
7430
- function updateMatrix$1(updateList, levelList) {
7431
- let layout;
7432
- updateList.list.forEach(leaf => {
7433
- layout = leaf.__layout;
7434
- if (levelList.without(leaf) && !layout.proxyZoom) {
7435
- if (layout.matrixChanged) {
7436
- updateAllMatrix$2(leaf, true);
7437
- levelList.add(leaf);
7438
- if (leaf.isBranch) pushAllChildBranch(leaf, levelList);
7439
- pushAllParent(leaf, levelList);
7440
- } else if (layout.boundsChanged) {
7441
- levelList.add(leaf);
7442
- if (leaf.isBranch) leaf.__tempNumber = 0;
7443
- pushAllParent(leaf, levelList);
7457
+ const LayouterHelper = {
7458
+ updateMatrix(updateList, levelList) {
7459
+ let index = 0, leaf, layout;
7460
+ const {list: list} = updateList;
7461
+ while (index < list.length) {
7462
+ leaf = list[index];
7463
+ layout = leaf.__layout;
7464
+ if (levelList.without(leaf) && !layout.proxyZoom) {
7465
+ if (layout.matrixChanged) {
7466
+ updateAllMatrix$2(leaf, true);
7467
+ if (leaf.isBranch) pushAllChildBranch(leaf, levelList);
7468
+ push(leaf, levelList);
7469
+ } else if (layout.boundsChanged) {
7470
+ if (leaf.isBranch) leaf.__tempNumber = 0;
7471
+ push(leaf, levelList);
7472
+ }
7444
7473
  }
7474
+ index++;
7445
7475
  }
7446
- });
7447
- }
7448
-
7449
- function updateBounds$1(boundsList) {
7450
- let list, branch, children;
7451
- boundsList.sort(true);
7452
- boundsList.levels.forEach(level => {
7453
- list = boundsList.levelMap[level];
7454
- for (let i = 0, len = list.length; i < len; i++) {
7455
- branch = list[i];
7456
- if (branch.isBranch && branch.__tempNumber) {
7457
- children = branch.children;
7458
- for (let j = 0, jLen = children.length; j < jLen; j++) {
7459
- if (!children[j].isBranch) {
7460
- updateOneBounds(children[j]);
7476
+ },
7477
+ updateBounds(boundsList) {
7478
+ let index = 0, level, list, branch, children;
7479
+ const {levels: levels, levelMap: levelMap} = boundsList;
7480
+ boundsList.sort(true);
7481
+ while (index < levels.length) {
7482
+ level = levels[index];
7483
+ list = levelMap[level];
7484
+ for (let i = 0, len = list.length; i < len; i++) {
7485
+ branch = list[i];
7486
+ if (branch.isBranch && branch.__tempNumber) {
7487
+ children = branch.children;
7488
+ for (let j = 0, jLen = children.length; j < jLen; j++) {
7489
+ if (!children[j].isBranch) {
7490
+ updateOneBounds(children[j]);
7491
+ }
7461
7492
  }
7462
7493
  }
7494
+ updateOneBounds(branch);
7463
7495
  }
7464
- updateOneBounds(branch);
7496
+ index++;
7465
7497
  }
7466
- });
7467
- }
7498
+ },
7499
+ updateChange(updateList) {
7500
+ updateList.list.forEach(updateOneChange);
7501
+ },
7502
+ push: push
7503
+ };
7468
7504
 
7469
- function updateChange(updateList) {
7470
- updateList.list.forEach(updateOneChange);
7505
+ function push(leaf, levelList) {
7506
+ levelList.add(leaf);
7507
+ pushAllParent(leaf, levelList);
7471
7508
  }
7472
7509
 
7473
7510
  const {worldBounds: worldBounds} = LeafBoundsHelper;
@@ -7574,9 +7611,9 @@ class Layouter {
7574
7611
  target.emitEvent(new LayoutEvent(BEFORE, blocks, this.times));
7575
7612
  this.extraBlock = null;
7576
7613
  updateList.sort();
7577
- updateMatrix$1(updateList, this.__levelList);
7578
- updateBounds$1(this.__levelList);
7579
- updateChange(updateList);
7614
+ LayouterHelper.updateMatrix(updateList, this.__levelList);
7615
+ LayouterHelper.updateBounds(this.__levelList);
7616
+ LayouterHelper.updateChange(updateList);
7580
7617
  if (this.extraBlock) blocks.push(this.extraBlock);
7581
7618
  blocks.forEach(item => item.setAfter());
7582
7619
  target.emitEvent(new LayoutEvent(LAYOUT, blocks, this.times));
@@ -7606,11 +7643,16 @@ class Layouter {
7606
7643
  if (target.isBranch) BranchHelper.updateBounds(target); else LeafHelper.updateBounds(target);
7607
7644
  updateAllChange(target);
7608
7645
  }
7609
- addExtra(leaf) {
7646
+ addExtra(leaf, updateBounds) {
7610
7647
  if (!this.__updatedList.has(leaf)) {
7611
7648
  const {updatedList: updatedList, beforeBounds: beforeBounds} = this.extraBlock || (this.extraBlock = new LayoutBlockData([]));
7612
7649
  updatedList.length ? beforeBounds.add(leaf.__world) : beforeBounds.set(leaf.__world);
7613
7650
  updatedList.add(leaf);
7651
+ if (updateBounds) {
7652
+ const list = this.__levelList;
7653
+ LayouterHelper.push(leaf, list);
7654
+ list.sort(true);
7655
+ }
7614
7656
  }
7615
7657
  }
7616
7658
  createBlock(data) {
@@ -7877,7 +7919,7 @@ class Renderer {
7877
7919
 
7878
7920
  Renderer.clipSpread = 10;
7879
7921
 
7880
- const tempPoint$2 = {};
7922
+ const tempPoint$3 = {};
7881
7923
 
7882
7924
  const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
7883
7925
 
@@ -7935,7 +7977,7 @@ class Picker {
7935
7977
  for (let i = 0, len = list.length; i < len; i++) {
7936
7978
  find = list[i];
7937
7979
  if (ignoreHittable || LeafHelper.worldHittable(find)) {
7938
- this.hitChild(find, find.hitThrough ? this.point : point);
7980
+ this.hitChild(find, find.hitThrough ? this.point : point, find.mask && find.parent && find.parent.__onlyHitMask);
7939
7981
  if (findList.length) {
7940
7982
  if (find.isBranchLeaf && list.some(item => item !== find && LeafHelper.hasParent(item, find))) {
7941
7983
  findList.reset();
@@ -8012,7 +8054,7 @@ class Picker {
8012
8054
  for (let i = len - 1; i > -1; i--) {
8013
8055
  child = children[i], data = child.__;
8014
8056
  if (!data.visible || onlyHitMask && !data.mask) continue;
8015
- hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$2, point, data.hitRadius) : point);
8057
+ hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$3, point, data.hitRadius) : point);
8016
8058
  if (child.isBranch) {
8017
8059
  if (hit || child.__ignoreHitWorld) {
8018
8060
  if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
@@ -8034,7 +8076,7 @@ class Picker {
8034
8076
  }
8035
8077
  const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
8036
8078
  if (hitThrough) {
8037
- const index = findList.list.findIndex(item => item[hitThrough] === child[hitThrough]);
8079
+ const index = findList.list.findIndex(item => hitThrough === "parent" ? LeafHelper.hasParent(item.parent, child.parent) : item[hitThrough] === child[hitThrough]);
8038
8080
  if (index > 0) return findList.addAt(leaf, index);
8039
8081
  }
8040
8082
  findList.add(leaf);
@@ -8567,7 +8609,7 @@ const UIRender = {
8567
8609
  }
8568
8610
  if (data.__useEffect) {
8569
8611
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8570
- 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"));
8612
+ stintSet$2(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && !(shadow[0].blendMode && shadow[0].blendMode !== "pass-through") && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
8571
8613
  data.__useEffect = !!(shadow || otherEffect);
8572
8614
  }
8573
8615
  data.__checkSingle();
@@ -9062,6 +9104,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
9062
9104
  start: true,
9063
9105
  hittable: true,
9064
9106
  smooth: true,
9107
+ trackChanges: true,
9065
9108
  lazySpeard: 100
9066
9109
  };
9067
9110
  this.leafs = 0;
@@ -9547,7 +9590,7 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
9547
9590
 
9548
9591
  Frame = __decorate([ registerUI() ], Frame);
9549
9592
 
9550
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint$1, set: set$2, rotate: rotate$2} = PointHelper, {abs: abs$4} = Math, tempCenter = {};
9593
+ const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint$2, set: set$2, rotate: rotate$2} = PointHelper, {abs: abs$4} = Math, tempCenter = {};
9551
9594
 
9552
9595
  let Ellipse = class Ellipse extends UI {
9553
9596
  get __tag() {
@@ -9568,9 +9611,9 @@ let Ellipse = class Ellipse extends UI {
9568
9611
  if (drawInnerEllipse) {
9569
9612
  if (closedAngle) {
9570
9613
  closePath$2(path);
9571
- set$2(tempPoint$1, rx + innerRx, ry), set$2(tempCenter, rx, ry);
9572
- rotate$2(tempPoint$1, endAngle, tempCenter, rx, ry);
9573
- moveTo$3(path, tempPoint$1.x, tempPoint$1.y);
9614
+ set$2(tempPoint$2, rx + innerRx, ry), set$2(tempCenter, rx, ry);
9615
+ rotate$2(tempPoint$2, endAngle, tempCenter, rx, ry);
9616
+ moveTo$3(path, tempPoint$2.x, tempPoint$2.y);
9574
9617
  }
9575
9618
  ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
9576
9619
  } else {
@@ -9625,7 +9668,7 @@ let Polygon = class Polygon extends UI {
9625
9668
  const data = this.__;
9626
9669
  const path = data.path = [];
9627
9670
  if (data.points) {
9628
- drawPoints$1(path, data.points, data.curve, data.closed);
9671
+ drawPoints$1(path, data.points, data.curve, data.closed, data);
9629
9672
  } else {
9630
9673
  const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9631
9674
  const rx = width / 2, ry = height / 2;
@@ -9717,7 +9760,7 @@ let Line = class Line extends UI {
9717
9760
  const data = this.__;
9718
9761
  const path = data.path = [];
9719
9762
  if (data.points) {
9720
- drawPoints(path, data.points, data.curve, data.closed);
9763
+ drawPoints(path, data.points, data.curve, data.closed, data);
9721
9764
  } else {
9722
9765
  moveTo(path, 0, 0);
9723
9766
  lineTo(path, this.width, 0);
@@ -12329,7 +12372,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
12329
12372
  data.__naturalHeight = image.height / data.pixelRatio;
12330
12373
  if (data.__autoSide) {
12331
12374
  ui.forceUpdate();
12332
- LeafHelper.updateBounds(ui);
12375
+ LeafHelper.updateBounds(ui, true);
12333
12376
  ui.__layout.boundsChanged = true;
12334
12377
  if (ui.__proxyData) {
12335
12378
  ui.setProxyAttr("width", data.width);
@@ -15273,7 +15316,7 @@ const {getDistance: getDistance} = HighBezierHelper;
15273
15316
 
15274
15317
  const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper, {set: set, getAngle: getAngle, getDistanceFrom: getDistanceFrom, getDistancePoint: getDistancePoint} = PointHelper;
15275
15318
 
15276
- const tempPoint = {}, tempFrom = {};
15319
+ const tempPoint$1 = {}, tempFrom = {};
15277
15320
 
15278
15321
  const HighCurveHelper = {
15279
15322
  transform(data, matrix) {
@@ -15300,11 +15343,11 @@ const HighCurveHelper = {
15300
15343
  },
15301
15344
  transformPoints(data, matrix, start, pointCount) {
15302
15345
  for (let i = start + 1, end = i + pointCount * 2; i < end; i += 2) {
15303
- tempPoint.x = data[i];
15304
- tempPoint.y = data[i + 1];
15305
- MatrixHelper.toOuterPoint(matrix, tempPoint);
15306
- data[i] = tempPoint.x;
15307
- data[i + 1] = tempPoint.y;
15346
+ tempPoint$1.x = data[i];
15347
+ tempPoint$1.y = data[i + 1];
15348
+ MatrixHelper.toOuterPoint(matrix, tempPoint$1);
15349
+ data[i] = tempPoint$1.x;
15350
+ data[i + 1] = tempPoint$1.y;
15308
15351
  }
15309
15352
  },
15310
15353
  getMotionPathData(data) {
@@ -15546,12 +15589,16 @@ const {updateBounds: updateBounds} = BranchHelper;
15546
15589
 
15547
15590
  const {toVertical: toVertical} = PointHelper;
15548
15591
 
15592
+ const tempPoint = {};
15593
+
15549
15594
  UI.addAttr("motionPath", undefined, motionPathType);
15550
15595
 
15551
15596
  UI.addAttr("motionPrecision", 1, motionPathType);
15552
15597
 
15553
15598
  UI.addAttr("motion", undefined, motionPathType);
15554
15599
 
15600
+ UI.addAttr("motionAround", undefined, motionPathType);
15601
+
15555
15602
  UI.addAttr("motionVertical", "below", motionPathType);
15556
15603
 
15557
15604
  UI.addAttr("motionRotation", true, motionPathType);
@@ -15568,13 +15615,19 @@ ui$1.getMotionContentHeight = function() {
15568
15615
  return this.__layout.boxBounds.height;
15569
15616
  };
15570
15617
 
15571
- ui$1.getMotionPoint = function(motionDistance, motionVertical, pathElement, offsetX = 0, offsetY = 0) {
15618
+ ui$1.getMotionPoint = function(motionDistance, motionAround, motionVertical, offsetX = 0, offsetY = 0, pathElement) {
15572
15619
  if (!pathElement) pathElement = getMotionPath(this);
15573
15620
  const data = getMotionPathData(pathElement);
15574
15621
  if (!data.total) return {};
15575
15622
  const point = HighCurveHelper.getDistancePoint(data, motionDistance, pathElement.motionPrecision, offsetX);
15576
15623
  const {motionRotation: motionRotation} = this;
15577
15624
  if (isNumber(motionRotation)) point.rotation += motionRotation;
15625
+ if (motionAround && motionAround !== "top-left") {
15626
+ AroundHelper.toPoint(motionAround, this.__layout.boxBounds, tempPoint);
15627
+ PointHelper.set(tempPoint, point.x - tempPoint.x * this.scaleX, point.y - tempPoint.y * this.scaleY);
15628
+ if (point.rotation) PointHelper.rotate(tempPoint, point.rotation, point);
15629
+ PointHelper.copy(point, tempPoint);
15630
+ }
15578
15631
  let verticalType, verticalOffset;
15579
15632
  if (isObject(motionVertical)) verticalType = motionVertical.type, verticalOffset = motionVertical.offset; else if (isNumber(motionVertical)) verticalOffset = motionVertical; else verticalType = motionVertical;
15580
15633
  if (verticalType !== "below" || offsetY) {
@@ -15627,7 +15680,7 @@ function updateMotion(leaf) {
15627
15680
  if (data.total) leaf.__.__pathForRender = HighCurveHelper.getDistancePath(data, motion, leaf.motionPrecision);
15628
15681
  } else {
15629
15682
  if (leaf.motionText) leaf.__updateMotionText(); else {
15630
- const point = leaf.getMotionPoint(motion);
15683
+ const point = leaf.getMotionPoint(motion, leaf.motionAround);
15631
15684
  if (leaf.motionRotation === false) delete point.rotation;
15632
15685
  leaf.set(point);
15633
15686
  }
@@ -15814,4 +15867,4 @@ LeafHelper.cacheId = function(t) {
15814
15867
  if (leafer.cacheInnerId) leafer.app.innerIdMap[t.innerId] = t;
15815
15868
  };
15816
15869
 
15817
- export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, doSurfaceType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$5 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
15870
+ export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, LayouterHelper, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, doSurfaceType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerPointsCurve, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$6 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };