@leafer/miniapp 2.2.0 → 2.2.2

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(),
@@ -838,8 +838,8 @@ const PointHelper = {
838
838
  return getDistanceFrom(t.x, t.y, point.x, point.y);
839
839
  },
840
840
  getDistanceFrom(x1, y1, x2, y2) {
841
- const x = abs$c(x2 - x1);
842
- const y = abs$c(y2 - y1);
841
+ const x = abs$d(x2 - x1);
842
+ const y = abs$d(y2 - y1);
843
843
  return sqrt$4(x * x + y * y);
844
844
  },
845
845
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
@@ -1865,7 +1865,7 @@ function getNameList(name) {
1865
1865
 
1866
1866
  const D$7 = Debug;
1867
1867
 
1868
- const debug$i = Debug.get("RunTime");
1868
+ const debug$j = 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$i.log(name, duration, "ms");
1887
+ debug$j.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$h = Debug.get("UICreator");
1923
+ const debug$i = 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$3[tag]) debug$h.repeat(tag);
1929
+ if (list$3[tag]) debug$i.repeat(tag);
1930
1930
  list$3[tag] = UI;
1931
1931
  },
1932
1932
  get(tag, data, x, y, width, height) {
1933
1933
  if (!list$3[tag]) {
1934
- debug$h.warn("not register " + tag);
1934
+ debug$i.warn("not register " + tag);
1935
1935
  return undefined;
1936
1936
  }
1937
1937
  const ui = new list$3[tag](data);
@@ -1947,7 +1947,7 @@ const UICreator = {
1947
1947
 
1948
1948
  const {list: list$3} = UICreator;
1949
1949
 
1950
- const debug$g = Debug.get("EventCreator");
1950
+ const debug$h = 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$g.repeat(name), nameList[name] = Event;
1958
+ if (isString(name)) nameList[name] && debug$h.repeat(name), nameList[name] = Event;
1959
1959
  });
1960
1960
  },
1961
1961
  changeName(oldName, newName) {
@@ -2707,7 +2707,7 @@ const RectHelper = {
2707
2707
  }
2708
2708
  };
2709
2709
 
2710
- 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;
2711
2711
 
2712
2712
  const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
2713
2713
 
@@ -2784,7 +2784,7 @@ const BezierHelper = {
2784
2784
  const lenCB = hypot$1(CBx, CBy);
2785
2785
  let totalRadian = endRadian - startRadian;
2786
2786
  if (totalRadian < 0) totalRadian += PI2;
2787
- 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) {
2788
2788
  if (data) data.push(L$b, x1, y1);
2789
2789
  if (setPointBounds) {
2790
2790
  setPoint$4(setPointBounds, fromX, fromY);
@@ -2817,7 +2817,7 @@ const BezierHelper = {
2817
2817
  let totalRadian = endRadian - startRadian;
2818
2818
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2819
2819
  if (anticlockwise) totalRadian -= PI2;
2820
- const parts = ceil$1(abs$b(totalRadian / PI_2));
2820
+ const parts = ceil$1(abs$c(totalRadian / PI_2));
2821
2821
  const partRadian = totalRadian / parts;
2822
2822
  const partRadian4Sin = sin$4(partRadian / 4);
2823
2823
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
@@ -3000,7 +3000,7 @@ const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$4, arc: arc$3, ellipse
3000
3000
 
3001
3001
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
3002
3002
 
3003
- const debug$f = Debug.get("PathConvert");
3003
+ const debug$g = Debug.get("PathConvert");
3004
3004
 
3005
3005
  const setEndPoint$1 = {};
3006
3006
 
@@ -3267,7 +3267,7 @@ const PathConvert = {
3267
3267
  break;
3268
3268
 
3269
3269
  default:
3270
- debug$f.error(`command: ${command} [index:${i}]`, old);
3270
+ debug$g.error(`command: ${command} [index:${i}]`, old);
3271
3271
  return data;
3272
3272
  }
3273
3273
  lastCommand = command;
@@ -3326,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
3326
3326
 
3327
3327
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3328
3328
 
3329
- const {tan: tan, min: min$2, abs: abs$a} = Math;
3329
+ const {tan: tan, min: min$2, abs: abs$b} = Math;
3330
3330
 
3331
3331
  const startPoint = {};
3332
3332
 
@@ -3386,7 +3386,7 @@ const PathCommandDataHelper = {
3386
3386
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
3387
3387
  if (!isUndefined(lastX)) {
3388
3388
  const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
3389
- 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))));
3390
3390
  }
3391
3391
  data.push(U$4, x1, y1, x2, y2, radius);
3392
3392
  },
@@ -3501,7 +3501,7 @@ class PathCreator {
3501
3501
 
3502
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;
3503
3503
 
3504
- const debug$e = Debug.get("PathDrawer");
3504
+ const debug$f = Debug.get("PathDrawer");
3505
3505
 
3506
3506
  const PathDrawer = {
3507
3507
  drawPathByData(drawer, data) {
@@ -3577,7 +3577,7 @@ const PathDrawer = {
3577
3577
  break;
3578
3578
 
3579
3579
  default:
3580
- debug$e.error(`command: ${command} [index:${i}]`, data);
3580
+ debug$f.error(`command: ${command} [index:${i}]`, data);
3581
3581
  return;
3582
3582
  }
3583
3583
  }
@@ -3591,7 +3591,7 @@ const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toT
3591
3591
 
3592
3592
  const {addPointBounds: addPointBounds, copy: copy$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3593
3593
 
3594
- const debug$d = Debug.get("PathBounds");
3594
+ const debug$e = Debug.get("PathBounds");
3595
3595
 
3596
3596
  let radius, radiusX, radiusY;
3597
3597
 
@@ -3713,7 +3713,7 @@ const PathBounds = {
3713
3713
  break;
3714
3714
 
3715
3715
  default:
3716
- debug$d.error(`command: ${command} [index:${i}]`, data);
3716
+ debug$e.error(`command: ${command} [index:${i}]`, data);
3717
3717
  return;
3718
3718
  }
3719
3719
  }
@@ -3868,7 +3868,7 @@ F$2.mineType = F$2.mimeType;
3868
3868
 
3869
3869
  F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
3870
3870
 
3871
- const debug$c = Debug.get("TaskProcessor");
3871
+ const debug$d = Debug.get("TaskProcessor");
3872
3872
 
3873
3873
  class TaskItem {
3874
3874
  constructor(task) {
@@ -3885,7 +3885,7 @@ class TaskItem {
3885
3885
  if (this.canUse && !this.canUse()) return this.cancel();
3886
3886
  if (this.task) yield this.task();
3887
3887
  } catch (error) {
3888
- debug$c.error(error);
3888
+ debug$d.error(error);
3889
3889
  }
3890
3890
  });
3891
3891
  }
@@ -4106,7 +4106,7 @@ class TaskProcessor {
4106
4106
  }
4107
4107
  }
4108
4108
 
4109
- const debug$b = Debug.get("Resource");
4109
+ const debug$c = Debug.get("Resource");
4110
4110
 
4111
4111
  const Resource = {
4112
4112
  tasker: new TaskProcessor,
@@ -4118,7 +4118,7 @@ const Resource = {
4118
4118
  return R.tasker.isComplete;
4119
4119
  },
4120
4120
  set(key, value) {
4121
- if (R.map[key]) debug$b.repeat(key);
4121
+ if (R.map[key]) debug$c.repeat(key);
4122
4122
  R.map[key] = value;
4123
4123
  },
4124
4124
  get(key) {
@@ -4531,11 +4531,15 @@ function affectRenderBoundsType(defaultValue) {
4531
4531
  function surfaceType(defaultValue) {
4532
4532
  return decorateLeafAttr(defaultValue, key => attr({
4533
4533
  set(value) {
4534
- this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
4534
+ this.__setAttr(key, value) && doSurfaceType(this);
4535
4535
  }
4536
4536
  }));
4537
4537
  }
4538
4538
 
4539
+ function doSurfaceType(leaf) {
4540
+ leaf.__layout.surfaceChanged || leaf.__layout.surfaceChange();
4541
+ }
4542
+
4539
4543
  function dimType(defaultValue) {
4540
4544
  return decorateLeafAttr(defaultValue, key => attr({
4541
4545
  set(value) {
@@ -4601,12 +4605,12 @@ function sortType(defaultValue) {
4601
4605
  }));
4602
4606
  }
4603
4607
 
4604
- function maskType(defaultValue) {
4608
+ function maskType(defaultValue, updateSelf) {
4605
4609
  return decorateLeafAttr(defaultValue, key => attr({
4606
4610
  set(value) {
4607
4611
  if (this.__setAttr(key, value)) {
4608
4612
  this.__layout.boxChanged || this.__layout.boxChange();
4609
- this.waitParent(() => {
4613
+ updateSelf ? this.__updateMask() : this.waitParent(() => {
4610
4614
  this.parent.__updateMask(value);
4611
4615
  });
4612
4616
  }
@@ -4724,7 +4728,7 @@ function defineDataProcessor(target, key, defaultValue) {
4724
4728
  defineKey(data, key, property);
4725
4729
  }
4726
4730
 
4727
- const debug$a = new Debug("rewrite");
4731
+ const debug$b = new Debug("rewrite");
4728
4732
 
4729
4733
  const list$2 = [];
4730
4734
 
@@ -4750,7 +4754,7 @@ function rewriteAble() {
4750
4754
  function doRewrite(error) {
4751
4755
  if (list$2.length) {
4752
4756
  list$2.forEach(item => {
4753
- if (error) debug$a.error(item.name, "需在Class上装饰@rewriteAble()");
4757
+ if (error) debug$b.error(item.name, "需在Class上装饰@rewriteAble()");
4754
4758
  item.run();
4755
4759
  });
4756
4760
  list$2.length = 0;
@@ -5165,12 +5169,12 @@ const BranchHelper = {
5165
5169
  w.height *= scaleY;
5166
5170
  w.scaleX *= scaleX;
5167
5171
  w.scaleY *= scaleY;
5168
- 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);
5169
5173
  }
5170
5174
  }
5171
5175
  };
5172
5176
 
5173
- 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;
5174
5178
 
5175
5179
  const WaitHelper = {
5176
5180
  run(wait) {
@@ -5996,14 +6000,14 @@ const LeafEventer = {
5996
6000
  destroyEventer: destroy
5997
6001
  };
5998
6002
 
5999
- const debug$9 = Debug.get("setAttr");
6003
+ const debug$a = Debug.get("setAttr");
6000
6004
 
6001
6005
  const LeafDataProxy = {
6002
6006
  __setAttr(name, newValue, checkFiniteNumber) {
6003
6007
  if (this.leaferIsCreated) {
6004
6008
  const oldValue = this.__.__getInput(name);
6005
6009
  if (checkFiniteNumber && !isFinite$1(newValue) && !isUndefined(newValue)) {
6006
- debug$9.warn(this.innerName, name, newValue);
6010
+ debug$a.warn(this.innerName, name, newValue);
6007
6011
  newValue = undefined;
6008
6012
  }
6009
6013
  if (isObject(newValue) || oldValue !== newValue) {
@@ -6258,7 +6262,8 @@ const BranchRender = {
6258
6262
  if (this.__worldOpacity && hasSize(nowWorld)) {
6259
6263
  const data = this.__;
6260
6264
  if (data.__useDim) {
6261
- 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);
6262
6267
  }
6263
6268
  if (data.__single && !this.isBranchLeaf) {
6264
6269
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
@@ -6282,6 +6287,7 @@ const BranchRender = {
6282
6287
  child = children[i];
6283
6288
  excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
6284
6289
  }
6290
+ if (this.__hasMask === 0) this.__rerenderMask(canvas, options);
6285
6291
  }
6286
6292
  },
6287
6293
  __clip(canvas, options) {
@@ -6498,11 +6504,19 @@ let Leaf = class Leaf {
6498
6504
  updateLayout() {
6499
6505
  this.__layout.update();
6500
6506
  }
6501
- forceUpdate(attrName) {
6502
- if (isUndefined(attrName)) attrName = "width"; else if (attrName === "surface") attrName = "blendMode";
6503
- const value = this.__.__getInput(attrName);
6504
- this.__[attrName] = isUndefined(value) ? null : undefined;
6505
- 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;
6506
6520
  }
6507
6521
  forceRender(_bounds, _sync) {
6508
6522
  this.forceUpdate("surface");
@@ -6521,7 +6535,8 @@ let Leaf = class Leaf {
6521
6535
  canvas.restore();
6522
6536
  }
6523
6537
  __updateMask(_value) {
6524
- 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;
6525
6540
  }
6526
6541
  __getNowWorld(options) {
6527
6542
  if (options.matrix) {
@@ -6715,7 +6730,7 @@ const {sort: sort} = BranchHelper;
6715
6730
 
6716
6731
  const {localBoxBounds: localBoxBounds, localStrokeBounds: localStrokeBounds, localRenderBounds: localRenderBounds, maskLocalBoxBounds: maskLocalBoxBounds, maskLocalStrokeBounds: maskLocalStrokeBounds, maskLocalRenderBounds: maskLocalRenderBounds} = LeafBoundsHelper;
6717
6732
 
6718
- const debug$8 = new Debug("Branch");
6733
+ const debug$9 = new Debug("Branch");
6719
6734
 
6720
6735
  let Branch = class Branch extends Leaf {
6721
6736
  __updateStrokeSpread() {
@@ -6757,7 +6772,7 @@ let Branch = class Branch extends Leaf {
6757
6772
  this.__layout.childrenSortChanged = false;
6758
6773
  }
6759
6774
  add(child, index) {
6760
- 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");
6761
6776
  const noIndex = isUndefined(index);
6762
6777
  if (!child.__) {
6763
6778
  if (isArray(child)) return child.forEach(item => {
@@ -6990,7 +7005,7 @@ class LeafLevelList {
6990
7005
  }
6991
7006
  }
6992
7007
 
6993
- const version = "2.2.0";
7008
+ const version = "2.2.1";
6994
7009
 
6995
7010
  class LeaferCanvas extends LeaferCanvasBase {
6996
7011
  get allowBackgroundColor() {
@@ -7432,7 +7447,7 @@ class LayoutBlockData {
7432
7447
 
7433
7448
  const {updateAllMatrix: updateAllMatrix$1, updateAllChange: updateAllChange} = LeafHelper;
7434
7449
 
7435
- const debug$7 = Debug.get("Layouter");
7450
+ const debug$8 = Debug.get("Layouter");
7436
7451
 
7437
7452
  class Layouter {
7438
7453
  constructor(target, userConfig) {
@@ -7466,7 +7481,7 @@ class Layouter {
7466
7481
  this.layoutOnce();
7467
7482
  target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks, this.times));
7468
7483
  } catch (e) {
7469
- debug$7.error(e);
7484
+ debug$8.error(e);
7470
7485
  }
7471
7486
  this.layoutedBlocks = null;
7472
7487
  }
@@ -7478,8 +7493,8 @@ class Layouter {
7478
7493
  }
7479
7494
  }
7480
7495
  layoutOnce() {
7481
- if (this.layouting) return debug$7.warn("layouting");
7482
- 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");
7483
7498
  this.times++;
7484
7499
  this.totalTimes++;
7485
7500
  this.layouting = true;
@@ -7572,7 +7587,7 @@ class Layouter {
7572
7587
  }
7573
7588
  }
7574
7589
 
7575
- const debug$6 = Debug.get("Renderer");
7590
+ const debug$7 = Debug.get("Renderer");
7576
7591
 
7577
7592
  class Renderer {
7578
7593
  get needFill() {
@@ -7627,7 +7642,7 @@ class Renderer {
7627
7642
  const {target: target} = this;
7628
7643
  this.times = 0;
7629
7644
  this.totalBounds = new Bounds;
7630
- debug$6.log(target.innerName, "---\x3e");
7645
+ debug$7.log(target.innerName, "---\x3e");
7631
7646
  try {
7632
7647
  this.emitRender(RenderEvent.START);
7633
7648
  this.renderOnce(callback);
@@ -7635,9 +7650,9 @@ class Renderer {
7635
7650
  ImageManager.clearRecycled();
7636
7651
  } catch (e) {
7637
7652
  this.rendering = false;
7638
- debug$6.error(e);
7653
+ debug$7.error(e);
7639
7654
  }
7640
- debug$6.log("-------------|");
7655
+ debug$7.log("-------------|");
7641
7656
  }
7642
7657
  renderAgain() {
7643
7658
  if (this.rendering) {
@@ -7647,8 +7662,8 @@ class Renderer {
7647
7662
  }
7648
7663
  }
7649
7664
  renderOnce(callback) {
7650
- if (this.rendering) return debug$6.warn("rendering");
7651
- 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");
7652
7667
  this.times++;
7653
7668
  this.totalTimes++;
7654
7669
  this.rendering = true;
@@ -7780,7 +7795,7 @@ class Renderer {
7780
7795
  if (updatedList) updatedList.list.some(leaf => {
7781
7796
  empty = !leaf.__world.width || !leaf.__world.height;
7782
7797
  if (empty) {
7783
- if (!leaf.isLeafer) debug$6.tip(leaf.innerName, ": empty");
7798
+ if (!leaf.isLeafer) debug$7.tip(leaf.innerName, ": empty");
7784
7799
  empty = !leaf.isBranch || leaf.isBranchLeaf;
7785
7800
  }
7786
7801
  return empty;
@@ -7867,7 +7882,7 @@ class Picker {
7867
7882
  for (let i = 0, len = list.length; i < len; i++) {
7868
7883
  find = list[i];
7869
7884
  if (ignoreHittable || LeafHelper.worldHittable(find)) {
7870
- this.hitChild(find, point);
7885
+ this.hitChild(find, find.hitThrough ? this.point : point);
7871
7886
  if (findList.length) {
7872
7887
  if (find.isBranchLeaf && list.some(item => item !== find && LeafHelper.hasParent(item, find))) {
7873
7888
  findList.reset();
@@ -7880,7 +7895,7 @@ class Picker {
7880
7895
  }
7881
7896
  if (bottomList) {
7882
7897
  for (let i = 0, len = bottomList.length; i < len; i++) {
7883
- this.hitChild(bottomList[i].target, this.point, bottomList[i].proxy);
7898
+ this.hitChild(bottomList[i].target, this.point, undefined, bottomList[i].proxy);
7884
7899
  if (findList.length) return findList.list[0];
7885
7900
  }
7886
7901
  }
@@ -7938,42 +7953,38 @@ class Picker {
7938
7953
  hitBranch(branch) {
7939
7954
  this.eachFind(branch.children, branch.__onlyHitMask);
7940
7955
  }
7941
- eachFind(children, hitMask) {
7956
+ eachFind(children, onlyHitMask) {
7942
7957
  let child, hit, data;
7943
7958
  const {point: point} = this, len = children.length;
7944
7959
  for (let i = len - 1; i > -1; i--) {
7945
7960
  child = children[i], data = child.__;
7946
- if (!data.visible || hitMask && !data.mask) continue;
7961
+ if (!data.visible || onlyHitMask && !data.mask) continue;
7947
7962
  hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$3, point, data.hitRadius) : point);
7948
7963
  if (child.isBranch) {
7949
7964
  if (hit || child.__ignoreHitWorld) {
7950
7965
  if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
7951
7966
  if (child.topChildren) this.eachFind(child.topChildren, false);
7952
7967
  this.eachFind(child.children, child.__onlyHitMask);
7953
- if (child.isBranchLeaf) this.hitChild(child, point);
7968
+ if (child.isBranchLeaf) this.hitChild(child, point, onlyHitMask);
7954
7969
  }
7955
7970
  } else {
7956
- if (hit) this.hitChild(child, point);
7971
+ if (hit) this.hitChild(child, point, onlyHitMask);
7957
7972
  }
7958
7973
  }
7959
7974
  }
7960
- hitChild(child, point, proxy) {
7975
+ hitChild(child, point, onlyHitMask, proxy) {
7961
7976
  if (this.exclude && this.exclude.has(child)) return;
7962
- if (child.__hitWorld(point)) {
7963
- const {parent: parent} = child;
7964
- if (parent && parent.__hasMask && !child.__.mask) {
7965
- let findMasks = [], item;
7966
- const {children: children} = parent;
7967
- for (let i = 0, len = children.length; i < len; i++) {
7968
- item = children[i];
7969
- if (item.__.mask) findMasks.push(item);
7970
- if (item === child) {
7971
- if (findMasks && !findMasks.every(value => value.__hitWorld(point))) return;
7972
- break;
7973
- }
7974
- }
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);
7975
7986
  }
7976
- this.findList.add(proxy || child);
7987
+ findList.add(leaf);
7977
7988
  }
7978
7989
  }
7979
7990
  clear() {
@@ -8144,7 +8155,7 @@ const emptyPaint = {
8144
8155
  originPaint: {}
8145
8156
  };
8146
8157
 
8147
- const debug$5 = Debug.get("UIData");
8158
+ const debug$6 = Debug.get("UIData");
8148
8159
 
8149
8160
  class UIData extends LeafData {
8150
8161
  get scale() {
@@ -8194,14 +8205,14 @@ class UIData extends LeafData {
8194
8205
  if (value < 0) {
8195
8206
  this._width = -value;
8196
8207
  this.__leaf.scaleX *= -1;
8197
- debug$5.warn("width < 0, instead -scaleX ", this);
8208
+ debug$6.warn("width < 0, instead -scaleX ", this);
8198
8209
  } else this._width = value;
8199
8210
  }
8200
8211
  setHeight(value) {
8201
8212
  if (value < 0) {
8202
8213
  this._height = -value;
8203
8214
  this.__leaf.scaleY *= -1;
8204
- debug$5.warn("height < 0, instead -scaleY", this);
8215
+ debug$6.warn("height < 0, instead -scaleY", this);
8205
8216
  } else this._height = value;
8206
8217
  }
8207
8218
  setFill(value) {
@@ -8835,6 +8846,8 @@ __decorate([ dataType(false) ], UI.prototype, "editable", void 0);
8835
8846
 
8836
8847
  __decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
8837
8848
 
8849
+ __decorate([ hitType() ], UI.prototype, "hitThrough", void 0);
8850
+
8838
8851
  __decorate([ hitType("path") ], UI.prototype, "hitFill", void 0);
8839
8852
 
8840
8853
  __decorate([ strokeType("path") ], UI.prototype, "hitStroke", void 0);
@@ -8948,7 +8961,7 @@ Group = __decorate([ useModule(Branch), registerUI() ], Group);
8948
8961
 
8949
8962
  var Leafer_1;
8950
8963
 
8951
- const debug$4 = Debug.get("Leafer");
8964
+ const debug$5 = Debug.get("Leafer");
8952
8965
 
8953
8966
  let Leafer = Leafer_1 = class Leafer extends Group {
8954
8967
  get __tag() {
@@ -9309,7 +9322,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
9309
9322
  ImageManager.clearRecycled();
9310
9323
  }, 100);
9311
9324
  } catch (e) {
9312
- debug$4.error(e);
9325
+ debug$5.error(e);
9313
9326
  }
9314
9327
  }
9315
9328
  };
@@ -9475,7 +9488,7 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
9475
9488
 
9476
9489
  Frame = __decorate([ registerUI() ], Frame);
9477
9490
 
9478
- 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 = {};
9479
9492
 
9480
9493
  let Ellipse = class Ellipse extends UI {
9481
9494
  get __tag() {
@@ -9487,7 +9500,7 @@ let Ellipse = class Ellipse extends UI {
9487
9500
  const path = data.path = [];
9488
9501
  let open, hasAngle, closedAngle;
9489
9502
  if (startAngle || endAngle) hasAngle = true;
9490
- if (hasAngle) closedAngle = abs$9(endAngle - startAngle) === 360;
9503
+ if (hasAngle) closedAngle = abs$a(endAngle - startAngle) === 360;
9491
9504
  if (innerRadius) {
9492
9505
  const drawInnerEllipse = innerRadius < 1 || closed;
9493
9506
  let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
@@ -10159,7 +10172,7 @@ class UIEvent extends Event {
10159
10172
  }
10160
10173
  }
10161
10174
 
10162
- 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;
10163
10176
 
10164
10177
  const tempContent = new Bounds, tempDragBounds = new Bounds;
10165
10178
 
@@ -10242,7 +10255,7 @@ const DragBoundsHelper = {
10242
10255
  bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
10243
10256
  correctScaleY *= max$3(aScale, bScale);
10244
10257
  if (lockRatio) {
10245
- aScale = max$3(abs$8(correctScaleX), abs$8(correctScaleY));
10258
+ aScale = max$3(abs$9(correctScaleX), abs$9(correctScaleY));
10246
10259
  correctScaleX = sign$2(correctScaleX) * aScale;
10247
10260
  correctScaleY = sign$2(correctScaleY) * aScale;
10248
10261
  }
@@ -10668,6 +10681,7 @@ class Dragger {
10668
10681
  }
10669
10682
  dragEnd(data) {
10670
10683
  if (!this.dragging && !this.moving) return;
10684
+ setTimeout(() => this.interaction.pointerMove(data));
10671
10685
  if (this.checkDragEndAnimate(data)) return;
10672
10686
  this.dragEndReal(data);
10673
10687
  }
@@ -10725,7 +10739,7 @@ class Dragger {
10725
10739
  }
10726
10740
  }
10727
10741
 
10728
- const debug$3 = Debug.get("emit");
10742
+ const debug$4 = Debug.get("emit");
10729
10743
 
10730
10744
  function emit$1(type, data, path, excludePath) {
10731
10745
  if (!path && !data.path) return;
@@ -10747,7 +10761,7 @@ function emit$1(type, data, path, excludePath) {
10747
10761
  if (emitEvent(leaf, type, data, false, excludePath)) return;
10748
10762
  }
10749
10763
  } catch (e) {
10750
- debug$3.error(e);
10764
+ debug$4.error(e);
10751
10765
  }
10752
10766
  }
10753
10767
 
@@ -12040,7 +12054,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
12040
12054
  data.__naturalWidth = image.width / data.pixelRatio;
12041
12055
  data.__naturalHeight = image.height / data.pixelRatio;
12042
12056
  if (data.__autoSide) {
12043
- ui.forceUpdate("width");
12057
+ ui.forceUpdate();
12044
12058
  LeafHelper.updateBounds(ui);
12045
12059
  ui.__layout.boundsChanged = true;
12046
12060
  if (ui.__proxyData) {
@@ -12267,9 +12281,9 @@ function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
12267
12281
  translate(transform, box.x + x, box.y + y);
12268
12282
  }
12269
12283
 
12270
- const {get: get$1, scale: scale$3, copy: copy$5} = MatrixHelper;
12284
+ const {get: get$1, scale: scale$4, copy: copy$5} = MatrixHelper;
12271
12285
 
12272
- const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
12286
+ const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$8} = Math;
12273
12287
 
12274
12288
  function createPatternTask(paint, ui, canvas, renderOptions) {
12275
12289
  if (!paint.patternTask) {
@@ -12294,15 +12308,15 @@ function createPattern(paint, ui, canvas, renderOptions) {
12294
12308
  width *= scaleX;
12295
12309
  height *= scaleY;
12296
12310
  if (gap && !brush) {
12297
- xGap = gap.x * scaleX / abs$7(data.scaleX || 1);
12298
- 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);
12299
12313
  }
12300
12314
  if (transform || scaleX !== 1 || scaleY !== 1) {
12301
12315
  scaleX *= getFloorScale(width + (xGap || 0));
12302
12316
  scaleY *= getFloorScale(height + (yGap || 0));
12303
12317
  imageMatrix = get$1();
12304
12318
  if (transform) copy$5(imageMatrix, transform);
12305
- scale$3(imageMatrix, 1 / scaleX, 1 / scaleY);
12319
+ scale$4(imageMatrix, 1 / scaleX, 1 / scaleY);
12306
12320
  }
12307
12321
  const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
12308
12322
  if (brush) {
@@ -12539,7 +12553,7 @@ const PaintGradientModule = {
12539
12553
  getTransform: getTransform
12540
12554
  };
12541
12555
 
12542
- 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;
12543
12557
 
12544
12558
  const tempBounds$1 = {}, tempMatrix$1 = new Matrix;
12545
12559
 
@@ -12583,7 +12597,7 @@ function shadow$1(ui, current, shape) {
12583
12597
  function getShadowRenderSpread(_ui, shadow) {
12584
12598
  let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
12585
12599
  shadow.forEach(item => {
12586
- 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);
12587
12601
  top = max$2(top, spread + blur - y);
12588
12602
  right = max$2(right, spread + blur + x);
12589
12603
  bottom = max$2(bottom, spread + blur + y);
@@ -13353,6 +13367,69 @@ EditorEvent.BEFORE_HOVER = "editor.before_hover";
13353
13367
 
13354
13368
  EditorEvent.HOVER = "editor.hover";
13355
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
+
13356
13433
  function targetAttr(fn) {
13357
13434
  return (target, key) => {
13358
13435
  const privateKey = "_" + key;
@@ -13401,6 +13478,7 @@ function mergeConfigAttr() {
13401
13478
  get() {
13402
13479
  const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, editTool: editTool, innerEditor: innerEditor, app: app} = this, mergeConfig = Object.assign({}, config);
13403
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);
13404
13482
  if (element && element.editConfig) {
13405
13483
  let {editConfig: editConfig} = element;
13406
13484
  if (editConfig.hover || editConfig.hoverStyle || editConfig.hoverPathType) {
@@ -13427,7 +13505,28 @@ function mergeConfigAttr() {
13427
13505
  };
13428
13506
  }
13429
13507
 
13430
- 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;
13431
13530
 
13432
13531
  const {copy: copy$3} = MatrixHelper;
13433
13532
 
@@ -13470,7 +13569,7 @@ class Stroker extends UI {
13470
13569
  leaf = list[i];
13471
13570
  const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
13472
13571
  if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
13473
- const aScaleX = abs$5(worldTransform.scaleX), aScaleY = abs$5(worldTransform.scaleY);
13572
+ const aScaleX = abs$6(worldTransform.scaleX), aScaleY = abs$6(worldTransform.scaleY);
13474
13573
  copy$3(matrix$1, worldTransform);
13475
13574
  matrix$1.half = strokeWidth % 2;
13476
13575
  canvas.setWorld(matrix$1, options.matrix);
@@ -13625,7 +13724,11 @@ class EditSelect extends Group {
13625
13724
  }
13626
13725
  onSelect() {
13627
13726
  if (this.running) {
13628
- 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);
13629
13732
  this.hoverStroker.target = null;
13630
13733
  }
13631
13734
  }
@@ -13797,13 +13900,13 @@ class EditSelect extends Group {
13797
13900
 
13798
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;
13799
13902
 
13800
- 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;
13801
13904
 
13802
13905
  const EditDataHelper = {
13803
13906
  getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
13804
13907
  let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
13805
13908
  const {widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldTransform: worldTransform, boxBounds: boxBounds} = target;
13806
- 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);
13807
13910
  const originChangedScaleX = target.scaleX / startBounds.scaleX;
13808
13911
  const originChangedScaleY = target.scaleY / startBounds.scaleY;
13809
13912
  const signX = sign$1(originChangedScaleX);
@@ -13883,7 +13986,7 @@ const EditDataHelper = {
13883
13986
  break;
13884
13987
 
13885
13988
  default:
13886
- lockScale = Math.sqrt(abs$4(scaleX * scaleY));
13989
+ lockScale = Math.sqrt(abs$5(scaleX * scaleY));
13887
13990
  scaleX = sign$1(scaleX) * lockScale;
13888
13991
  scaleY = sign$1(scaleY) * lockScale;
13889
13992
  }
@@ -13917,10 +14020,10 @@ const EditDataHelper = {
13917
14020
  }
13918
14021
  const minWidth = 1, minHeight = 1;
13919
14022
  const worldWidth = worldScaleX * boxBounds.width, worldHeight = worldScaleY * boxBounds.height;
13920
- if (useScaleX && abs$4(scaleX * worldWidth) < minWidth) scaleX = sign$1(scaleX) * minWidth / worldWidth;
13921
- 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;
13922
14025
  if (lockRatio && scaleX !== scaleY) {
13923
- lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
14026
+ lockScale = Math.min(abs$5(scaleX), abs$5(scaleY));
13924
14027
  scaleX = sign$1(scaleX) * lockScale;
13925
14028
  scaleY = sign$1(scaleY) * lockScale;
13926
14029
  }
@@ -14142,6 +14245,8 @@ class EditPoint extends Box {
14142
14245
 
14143
14246
  const fourDirection = [ "top", "right", "bottom", "left" ], editConfig = undefined;
14144
14247
 
14248
+ const debug$3 = Debug.get("EditBox");
14249
+
14145
14250
  class EditBox extends Group {
14146
14251
  get mergeConfig() {
14147
14252
  const {config: config} = this, {mergeConfig: mergeConfig, editBox: editBox} = this.editor;
@@ -14212,10 +14317,12 @@ class EditBox extends Group {
14212
14317
  this.resizeLines = [];
14213
14318
  this.dragStartData = {};
14214
14319
  this.__eventIds = [];
14320
+ this.widgets = [];
14215
14321
  this.editor = editor;
14216
14322
  this.visible = false;
14217
14323
  this.create();
14218
14324
  this.__listenEvents();
14325
+ this.createWidgets();
14219
14326
  }
14220
14327
  create() {
14221
14328
  let rotatePoint, resizeLine, resizePoint;
@@ -14251,7 +14358,7 @@ class EditBox extends Group {
14251
14358
  }
14252
14359
  this.listenPointEvents(circle, "rotate", 2);
14253
14360
  this.listenPointEvents(rect, "move", 8);
14254
- view.addMany(...rotatePoints, rect, circle, buttons, ...resizeLines, ...resizePoints);
14361
+ view.add([ ...rotatePoints, rect, circle, buttons, ...resizeLines, ...resizePoints ]);
14255
14362
  this.add(view);
14256
14363
  }
14257
14364
  load() {
@@ -14264,6 +14371,7 @@ class EditBox extends Group {
14264
14371
  let resizeP;
14265
14372
  for (let i = 0; i < 8; i++) {
14266
14373
  resizeP = resizePoints[i];
14374
+ if (resizeP.children.length) resizeP.clear();
14267
14375
  resizeP.set(this.getPointStyle(i % 2 ? middlePointsStyle[(i - 1) / 2 % middlePointsStyle.length] : pointsStyle[i / 2 % pointsStyle.length]));
14268
14376
  resizeP.rotation = (i - (i % 2 ? 1 : 0)) / 2 * 90;
14269
14377
  if (i % 2) resizeLines[(i - 1) / 2].set(Object.assign({
@@ -14289,6 +14397,7 @@ class EditBox extends Group {
14289
14397
  }
14290
14398
  if (single) DataHelper.stintSet(target.__world, "ignorePixelSnap", ignorePixelSnap);
14291
14399
  updateMoveCursor(this);
14400
+ this.loadWidgets();
14292
14401
  }
14293
14402
  update() {
14294
14403
  const {editor: editor} = this;
@@ -14309,8 +14418,10 @@ class EditBox extends Group {
14309
14418
  width: width,
14310
14419
  height: height
14311
14420
  });
14421
+ this.updateWidgets();
14312
14422
  }
14313
14423
  unload() {
14424
+ this.unloadWidgets();
14314
14425
  this.visible = false;
14315
14426
  if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
14316
14427
  }
@@ -14323,6 +14434,7 @@ class EditBox extends Group {
14323
14434
  strokeBoxSpread && BoundsHelper.spread(bounds, [ strokeBoxSpread * Math.abs(scaleY), strokeBoxSpread * Math.abs(scaleX) ]);
14324
14435
  }
14325
14436
  if (spread) BoundsHelper.spread(bounds, spread);
14437
+ this.rectBounds = bounds;
14326
14438
  editMask.visible = mask ? true : 0;
14327
14439
  if (!isUndefined(dimOthers) || !isUndefined(bright)) {
14328
14440
  editor.setDimOthers(dimOthers);
@@ -14334,7 +14446,7 @@ class EditBox extends Group {
14334
14446
  if (this.view.worldOpacity) {
14335
14447
  const {width: width, height: height} = bounds;
14336
14448
  const smallSize = isNumber(hideOnSmall) ? hideOnSmall : 10;
14337
- const showPoints = editBox && !(hideOnSmall && width < smallSize && height < smallSize);
14449
+ const showPoints = this.showPoints = editBox && !(hideOnSmall && width < smallSize && height < smallSize);
14338
14450
  let point = {}, rotateP, resizeP, resizeL;
14339
14451
  for (let i = 0; i < 8; i++) {
14340
14452
  AroundHelper.toPoint(AroundHelper.directionData[i], bounds, point);
@@ -14628,13 +14740,38 @@ class EditBox extends Group {
14628
14740
  __removeListenEvents() {
14629
14741
  this.off_(this.__eventIds);
14630
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
+ }
14631
14765
  destroy() {
14632
14766
  this.editor = null;
14633
14767
  this.__removeListenEvents();
14768
+ this.destroyWidgets();
14634
14769
  super.destroy();
14635
14770
  }
14636
14771
  }
14637
14772
 
14773
+ EditBox.WidgetList = {};
14774
+
14638
14775
  const bigBounds = {
14639
14776
  x: 0,
14640
14777
  y: 0,
@@ -14781,65 +14918,6 @@ function onHover(editor, oldValue) {
14781
14918
  }));
14782
14919
  }
14783
14920
 
14784
- const order = (a, b) => a.parent.children.indexOf(a) - b.parent.children.indexOf(b);
14785
-
14786
- const reverseOrder = (a, b) => b.parent.children.indexOf(b) - a.parent.children.indexOf(a);
14787
-
14788
- const EditorHelper = {
14789
- group(list, element, userGroup) {
14790
- list.sort(reverseOrder);
14791
- const {app: app, parent: parent} = list[0];
14792
- let group;
14793
- if (userGroup && userGroup.add) {
14794
- group = userGroup;
14795
- } else {
14796
- group = new Group(userGroup);
14797
- }
14798
- parent.addAt(group, parent.children.indexOf(list[0]));
14799
- list.sort(order);
14800
- const matrx = new Matrix(element.worldTransform);
14801
- matrx.divideParent(parent.scrollWorldTransform);
14802
- group.setTransform(matrx);
14803
- group.editable = true;
14804
- group.hitChildren = false;
14805
- app.lockLayout();
14806
- list.forEach(child => child.dropTo(group));
14807
- app.unlockLayout();
14808
- return group;
14809
- },
14810
- ungroup(list) {
14811
- const {app: app} = list[0];
14812
- const ungroupList = [];
14813
- app.lockLayout();
14814
- list.forEach(leaf => {
14815
- if (leaf.isBranch) {
14816
- const {parent: parent, children: children} = leaf;
14817
- while (children.length) {
14818
- ungroupList.push(children[0]);
14819
- children[0].dropTo(parent, parent.children.indexOf(leaf));
14820
- }
14821
- if (leaf.isBranchLeaf) ungroupList.push(leaf); else leaf.remove();
14822
- } else {
14823
- ungroupList.push(leaf);
14824
- }
14825
- });
14826
- app.unlockLayout();
14827
- return ungroupList;
14828
- },
14829
- toTop(list) {
14830
- list.sort(order);
14831
- list.forEach(leaf => {
14832
- if (leaf.parent) leaf.parent.add(leaf);
14833
- });
14834
- },
14835
- toBottom(list) {
14836
- list.sort(reverseOrder);
14837
- list.forEach(leaf => {
14838
- if (leaf.parent) leaf.parent.addAt(leaf, 0);
14839
- });
14840
- }
14841
- };
14842
-
14843
14921
  const debug$2 = Debug.get("EditToolCreator");
14844
14922
 
14845
14923
  function registerEditTool() {
@@ -15615,6 +15693,8 @@ __decorate([ targetAttr(onHover) ], Editor.prototype, "hoverTarget", void 0);
15615
15693
 
15616
15694
  Editor = __decorate([ useModule(TransformTool, [ "editBox", "editTool", "emitEvent" ]) ], Editor);
15617
15695
 
15696
+ const {abs: abs$4} = Math, {scale: scale$3} = PointHelper;
15697
+
15618
15698
  class InnerEditor {
15619
15699
  static registerInnerEditor() {
15620
15700
  EditToolCreator.register(this);
@@ -15625,6 +15705,9 @@ class InnerEditor {
15625
15705
  get mode() {
15626
15706
  return "focus";
15627
15707
  }
15708
+ get userConfig() {
15709
+ return this.editBox.mergeConfig[this.tag] || {};
15710
+ }
15628
15711
  get editBox() {
15629
15712
  return this._editBox || this.editor.editBox;
15630
15713
  }
@@ -15636,6 +15719,22 @@ class InnerEditor {
15636
15719
  this.editor = editor;
15637
15720
  this.create();
15638
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
+ }
15639
15738
  onCreate() {}
15640
15739
  create() {
15641
15740
  this.view = new Group;
@@ -19925,7 +20024,7 @@ let Robot = class Robot extends UI {
19925
20024
  const data = this.__;
19926
20025
  const width = nowFrame.width / data.pixelRatio;
19927
20026
  const height = nowFrame.height / data.pixelRatio;
19928
- if (data.width !== width || data.height !== height) this.forceUpdate("width");
20027
+ if (data.width !== width || data.height !== height) this.forceUpdate();
19929
20028
  data.__naturalWidth = width;
19930
20029
  data.__naturalHeight = height;
19931
20030
  }
@@ -21122,4 +21221,4 @@ function isSame(a, b) {
21122
21221
 
21123
21222
  Plugin.add("corner");
21124
21223
 
21125
- 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 };