@leafer/miniapp 2.1.11 → 2.2.1

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.
@@ -735,7 +735,7 @@ const {float: float$5} = MathHelper;
735
735
 
736
736
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$4} = MatrixHelper;
737
737
 
738
- const {sin: sin$5, cos: cos$5, abs: abs$c, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
738
+ const {sin: sin$5, cos: cos$5, abs: abs$d, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
739
739
 
740
740
  const PointHelper = {
741
741
  defaultPoint: getPointData(),
@@ -817,6 +817,11 @@ const PointHelper = {
817
817
  toOuterOf(t, matrix, to) {
818
818
  toOuterPoint$4(matrix, t, to);
819
819
  },
820
+ toVertical(t, rotation, verticalDistance, to) {
821
+ const r = rotation * OneRadian;
822
+ t.x += -Math.sin(r) * verticalDistance;
823
+ t.y += Math.cos(r) * verticalDistance;
824
+ },
820
825
  getCenter(t, to) {
821
826
  return {
822
827
  x: t.x + (to.x - t.x) / 2,
@@ -833,8 +838,8 @@ const PointHelper = {
833
838
  return getDistanceFrom(t.x, t.y, point.x, point.y);
834
839
  },
835
840
  getDistanceFrom(x1, y1, x2, y2) {
836
- const x = abs$c(x2 - x1);
837
- const y = abs$c(y2 - y1);
841
+ const x = abs$d(x2 - x1);
842
+ const y = abs$d(y2 - y1);
838
843
  return sqrt$4(x * x + y * y);
839
844
  },
840
845
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
@@ -1860,7 +1865,7 @@ function getNameList(name) {
1860
1865
 
1861
1866
  const D$7 = Debug;
1862
1867
 
1863
- const debug$i = Debug.get("RunTime");
1868
+ const debug$j = Debug.get("RunTime");
1864
1869
 
1865
1870
  const Run = {
1866
1871
  currentId: 0,
@@ -1879,7 +1884,7 @@ const Run = {
1879
1884
  const time = R$1.idMap[id], name = R$1.nameMap[id];
1880
1885
  const duration = microsecond ? (performance.now() - time) / 1e3 : Date.now() - time;
1881
1886
  R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1882
- debug$i.log(name, duration, "ms");
1887
+ debug$j.log(name, duration, "ms");
1883
1888
  },
1884
1889
  endOfName(name, microsecond) {
1885
1890
  const id = R$1.nameToIdMap[name];
@@ -1915,18 +1920,18 @@ const Creator = {
1915
1920
  }
1916
1921
  };
1917
1922
 
1918
- const debug$h = Debug.get("UICreator");
1923
+ const debug$i = Debug.get("UICreator");
1919
1924
 
1920
1925
  const UICreator = {
1921
1926
  list: {},
1922
1927
  register(UI) {
1923
1928
  const {__tag: tag} = UI.prototype;
1924
- if (list$3[tag]) debug$h.repeat(tag);
1929
+ if (list$3[tag]) debug$i.repeat(tag);
1925
1930
  list$3[tag] = UI;
1926
1931
  },
1927
1932
  get(tag, data, x, y, width, height) {
1928
1933
  if (!list$3[tag]) {
1929
- debug$h.warn("not register " + tag);
1934
+ debug$i.warn("not register " + tag);
1930
1935
  return undefined;
1931
1936
  }
1932
1937
  const ui = new list$3[tag](data);
@@ -1942,7 +1947,7 @@ const UICreator = {
1942
1947
 
1943
1948
  const {list: list$3} = UICreator;
1944
1949
 
1945
- const debug$g = Debug.get("EventCreator");
1950
+ const debug$h = Debug.get("EventCreator");
1946
1951
 
1947
1952
  const EventCreator = {
1948
1953
  nameList: {},
@@ -1950,7 +1955,7 @@ const EventCreator = {
1950
1955
  let name;
1951
1956
  Object.keys(Event).forEach(key => {
1952
1957
  name = Event[key];
1953
- if (isString(name)) nameList[name] && debug$g.repeat(name), nameList[name] = Event;
1958
+ if (isString(name)) nameList[name] && debug$h.repeat(name), nameList[name] = Event;
1954
1959
  });
1955
1960
  },
1956
1961
  changeName(oldName, newName) {
@@ -2702,7 +2707,7 @@ const RectHelper = {
2702
2707
  }
2703
2708
  };
2704
2709
 
2705
- const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$b, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
2710
+ const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$c, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
2706
2711
 
2707
2712
  const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
2708
2713
 
@@ -2779,7 +2784,7 @@ const BezierHelper = {
2779
2784
  const lenCB = hypot$1(CBx, CBy);
2780
2785
  let totalRadian = endRadian - startRadian;
2781
2786
  if (totalRadian < 0) totalRadian += PI2;
2782
- if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$b(totalRadian - PI$3) < 1e-12) {
2787
+ if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$c(totalRadian - PI$3) < 1e-12) {
2783
2788
  if (data) data.push(L$b, x1, y1);
2784
2789
  if (setPointBounds) {
2785
2790
  setPoint$4(setPointBounds, fromX, fromY);
@@ -2812,7 +2817,7 @@ const BezierHelper = {
2812
2817
  let totalRadian = endRadian - startRadian;
2813
2818
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2814
2819
  if (anticlockwise) totalRadian -= PI2;
2815
- const parts = ceil$1(abs$b(totalRadian / PI_2));
2820
+ const parts = ceil$1(abs$c(totalRadian / PI_2));
2816
2821
  const partRadian = totalRadian / parts;
2817
2822
  const partRadian4Sin = sin$4(partRadian / 4);
2818
2823
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
@@ -2995,7 +3000,7 @@ const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$4, arc: arc$3, ellipse
2995
3000
 
2996
3001
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
2997
3002
 
2998
- const debug$f = Debug.get("PathConvert");
3003
+ const debug$g = Debug.get("PathConvert");
2999
3004
 
3000
3005
  const setEndPoint$1 = {};
3001
3006
 
@@ -3262,7 +3267,7 @@ const PathConvert = {
3262
3267
  break;
3263
3268
 
3264
3269
  default:
3265
- debug$f.error(`command: ${command} [index:${i}]`, old);
3270
+ debug$g.error(`command: ${command} [index:${i}]`, old);
3266
3271
  return data;
3267
3272
  }
3268
3273
  lastCommand = command;
@@ -3321,7 +3326,7 @@ const {M: M$9, L: L$9, C: C$7, Q: Q$5, Z: Z$7, N: N$4, D: D$5, X: X$4, G: G$4, F
3321
3326
 
3322
3327
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3323
3328
 
3324
- const {tan: tan, min: min$2, abs: abs$a} = Math;
3329
+ const {tan: tan, min: min$2, abs: abs$b} = Math;
3325
3330
 
3326
3331
  const startPoint = {};
3327
3332
 
@@ -3381,7 +3386,7 @@ const PathCommandDataHelper = {
3381
3386
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
3382
3387
  if (!isUndefined(lastX)) {
3383
3388
  const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
3384
- radius = min$2(radius, min$2(r, r * abs$a(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3389
+ radius = min$2(radius, min$2(r, r * abs$b(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3385
3390
  }
3386
3391
  data.push(U$4, x1, y1, x2, y2, radius);
3387
3392
  },
@@ -3496,7 +3501,7 @@ class PathCreator {
3496
3501
 
3497
3502
  const {M: M$8, L: L$8, C: C$6, Q: Q$4, Z: Z$6, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$4, P: P$3, U: U$3} = PathCommandMap;
3498
3503
 
3499
- const debug$e = Debug.get("PathDrawer");
3504
+ const debug$f = Debug.get("PathDrawer");
3500
3505
 
3501
3506
  const PathDrawer = {
3502
3507
  drawPathByData(drawer, data) {
@@ -3572,7 +3577,7 @@ const PathDrawer = {
3572
3577
  break;
3573
3578
 
3574
3579
  default:
3575
- debug$e.error(`command: ${command} [index:${i}]`, data);
3580
+ debug$f.error(`command: ${command} [index:${i}]`, data);
3576
3581
  return;
3577
3582
  }
3578
3583
  }
@@ -3586,7 +3591,7 @@ const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toT
3586
3591
 
3587
3592
  const {addPointBounds: addPointBounds, copy: copy$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3588
3593
 
3589
- const debug$d = Debug.get("PathBounds");
3594
+ const debug$e = Debug.get("PathBounds");
3590
3595
 
3591
3596
  let radius, radiusX, radiusY;
3592
3597
 
@@ -3708,7 +3713,7 @@ const PathBounds = {
3708
3713
  break;
3709
3714
 
3710
3715
  default:
3711
- debug$d.error(`command: ${command} [index:${i}]`, data);
3716
+ debug$e.error(`command: ${command} [index:${i}]`, data);
3712
3717
  return;
3713
3718
  }
3714
3719
  }
@@ -3863,7 +3868,7 @@ F$2.mineType = F$2.mimeType;
3863
3868
 
3864
3869
  F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
3865
3870
 
3866
- const debug$c = Debug.get("TaskProcessor");
3871
+ const debug$d = Debug.get("TaskProcessor");
3867
3872
 
3868
3873
  class TaskItem {
3869
3874
  constructor(task) {
@@ -3880,7 +3885,7 @@ class TaskItem {
3880
3885
  if (this.canUse && !this.canUse()) return this.cancel();
3881
3886
  if (this.task) yield this.task();
3882
3887
  } catch (error) {
3883
- debug$c.error(error);
3888
+ debug$d.error(error);
3884
3889
  }
3885
3890
  });
3886
3891
  }
@@ -4101,7 +4106,7 @@ class TaskProcessor {
4101
4106
  }
4102
4107
  }
4103
4108
 
4104
- const debug$b = Debug.get("Resource");
4109
+ const debug$c = Debug.get("Resource");
4105
4110
 
4106
4111
  const Resource = {
4107
4112
  tasker: new TaskProcessor,
@@ -4113,7 +4118,7 @@ const Resource = {
4113
4118
  return R.tasker.isComplete;
4114
4119
  },
4115
4120
  set(key, value) {
4116
- if (R.map[key]) debug$b.repeat(key);
4121
+ if (R.map[key]) debug$c.repeat(key);
4117
4122
  R.map[key] = value;
4118
4123
  },
4119
4124
  get(key) {
@@ -4526,11 +4531,15 @@ function affectRenderBoundsType(defaultValue) {
4526
4531
  function surfaceType(defaultValue) {
4527
4532
  return decorateLeafAttr(defaultValue, key => attr({
4528
4533
  set(value) {
4529
- this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
4534
+ this.__setAttr(key, value) && doSurfaceType(this);
4530
4535
  }
4531
4536
  }));
4532
4537
  }
4533
4538
 
4539
+ function doSurfaceType(leaf) {
4540
+ leaf.__layout.surfaceChanged || leaf.__layout.surfaceChange();
4541
+ }
4542
+
4534
4543
  function dimType(defaultValue) {
4535
4544
  return decorateLeafAttr(defaultValue, key => attr({
4536
4545
  set(value) {
@@ -4596,12 +4605,12 @@ function sortType(defaultValue) {
4596
4605
  }));
4597
4606
  }
4598
4607
 
4599
- function maskType(defaultValue) {
4608
+ function maskType(defaultValue, updateSelf) {
4600
4609
  return decorateLeafAttr(defaultValue, key => attr({
4601
4610
  set(value) {
4602
4611
  if (this.__setAttr(key, value)) {
4603
4612
  this.__layout.boxChanged || this.__layout.boxChange();
4604
- this.waitParent(() => {
4613
+ updateSelf ? this.__updateMask() : this.waitParent(() => {
4605
4614
  this.parent.__updateMask(value);
4606
4615
  });
4607
4616
  }
@@ -4719,7 +4728,7 @@ function defineDataProcessor(target, key, defaultValue) {
4719
4728
  defineKey(data, key, property);
4720
4729
  }
4721
4730
 
4722
- const debug$a = new Debug("rewrite");
4731
+ const debug$b = new Debug("rewrite");
4723
4732
 
4724
4733
  const list$2 = [];
4725
4734
 
@@ -4745,7 +4754,7 @@ function rewriteAble() {
4745
4754
  function doRewrite(error) {
4746
4755
  if (list$2.length) {
4747
4756
  list$2.forEach(item => {
4748
- if (error) debug$a.error(item.name, "需在Class上装饰@rewriteAble()");
4757
+ if (error) debug$b.error(item.name, "需在Class上装饰@rewriteAble()");
4749
4758
  item.run();
4750
4759
  });
4751
4760
  list$2.length = 0;
@@ -5160,12 +5169,12 @@ const BranchHelper = {
5160
5169
  w.height *= scaleY;
5161
5170
  w.scaleX *= scaleX;
5162
5171
  w.scaleY *= scaleY;
5163
- if (branch.isBranch) scale$4(branch, x, y, scaleX, scaleY, a, b);
5172
+ if (branch.isBranch) scale$5(branch, x, y, scaleX, scaleY, a, b);
5164
5173
  }
5165
5174
  }
5166
5175
  };
5167
5176
 
5168
- const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$4} = BranchHelper;
5177
+ const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$5} = BranchHelper;
5169
5178
 
5170
5179
  const WaitHelper = {
5171
5180
  run(wait) {
@@ -5991,14 +6000,14 @@ const LeafEventer = {
5991
6000
  destroyEventer: destroy
5992
6001
  };
5993
6002
 
5994
- const debug$9 = Debug.get("setAttr");
6003
+ const debug$a = Debug.get("setAttr");
5995
6004
 
5996
6005
  const LeafDataProxy = {
5997
6006
  __setAttr(name, newValue, checkFiniteNumber) {
5998
6007
  if (this.leaferIsCreated) {
5999
6008
  const oldValue = this.__.__getInput(name);
6000
6009
  if (checkFiniteNumber && !isFinite$1(newValue) && !isUndefined(newValue)) {
6001
- debug$9.warn(this.innerName, name, newValue);
6010
+ debug$a.warn(this.innerName, name, newValue);
6002
6011
  newValue = undefined;
6003
6012
  }
6004
6013
  if (isObject(newValue) || oldValue !== newValue) {
@@ -6253,7 +6262,8 @@ const BranchRender = {
6253
6262
  if (this.__worldOpacity && hasSize(nowWorld)) {
6254
6263
  const data = this.__;
6255
6264
  if (data.__useDim) {
6256
- if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
6265
+ if (data.bright && !options.topRendering) return options.topList.add(this);
6266
+ if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
6257
6267
  }
6258
6268
  if (data.__single && !this.isBranchLeaf) {
6259
6269
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
@@ -6277,6 +6287,7 @@ const BranchRender = {
6277
6287
  child = children[i];
6278
6288
  excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
6279
6289
  }
6290
+ if (this.__hasMask === 0) this.__rerenderMask(canvas, options);
6280
6291
  }
6281
6292
  },
6282
6293
  __clip(canvas, options) {
@@ -6493,11 +6504,19 @@ let Leaf = class Leaf {
6493
6504
  updateLayout() {
6494
6505
  this.__layout.update();
6495
6506
  }
6496
- forceUpdate(attrName) {
6497
- if (isUndefined(attrName)) attrName = "width"; else if (attrName === "surface") attrName = "blendMode";
6498
- const value = this.__.__getInput(attrName);
6499
- this.__[attrName] = isUndefined(value) ? null : undefined;
6500
- this[attrName] = value;
6507
+ forceUpdate(typeOrAttrName) {
6508
+ let quick;
6509
+ if (!typeOrAttrName || typeOrAttrName === "bounds") doBoundsType(this), quick = true; else if (typeOrAttrName === "surface") doSurfaceType(this),
6510
+ quick = true; else if (typeOrAttrName === "stroke") doStrokeType(this), quick = true;
6511
+ if (quick) {
6512
+ const {leafer: leafer} = this;
6513
+ return leafer && leafer.watcher && leafer.watcher.__onAttrChange({
6514
+ target: this
6515
+ });
6516
+ }
6517
+ const value = this.__.__getInput(typeOrAttrName);
6518
+ this.__[typeOrAttrName] = isUndefined(value) ? null : undefined;
6519
+ this[typeOrAttrName] = value;
6501
6520
  }
6502
6521
  forceRender(_bounds, _sync) {
6503
6522
  this.forceUpdate("surface");
@@ -6516,7 +6535,8 @@ let Leaf = class Leaf {
6516
6535
  canvas.restore();
6517
6536
  }
6518
6537
  __updateMask(_value) {
6519
- this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
6538
+ const hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
6539
+ this.__hasMask = this.__.maskskip ? hasMask && 0 : hasMask;
6520
6540
  }
6521
6541
  __getNowWorld(options) {
6522
6542
  if (options.matrix) {
@@ -6710,7 +6730,7 @@ const {sort: sort} = BranchHelper;
6710
6730
 
6711
6731
  const {localBoxBounds: localBoxBounds, localStrokeBounds: localStrokeBounds, localRenderBounds: localRenderBounds, maskLocalBoxBounds: maskLocalBoxBounds, maskLocalStrokeBounds: maskLocalStrokeBounds, maskLocalRenderBounds: maskLocalRenderBounds} = LeafBoundsHelper;
6712
6732
 
6713
- const debug$8 = new Debug("Branch");
6733
+ const debug$9 = new Debug("Branch");
6714
6734
 
6715
6735
  let Branch = class Branch extends Leaf {
6716
6736
  __updateStrokeSpread() {
@@ -6752,7 +6772,7 @@ let Branch = class Branch extends Leaf {
6752
6772
  this.__layout.childrenSortChanged = false;
6753
6773
  }
6754
6774
  add(child, index) {
6755
- if (child === this || child.destroyed) return debug$8.warn("add self or destroyed");
6775
+ if (child === this || child.destroyed) return debug$9.warn("add self or destroyed");
6756
6776
  const noIndex = isUndefined(index);
6757
6777
  if (!child.__) {
6758
6778
  if (isArray(child)) return child.forEach(item => {
@@ -6985,7 +7005,7 @@ class LeafLevelList {
6985
7005
  }
6986
7006
  }
6987
7007
 
6988
- const version = "2.1.11";
7008
+ const version = "2.2.1";
6989
7009
 
6990
7010
  class LeaferCanvas extends LeaferCanvasBase {
6991
7011
  get allowBackgroundColor() {
@@ -7427,7 +7447,7 @@ class LayoutBlockData {
7427
7447
 
7428
7448
  const {updateAllMatrix: updateAllMatrix$1, updateAllChange: updateAllChange} = LeafHelper;
7429
7449
 
7430
- const debug$7 = Debug.get("Layouter");
7450
+ const debug$8 = Debug.get("Layouter");
7431
7451
 
7432
7452
  class Layouter {
7433
7453
  constructor(target, userConfig) {
@@ -7461,7 +7481,7 @@ class Layouter {
7461
7481
  this.layoutOnce();
7462
7482
  target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks, this.times));
7463
7483
  } catch (e) {
7464
- debug$7.error(e);
7484
+ debug$8.error(e);
7465
7485
  }
7466
7486
  this.layoutedBlocks = null;
7467
7487
  }
@@ -7473,8 +7493,8 @@ class Layouter {
7473
7493
  }
7474
7494
  }
7475
7495
  layoutOnce() {
7476
- if (this.layouting) return debug$7.warn("layouting");
7477
- if (this.times > 3) return debug$7.warn("layout max times");
7496
+ if (this.layouting) return debug$8.warn("layouting");
7497
+ if (this.times > 3) return debug$8.warn("layout max times");
7478
7498
  this.times++;
7479
7499
  this.totalTimes++;
7480
7500
  this.layouting = true;
@@ -7567,7 +7587,7 @@ class Layouter {
7567
7587
  }
7568
7588
  }
7569
7589
 
7570
- const debug$6 = Debug.get("Renderer");
7590
+ const debug$7 = Debug.get("Renderer");
7571
7591
 
7572
7592
  class Renderer {
7573
7593
  get needFill() {
@@ -7622,7 +7642,7 @@ class Renderer {
7622
7642
  const {target: target} = this;
7623
7643
  this.times = 0;
7624
7644
  this.totalBounds = new Bounds;
7625
- debug$6.log(target.innerName, "---\x3e");
7645
+ debug$7.log(target.innerName, "---\x3e");
7626
7646
  try {
7627
7647
  this.emitRender(RenderEvent.START);
7628
7648
  this.renderOnce(callback);
@@ -7630,9 +7650,9 @@ class Renderer {
7630
7650
  ImageManager.clearRecycled();
7631
7651
  } catch (e) {
7632
7652
  this.rendering = false;
7633
- debug$6.error(e);
7653
+ debug$7.error(e);
7634
7654
  }
7635
- debug$6.log("-------------|");
7655
+ debug$7.log("-------------|");
7636
7656
  }
7637
7657
  renderAgain() {
7638
7658
  if (this.rendering) {
@@ -7642,8 +7662,8 @@ class Renderer {
7642
7662
  }
7643
7663
  }
7644
7664
  renderOnce(callback) {
7645
- if (this.rendering) return debug$6.warn("rendering");
7646
- if (this.times > 3) return debug$6.warn("render max times");
7665
+ if (this.rendering) return debug$7.warn("rendering");
7666
+ if (this.times > 3) return debug$7.warn("render max times");
7647
7667
  this.times++;
7648
7668
  this.totalTimes++;
7649
7669
  this.rendering = true;
@@ -7775,7 +7795,7 @@ class Renderer {
7775
7795
  if (updatedList) updatedList.list.some(leaf => {
7776
7796
  empty = !leaf.__world.width || !leaf.__world.height;
7777
7797
  if (empty) {
7778
- if (!leaf.isLeafer) debug$6.tip(leaf.innerName, ": empty");
7798
+ if (!leaf.isLeafer) debug$7.tip(leaf.innerName, ": empty");
7779
7799
  empty = !leaf.isBranch || leaf.isBranchLeaf;
7780
7800
  }
7781
7801
  return empty;
@@ -7862,7 +7882,7 @@ class Picker {
7862
7882
  for (let i = 0, len = list.length; i < len; i++) {
7863
7883
  find = list[i];
7864
7884
  if (ignoreHittable || LeafHelper.worldHittable(find)) {
7865
- this.hitChild(find, point);
7885
+ this.hitChild(find, find.hitThrough ? this.point : point);
7866
7886
  if (findList.length) {
7867
7887
  if (find.isBranchLeaf && list.some(item => item !== find && LeafHelper.hasParent(item, find))) {
7868
7888
  findList.reset();
@@ -7875,7 +7895,7 @@ class Picker {
7875
7895
  }
7876
7896
  if (bottomList) {
7877
7897
  for (let i = 0, len = bottomList.length; i < len; i++) {
7878
- this.hitChild(bottomList[i].target, this.point, bottomList[i].proxy);
7898
+ this.hitChild(bottomList[i].target, this.point, undefined, bottomList[i].proxy);
7879
7899
  if (findList.length) return findList.list[0];
7880
7900
  }
7881
7901
  }
@@ -7933,42 +7953,38 @@ class Picker {
7933
7953
  hitBranch(branch) {
7934
7954
  this.eachFind(branch.children, branch.__onlyHitMask);
7935
7955
  }
7936
- eachFind(children, hitMask) {
7956
+ eachFind(children, onlyHitMask) {
7937
7957
  let child, hit, data;
7938
7958
  const {point: point} = this, len = children.length;
7939
7959
  for (let i = len - 1; i > -1; i--) {
7940
7960
  child = children[i], data = child.__;
7941
- if (!data.visible || hitMask && !data.mask) continue;
7961
+ if (!data.visible || onlyHitMask && !data.mask) continue;
7942
7962
  hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$3, point, data.hitRadius) : point);
7943
7963
  if (child.isBranch) {
7944
7964
  if (hit || child.__ignoreHitWorld) {
7945
7965
  if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
7946
7966
  if (child.topChildren) this.eachFind(child.topChildren, false);
7947
7967
  this.eachFind(child.children, child.__onlyHitMask);
7948
- if (child.isBranchLeaf) this.hitChild(child, point);
7968
+ if (child.isBranchLeaf) this.hitChild(child, point, onlyHitMask);
7949
7969
  }
7950
7970
  } else {
7951
- if (hit) this.hitChild(child, point);
7971
+ if (hit) this.hitChild(child, point, onlyHitMask);
7952
7972
  }
7953
7973
  }
7954
7974
  }
7955
- hitChild(child, point, proxy) {
7975
+ hitChild(child, point, onlyHitMask, proxy) {
7956
7976
  if (this.exclude && this.exclude.has(child)) return;
7957
- if (child.__hitWorld(point)) {
7958
- const {parent: parent} = child;
7959
- if (parent && parent.__hasMask && !child.__.mask) {
7960
- let findMasks = [], item;
7961
- const {children: children} = parent;
7962
- for (let i = 0, len = children.length; i < len; i++) {
7963
- item = children[i];
7964
- if (item.__.mask) findMasks.push(item);
7965
- if (item === child) {
7966
- if (findMasks && !findMasks.every(value => value.__hitWorld(point))) return;
7967
- break;
7968
- }
7969
- }
7977
+ if (child.__hitWorld(point, onlyHitMask && child.mask === "path" ? true : undefined)) {
7978
+ const {parent: parent, mask: mask} = child;
7979
+ if (parent && parent.__hasMask && mask && !(mask === "clipping" || mask === "clipping-path")) {
7980
+ if (!parent.children.some(item => !item.mask && item.__hitWorld(point))) return;
7981
+ }
7982
+ const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
7983
+ if (hitThrough) {
7984
+ const index = findList.list.findIndex(item => item[hitThrough] === child[hitThrough]);
7985
+ if (index > 0) return findList.addAt(leaf, index);
7970
7986
  }
7971
- this.findList.add(proxy || child);
7987
+ findList.add(leaf);
7972
7988
  }
7973
7989
  }
7974
7990
  clear() {
@@ -8139,7 +8155,7 @@ const emptyPaint = {
8139
8155
  originPaint: {}
8140
8156
  };
8141
8157
 
8142
- const debug$5 = Debug.get("UIData");
8158
+ const debug$6 = Debug.get("UIData");
8143
8159
 
8144
8160
  class UIData extends LeafData {
8145
8161
  get scale() {
@@ -8189,14 +8205,14 @@ class UIData extends LeafData {
8189
8205
  if (value < 0) {
8190
8206
  this._width = -value;
8191
8207
  this.__leaf.scaleX *= -1;
8192
- debug$5.warn("width < 0, instead -scaleX ", this);
8208
+ debug$6.warn("width < 0, instead -scaleX ", this);
8193
8209
  } else this._width = value;
8194
8210
  }
8195
8211
  setHeight(value) {
8196
8212
  if (value < 0) {
8197
8213
  this._height = -value;
8198
8214
  this.__leaf.scaleY *= -1;
8199
- debug$5.warn("height < 0, instead -scaleY", this);
8215
+ debug$6.warn("height < 0, instead -scaleY", this);
8200
8216
  } else this._height = value;
8201
8217
  }
8202
8218
  setFill(value) {
@@ -8830,6 +8846,8 @@ __decorate([ dataType(false) ], UI.prototype, "editable", void 0);
8830
8846
 
8831
8847
  __decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
8832
8848
 
8849
+ __decorate([ hitType() ], UI.prototype, "hitThrough", void 0);
8850
+
8833
8851
  __decorate([ hitType("path") ], UI.prototype, "hitFill", void 0);
8834
8852
 
8835
8853
  __decorate([ strokeType("path") ], UI.prototype, "hitStroke", void 0);
@@ -8943,7 +8961,7 @@ Group = __decorate([ useModule(Branch), registerUI() ], Group);
8943
8961
 
8944
8962
  var Leafer_1;
8945
8963
 
8946
- const debug$4 = Debug.get("Leafer");
8964
+ const debug$5 = Debug.get("Leafer");
8947
8965
 
8948
8966
  let Leafer = Leafer_1 = class Leafer extends Group {
8949
8967
  get __tag() {
@@ -9304,7 +9322,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
9304
9322
  ImageManager.clearRecycled();
9305
9323
  }, 100);
9306
9324
  } catch (e) {
9307
- debug$4.error(e);
9325
+ debug$5.error(e);
9308
9326
  }
9309
9327
  }
9310
9328
  };
@@ -9470,7 +9488,7 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
9470
9488
 
9471
9489
  Frame = __decorate([ registerUI() ], Frame);
9472
9490
 
9473
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse$1} = PathCommandDataHelper, {tempPoint: tempPoint$2, set: set$1, rotate: rotate$4} = PointHelper, {abs: abs$9} = Math, tempCenter = {};
9491
+ const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse$1} = PathCommandDataHelper, {tempPoint: tempPoint$2, set: set$1, rotate: rotate$4} = PointHelper, {abs: abs$a} = Math, tempCenter = {};
9474
9492
 
9475
9493
  let Ellipse = class Ellipse extends UI {
9476
9494
  get __tag() {
@@ -9482,7 +9500,7 @@ let Ellipse = class Ellipse extends UI {
9482
9500
  const path = data.path = [];
9483
9501
  let open, hasAngle, closedAngle;
9484
9502
  if (startAngle || endAngle) hasAngle = true;
9485
- if (hasAngle) closedAngle = abs$9(endAngle - startAngle) === 360;
9503
+ if (hasAngle) closedAngle = abs$a(endAngle - startAngle) === 360;
9486
9504
  if (innerRadius) {
9487
9505
  const drawInnerEllipse = innerRadius < 1 || closed;
9488
9506
  let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
@@ -9788,7 +9806,7 @@ let Text = class Text extends UI {
9788
9806
  data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
9789
9807
  stintSet$3(data, "__padding", padding && MathHelper.fourNumber(padding));
9790
9808
  stintSet$3(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
9791
- stintSet$3(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
9809
+ stintSet$3(data, "__isCharMode", width || height || data.__letterSpacing || data.motionText || textCase !== "none");
9792
9810
  data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
9793
9811
  }
9794
9812
  __updateBoxBounds() {
@@ -9813,7 +9831,7 @@ let Text = class Text extends UI {
9813
9831
  this.__updateNaturalSize();
9814
9832
  } else super.__updateBoxBounds();
9815
9833
  if (italic) b.width += fontSize * .16;
9816
- DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9834
+ DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds) && !data.motionText);
9817
9835
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9818
9836
  }
9819
9837
  __updateRenderSpread() {
@@ -10154,7 +10172,7 @@ class UIEvent extends Event {
10154
10172
  }
10155
10173
  }
10156
10174
 
10157
- const {min: min$1, max: max$3, abs: abs$8} = Math, {float: float$3, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
10175
+ const {min: min$1, max: max$3, abs: abs$9} = Math, {float: float$3, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
10158
10176
 
10159
10177
  const tempContent = new Bounds, tempDragBounds = new Bounds;
10160
10178
 
@@ -10237,7 +10255,7 @@ const DragBoundsHelper = {
10237
10255
  bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
10238
10256
  correctScaleY *= max$3(aScale, bScale);
10239
10257
  if (lockRatio) {
10240
- aScale = max$3(abs$8(correctScaleX), abs$8(correctScaleY));
10258
+ aScale = max$3(abs$9(correctScaleX), abs$9(correctScaleY));
10241
10259
  correctScaleX = sign$2(correctScaleX) * aScale;
10242
10260
  correctScaleY = sign$2(correctScaleY) * aScale;
10243
10261
  }
@@ -10663,6 +10681,7 @@ class Dragger {
10663
10681
  }
10664
10682
  dragEnd(data) {
10665
10683
  if (!this.dragging && !this.moving) return;
10684
+ setTimeout(() => this.interaction.pointerMove(data));
10666
10685
  if (this.checkDragEndAnimate(data)) return;
10667
10686
  this.dragEndReal(data);
10668
10687
  }
@@ -10720,7 +10739,7 @@ class Dragger {
10720
10739
  }
10721
10740
  }
10722
10741
 
10723
- const debug$3 = Debug.get("emit");
10742
+ const debug$4 = Debug.get("emit");
10724
10743
 
10725
10744
  function emit$1(type, data, path, excludePath) {
10726
10745
  if (!path && !data.path) return;
@@ -10742,7 +10761,7 @@ function emit$1(type, data, path, excludePath) {
10742
10761
  if (emitEvent(leaf, type, data, false, excludePath)) return;
10743
10762
  }
10744
10763
  } catch (e) {
10745
- debug$3.error(e);
10764
+ debug$4.error(e);
10746
10765
  }
10747
10766
  }
10748
10767
 
@@ -11416,8 +11435,10 @@ ui$5.__hit = function(inner, forceHitFill) {
11416
11435
  if (!needHitFillPath && !needHitStrokePath) return false;
11417
11436
  const radiusWidth = inner.radiusX * 2;
11418
11437
  let hitWidth = radiusWidth;
11438
+ let {strokeAlign: strokeAlign} = data;
11439
+ if (data.motionText) hitWidth += data.fontSize / 2, strokeAlign = "center";
11419
11440
  if (needHitStrokePath) {
11420
- switch (data.strokeAlign) {
11441
+ switch (strokeAlign) {
11421
11442
  case "inside":
11422
11443
  hitWidth += strokeWidth * 2;
11423
11444
  if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth)) return true;
@@ -11451,9 +11472,9 @@ rect.__hitFill = box$3.__hitFill = function(inner) {
11451
11472
  };
11452
11473
 
11453
11474
  Text.prototype.__drawHitPath = function(canvas) {
11454
- const {__lineHeight: __lineHeight, fontSize: fontSize, __baseLine: __baseLine, __letterSpacing: __letterSpacing, __textDrawData: data} = this.__;
11475
+ const data = this.__, {__lineHeight: __lineHeight, fontSize: fontSize, __baseLine: __baseLine, __letterSpacing: __letterSpacing, __textDrawData: drawData} = data;
11455
11476
  canvas.beginPath();
11456
- if (__letterSpacing < 0) this.__drawPathByBox(canvas); else data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
11477
+ if (data.motionText) this.__drawPathByData(canvas, data.__pathForMotionText); else if (__letterSpacing < 0) this.__drawPathByBox(canvas); else drawData.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
11457
11478
  };
11458
11479
 
11459
11480
  Group.prototype.pick = function(hitPoint, options) {
@@ -11640,7 +11661,8 @@ function fillPathOrText(ui, canvas, renderOptions) {
11640
11661
  ui.__.__font ? Paint.fillText(ui, canvas, renderOptions) : ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill();
11641
11662
  }
11642
11663
 
11643
- function fillText(ui, canvas, _renderOptions) {
11664
+ function fillText(ui, canvas, renderOptions) {
11665
+ if (ui.motionText) return Paint.fillMotionText(ui, canvas, renderOptions);
11644
11666
  const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
11645
11667
  if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
11646
11668
  let row;
@@ -12032,7 +12054,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
12032
12054
  data.__naturalWidth = image.width / data.pixelRatio;
12033
12055
  data.__naturalHeight = image.height / data.pixelRatio;
12034
12056
  if (data.__autoSide) {
12035
- ui.forceUpdate("width");
12057
+ ui.forceUpdate();
12036
12058
  LeafHelper.updateBounds(ui);
12037
12059
  ui.__layout.boundsChanged = true;
12038
12060
  if (ui.__proxyData) {
@@ -12259,9 +12281,9 @@ function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
12259
12281
  translate(transform, box.x + x, box.y + y);
12260
12282
  }
12261
12283
 
12262
- const {get: get$1, scale: scale$3, copy: copy$5} = MatrixHelper;
12284
+ const {get: get$1, scale: scale$4, copy: copy$5} = MatrixHelper;
12263
12285
 
12264
- const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
12286
+ const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$8} = Math;
12265
12287
 
12266
12288
  function createPatternTask(paint, ui, canvas, renderOptions) {
12267
12289
  if (!paint.patternTask) {
@@ -12286,15 +12308,15 @@ function createPattern(paint, ui, canvas, renderOptions) {
12286
12308
  width *= scaleX;
12287
12309
  height *= scaleY;
12288
12310
  if (gap && !brush) {
12289
- xGap = gap.x * scaleX / abs$7(data.scaleX || 1);
12290
- yGap = gap.y * scaleY / abs$7(data.scaleY || 1);
12311
+ xGap = gap.x * scaleX / abs$8(data.scaleX || 1);
12312
+ yGap = gap.y * scaleY / abs$8(data.scaleY || 1);
12291
12313
  }
12292
12314
  if (transform || scaleX !== 1 || scaleY !== 1) {
12293
12315
  scaleX *= getFloorScale(width + (xGap || 0));
12294
12316
  scaleY *= getFloorScale(height + (yGap || 0));
12295
12317
  imageMatrix = get$1();
12296
12318
  if (transform) copy$5(imageMatrix, transform);
12297
- scale$3(imageMatrix, 1 / scaleX, 1 / scaleY);
12319
+ scale$4(imageMatrix, 1 / scaleX, 1 / scaleY);
12298
12320
  }
12299
12321
  const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
12300
12322
  if (brush) {
@@ -12531,7 +12553,7 @@ const PaintGradientModule = {
12531
12553
  getTransform: getTransform
12532
12554
  };
12533
12555
 
12534
- const {copy: copy$4, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$6} = Math;
12556
+ const {copy: copy$4, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$7} = Math;
12535
12557
 
12536
12558
  const tempBounds$1 = {}, tempMatrix$1 = new Matrix;
12537
12559
 
@@ -12575,7 +12597,7 @@ function shadow$1(ui, current, shape) {
12575
12597
  function getShadowRenderSpread(_ui, shadow) {
12576
12598
  let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
12577
12599
  shadow.forEach(item => {
12578
- x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$6(item.spread || 0);
12600
+ x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$7(item.spread || 0);
12579
12601
  top = max$2(top, spread + blur - y);
12580
12602
  right = max$2(right, spread + blur + x);
12581
12603
  bottom = max$2(bottom, spread + blur + y);
@@ -13002,7 +13024,8 @@ const TextMode = 2;
13002
13024
 
13003
13025
  function layoutChar(drawData, style, width, _height) {
13004
13026
  const {rows: rows} = drawData;
13005
- const {textAlign: textAlign, paraIndent: paraIndent, __letterSpacing: __letterSpacing} = style;
13027
+ const {textAlign: textAlign, paraIndent: paraIndent} = style;
13028
+ const useLetter = style.__letterSpacing || style.motionText;
13006
13029
  const justifyLast = width && textAlign.includes("both");
13007
13030
  const justify = justifyLast || width && textAlign.includes("justify");
13008
13031
  const justifyLetter = justify && textAlign.includes("letter");
@@ -13015,8 +13038,8 @@ function layoutChar(drawData, style, width, _height) {
13015
13038
  remainingWidth = width - row.width - indentWidth;
13016
13039
  if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
13017
13040
  }
13018
- mode = __letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
13019
- if (row.isOverflow && !__letterSpacing) row.textMode = true;
13041
+ mode = useLetter || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
13042
+ if (row.isOverflow && !useLetter) row.textMode = true;
13020
13043
  if (mode === TextMode) {
13021
13044
  row.x += indentWidth;
13022
13045
  toTextChar$1(row);
@@ -13217,6 +13240,7 @@ function getDrawData$1(content, style) {
13217
13240
  let width = style.__getInput("width") || 0;
13218
13241
  let height = style.__getInput("height") || 0;
13219
13242
  const {__padding: padding} = style;
13243
+ if (style.motionText) width = height = 0;
13220
13244
  if (padding) {
13221
13245
  if (width) x = padding[left$3], width -= padding[right$3] + padding[left$3], !width && (width = .01); else if (!style.autoSizeAlign) x = padding[left$3];
13222
13246
  if (height) y = padding[top$2], height -= padding[top$2] + padding[bottom$2], !height && (height = .01); else if (!style.autoSizeAlign) y = padding[top$2];
@@ -13343,6 +13367,69 @@ EditorEvent.BEFORE_HOVER = "editor.before_hover";
13343
13367
 
13344
13368
  EditorEvent.HOVER = "editor.hover";
13345
13369
 
13370
+ const order = (a, b) => a.parent.children.indexOf(a) - b.parent.children.indexOf(b);
13371
+
13372
+ const reverseOrder = (a, b) => b.parent.children.indexOf(b) - a.parent.children.indexOf(a);
13373
+
13374
+ const EditorHelper = {
13375
+ group(list, element, userGroup) {
13376
+ list.sort(reverseOrder);
13377
+ const {app: app, parent: parent} = list[0];
13378
+ let group;
13379
+ if (userGroup && userGroup.add) {
13380
+ group = userGroup;
13381
+ } else {
13382
+ group = new Group(userGroup);
13383
+ }
13384
+ parent.addAt(group, parent.children.indexOf(list[0]));
13385
+ list.sort(order);
13386
+ const matrx = new Matrix(element.worldTransform);
13387
+ matrx.divideParent(parent.scrollWorldTransform);
13388
+ group.setTransform(matrx);
13389
+ group.editable = true;
13390
+ group.hitChildren = false;
13391
+ app.lockLayout();
13392
+ list.forEach(child => child.dropTo(group));
13393
+ app.unlockLayout();
13394
+ return group;
13395
+ },
13396
+ ungroup(list) {
13397
+ const {app: app} = list[0];
13398
+ const ungroupList = [];
13399
+ app.lockLayout();
13400
+ list.forEach(leaf => {
13401
+ if (leaf.isBranch) {
13402
+ const {parent: parent, children: children} = leaf;
13403
+ while (children.length) {
13404
+ ungroupList.push(children[0]);
13405
+ children[0].dropTo(parent, parent.children.indexOf(leaf));
13406
+ }
13407
+ if (leaf.isBranchLeaf) ungroupList.push(leaf); else leaf.remove();
13408
+ } else {
13409
+ ungroupList.push(leaf);
13410
+ }
13411
+ });
13412
+ app.unlockLayout();
13413
+ return ungroupList;
13414
+ },
13415
+ toTop(list) {
13416
+ list.sort(order);
13417
+ list.forEach(leaf => {
13418
+ if (leaf.parent) leaf.parent.add(leaf);
13419
+ });
13420
+ },
13421
+ toBottom(list) {
13422
+ list.sort(reverseOrder);
13423
+ list.forEach(leaf => {
13424
+ if (leaf.parent) leaf.parent.addAt(leaf, 0);
13425
+ });
13426
+ },
13427
+ mergeMaskConfig(_mergeConfig, _editor) {},
13428
+ getSiblingMaskElements(_editor) {
13429
+ return undefined;
13430
+ }
13431
+ };
13432
+
13346
13433
  function targetAttr(fn) {
13347
13434
  return (target, key) => {
13348
13435
  const privateKey = "_" + key;
@@ -13391,6 +13478,7 @@ function mergeConfigAttr() {
13391
13478
  get() {
13392
13479
  const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, editTool: editTool, innerEditor: innerEditor, app: app} = this, mergeConfig = Object.assign({}, config);
13393
13480
  if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig); else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig);
13481
+ if (element && element.mask) EditorHelper.mergeMaskConfig(mergeConfig, this);
13394
13482
  if (element && element.editConfig) {
13395
13483
  let {editConfig: editConfig} = element;
13396
13484
  if (editConfig.hover || editConfig.hoverStyle || editConfig.hoverPathType) {
@@ -13417,7 +13505,28 @@ function mergeConfigAttr() {
13417
13505
  };
13418
13506
  }
13419
13507
 
13420
- const {abs: abs$5} = Math;
13508
+ function editToolMergeConfigAttr() {
13509
+ return (target, key) => {
13510
+ defineKey(target, key, {
13511
+ get() {
13512
+ const t = this;
13513
+ const {config: config, userConfig: userConfig, configKeepKeys: configKeepKeys} = t, mergedConfig = config ? DataHelper.clone(config) : {};
13514
+ if (configKeepKeys) {
13515
+ for (let key in userConfig) {
13516
+ if (!configKeepKeys.includes(key)) mergedConfig[key] = userConfig[key];
13517
+ }
13518
+ }
13519
+ if (t.preMergedConfig) t.preMergedConfig(mergedConfig);
13520
+ if (configKeepKeys) configKeepKeys.forEach(key => {
13521
+ userConfig[key] && Object.assign(mergedConfig[key], userConfig[key]);
13522
+ });
13523
+ return t.mergedConfig = mergedConfig;
13524
+ }
13525
+ });
13526
+ };
13527
+ }
13528
+
13529
+ const {abs: abs$6} = Math;
13421
13530
 
13422
13531
  const {copy: copy$3} = MatrixHelper;
13423
13532
 
@@ -13460,7 +13569,7 @@ class Stroker extends UI {
13460
13569
  leaf = list[i];
13461
13570
  const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
13462
13571
  if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
13463
- const aScaleX = abs$5(worldTransform.scaleX), aScaleY = abs$5(worldTransform.scaleY);
13572
+ const aScaleX = abs$6(worldTransform.scaleX), aScaleY = abs$6(worldTransform.scaleY);
13464
13573
  copy$3(matrix$1, worldTransform);
13465
13574
  matrix$1.half = strokeWidth % 2;
13466
13575
  canvas.setWorld(matrix$1, options.matrix);
@@ -13615,7 +13724,11 @@ class EditSelect extends Group {
13615
13724
  }
13616
13725
  onSelect() {
13617
13726
  if (this.running) {
13618
- this.targetStroker.setTarget(this.editor.list);
13727
+ const {editor: editor} = this;
13728
+ let {list: list} = editor;
13729
+ const maskList = EditorHelper.getSiblingMaskElements(editor);
13730
+ if (maskList) list = maskList.concat(list);
13731
+ this.targetStroker.setTarget(list);
13619
13732
  this.hoverStroker.target = null;
13620
13733
  }
13621
13734
  }
@@ -13787,13 +13900,13 @@ class EditSelect extends Group {
13787
13900
 
13788
13901
  const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight: bottomRight, bottom: bottom$1, bottomLeft: bottomLeft, left: left$2} = Direction9;
13789
13902
 
13790
- const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$4} = Math;
13903
+ const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$5} = Math;
13791
13904
 
13792
13905
  const EditDataHelper = {
13793
13906
  getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
13794
13907
  let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
13795
13908
  const {widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldTransform: worldTransform, boxBounds: boxBounds} = target;
13796
- const {width: width, height: height} = startBounds, worldScaleX = abs$4(worldTransform.scaleX), worldScaleY = abs$4(worldTransform.scaleY);
13909
+ const {width: width, height: height} = startBounds, worldScaleX = abs$5(worldTransform.scaleX), worldScaleY = abs$5(worldTransform.scaleY);
13797
13910
  const originChangedScaleX = target.scaleX / startBounds.scaleX;
13798
13911
  const originChangedScaleY = target.scaleY / startBounds.scaleY;
13799
13912
  const signX = sign$1(originChangedScaleX);
@@ -13873,7 +13986,7 @@ const EditDataHelper = {
13873
13986
  break;
13874
13987
 
13875
13988
  default:
13876
- lockScale = Math.sqrt(abs$4(scaleX * scaleY));
13989
+ lockScale = Math.sqrt(abs$5(scaleX * scaleY));
13877
13990
  scaleX = sign$1(scaleX) * lockScale;
13878
13991
  scaleY = sign$1(scaleY) * lockScale;
13879
13992
  }
@@ -13907,10 +14020,10 @@ const EditDataHelper = {
13907
14020
  }
13908
14021
  const minWidth = 1, minHeight = 1;
13909
14022
  const worldWidth = worldScaleX * boxBounds.width, worldHeight = worldScaleY * boxBounds.height;
13910
- if (useScaleX && abs$4(scaleX * worldWidth) < minWidth) scaleX = sign$1(scaleX) * minWidth / worldWidth;
13911
- if (useScaleY && abs$4(scaleY * worldHeight) < minHeight) scaleY = sign$1(scaleY) * minHeight / worldHeight;
14023
+ if (useScaleX && abs$5(scaleX * worldWidth) < minWidth) scaleX = sign$1(scaleX) * minWidth / worldWidth;
14024
+ if (useScaleY && abs$5(scaleY * worldHeight) < minHeight) scaleY = sign$1(scaleY) * minHeight / worldHeight;
13912
14025
  if (lockRatio && scaleX !== scaleY) {
13913
- lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
14026
+ lockScale = Math.min(abs$5(scaleX), abs$5(scaleY));
13914
14027
  scaleX = sign$1(scaleX) * lockScale;
13915
14028
  scaleY = sign$1(scaleY) * lockScale;
13916
14029
  }
@@ -14132,6 +14245,8 @@ class EditPoint extends Box {
14132
14245
 
14133
14246
  const fourDirection = [ "top", "right", "bottom", "left" ], editConfig = undefined;
14134
14247
 
14248
+ const debug$3 = Debug.get("EditBox");
14249
+
14135
14250
  class EditBox extends Group {
14136
14251
  get mergeConfig() {
14137
14252
  const {config: config} = this, {mergeConfig: mergeConfig, editBox: editBox} = this.editor;
@@ -14202,10 +14317,12 @@ class EditBox extends Group {
14202
14317
  this.resizeLines = [];
14203
14318
  this.dragStartData = {};
14204
14319
  this.__eventIds = [];
14320
+ this.widgets = [];
14205
14321
  this.editor = editor;
14206
14322
  this.visible = false;
14207
14323
  this.create();
14208
14324
  this.__listenEvents();
14325
+ this.createWidgets();
14209
14326
  }
14210
14327
  create() {
14211
14328
  let rotatePoint, resizeLine, resizePoint;
@@ -14241,7 +14358,7 @@ class EditBox extends Group {
14241
14358
  }
14242
14359
  this.listenPointEvents(circle, "rotate", 2);
14243
14360
  this.listenPointEvents(rect, "move", 8);
14244
- view.addMany(...rotatePoints, rect, circle, buttons, ...resizeLines, ...resizePoints);
14361
+ view.add([ ...rotatePoints, rect, circle, buttons, ...resizeLines, ...resizePoints ]);
14245
14362
  this.add(view);
14246
14363
  }
14247
14364
  load() {
@@ -14254,6 +14371,7 @@ class EditBox extends Group {
14254
14371
  let resizeP;
14255
14372
  for (let i = 0; i < 8; i++) {
14256
14373
  resizeP = resizePoints[i];
14374
+ if (resizeP.children.length) resizeP.clear();
14257
14375
  resizeP.set(this.getPointStyle(i % 2 ? middlePointsStyle[(i - 1) / 2 % middlePointsStyle.length] : pointsStyle[i / 2 % pointsStyle.length]));
14258
14376
  resizeP.rotation = (i - (i % 2 ? 1 : 0)) / 2 * 90;
14259
14377
  if (i % 2) resizeLines[(i - 1) / 2].set(Object.assign({
@@ -14279,6 +14397,7 @@ class EditBox extends Group {
14279
14397
  }
14280
14398
  if (single) DataHelper.stintSet(target.__world, "ignorePixelSnap", ignorePixelSnap);
14281
14399
  updateMoveCursor(this);
14400
+ this.loadWidgets();
14282
14401
  }
14283
14402
  update() {
14284
14403
  const {editor: editor} = this;
@@ -14299,8 +14418,10 @@ class EditBox extends Group {
14299
14418
  width: width,
14300
14419
  height: height
14301
14420
  });
14421
+ this.updateWidgets();
14302
14422
  }
14303
14423
  unload() {
14424
+ this.unloadWidgets();
14304
14425
  this.visible = false;
14305
14426
  if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
14306
14427
  }
@@ -14313,6 +14434,7 @@ class EditBox extends Group {
14313
14434
  strokeBoxSpread && BoundsHelper.spread(bounds, [ strokeBoxSpread * Math.abs(scaleY), strokeBoxSpread * Math.abs(scaleX) ]);
14314
14435
  }
14315
14436
  if (spread) BoundsHelper.spread(bounds, spread);
14437
+ this.rectBounds = bounds;
14316
14438
  editMask.visible = mask ? true : 0;
14317
14439
  if (!isUndefined(dimOthers) || !isUndefined(bright)) {
14318
14440
  editor.setDimOthers(dimOthers);
@@ -14324,7 +14446,7 @@ class EditBox extends Group {
14324
14446
  if (this.view.worldOpacity) {
14325
14447
  const {width: width, height: height} = bounds;
14326
14448
  const smallSize = isNumber(hideOnSmall) ? hideOnSmall : 10;
14327
- const showPoints = editBox && !(hideOnSmall && width < smallSize && height < smallSize);
14449
+ const showPoints = this.showPoints = editBox && !(hideOnSmall && width < smallSize && height < smallSize);
14328
14450
  let point = {}, rotateP, resizeP, resizeL;
14329
14451
  for (let i = 0; i < 8; i++) {
14330
14452
  AroundHelper.toPoint(AroundHelper.directionData[i], bounds, point);
@@ -14618,13 +14740,38 @@ class EditBox extends Group {
14618
14740
  __removeListenEvents() {
14619
14741
  this.off_(this.__eventIds);
14620
14742
  }
14743
+ static registerWidget(Widget) {
14744
+ const {tag: tag} = Widget.prototype;
14745
+ EditBox.WidgetList[tag] && debug$3.repeat(tag);
14746
+ EditBox.WidgetList[tag] = Widget;
14747
+ }
14748
+ createWidgets() {
14749
+ Object.values(EditBox.WidgetList).forEach(item => {
14750
+ this.widgets.push(new item(this));
14751
+ });
14752
+ }
14753
+ loadWidgets() {
14754
+ this.widgets.forEach(item => item.onLoad());
14755
+ }
14756
+ updateWidgets() {
14757
+ this.widgets.forEach(item => item.onUpdate());
14758
+ }
14759
+ unloadWidgets() {
14760
+ this.widgets.forEach(item => item.onUnload());
14761
+ }
14762
+ destroyWidgets() {
14763
+ this.widgets.forEach(item => item.onDestroy());
14764
+ }
14621
14765
  destroy() {
14622
14766
  this.editor = null;
14623
14767
  this.__removeListenEvents();
14768
+ this.destroyWidgets();
14624
14769
  super.destroy();
14625
14770
  }
14626
14771
  }
14627
14772
 
14773
+ EditBox.WidgetList = {};
14774
+
14628
14775
  const bigBounds = {
14629
14776
  x: 0,
14630
14777
  y: 0,
@@ -14771,65 +14918,6 @@ function onHover(editor, oldValue) {
14771
14918
  }));
14772
14919
  }
14773
14920
 
14774
- const order = (a, b) => a.parent.children.indexOf(a) - b.parent.children.indexOf(b);
14775
-
14776
- const reverseOrder = (a, b) => b.parent.children.indexOf(b) - a.parent.children.indexOf(a);
14777
-
14778
- const EditorHelper = {
14779
- group(list, element, userGroup) {
14780
- list.sort(reverseOrder);
14781
- const {app: app, parent: parent} = list[0];
14782
- let group;
14783
- if (userGroup && userGroup.add) {
14784
- group = userGroup;
14785
- } else {
14786
- group = new Group(userGroup);
14787
- }
14788
- parent.addAt(group, parent.children.indexOf(list[0]));
14789
- list.sort(order);
14790
- const matrx = new Matrix(element.worldTransform);
14791
- matrx.divideParent(parent.scrollWorldTransform);
14792
- group.setTransform(matrx);
14793
- group.editable = true;
14794
- group.hitChildren = false;
14795
- app.lockLayout();
14796
- list.forEach(child => child.dropTo(group));
14797
- app.unlockLayout();
14798
- return group;
14799
- },
14800
- ungroup(list) {
14801
- const {app: app} = list[0];
14802
- const ungroupList = [];
14803
- app.lockLayout();
14804
- list.forEach(leaf => {
14805
- if (leaf.isBranch) {
14806
- const {parent: parent, children: children} = leaf;
14807
- while (children.length) {
14808
- ungroupList.push(children[0]);
14809
- children[0].dropTo(parent, parent.children.indexOf(leaf));
14810
- }
14811
- if (leaf.isBranchLeaf) ungroupList.push(leaf); else leaf.remove();
14812
- } else {
14813
- ungroupList.push(leaf);
14814
- }
14815
- });
14816
- app.unlockLayout();
14817
- return ungroupList;
14818
- },
14819
- toTop(list) {
14820
- list.sort(order);
14821
- list.forEach(leaf => {
14822
- if (leaf.parent) leaf.parent.add(leaf);
14823
- });
14824
- },
14825
- toBottom(list) {
14826
- list.sort(reverseOrder);
14827
- list.forEach(leaf => {
14828
- if (leaf.parent) leaf.parent.addAt(leaf, 0);
14829
- });
14830
- }
14831
- };
14832
-
14833
14921
  const debug$2 = Debug.get("EditToolCreator");
14834
14922
 
14835
14923
  function registerEditTool() {
@@ -15605,6 +15693,8 @@ __decorate([ targetAttr(onHover) ], Editor.prototype, "hoverTarget", void 0);
15605
15693
 
15606
15694
  Editor = __decorate([ useModule(TransformTool, [ "editBox", "editTool", "emitEvent" ]) ], Editor);
15607
15695
 
15696
+ const {abs: abs$4} = Math, {scale: scale$3} = PointHelper;
15697
+
15608
15698
  class InnerEditor {
15609
15699
  static registerInnerEditor() {
15610
15700
  EditToolCreator.register(this);
@@ -15615,6 +15705,9 @@ class InnerEditor {
15615
15705
  get mode() {
15616
15706
  return "focus";
15617
15707
  }
15708
+ get userConfig() {
15709
+ return this.editBox.mergeConfig[this.tag] || {};
15710
+ }
15618
15711
  get editBox() {
15619
15712
  return this._editBox || this.editor.editBox;
15620
15713
  }
@@ -15626,6 +15719,22 @@ class InnerEditor {
15626
15719
  this.editor = editor;
15627
15720
  this.create();
15628
15721
  }
15722
+ getEditBoxPoint(editTargetPoint, change) {
15723
+ const point = change ? editTargetPoint : {
15724
+ x: editTargetPoint.x,
15725
+ y: editTargetPoint.y
15726
+ }, {scaleX: scaleX, scaleY: scaleY} = this.editTarget.worldTransform;
15727
+ scale$3(point, abs$4(scaleX), abs$4(scaleY));
15728
+ return point;
15729
+ }
15730
+ getEditTargetPoint(editBoxPoint, change) {
15731
+ const point = change ? editBoxPoint : {
15732
+ x: editBoxPoint.x,
15733
+ y: editBoxPoint.y
15734
+ }, {scaleX: scaleX, scaleY: scaleY} = this.editTarget.worldTransform;
15735
+ scale$3(point, Math.abs(1 / scaleX), abs$4(1 / scaleY));
15736
+ return point;
15737
+ }
15629
15738
  onCreate() {}
15630
15739
  create() {
15631
15740
  this.view = new Group;
@@ -19111,7 +19220,7 @@ const HighCurveHelper = {
19111
19220
  },
19112
19221
  getMotionPathData(data) {
19113
19222
  let total = 0, distance, segments = [];
19114
- let i = 0, x = 0, y = 0, toX, toY, command;
19223
+ let i = 0, x = 0, y = 0, toX, toY, command, closed;
19115
19224
  const len = data.length;
19116
19225
  while (i < len) {
19117
19226
  command = data[i];
@@ -19136,6 +19245,7 @@ const HighCurveHelper = {
19136
19245
  break;
19137
19246
 
19138
19247
  case Z$1:
19248
+ closed = true;
19139
19249
  i += 1;
19140
19250
 
19141
19251
  default:
@@ -19147,13 +19257,16 @@ const HighCurveHelper = {
19147
19257
  return {
19148
19258
  total: total,
19149
19259
  segments: segments,
19150
- data: data
19260
+ data: data,
19261
+ closed: closed
19151
19262
  };
19152
19263
  },
19153
- getDistancePoint(distanceData, motionDistance, motionPrecision) {
19154
- const {segments: segments, data: data} = distanceData;
19155
- motionDistance = UnitConvert.number(motionDistance, distanceData.total);
19156
- let total = 0, distance, to = {};
19264
+ getDistancePoint(distanceData, motionDistance, motionPrecision, offsetX) {
19265
+ const {segments: segments, data: data, total: total} = distanceData;
19266
+ motionDistance = UnitConvert.number(motionDistance, total);
19267
+ if (offsetX) motionDistance += offsetX;
19268
+ if (motionDistance > total) motionDistance = motionDistance % total;
19269
+ let nowDistance = 0, distance, to = {};
19157
19270
  let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
19158
19271
  let x1, y1, x2, y2, t;
19159
19272
  const len = data.length;
@@ -19165,15 +19278,20 @@ const HighCurveHelper = {
19165
19278
  toX = data[i + 1];
19166
19279
  toY = data[i + 2];
19167
19280
  distance = segments[index];
19168
- if (total + distance >= motionDistance || !distanceData.total) {
19169
- if (!i) x = toX, y = toY;
19170
- tempFrom.x = x;
19171
- tempFrom.y = y;
19281
+ if (nowDistance + distance >= motionDistance || !distanceData.total) {
19172
19282
  to.x = toX;
19173
19283
  to.y = toY;
19174
- PointHelper.getDistancePoint(tempFrom, to, motionDistance - total, true);
19175
- to.rotation = PointHelper.getAngle(tempFrom, to);
19176
- return to;
19284
+ if (i) {
19285
+ tempFrom.x = x;
19286
+ tempFrom.y = y;
19287
+ PointHelper.getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
19288
+ to.rotation = PointHelper.getAngle(tempFrom, to);
19289
+ return to;
19290
+ } else {
19291
+ const nextPoint = HighCurveHelper.getDistancePoint(distanceData, motionPrecision, motionPrecision, offsetX);
19292
+ to.rotation = nextPoint.rotation;
19293
+ return to;
19294
+ }
19177
19295
  }
19178
19296
  x = toX;
19179
19297
  y = toY;
@@ -19184,9 +19302,9 @@ const HighCurveHelper = {
19184
19302
  toX = data[i + 5];
19185
19303
  toY = data[i + 6];
19186
19304
  distance = segments[index];
19187
- if (total + distance >= motionDistance) {
19305
+ if (nowDistance + distance >= motionDistance) {
19188
19306
  x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
19189
- t = HighBezierHelper.getT(motionDistance - total, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
19307
+ t = HighBezierHelper.getT(motionDistance - nowDistance, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
19190
19308
  BezierHelper.getPointAndSet(t, x, y, x1, y1, x2, y2, toX, toY, to);
19191
19309
  to.rotation = HighBezierHelper.getRotation(t, x, y, x1, y1, x2, y2, toX, toY);
19192
19310
  return to;
@@ -19203,7 +19321,7 @@ const HighCurveHelper = {
19203
19321
  distance = 0;
19204
19322
  }
19205
19323
  index++;
19206
- total += distance;
19324
+ nowDistance += distance;
19207
19325
  }
19208
19326
  return to;
19209
19327
  },
@@ -19302,26 +19420,57 @@ const {updateMatrix: updateMatrix, updateAllMatrix: updateAllMatrix} = LeafHelpe
19302
19420
 
19303
19421
  const {updateBounds: updateBounds} = BranchHelper;
19304
19422
 
19423
+ const {toVertical: toVertical} = PointHelper;
19424
+
19305
19425
  UI.addAttr("motionPath", undefined, motionPathType);
19306
19426
 
19307
19427
  UI.addAttr("motionPrecision", 1, motionPathType);
19308
19428
 
19309
19429
  UI.addAttr("motion", undefined, motionPathType);
19310
19430
 
19431
+ UI.addAttr("motionVertical", "below", motionPathType);
19432
+
19311
19433
  UI.addAttr("motionRotation", true, motionPathType);
19312
19434
 
19435
+ ui$2.getMotionPath = function() {
19436
+ return getMotionPath(this);
19437
+ };
19438
+
19313
19439
  ui$2.getMotionPathData = function() {
19314
19440
  return getMotionPathData(getMotionPath(this));
19315
19441
  };
19316
19442
 
19317
- ui$2.getMotionPoint = function(motionDistance) {
19318
- const path = getMotionPath(this);
19319
- const data = getMotionPathData(path);
19443
+ ui$2.getMotionContentHeight = function() {
19444
+ return this.__layout.boxBounds.height;
19445
+ };
19446
+
19447
+ ui$2.getMotionPoint = function(motionDistance, motionVertical, pathElement, offsetX = 0, offsetY = 0) {
19448
+ if (!pathElement) pathElement = getMotionPath(this);
19449
+ const data = getMotionPathData(pathElement);
19320
19450
  if (!data.total) return {};
19321
- const point = HighCurveHelper.getDistancePoint(data, motionDistance, path.motionPrecision);
19322
- MatrixHelper.toOuterPoint(path.localTransform, point);
19451
+ const point = HighCurveHelper.getDistancePoint(data, motionDistance, pathElement.motionPrecision, offsetX);
19323
19452
  const {motionRotation: motionRotation} = this;
19324
- if (motionRotation === false) delete point.rotation; else if (isNumber(motionRotation)) point.rotation += motionRotation;
19453
+ if (isNumber(motionRotation)) point.rotation += motionRotation;
19454
+ let verticalType, verticalOffset;
19455
+ if (isObject(motionVertical)) verticalType = motionVertical.type, verticalOffset = motionVertical.offset; else if (isNumber(motionVertical)) verticalOffset = motionVertical; else verticalType = motionVertical;
19456
+ if (verticalType !== "below" || offsetY) {
19457
+ const {rotation: rotation} = point, height = this.getMotionContentHeight();
19458
+ if (verticalOffset) offsetY += verticalType === "above" ? -verticalOffset : verticalOffset;
19459
+ switch (verticalType) {
19460
+ case "above":
19461
+ toVertical(point, rotation, -height + offsetY);
19462
+ break;
19463
+
19464
+ case "center":
19465
+ toVertical(point, rotation, -height / 2 + offsetY);
19466
+ break;
19467
+
19468
+ case "below":
19469
+ default:
19470
+ toVertical(point, rotation, offsetY);
19471
+ }
19472
+ }
19473
+ MatrixHelper.toOuterPoint(pathElement.localTransform, point);
19325
19474
  return point;
19326
19475
  };
19327
19476
 
@@ -19353,7 +19502,11 @@ function updateMotion(leaf) {
19353
19502
  const data = getMotionPathData(leaf);
19354
19503
  if (data.total) leaf.__.__pathForRender = HighCurveHelper.getDistancePath(data, motion, leaf.motionPrecision);
19355
19504
  } else {
19356
- leaf.set(leaf.getMotionPoint(motion));
19505
+ if (leaf.motionText) leaf.__updateMotionText(); else {
19506
+ const point = leaf.getMotionPoint(motion);
19507
+ if (leaf.motionRotation === false) delete point.rotation;
19508
+ leaf.set(point);
19509
+ }
19357
19510
  if (!leaf.__hasAutoLayout) {
19358
19511
  if (leaf.isBranch) updateAllMatrix(leaf), updateBounds(leaf, leaf); else updateMatrix(leaf);
19359
19512
  }
@@ -19375,7 +19528,8 @@ function getMotionPath(leaf) {
19375
19528
  function getMotionPathData(leaf) {
19376
19529
  const data = leaf.__;
19377
19530
  if (data.__pathForMotion) return data.__pathForMotion;
19378
- return data.__pathForMotion = HighCurveHelper.getMotionPathData(leaf.getPath(true, true));
19531
+ const path = data.__pathForMotion = HighCurveHelper.getMotionPathData(leaf.getPath(true, true));
19532
+ return path;
19379
19533
  }
19380
19534
 
19381
19535
  function stateType(defaultValue, styleName) {
@@ -19870,7 +20024,7 @@ let Robot = class Robot extends UI {
19870
20024
  const data = this.__;
19871
20025
  const width = nowFrame.width / data.pixelRatio;
19872
20026
  const height = nowFrame.height / data.pixelRatio;
19873
- if (data.width !== width || data.height !== height) this.forceUpdate("width");
20027
+ if (data.width !== width || data.height !== height) this.forceUpdate();
19874
20028
  data.__naturalWidth = width;
19875
20029
  data.__naturalHeight = height;
19876
20030
  }
@@ -21067,4 +21221,4 @@ function isSame(a, b) {
21067
21221
 
21068
21222
  Plugin.add("corner");
21069
21223
 
21070
- 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, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, 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, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, 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$3 as tempMatrix, tempPoint$6 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
21224
+ 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, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, 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, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, 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, doSurfaceType, editToolMergeConfigAttr, 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$3 as tempMatrix, tempPoint$6 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };