@leafer-game/miniapp 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.
@@ -433,7 +433,7 @@ const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
433
433
 
434
434
  const {float: float$5} = MathHelper;
435
435
 
436
- const tempPoint$6 = {};
436
+ const tempPoint$7 = {};
437
437
 
438
438
  function getWorld() {
439
439
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
@@ -492,8 +492,8 @@ const MatrixHelper = {
492
492
  to.f = t.f * pixelRatio;
493
493
  },
494
494
  scaleOfOuter(t, origin, scaleX, scaleY) {
495
- M$7.toInnerPoint(t, origin, tempPoint$6);
496
- M$7.scaleOfInner(t, tempPoint$6, scaleX, scaleY);
495
+ M$7.toInnerPoint(t, origin, tempPoint$7);
496
+ M$7.scaleOfInner(t, tempPoint$7, scaleX, scaleY);
497
497
  },
498
498
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
499
499
  M$7.translateInner(t, origin.x, origin.y);
@@ -511,8 +511,8 @@ const MatrixHelper = {
511
511
  t.d = c * sinR + d * cosR;
512
512
  },
513
513
  rotateOfOuter(t, origin, rotation) {
514
- M$7.toInnerPoint(t, origin, tempPoint$6);
515
- M$7.rotateOfInner(t, tempPoint$6, rotation);
514
+ M$7.toInnerPoint(t, origin, tempPoint$7);
515
+ M$7.rotateOfInner(t, tempPoint$7, rotation);
516
516
  },
517
517
  rotateOfInner(t, origin, rotation) {
518
518
  M$7.translateInner(t, origin.x, origin.y);
@@ -533,8 +533,8 @@ const MatrixHelper = {
533
533
  }
534
534
  },
535
535
  skewOfOuter(t, origin, skewX, skewY) {
536
- M$7.toInnerPoint(t, origin, tempPoint$6);
537
- M$7.skewOfInner(t, tempPoint$6, skewX, skewY);
536
+ M$7.toInnerPoint(t, origin, tempPoint$7);
537
+ M$7.skewOfInner(t, tempPoint$7, skewX, skewY);
538
538
  },
539
539
  skewOfInner(t, origin, skewX, skewY = 0) {
540
540
  M$7.translateInner(t, origin.x, origin.y);
@@ -961,7 +961,7 @@ class Point {
961
961
  }
962
962
  }
963
963
 
964
- const tempPoint$5 = new Point;
964
+ const tempPoint$6 = new Point;
965
965
 
966
966
  class Matrix {
967
967
  constructor(a, b, c, d, e, f) {
@@ -1865,7 +1865,7 @@ function getNameList(name) {
1865
1865
 
1866
1866
  const D$5 = Debug;
1867
1867
 
1868
- const debug$f = Debug.get("RunTime");
1868
+ const debug$g = Debug.get("RunTime");
1869
1869
 
1870
1870
  const Run = {
1871
1871
  currentId: 0,
@@ -1884,7 +1884,7 @@ const Run = {
1884
1884
  const time = R$1.idMap[id], name = R$1.nameMap[id];
1885
1885
  const duration = microsecond ? (performance.now() - time) / 1e3 : Date.now() - time;
1886
1886
  R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1887
- debug$f.log(name, duration, "ms");
1887
+ debug$g.log(name, duration, "ms");
1888
1888
  },
1889
1889
  endOfName(name, microsecond) {
1890
1890
  const id = R$1.nameToIdMap[name];
@@ -1920,18 +1920,18 @@ const Creator = {
1920
1920
  }
1921
1921
  };
1922
1922
 
1923
- const debug$e = Debug.get("UICreator");
1923
+ const debug$f = Debug.get("UICreator");
1924
1924
 
1925
1925
  const UICreator = {
1926
1926
  list: {},
1927
1927
  register(UI) {
1928
1928
  const {__tag: tag} = UI.prototype;
1929
- if (list$1[tag]) debug$e.repeat(tag);
1929
+ if (list$1[tag]) debug$f.repeat(tag);
1930
1930
  list$1[tag] = UI;
1931
1931
  },
1932
1932
  get(tag, data, x, y, width, height) {
1933
1933
  if (!list$1[tag]) {
1934
- debug$e.warn("not register " + tag);
1934
+ debug$f.warn("not register " + tag);
1935
1935
  return undefined;
1936
1936
  }
1937
1937
  const ui = new list$1[tag](data);
@@ -1947,7 +1947,7 @@ const UICreator = {
1947
1947
 
1948
1948
  const {list: list$1} = UICreator;
1949
1949
 
1950
- const debug$d = Debug.get("EventCreator");
1950
+ const debug$e = Debug.get("EventCreator");
1951
1951
 
1952
1952
  const EventCreator = {
1953
1953
  nameList: {},
@@ -1955,7 +1955,7 @@ const EventCreator = {
1955
1955
  let name;
1956
1956
  Object.keys(Event).forEach(key => {
1957
1957
  name = Event[key];
1958
- if (isString(name)) nameList[name] && debug$d.repeat(name), nameList[name] = Event;
1958
+ if (isString(name)) nameList[name] && debug$e.repeat(name), nameList[name] = Event;
1959
1959
  });
1960
1960
  },
1961
1961
  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$c = Debug.get("PathConvert");
3006
+ const debug$d = 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$c.error(`command: ${command} [index:${i}]`, old);
3273
+ debug$d.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$c = 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$c.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$c.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
  class LeaferCanvas extends LeaferCanvasBase {
7029
7049
  get allowBackgroundColor() {
@@ -7316,6 +7336,7 @@ class Watcher {
7316
7336
  }
7317
7337
  constructor(target, userConfig) {
7318
7338
  this.totalTimes = 0;
7339
+ this.changed = 0;
7319
7340
  this.config = {};
7320
7341
  this.__updatedList = new LeafList;
7321
7342
  this.target = target;
@@ -7335,8 +7356,10 @@ class Watcher {
7335
7356
  this.disabled = true;
7336
7357
  }
7337
7358
  update() {
7338
- this.changed = true;
7339
- if (this.running) this.target.emit(RenderEvent.REQUEST);
7359
+ if (this.changed < 100) {
7360
+ this.changed++;
7361
+ if (this.running) this.target.emit(RenderEvent.REQUEST);
7362
+ }
7340
7363
  }
7341
7364
  __onAttrChange(event) {
7342
7365
  this.add(event.target);
@@ -7345,18 +7368,21 @@ class Watcher {
7345
7368
  if (this.config.usePartLayout) this.__updatedList.add(leaf);
7346
7369
  this.update();
7347
7370
  }
7348
- __onChildEvent(event) {
7371
+ addChild(child, parent, eventType) {
7349
7372
  if (this.config.usePartLayout) {
7350
- if (event.type === ChildEvent.ADD) {
7373
+ if (eventType === ChildEvent.ADD) {
7351
7374
  this.hasAdd = true;
7352
- this.__pushChild(event.child);
7375
+ this.__pushChild(child);
7353
7376
  } else {
7354
7377
  this.hasRemove = true;
7355
- this.__updatedList.add(event.parent);
7378
+ this.__updatedList.add(parent);
7356
7379
  }
7357
7380
  }
7358
7381
  this.update();
7359
7382
  }
7383
+ __onChildEvent(event) {
7384
+ this.addChild(event.child, event.parent, event.type);
7385
+ }
7360
7386
  __pushChild(child) {
7361
7387
  this.__updatedList.add(child);
7362
7388
  if (child.isBranch) this.__loopChildren(child);
@@ -7371,7 +7397,8 @@ class Watcher {
7371
7397
  }));
7372
7398
  this.__updatedList = new LeafList;
7373
7399
  this.totalTimes++;
7374
- this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
7400
+ this.hasVisible = this.hasRemove = this.hasAdd = false;
7401
+ this.changed = 0;
7375
7402
  }
7376
7403
  __listenEvents() {
7377
7404
  this.__eventIds = [ this.target.on_([ [ PropertyEvent.CHANGE, this.__onAttrChange, this ], [ [ ChildEvent.ADD, ChildEvent.REMOVE ], this.__onChildEvent, this ], [ WatchEvent.REQUEST, this.__onRquestData, this ] ]) ];
@@ -7392,47 +7419,57 @@ const {updateAllMatrix: updateAllMatrix$2, updateBounds: updateOneBounds, update
7392
7419
 
7393
7420
  const {pushAllChildBranch: pushAllChildBranch, pushAllParent: pushAllParent} = BranchHelper;
7394
7421
 
7395
- function updateMatrix$1(updateList, levelList) {
7396
- let layout;
7397
- updateList.list.forEach(leaf => {
7398
- layout = leaf.__layout;
7399
- if (levelList.without(leaf) && !layout.proxyZoom) {
7400
- if (layout.matrixChanged) {
7401
- updateAllMatrix$2(leaf, true);
7402
- levelList.add(leaf);
7403
- if (leaf.isBranch) pushAllChildBranch(leaf, levelList);
7404
- pushAllParent(leaf, levelList);
7405
- } else if (layout.boundsChanged) {
7406
- levelList.add(leaf);
7407
- if (leaf.isBranch) leaf.__tempNumber = 0;
7408
- pushAllParent(leaf, levelList);
7422
+ const LayouterHelper = {
7423
+ updateMatrix(updateList, levelList) {
7424
+ let index = 0, leaf, layout;
7425
+ const {list: list} = updateList;
7426
+ while (index < list.length) {
7427
+ leaf = list[index];
7428
+ layout = leaf.__layout;
7429
+ if (levelList.without(leaf) && !layout.proxyZoom) {
7430
+ if (layout.matrixChanged) {
7431
+ updateAllMatrix$2(leaf, true);
7432
+ if (leaf.isBranch) pushAllChildBranch(leaf, levelList);
7433
+ push(leaf, levelList);
7434
+ } else if (layout.boundsChanged) {
7435
+ if (leaf.isBranch) leaf.__tempNumber = 0;
7436
+ push(leaf, levelList);
7437
+ }
7409
7438
  }
7439
+ index++;
7410
7440
  }
7411
- });
7412
- }
7413
-
7414
- function updateBounds$1(boundsList) {
7415
- let list, branch, children;
7416
- boundsList.sort(true);
7417
- boundsList.levels.forEach(level => {
7418
- list = boundsList.levelMap[level];
7419
- for (let i = 0, len = list.length; i < len; i++) {
7420
- branch = list[i];
7421
- if (branch.isBranch && branch.__tempNumber) {
7422
- children = branch.children;
7423
- for (let j = 0, jLen = children.length; j < jLen; j++) {
7424
- if (!children[j].isBranch) {
7425
- updateOneBounds(children[j]);
7441
+ },
7442
+ updateBounds(boundsList) {
7443
+ let index = 0, level, list, branch, children;
7444
+ const {levels: levels, levelMap: levelMap} = boundsList;
7445
+ boundsList.sort(true);
7446
+ while (index < levels.length) {
7447
+ level = levels[index];
7448
+ list = levelMap[level];
7449
+ for (let i = 0, len = list.length; i < len; i++) {
7450
+ branch = list[i];
7451
+ if (branch.isBranch && branch.__tempNumber) {
7452
+ children = branch.children;
7453
+ for (let j = 0, jLen = children.length; j < jLen; j++) {
7454
+ if (!children[j].isBranch) {
7455
+ updateOneBounds(children[j]);
7456
+ }
7426
7457
  }
7427
7458
  }
7459
+ updateOneBounds(branch);
7428
7460
  }
7429
- updateOneBounds(branch);
7461
+ index++;
7430
7462
  }
7431
- });
7432
- }
7463
+ },
7464
+ updateChange(updateList) {
7465
+ updateList.list.forEach(updateOneChange);
7466
+ },
7467
+ push: push
7468
+ };
7433
7469
 
7434
- function updateChange(updateList) {
7435
- updateList.list.forEach(updateOneChange);
7470
+ function push(leaf, levelList) {
7471
+ levelList.add(leaf);
7472
+ pushAllParent(leaf, levelList);
7436
7473
  }
7437
7474
 
7438
7475
  const {worldBounds: worldBounds} = LeafBoundsHelper;
@@ -7539,9 +7576,9 @@ class Layouter {
7539
7576
  target.emitEvent(new LayoutEvent(BEFORE, blocks, this.times));
7540
7577
  this.extraBlock = null;
7541
7578
  updateList.sort();
7542
- updateMatrix$1(updateList, this.__levelList);
7543
- updateBounds$1(this.__levelList);
7544
- updateChange(updateList);
7579
+ LayouterHelper.updateMatrix(updateList, this.__levelList);
7580
+ LayouterHelper.updateBounds(this.__levelList);
7581
+ LayouterHelper.updateChange(updateList);
7545
7582
  if (this.extraBlock) blocks.push(this.extraBlock);
7546
7583
  blocks.forEach(item => item.setAfter());
7547
7584
  target.emitEvent(new LayoutEvent(LAYOUT, blocks, this.times));
@@ -7571,11 +7608,16 @@ class Layouter {
7571
7608
  if (target.isBranch) BranchHelper.updateBounds(target); else LeafHelper.updateBounds(target);
7572
7609
  updateAllChange(target);
7573
7610
  }
7574
- addExtra(leaf) {
7611
+ addExtra(leaf, updateBounds) {
7575
7612
  if (!this.__updatedList.has(leaf)) {
7576
7613
  const {updatedList: updatedList, beforeBounds: beforeBounds} = this.extraBlock || (this.extraBlock = new LayoutBlockData([]));
7577
7614
  updatedList.length ? beforeBounds.add(leaf.__world) : beforeBounds.set(leaf.__world);
7578
7615
  updatedList.add(leaf);
7616
+ if (updateBounds) {
7617
+ const list = this.__levelList;
7618
+ LayouterHelper.push(leaf, list);
7619
+ list.sort(true);
7620
+ }
7579
7621
  }
7580
7622
  }
7581
7623
  createBlock(data) {
@@ -7842,7 +7884,7 @@ class Renderer {
7842
7884
 
7843
7885
  Renderer.clipSpread = 10;
7844
7886
 
7845
- const tempPoint$2 = {};
7887
+ const tempPoint$3 = {};
7846
7888
 
7847
7889
  const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
7848
7890
 
@@ -7900,7 +7942,7 @@ class Picker {
7900
7942
  for (let i = 0, len = list.length; i < len; i++) {
7901
7943
  find = list[i];
7902
7944
  if (ignoreHittable || LeafHelper.worldHittable(find)) {
7903
- this.hitChild(find, find.hitThrough ? this.point : point);
7945
+ this.hitChild(find, find.hitThrough ? this.point : point, find.mask && find.parent && find.parent.__onlyHitMask);
7904
7946
  if (findList.length) {
7905
7947
  if (find.isBranchLeaf && list.some(item => item !== find && LeafHelper.hasParent(item, find))) {
7906
7948
  findList.reset();
@@ -7977,7 +8019,7 @@ class Picker {
7977
8019
  for (let i = len - 1; i > -1; i--) {
7978
8020
  child = children[i], data = child.__;
7979
8021
  if (!data.visible || onlyHitMask && !data.mask) continue;
7980
- hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$2, point, data.hitRadius) : point);
8022
+ hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$3, point, data.hitRadius) : point);
7981
8023
  if (child.isBranch) {
7982
8024
  if (hit || child.__ignoreHitWorld) {
7983
8025
  if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
@@ -7999,7 +8041,7 @@ class Picker {
7999
8041
  }
8000
8042
  const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
8001
8043
  if (hitThrough) {
8002
- const index = findList.list.findIndex(item => item[hitThrough] === child[hitThrough]);
8044
+ const index = findList.list.findIndex(item => hitThrough === "parent" ? LeafHelper.hasParent(item.parent, child.parent) : item[hitThrough] === child[hitThrough]);
8003
8045
  if (index > 0) return findList.addAt(leaf, index);
8004
8046
  }
8005
8047
  findList.add(leaf);
@@ -8532,7 +8574,7 @@ const UIRender = {
8532
8574
  }
8533
8575
  if (data.__useEffect) {
8534
8576
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8535
- 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"));
8577
+ 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"));
8536
8578
  data.__useEffect = !!(shadow || otherEffect);
8537
8579
  }
8538
8580
  data.__checkSingle();
@@ -9027,6 +9069,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
9027
9069
  start: true,
9028
9070
  hittable: true,
9029
9071
  smooth: true,
9072
+ trackChanges: true,
9030
9073
  lazySpeard: 100
9031
9074
  };
9032
9075
  this.leafs = 0;
@@ -9512,7 +9555,7 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
9512
9555
 
9513
9556
  Frame = __decorate([ registerUI() ], Frame);
9514
9557
 
9515
- 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 = {};
9558
+ 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 = {};
9516
9559
 
9517
9560
  let Ellipse = class Ellipse extends UI {
9518
9561
  get __tag() {
@@ -9533,9 +9576,9 @@ let Ellipse = class Ellipse extends UI {
9533
9576
  if (drawInnerEllipse) {
9534
9577
  if (closedAngle) {
9535
9578
  closePath$2(path);
9536
- set$2(tempPoint$1, rx + innerRx, ry), set$2(tempCenter, rx, ry);
9537
- rotate$2(tempPoint$1, endAngle, tempCenter, rx, ry);
9538
- moveTo$3(path, tempPoint$1.x, tempPoint$1.y);
9579
+ set$2(tempPoint$2, rx + innerRx, ry), set$2(tempCenter, rx, ry);
9580
+ rotate$2(tempPoint$2, endAngle, tempCenter, rx, ry);
9581
+ moveTo$3(path, tempPoint$2.x, tempPoint$2.y);
9539
9582
  }
9540
9583
  ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
9541
9584
  } else {
@@ -9590,7 +9633,7 @@ let Polygon = class Polygon extends UI {
9590
9633
  const data = this.__;
9591
9634
  const path = data.path = [];
9592
9635
  if (data.points) {
9593
- drawPoints$1(path, data.points, data.curve, data.closed);
9636
+ drawPoints$1(path, data.points, data.curve, data.closed, data);
9594
9637
  } else {
9595
9638
  const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9596
9639
  const rx = width / 2, ry = height / 2;
@@ -9682,7 +9725,7 @@ let Line = class Line extends UI {
9682
9725
  const data = this.__;
9683
9726
  const path = data.path = [];
9684
9727
  if (data.points) {
9685
- drawPoints(path, data.points, data.curve, data.closed);
9728
+ drawPoints(path, data.points, data.curve, data.closed, data);
9686
9729
  } else {
9687
9730
  moveTo(path, 0, 0);
9688
9731
  lineTo(path, this.width, 0);
@@ -12074,7 +12117,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
12074
12117
  data.__naturalHeight = image.height / data.pixelRatio;
12075
12118
  if (data.__autoSide) {
12076
12119
  ui.forceUpdate();
12077
- LeafHelper.updateBounds(ui);
12120
+ LeafHelper.updateBounds(ui, true);
12078
12121
  ui.__layout.boundsChanged = true;
12079
12122
  if (ui.__proxyData) {
12080
12123
  ui.setProxyAttr("width", data.width);
@@ -15024,7 +15067,7 @@ const {getDistance: getDistance} = HighBezierHelper;
15024
15067
 
15025
15068
  const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper, {set: set, getAngle: getAngle, getDistanceFrom: getDistanceFrom, getDistancePoint: getDistancePoint} = PointHelper;
15026
15069
 
15027
- const tempPoint = {}, tempFrom = {};
15070
+ const tempPoint$1 = {}, tempFrom = {};
15028
15071
 
15029
15072
  const HighCurveHelper = {
15030
15073
  transform(data, matrix) {
@@ -15051,11 +15094,11 @@ const HighCurveHelper = {
15051
15094
  },
15052
15095
  transformPoints(data, matrix, start, pointCount) {
15053
15096
  for (let i = start + 1, end = i + pointCount * 2; i < end; i += 2) {
15054
- tempPoint.x = data[i];
15055
- tempPoint.y = data[i + 1];
15056
- MatrixHelper.toOuterPoint(matrix, tempPoint);
15057
- data[i] = tempPoint.x;
15058
- data[i + 1] = tempPoint.y;
15097
+ tempPoint$1.x = data[i];
15098
+ tempPoint$1.y = data[i + 1];
15099
+ MatrixHelper.toOuterPoint(matrix, tempPoint$1);
15100
+ data[i] = tempPoint$1.x;
15101
+ data[i + 1] = tempPoint$1.y;
15059
15102
  }
15060
15103
  },
15061
15104
  getMotionPathData(data) {
@@ -15297,12 +15340,16 @@ const {updateBounds: updateBounds} = BranchHelper;
15297
15340
 
15298
15341
  const {toVertical: toVertical} = PointHelper;
15299
15342
 
15343
+ const tempPoint = {};
15344
+
15300
15345
  UI.addAttr("motionPath", undefined, motionPathType);
15301
15346
 
15302
15347
  UI.addAttr("motionPrecision", 1, motionPathType);
15303
15348
 
15304
15349
  UI.addAttr("motion", undefined, motionPathType);
15305
15350
 
15351
+ UI.addAttr("motionAround", undefined, motionPathType);
15352
+
15306
15353
  UI.addAttr("motionVertical", "below", motionPathType);
15307
15354
 
15308
15355
  UI.addAttr("motionRotation", true, motionPathType);
@@ -15319,13 +15366,19 @@ ui$1.getMotionContentHeight = function() {
15319
15366
  return this.__layout.boxBounds.height;
15320
15367
  };
15321
15368
 
15322
- ui$1.getMotionPoint = function(motionDistance, motionVertical, pathElement, offsetX = 0, offsetY = 0) {
15369
+ ui$1.getMotionPoint = function(motionDistance, motionAround, motionVertical, offsetX = 0, offsetY = 0, pathElement) {
15323
15370
  if (!pathElement) pathElement = getMotionPath(this);
15324
15371
  const data = getMotionPathData(pathElement);
15325
15372
  if (!data.total) return {};
15326
15373
  const point = HighCurveHelper.getDistancePoint(data, motionDistance, pathElement.motionPrecision, offsetX);
15327
15374
  const {motionRotation: motionRotation} = this;
15328
15375
  if (isNumber(motionRotation)) point.rotation += motionRotation;
15376
+ if (motionAround && motionAround !== "top-left") {
15377
+ AroundHelper.toPoint(motionAround, this.__layout.boxBounds, tempPoint);
15378
+ PointHelper.set(tempPoint, point.x - tempPoint.x * this.scaleX, point.y - tempPoint.y * this.scaleY);
15379
+ if (point.rotation) PointHelper.rotate(tempPoint, point.rotation, point);
15380
+ PointHelper.copy(point, tempPoint);
15381
+ }
15329
15382
  let verticalType, verticalOffset;
15330
15383
  if (isObject(motionVertical)) verticalType = motionVertical.type, verticalOffset = motionVertical.offset; else if (isNumber(motionVertical)) verticalOffset = motionVertical; else verticalType = motionVertical;
15331
15384
  if (verticalType !== "below" || offsetY) {
@@ -15378,7 +15431,7 @@ function updateMotion(leaf) {
15378
15431
  if (data.total) leaf.__.__pathForRender = HighCurveHelper.getDistancePath(data, motion, leaf.motionPrecision);
15379
15432
  } else {
15380
15433
  if (leaf.motionText) leaf.__updateMotionText(); else {
15381
- const point = leaf.getMotionPoint(motion);
15434
+ const point = leaf.getMotionPoint(motion, leaf.motionAround);
15382
15435
  if (leaf.motionRotation === false) delete point.rotation;
15383
15436
  leaf.set(point);
15384
15437
  }
@@ -15565,4 +15618,4 @@ LeafHelper.cacheId = function(t) {
15565
15618
  if (leafer.cacheInnerId) leafer.app.innerIdMap[t.innerId] = t;
15566
15619
  };
15567
15620
 
15568
- 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, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, 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, 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 };
15621
+ 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, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, 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, 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 };