@leafer-ui/miniapp 1.0.10 → 1.1.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.
@@ -108,7 +108,7 @@ const MathHelper = {
108
108
  return rotation - oldRotation;
109
109
  },
110
110
  float(num, maxLength) {
111
- const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
111
+ const a = maxLength !== undefined ? pow$1(10, maxLength) : 1000000000000;
112
112
  num = round(num * a) / a;
113
113
  return num === -0 ? 0 : num;
114
114
  },
@@ -1411,14 +1411,14 @@ const UICreator = {
1411
1411
  list: {},
1412
1412
  register(UI) {
1413
1413
  const { __tag: tag } = UI.prototype;
1414
- if (list$2[tag])
1414
+ if (list$1[tag])
1415
1415
  debug$e.repeat(tag);
1416
- list$2[tag] = UI;
1416
+ list$1[tag] = UI;
1417
1417
  },
1418
1418
  get(tag, data, x, y, width, height) {
1419
- if (!list$2[tag])
1419
+ if (!list$1[tag])
1420
1420
  debug$e.error('not register ' + tag);
1421
- const ui = new list$2[tag](data);
1421
+ const ui = new list$1[tag](data);
1422
1422
  if (x !== undefined) {
1423
1423
  ui.x = x;
1424
1424
  if (y)
@@ -1431,7 +1431,7 @@ const UICreator = {
1431
1431
  return ui;
1432
1432
  }
1433
1433
  };
1434
- const { list: list$2 } = UICreator;
1434
+ const { list: list$1 } = UICreator;
1435
1435
 
1436
1436
  const debug$d = Debug.get('EventCreator');
1437
1437
  const EventCreator = {
@@ -1513,17 +1513,19 @@ const DataHelper = {
1513
1513
  assign(t, defaultData);
1514
1514
  return t;
1515
1515
  },
1516
- assign(t, merge) {
1516
+ assign(t, merge, exclude) {
1517
1517
  let value;
1518
1518
  Object.keys(merge).forEach(key => {
1519
- var _a;
1519
+ var _a, _b;
1520
1520
  value = merge[key];
1521
- if ((value === null || value === void 0 ? void 0 : value.constructor) === Object) {
1522
- (((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object) ? assign(t[key], merge[key]) : t[key] = merge[key];
1523
- }
1524
- else {
1525
- t[key] = merge[key];
1521
+ if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
1522
+ return assign(t[key], merge[key], exclude && exclude[key]);
1523
+ if (exclude && (key in exclude)) {
1524
+ if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
1525
+ assign(t[key] = {}, merge[key], exclude[key]);
1526
+ return;
1526
1527
  }
1528
+ t[key] = merge[key];
1527
1529
  });
1528
1530
  },
1529
1531
  copyAttrs(t, from, include) {
@@ -3891,6 +3893,8 @@ function opacityType(defaultValue) {
3891
3893
  return decorateLeafAttr(defaultValue, (key) => attr({
3892
3894
  set(value) {
3893
3895
  this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange());
3896
+ if (this.mask)
3897
+ checkMask(this);
3894
3898
  }
3895
3899
  }));
3896
3900
  }
@@ -3907,9 +3911,20 @@ function visibleType(defaultValue) {
3907
3911
  this.__runAnimation('in');
3908
3912
  }
3909
3913
  doVisible(this, key, value, oldValue);
3914
+ if (this.mask)
3915
+ checkMask(this);
3910
3916
  }
3911
3917
  }));
3912
3918
  }
3919
+ function checkMask(leaf) {
3920
+ const { parent } = leaf;
3921
+ if (parent) {
3922
+ const { __hasMask } = parent;
3923
+ parent.__updateMask();
3924
+ if (__hasMask !== parent.__hasMask)
3925
+ parent.forceUpdate();
3926
+ }
3927
+ }
3913
3928
  function doVisible(leaf, key, value, oldValue) {
3914
3929
  if (leaf.__setAttr(key, value)) {
3915
3930
  leaf.__layout.opacityChanged || leaf.__layout.opacityChange();
@@ -4048,11 +4063,11 @@ function defineDataProcessor(target, key, defaultValue) {
4048
4063
  }
4049
4064
 
4050
4065
  const debug$8 = new Debug('rewrite');
4051
- const list$1 = [];
4066
+ const list = [];
4052
4067
  const excludeNames = ['destroy', 'constructor'];
4053
4068
  function rewrite(method) {
4054
4069
  return (target, key) => {
4055
- list$1.push({ name: target.constructor.name + '.' + key, run: () => { target[key] = method; } });
4070
+ list.push({ name: target.constructor.name + '.' + key, run: () => { target[key] = method; } });
4056
4071
  };
4057
4072
  }
4058
4073
  function rewriteAble() {
@@ -4061,13 +4076,13 @@ function rewriteAble() {
4061
4076
  };
4062
4077
  }
4063
4078
  function doRewrite(error) {
4064
- if (list$1.length) {
4065
- list$1.forEach(item => {
4079
+ if (list.length) {
4080
+ list.forEach(item => {
4066
4081
  if (error)
4067
4082
  debug$8.error(item.name, '需在Class上装饰@rewriteAble()');
4068
4083
  item.run();
4069
4084
  });
4070
- list$1.length = 0;
4085
+ list.length = 0;
4071
4086
  }
4072
4087
  }
4073
4088
  setTimeout(() => doRewrite(true));
@@ -4165,20 +4180,17 @@ const LeafHelper = {
4165
4180
  }
4166
4181
  return true;
4167
4182
  },
4168
- moveWorld(t, x, y = 0, isInnerPoint) {
4183
+ moveWorld(t, x, y = 0, isInnerPoint, transition) {
4169
4184
  const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
4170
4185
  isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
4171
- L.moveLocal(t, local.x, local.y);
4186
+ L.moveLocal(t, local.x, local.y, transition);
4172
4187
  },
4173
- moveLocal(t, x, y = 0) {
4174
- if (typeof x === 'object') {
4175
- t.x += x.x;
4176
- t.y += x.y;
4177
- }
4178
- else {
4179
- t.x += x;
4180
- t.y += y;
4181
- }
4188
+ moveLocal(t, x, y = 0, transition) {
4189
+ if (typeof x === 'object')
4190
+ y = x.y, x = x.x;
4191
+ x += t.x;
4192
+ y += t.y;
4193
+ transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
4182
4194
  },
4183
4195
  zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4184
4196
  L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
@@ -5437,8 +5449,8 @@ let Leaf = class Leaf {
5437
5449
  canvas.clearRect(r.x, r.y, r.width, r.height);
5438
5450
  canvas.restore();
5439
5451
  }
5440
- __updateMask(value) {
5441
- this.__hasMask = value ? true : this.children.some(item => item.__.mask);
5452
+ __updateMask(_value) {
5453
+ this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
5442
5454
  }
5443
5455
  __renderMask(_canvas, _options) { }
5444
5456
  __getNowWorld(options) {
@@ -5558,11 +5570,11 @@ let Leaf = class Leaf {
5558
5570
  transform(matrix, resize) {
5559
5571
  transform(this, matrix, resize);
5560
5572
  }
5561
- move(x, y) {
5562
- moveLocal(this, x, y);
5573
+ move(x, y, transition) {
5574
+ moveLocal(this, x, y, transition);
5563
5575
  }
5564
- moveInner(x, y) {
5565
- moveWorld(this, x, y, true);
5576
+ moveInner(x, y, transition) {
5577
+ moveWorld(this, x, y, true, transition);
5566
5578
  }
5567
5579
  scaleOf(origin, scaleX, scaleY, resize) {
5568
5580
  zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
@@ -5576,8 +5588,8 @@ let Leaf = class Leaf {
5576
5588
  transformWorld(worldTransform, resize) {
5577
5589
  transformWorld(this, worldTransform, resize);
5578
5590
  }
5579
- moveWorld(x, y) {
5580
- moveWorld(this, x, y);
5591
+ moveWorld(x, y, transition) {
5592
+ moveWorld(this, x, y, false, transition);
5581
5593
  }
5582
5594
  scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5583
5595
  zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
@@ -5681,6 +5693,7 @@ Leaf = __decorate([
5681
5693
  const { setListWithFn } = BoundsHelper;
5682
5694
  const { sort } = BranchHelper;
5683
5695
  const { localBoxBounds, localStrokeBounds, localRenderBounds, maskLocalBoxBounds, maskLocalStrokeBounds, maskLocalRenderBounds } = LeafBoundsHelper;
5696
+ const debug$6 = new Debug('Branch');
5684
5697
  let Branch = class Branch extends Leaf {
5685
5698
  __updateStrokeSpread() {
5686
5699
  const { children } = this;
@@ -5721,8 +5734,8 @@ let Branch = class Branch extends Leaf {
5721
5734
  }
5722
5735
  }
5723
5736
  add(child, index) {
5724
- if (child === this)
5725
- return;
5737
+ if (child === this || child.destroyed)
5738
+ return debug$6.warn('add self or destroyed');
5726
5739
  const noIndex = index === undefined;
5727
5740
  if (!child.__) {
5728
5741
  if (child instanceof Array)
@@ -5736,8 +5749,9 @@ let Branch = class Branch extends Leaf {
5736
5749
  noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
5737
5750
  if (child.isBranch)
5738
5751
  this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
5739
- child.__layout.boxChanged || child.__layout.boxChange();
5740
- child.__layout.matrixChanged || child.__layout.matrixChange();
5752
+ const childLayout = child.__layout;
5753
+ childLayout.boxChanged || childLayout.boxChange();
5754
+ childLayout.matrixChanged || childLayout.matrixChange();
5741
5755
  if (child.__bubbleMap)
5742
5756
  child.__emitLifeEvent(ChildEvent.ADD);
5743
5757
  if (this.leafer) {
@@ -5975,7 +5989,7 @@ class LeafLevelList {
5975
5989
  }
5976
5990
  }
5977
5991
 
5978
- const version = "1.0.10";
5992
+ const version = "1.1.1";
5979
5993
 
5980
5994
  class LeaferCanvas extends LeaferCanvasBase {
5981
5995
  get allowBackgroundColor() { return false; }
@@ -6389,7 +6403,7 @@ class LayoutBlockData {
6389
6403
  }
6390
6404
 
6391
6405
  const { updateAllMatrix, updateAllChange } = LeafHelper;
6392
- const debug$6 = Debug.get('Layouter');
6406
+ const debug$5 = Debug.get('Layouter');
6393
6407
  class Layouter {
6394
6408
  constructor(target, userConfig) {
6395
6409
  this.totalTimes = 0;
@@ -6424,7 +6438,7 @@ class Layouter {
6424
6438
  target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks, this.times));
6425
6439
  }
6426
6440
  catch (e) {
6427
- debug$6.error(e);
6441
+ debug$5.error(e);
6428
6442
  }
6429
6443
  this.layoutedBlocks = null;
6430
6444
  }
@@ -6438,9 +6452,9 @@ class Layouter {
6438
6452
  }
6439
6453
  layoutOnce() {
6440
6454
  if (this.layouting)
6441
- return debug$6.warn('layouting');
6455
+ return debug$5.warn('layouting');
6442
6456
  if (this.times > 3)
6443
- return debug$6.warn('layout max times');
6457
+ return debug$5.warn('layout max times');
6444
6458
  this.times++;
6445
6459
  this.totalTimes++;
6446
6460
  this.layouting = true;
@@ -6544,7 +6558,7 @@ class Layouter {
6544
6558
  }
6545
6559
  }
6546
6560
 
6547
- const debug$5 = Debug.get('Renderer');
6561
+ const debug$4 = Debug.get('Renderer');
6548
6562
  class Renderer {
6549
6563
  get needFill() { return !!(!this.canvas.allowBackgroundColor && this.config.fill); }
6550
6564
  constructor(target, canvas, userConfig) {
@@ -6560,29 +6574,29 @@ class Renderer {
6560
6574
  if (userConfig)
6561
6575
  this.config = DataHelper.default(userConfig, this.config);
6562
6576
  this.__listenEvents();
6563
- this.__requestRender();
6564
6577
  }
6565
6578
  start() {
6566
6579
  this.running = true;
6580
+ this.update(false);
6567
6581
  }
6568
6582
  stop() {
6569
6583
  this.running = false;
6570
6584
  }
6571
- update() {
6572
- this.changed = true;
6585
+ update(change = true) {
6586
+ if (!this.changed)
6587
+ this.changed = change;
6588
+ this.__requestRender();
6573
6589
  }
6574
6590
  requestLayout() {
6575
6591
  this.target.emit(LayoutEvent.REQUEST);
6576
6592
  }
6577
6593
  render(callback) {
6578
- if (!(this.running && this.canvas.view)) {
6579
- this.changed = true;
6580
- return;
6581
- }
6594
+ if (!(this.running && this.canvas.view))
6595
+ return this.update();
6582
6596
  const { target } = this;
6583
6597
  this.times = 0;
6584
6598
  this.totalBounds = new Bounds();
6585
- debug$5.log(target.innerName, '--->');
6599
+ debug$4.log(target.innerName, '--->');
6586
6600
  try {
6587
6601
  if (!target.isApp)
6588
6602
  target.app.emit(RenderEvent.CHILD_START, target);
@@ -6593,9 +6607,9 @@ class Renderer {
6593
6607
  }
6594
6608
  catch (e) {
6595
6609
  this.rendering = false;
6596
- debug$5.error(e);
6610
+ debug$4.error(e);
6597
6611
  }
6598
- debug$5.log('-------------|');
6612
+ debug$4.log('-------------|');
6599
6613
  }
6600
6614
  renderAgain() {
6601
6615
  if (this.rendering) {
@@ -6607,9 +6621,9 @@ class Renderer {
6607
6621
  }
6608
6622
  renderOnce(callback) {
6609
6623
  if (this.rendering)
6610
- return debug$5.warn('rendering');
6624
+ return debug$4.warn('rendering');
6611
6625
  if (this.times > 3)
6612
- return debug$5.warn('render max times');
6626
+ return debug$4.warn('render max times');
6613
6627
  this.times++;
6614
6628
  this.totalTimes++;
6615
6629
  this.rendering = true;
@@ -6646,7 +6660,7 @@ class Renderer {
6646
6660
  partRender() {
6647
6661
  const { canvas, updateBlocks: list } = this;
6648
6662
  if (!list)
6649
- return debug$5.warn('PartRender: need update attr');
6663
+ return debug$4.warn('PartRender: need update attr');
6650
6664
  this.mergeBlocks();
6651
6665
  list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
6652
6666
  this.clipRender(block); });
@@ -6712,16 +6726,17 @@ class Renderer {
6712
6726
  }
6713
6727
  }
6714
6728
  __requestRender() {
6715
- const startTime = Date.now();
6729
+ if (this.requestTime)
6730
+ return;
6731
+ const requestTime = this.requestTime = Date.now();
6716
6732
  Platform.requestRender(() => {
6717
- this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - startTime)));
6733
+ this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
6734
+ this.requestTime = 0;
6718
6735
  if (this.running) {
6719
6736
  if (this.changed && this.canvas.view)
6720
6737
  this.render();
6721
6738
  this.target.emit(RenderEvent.NEXT);
6722
6739
  }
6723
- if (this.target)
6724
- this.__requestRender();
6725
6740
  });
6726
6741
  }
6727
6742
  __onResize(e) {
@@ -6737,7 +6752,7 @@ class Renderer {
6737
6752
  }
6738
6753
  }
6739
6754
  this.addBlock(new Bounds(0, 0, 1, 1));
6740
- this.changed = true;
6755
+ this.update();
6741
6756
  }
6742
6757
  __onLayoutEnd(event) {
6743
6758
  if (event.data)
@@ -6748,7 +6763,7 @@ class Renderer {
6748
6763
  empty = (!leaf.__world.width || !leaf.__world.height);
6749
6764
  if (empty) {
6750
6765
  if (!leaf.isLeafer)
6751
- debug$5.tip(leaf.innerName, ': empty');
6766
+ debug$4.tip(leaf.innerName, ': empty');
6752
6767
  empty = (!leaf.isBranch || leaf.isBranchLeaf);
6753
6768
  }
6754
6769
  return empty;
@@ -7123,7 +7138,7 @@ const Transition = {
7123
7138
 
7124
7139
  const { parse, objectToCanvasData } = PathConvert;
7125
7140
  const emptyPaint = {};
7126
- const debug$4 = Debug.get('UIData');
7141
+ const debug$3 = Debug.get('UIData');
7127
7142
  class UIData extends LeafData {
7128
7143
  get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
7129
7144
  get __strokeWidth() {
@@ -7145,7 +7160,7 @@ class UIData extends LeafData {
7145
7160
  return true;
7146
7161
  return t.fill && this.__hasStroke;
7147
7162
  }
7148
- get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
7163
+ get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
7149
7164
  get __autoWidth() { return !this._width; }
7150
7165
  get __autoHeight() { return !this._height; }
7151
7166
  get __autoSide() { return !this._width || !this._height; }
@@ -7160,7 +7175,7 @@ class UIData extends LeafData {
7160
7175
  if (value < 0) {
7161
7176
  this._width = -value;
7162
7177
  this.__leaf.scaleX *= -1;
7163
- debug$4.warn('width < 0, instead -scaleX ', this);
7178
+ debug$3.warn('width < 0, instead -scaleX ', this);
7164
7179
  }
7165
7180
  else
7166
7181
  this._width = value;
@@ -7169,7 +7184,7 @@ class UIData extends LeafData {
7169
7184
  if (value < 0) {
7170
7185
  this._height = -value;
7171
7186
  this.__leaf.scaleY *= -1;
7172
- debug$4.warn('height < 0, instead -scaleY', this);
7187
+ debug$3.warn('height < 0, instead -scaleY', this);
7173
7188
  }
7174
7189
  else
7175
7190
  this._height = value;
@@ -7259,7 +7274,7 @@ class GroupData extends UIData {
7259
7274
 
7260
7275
  class BoxData extends GroupData {
7261
7276
  get __boxStroke() { return !this.__pathInputed; }
7262
- get __drawAfterFill() { return this.overflow === 'hide' && this.__clipAfterFill && this.__leaf.children.length; }
7277
+ get __drawAfterFill() { const t = this; return (t.overflow === 'hide' && (t.__clipAfterFill || t.innerShadow) && t.__leaf.children.length); }
7263
7278
  get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
7264
7279
  }
7265
7280
 
@@ -7545,11 +7560,15 @@ let UI = UI_1 = class UI extends Leaf {
7545
7560
  super(data);
7546
7561
  }
7547
7562
  reset(_data) { }
7548
- set(data, isTemp) {
7549
- if (isTemp) {
7550
- this.lockNormalStyle = true;
7551
- Object.assign(this, data);
7552
- this.lockNormalStyle = false;
7563
+ set(data, transition) {
7564
+ if (transition) {
7565
+ if (transition === 'temp') {
7566
+ this.lockNormalStyle = true;
7567
+ Object.assign(this, data);
7568
+ this.lockNormalStyle = false;
7569
+ }
7570
+ else
7571
+ this.animate(data, transition);
7553
7572
  }
7554
7573
  else
7555
7574
  Object.assign(this, data);
@@ -7859,17 +7878,17 @@ let Group = class Group extends UI {
7859
7878
  if (!this.children)
7860
7879
  this.children = [];
7861
7880
  }
7862
- set(data, isTemp) {
7881
+ set(data, transition) {
7863
7882
  if (data.children) {
7864
7883
  const { children } = data;
7865
7884
  delete data.children;
7866
7885
  this.children ? this.clear() : this.__setBranch();
7867
- super.set(data, isTemp);
7886
+ super.set(data, transition);
7868
7887
  children.forEach(child => this.add(child));
7869
7888
  data.children = children;
7870
7889
  }
7871
7890
  else
7872
- super.set(data, isTemp);
7891
+ super.set(data, transition);
7873
7892
  }
7874
7893
  toJSON(options) {
7875
7894
  const data = super.toJSON(options);
@@ -7901,7 +7920,7 @@ Group = __decorate([
7901
7920
  ], Group);
7902
7921
 
7903
7922
  var Leafer_1;
7904
- const debug$3 = Debug.get('Leafer');
7923
+ const debug$2 = Debug.get('Leafer');
7905
7924
  let Leafer = Leafer_1 = class Leafer extends Group {
7906
7925
  get __tag() { return 'Leafer'; }
7907
7926
  get isApp() { return false; }
@@ -7915,20 +7934,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7915
7934
  constructor(userConfig, data) {
7916
7935
  super(data);
7917
7936
  this.config = {
7918
- type: 'design',
7919
7937
  start: true,
7920
7938
  hittable: true,
7921
7939
  smooth: true,
7922
- lazySpeard: 100,
7923
- zoom: {
7924
- min: 0.01,
7925
- max: 256
7926
- },
7927
- move: {
7928
- holdSpaceKey: true,
7929
- holdMiddleKey: true,
7930
- autoDistance: 2
7931
- }
7940
+ lazySpeard: 100
7932
7941
  };
7933
7942
  this.leafs = 0;
7934
7943
  this.__eventIds = [];
@@ -7945,23 +7954,27 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7945
7954
  init(userConfig, parentApp) {
7946
7955
  if (this.canvas)
7947
7956
  return;
7948
- this.__setLeafer(this);
7949
- if (userConfig)
7950
- DataHelper.assign(this.config, userConfig);
7951
7957
  let start;
7952
7958
  const { config } = this;
7953
- this.initType(config.type);
7959
+ this.__setLeafer(this);
7960
+ if (parentApp) {
7961
+ this.parentApp = parentApp;
7962
+ this.__bindApp(parentApp);
7963
+ start = parentApp.running;
7964
+ }
7965
+ if (userConfig) {
7966
+ this.parent = parentApp;
7967
+ this.initType(userConfig.type);
7968
+ this.parent = undefined;
7969
+ DataHelper.assign(config, userConfig);
7970
+ }
7954
7971
  const canvas = this.canvas = Creator.canvas(config);
7955
7972
  this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
7956
7973
  if (this.isApp)
7957
7974
  this.__setApp();
7958
7975
  this.__checkAutoLayout(config, parentApp);
7959
7976
  this.view = canvas.view;
7960
- if (parentApp) {
7961
- this.__bindApp(parentApp);
7962
- start = parentApp.running;
7963
- }
7964
- else {
7977
+ if (!parentApp) {
7965
7978
  this.selector = Creator.selector(this);
7966
7979
  this.interaction = Creator.interaction(this, canvas, this.selector, config);
7967
7980
  if (this.interaction) {
@@ -7982,8 +7995,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7982
7995
  }
7983
7996
  onInit() { }
7984
7997
  initType(_type) { }
7985
- set(data) {
7986
- this.waitInit(() => { super.set(data); });
7998
+ set(data, transition) {
7999
+ this.waitInit(() => { super.set(data, transition); });
7987
8000
  }
7988
8001
  start() {
7989
8002
  clearTimeout(this.__startTimer);
@@ -8018,7 +8031,11 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8018
8031
  forceRender(bounds) {
8019
8032
  this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
8020
8033
  if (this.viewReady)
8021
- this.renderer.update();
8034
+ this.renderer.render();
8035
+ }
8036
+ requestRender(change = false) {
8037
+ if (this.renderer)
8038
+ this.renderer.update(change);
8022
8039
  }
8023
8040
  updateCursor(cursor) {
8024
8041
  const i = this.interaction;
@@ -8065,7 +8082,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8065
8082
  if (this.canvas) {
8066
8083
  if (canvasSizeAttrs.includes(attrName)) {
8067
8084
  if (!newValue)
8068
- debug$3.warn(attrName + ' is 0');
8085
+ debug$2.warn(attrName + ' is 0');
8069
8086
  this.__changeCanvasSize(attrName, newValue);
8070
8087
  }
8071
8088
  else if (attrName === 'fill') {
@@ -8126,8 +8143,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8126
8143
  const { imageReady } = this;
8127
8144
  if (imageReady && !this.viewCompleted)
8128
8145
  this.__checkViewCompleted();
8129
- if (!imageReady)
8146
+ if (!imageReady) {
8130
8147
  this.viewCompleted = false;
8148
+ this.requestRender();
8149
+ }
8131
8150
  }
8132
8151
  }
8133
8152
  __checkViewCompleted(emit = true) {
@@ -8185,6 +8204,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8185
8204
  }
8186
8205
  else
8187
8206
  list.push(item);
8207
+ this.requestRender();
8188
8208
  }
8189
8209
  zoom(_zoomType, _padding, _fixedScale) {
8190
8210
  return needPlugin('view');
@@ -8238,14 +8258,14 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8238
8258
  this.canvasManager.destroy();
8239
8259
  }
8240
8260
  this.canvas.destroy();
8241
- this.config.view = this.view = null;
8261
+ this.config.view = this.view = this.parentApp = null;
8242
8262
  if (this.userConfig)
8243
8263
  this.userConfig.view = null;
8244
8264
  super.destroy();
8245
8265
  setTimeout(() => { ImageManager.clearRecycled(); }, 100);
8246
8266
  }
8247
8267
  catch (e) {
8248
- debug$3.error(e);
8268
+ debug$2.error(e);
8249
8269
  }
8250
8270
  }
8251
8271
  };
@@ -8965,9 +8985,9 @@ let App = class App extends Leafer {
8965
8985
  if (ground)
8966
8986
  this.ground = this.addLeafer(ground);
8967
8987
  if (tree || editor)
8968
- this.tree = this.addLeafer(tree);
8988
+ this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
8969
8989
  if (sky || editor)
8970
- this.sky = this.addLeafer(sky || { type: 'draw', usePartRender: false });
8990
+ this.sky = this.addLeafer(sky);
8971
8991
  if (editor)
8972
8992
  this.sky.add(this.editor = Creator.editor(editor));
8973
8993
  }
@@ -9172,10 +9192,8 @@ let DragEvent = class DragEvent extends PointerEvent {
9172
9192
  this.data = data;
9173
9193
  }
9174
9194
  static getValidMove(leaf, start, total) {
9175
- const { draggable, dragBounds, x, y } = leaf;
9176
- const move = leaf.getLocalPoint(total, null, true);
9177
- move.x += start.x - x;
9178
- move.y += start.y - y;
9195
+ const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
9196
+ PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9179
9197
  if (dragBounds)
9180
9198
  this.getMoveInDragBounds(leaf.__local, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
9181
9199
  if (draggable === 'x')
@@ -9185,8 +9203,7 @@ let DragEvent = class DragEvent extends PointerEvent {
9185
9203
  return move;
9186
9204
  }
9187
9205
  static getMoveInDragBounds(childBox, dragBounds, move, change) {
9188
- const x = childBox.x + move.x, y = childBox.y + move.y;
9189
- const right = x + childBox.width, bottom = y + childBox.height;
9206
+ const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
9190
9207
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
9191
9208
  if (!change)
9192
9209
  move = Object.assign({}, move);
@@ -9238,9 +9255,7 @@ let DragEvent = class DragEvent extends PointerEvent {
9238
9255
  return this.getLocalMove(relative, true);
9239
9256
  }
9240
9257
  getPageBounds() {
9241
- const total = this.getPageTotal();
9242
- const start = this.getPagePoint();
9243
- const bounds = {};
9258
+ const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
9244
9259
  BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
9245
9260
  BoundsHelper.unsign(bounds);
9246
9261
  return bounds;
@@ -9326,184 +9341,7 @@ KeyEvent = __decorate([
9326
9341
  registerUIEvent()
9327
9342
  ], KeyEvent);
9328
9343
 
9329
- function addInteractionWindow(leafer) {
9330
- if (leafer.isApp)
9331
- return;
9332
- leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, (e) => {
9333
- leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY));
9334
- }), leafer.on_(ZoomEvent.BEFORE_ZOOM, (e) => {
9335
- const { zoomLayer } = leafer;
9336
- const changeScale = leafer.getValidScale(e.scale);
9337
- if (changeScale !== 1) {
9338
- PointHelper.scaleOf(zoomLayer, e, changeScale);
9339
- zoomLayer.scale = zoomLayer.__.scaleX * changeScale;
9340
- }
9341
- }));
9342
- }
9343
-
9344
- function document(leafer) {
9345
- addInteractionWindow(leafer);
9346
- const { move, zoom } = leafer.config;
9347
- move.scroll = 'limit';
9348
- zoom.min = 1;
9349
- }
9350
-
9351
- function block(leafer) {
9352
- const { config } = leafer;
9353
- (config.wheel || (config.wheel = {})).preventDefault = false;
9354
- (config.touch || (config.touch = {})).preventDefault = 'auto';
9355
- }
9356
-
9357
- const debug$2 = Debug.get('LeaferTypeCreator');
9358
- const LeaferTypeCreator = {
9359
- list: {},
9360
- register(name, fn) {
9361
- list[name] && debug$2.repeat(name);
9362
- list[name] = fn;
9363
- },
9364
- run(name, leafer) {
9365
- const fn = list[name];
9366
- fn && fn(leafer);
9367
- }
9368
- };
9369
- const { list, register } = LeaferTypeCreator;
9370
- register('design', addInteractionWindow);
9371
- register('document', document);
9372
- register('block', block);
9373
-
9374
- const leafer = Leafer.prototype;
9375
- leafer.initType = function (type) {
9376
- LeaferTypeCreator.run(type, this);
9377
- };
9378
- leafer.getValidMove = function (moveX, moveY) {
9379
- const { scroll, disabled } = this.app.config.move;
9380
- if (scroll) {
9381
- Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
9382
- if (scroll === 'limit') {
9383
- const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
9384
- const right = x + width - this.width, bottom = y + height - this.height;
9385
- if (x >= 0 && right <= 0)
9386
- moveX = 0;
9387
- else if (moveX > 0) {
9388
- if (x + moveX > 0)
9389
- moveX = -x;
9390
- }
9391
- else if (moveX < 0 && right + moveX < 0)
9392
- moveX = -right;
9393
- if (y >= 0 && bottom <= 0)
9394
- moveY = 0;
9395
- else if (moveY > 0) {
9396
- if (y + moveY > 0)
9397
- moveY = -y;
9398
- }
9399
- else if (moveY < 0 && bottom + moveY < 0)
9400
- moveY = -bottom;
9401
- }
9402
- }
9403
- return { x: disabled ? 0 : moveX, y: disabled ? 0 : moveY };
9404
- };
9405
- leafer.getValidScale = function (changeScale) {
9406
- const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
9407
- if (absScale < min)
9408
- changeScale = min / scaleX;
9409
- else if (absScale > max)
9410
- changeScale = max / scaleX;
9411
- return disabled ? 1 : changeScale;
9412
- };
9413
-
9414
- class Transformer {
9415
- get transforming() { return !!(this.moveData || this.zoomData || this.rotateData); }
9416
- constructor(interaction) {
9417
- this.interaction = interaction;
9418
- }
9419
- move(data) {
9420
- const { interaction } = this;
9421
- if (!data.moveType)
9422
- data.moveType = 'move';
9423
- if (!this.moveData) {
9424
- const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
9425
- data.path = path;
9426
- this.moveData = Object.assign(Object.assign({}, data), { moveX: 0, moveY: 0 });
9427
- interaction.cancelHover();
9428
- interaction.emit(MoveEvent.START, this.moveData);
9429
- }
9430
- data.path = this.moveData.path;
9431
- interaction.emit(MoveEvent.BEFORE_MOVE, data);
9432
- interaction.emit(MoveEvent.MOVE, data);
9433
- this.transformEndWait();
9434
- }
9435
- zoom(data) {
9436
- const { interaction } = this;
9437
- if (!this.zoomData) {
9438
- const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
9439
- data.path = path;
9440
- this.zoomData = Object.assign(Object.assign({}, data), { scale: 1 });
9441
- interaction.cancelHover();
9442
- interaction.emit(ZoomEvent.START, this.zoomData);
9443
- }
9444
- data.path = this.zoomData.path;
9445
- interaction.emit(ZoomEvent.BEFORE_ZOOM, data);
9446
- interaction.emit(ZoomEvent.ZOOM, data);
9447
- this.transformEndWait();
9448
- }
9449
- rotate(data) {
9450
- const { interaction } = this;
9451
- if (!this.rotateData) {
9452
- const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
9453
- data.path = path;
9454
- this.rotateData = Object.assign(Object.assign({}, data), { rotation: 0 });
9455
- interaction.cancelHover();
9456
- interaction.emit(RotateEvent.START, this.rotateData);
9457
- }
9458
- data.path = this.rotateData.path;
9459
- interaction.emit(RotateEvent.BEFORE_ROTATE, data);
9460
- interaction.emit(RotateEvent.ROTATE, data);
9461
- this.transformEndWait();
9462
- }
9463
- transformEndWait() {
9464
- clearTimeout(this.transformTimer);
9465
- this.transformTimer = setTimeout(() => {
9466
- this.transformEnd();
9467
- }, this.interaction.config.pointer.transformTime);
9468
- }
9469
- transformEnd() {
9470
- this.moveEnd();
9471
- this.zoomEnd();
9472
- this.rotateEnd();
9473
- }
9474
- moveEnd() {
9475
- if (this.moveData) {
9476
- this.interaction.emit(MoveEvent.END, this.moveData);
9477
- this.moveData = null;
9478
- }
9479
- }
9480
- zoomEnd() {
9481
- if (this.zoomData) {
9482
- this.interaction.emit(ZoomEvent.END, this.zoomData);
9483
- this.zoomData = null;
9484
- }
9485
- }
9486
- rotateEnd() {
9487
- if (this.rotateData) {
9488
- this.interaction.emit(RotateEvent.END, this.rotateData);
9489
- this.rotateData = null;
9490
- }
9491
- }
9492
- destroy() {
9493
- this.zoomData = this.moveData = this.rotateData = null;
9494
- }
9495
- }
9496
-
9497
9344
  const InteractionHelper = {
9498
- getMoveEventData(center, move, event) {
9499
- return Object.assign(Object.assign({}, event), { x: center.x, y: center.y, moveX: move.x, moveY: move.y });
9500
- },
9501
- getRotateEventData(center, angle, event) {
9502
- return Object.assign(Object.assign({}, event), { x: center.x, y: center.y, rotation: angle });
9503
- },
9504
- getZoomEventData(center, scale, event) {
9505
- return Object.assign(Object.assign({}, event), { x: center.x, y: center.y, scale });
9506
- },
9507
9345
  getDragEventData(startPoint, lastPoint, event) {
9508
9346
  return Object.assign(Object.assign({}, event), { x: event.x, y: event.y, moveX: event.x - lastPoint.x, moveY: event.y - lastPoint.y, totalX: event.x - startPoint.x, totalY: event.y - startPoint.y });
9509
9347
  },
@@ -9512,18 +9350,14 @@ const InteractionHelper = {
9512
9350
  data });
9513
9351
  },
9514
9352
  getSwipeDirection(angle) {
9515
- if (angle < -45 && angle > -135) {
9353
+ if (angle < -45 && angle > -135)
9516
9354
  return SwipeEvent.UP;
9517
- }
9518
- else if (angle > 45 && angle < 135) {
9355
+ else if (angle > 45 && angle < 135)
9519
9356
  return SwipeEvent.DOWN;
9520
- }
9521
- else if (angle <= 45 && angle >= -45) {
9357
+ else if (angle <= 45 && angle >= -45)
9522
9358
  return SwipeEvent.RIGHT;
9523
- }
9524
- else {
9359
+ else
9525
9360
  return SwipeEvent.LEFT;
9526
- }
9527
9361
  },
9528
9362
  getSwipeEventData(startPoint, lastDragData, event) {
9529
9363
  return Object.assign(Object.assign({}, event), { moveX: lastDragData.moveX, moveY: lastDragData.moveY, totalX: event.x - startPoint.x, totalY: event.y - startPoint.y, type: I.getSwipeDirection(PointHelper.getAngle(startPoint, event)) });
@@ -9596,9 +9430,8 @@ class Dragger {
9596
9430
  interaction.emit(MoveEvent.START, this.dragData);
9597
9431
  }
9598
9432
  }
9599
- if (!this.moving) {
9433
+ if (!this.moving)
9600
9434
  this.dragStart(data, canDrag);
9601
- }
9602
9435
  this.drag(data);
9603
9436
  }
9604
9437
  dragStart(data, canDrag) {
@@ -9676,16 +9509,9 @@ class Dragger {
9676
9509
  dragEnd(data, speed) {
9677
9510
  if (!this.dragging && !this.moving)
9678
9511
  return;
9679
- const { moveX, moveY } = this.dragData;
9680
- if (this.interaction.config.move.dragAnimate && this.canAnimate && this.moving && (Math.abs(moveX) > 1 || Math.abs(moveY) > 1)) {
9681
- data = Object.assign({}, data);
9682
- speed = (speed || (data.pointerType === 'touch' ? 2 : 1)) * 0.9;
9683
- PointHelper.move(data, moveX * speed, moveY * speed);
9684
- this.drag(data);
9685
- this.animate(() => { this.dragEnd(data, 1); });
9686
- }
9687
- else
9688
- this.dragEndReal(data);
9512
+ if (this.checkDragEndAnimate(data, speed))
9513
+ return;
9514
+ this.dragEndReal(data);
9689
9515
  }
9690
9516
  dragEndReal(data) {
9691
9517
  const { interaction, downData, dragData } = this;
@@ -9712,12 +9538,6 @@ class Dragger {
9712
9538
  this.dragReset();
9713
9539
  this.animate(null, 'off');
9714
9540
  }
9715
- animate(func, off) {
9716
- const animateWait = func || this.animateWait;
9717
- if (animateWait)
9718
- this.interaction.target.nextRender(animateWait, null, off);
9719
- this.animateWait = func;
9720
- }
9721
9541
  swipe(data, downData, dragData, endDragData) {
9722
9542
  const { interaction } = this;
9723
9543
  if (PointHelper.getDistance(downData, data) > interaction.config.pointer.swipeDistance) {
@@ -9734,39 +9554,11 @@ class Dragger {
9734
9554
  dragReset() {
9735
9555
  DragEvent.list = DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9736
9556
  }
9737
- checkDragOut(data) {
9738
- const { interaction } = this;
9739
- this.autoMoveCancel();
9740
- if (this.dragging && !interaction.shrinkCanvasBounds.hitPoint(data))
9741
- this.autoMoveOnDragOut(data);
9742
- }
9743
- autoMoveOnDragOut(data) {
9744
- const { interaction, downData, canDragOut } = this;
9745
- const { autoDistance, dragOut } = interaction.config.move;
9746
- if (!dragOut || !canDragOut || !autoDistance)
9747
- return;
9748
- const bounds = interaction.shrinkCanvasBounds;
9749
- const { x, y } = bounds;
9750
- const right = BoundsHelper.maxX(bounds);
9751
- const bottom = BoundsHelper.maxY(bounds);
9752
- const moveX = data.x < x ? autoDistance : (right < data.x ? -autoDistance : 0);
9753
- const moveY = data.y < y ? autoDistance : (bottom < data.y ? -autoDistance : 0);
9754
- let totalX = 0, totalY = 0;
9755
- this.autoMoveTimer = setInterval(() => {
9756
- totalX += moveX;
9757
- totalY += moveY;
9758
- PointHelper.move(downData, moveX, moveY);
9759
- PointHelper.move(this.dragData, moveX, moveY);
9760
- interaction.move(Object.assign(Object.assign({}, data), { moveX, moveY, totalX, totalY, moveType: 'drag' }));
9761
- interaction.pointerMoveReal(data);
9762
- }, 10);
9763
- }
9764
- autoMoveCancel() {
9765
- if (this.autoMoveTimer) {
9766
- clearInterval(this.autoMoveTimer);
9767
- this.autoMoveTimer = 0;
9768
- }
9769
- }
9557
+ checkDragEndAnimate(_data, _speed) { return false; }
9558
+ animate(_func, _off) { }
9559
+ checkDragOut(_data) { }
9560
+ autoMoveOnDragOut(_data) { }
9561
+ autoMoveCancel() { }
9770
9562
  destroy() {
9771
9563
  this.dragReset();
9772
9564
  }
@@ -9836,28 +9628,12 @@ function exclude(leaf, excludePath) {
9836
9628
  return excludePath && excludePath.has(leaf);
9837
9629
  }
9838
9630
 
9839
- const MultiTouchHelper = {
9840
- getData(list) {
9841
- const a = list[0];
9842
- const b = list[1];
9843
- const lastCenter = PointHelper.getCenter(a.from, b.from);
9844
- const center = PointHelper.getCenter(a.to, b.to);
9845
- const move = { x: center.x - lastCenter.x, y: center.y - lastCenter.y };
9846
- const lastDistance = PointHelper.getDistance(a.from, b.from);
9847
- const distance = PointHelper.getDistance(a.to, b.to);
9848
- const scale = distance / lastDistance;
9849
- const angle = PointHelper.getRotation(a.from, b.from, a.to, b.to);
9850
- return { move, scale, angle, center };
9851
- }
9852
- };
9853
-
9854
9631
  const config = {
9855
9632
  wheel: {
9856
9633
  zoomSpeed: 0.5,
9857
9634
  moveSpeed: 0.5,
9858
9635
  rotateSpeed: 0.5,
9859
9636
  delta: { x: 80 / 4, y: 8.0 },
9860
- preventDefault: true
9861
9637
  },
9862
9638
  pointer: {
9863
9639
  hitRadius: 5,
@@ -9868,17 +9644,18 @@ const config = {
9868
9644
  dragHover: true,
9869
9645
  dragDistance: 2,
9870
9646
  swipeDistance: 20,
9871
- preventDefaultMenu: true
9872
9647
  },
9873
9648
  touch: {
9874
- preventDefault: true
9649
+ preventDefault: 'auto'
9875
9650
  },
9876
9651
  multiTouch: {},
9652
+ move: { autoDistance: 2 },
9653
+ zoom: {},
9877
9654
  cursor: true,
9878
9655
  keyEvent: true
9879
9656
  };
9880
9657
 
9881
- const { pathHasEventType, getMoveEventData, getZoomEventData, getRotateEventData, pathCanDrag, pathHasOutside } = InteractionHelper;
9658
+ const { pathHasEventType, pathCanDrag, pathHasOutside } = InteractionHelper;
9882
9659
  class InteractionBase {
9883
9660
  get dragging() { return this.dragger.dragging; }
9884
9661
  get transforming() { return this.transformer.transforming; }
@@ -9900,7 +9677,7 @@ class InteractionBase {
9900
9677
  this.canvas = canvas;
9901
9678
  this.selector = selector;
9902
9679
  this.defaultPath = new LeafList(target);
9903
- this.transformer = new Transformer(this);
9680
+ this.createTransformer();
9904
9681
  this.dragger = new Dragger(this);
9905
9682
  if (userConfig)
9906
9683
  this.config = DataHelper.default(userConfig, this.config);
@@ -10001,14 +9778,6 @@ class InteractionBase {
10001
9778
  data.isCancel = true;
10002
9779
  this.pointerUp(data);
10003
9780
  }
10004
- multiTouch(data, list) {
10005
- if (this.config.multiTouch.disabled)
10006
- return;
10007
- const { move, angle, scale, center } = MultiTouchHelper.getData(list);
10008
- this.rotate(getRotateEventData(center, angle, data));
10009
- this.zoom(getZoomEventData(center, scale, data));
10010
- this.move(getMoveEventData(center, move, data));
10011
- }
10012
9781
  menu(data) {
10013
9782
  this.findPath(data);
10014
9783
  this.emit(PointerEvent.MENU, data);
@@ -10022,18 +9791,13 @@ class InteractionBase {
10022
9791
  this.waitRightTap = this.waitMenuTap = false;
10023
9792
  }
10024
9793
  }
10025
- move(data) {
10026
- this.transformer.move(data);
10027
- }
10028
- zoom(data) {
10029
- this.transformer.zoom(data);
10030
- }
10031
- rotate(data) {
10032
- this.transformer.rotate(data);
10033
- }
10034
- transformEnd() {
10035
- this.transformer.transformEnd();
10036
- }
9794
+ createTransformer() { }
9795
+ move(_data) { }
9796
+ zoom(_data) { }
9797
+ rotate(_data) { }
9798
+ transformEnd() { }
9799
+ wheel(_data) { }
9800
+ multiTouch(_data, _list) { }
10037
9801
  keyDown(data) {
10038
9802
  if (!this.config.keyEvent)
10039
9803
  return;
@@ -10271,8 +10035,9 @@ class InteractionBase {
10271
10035
  this.longPressed = false;
10272
10036
  }
10273
10037
  __onResize() {
10038
+ const { dragOut } = this.m;
10274
10039
  this.shrinkCanvasBounds = new Bounds(this.canvas.bounds);
10275
- this.shrinkCanvasBounds.spread(-2);
10040
+ this.shrinkCanvasBounds.spread(-(typeof dragOut === 'number' ? dragOut : 2));
10276
10041
  }
10277
10042
  __listenEvents() {
10278
10043
  const { target } = this;
@@ -10292,7 +10057,8 @@ class InteractionBase {
10292
10057
  this.stop();
10293
10058
  this.__removeListenEvents();
10294
10059
  this.dragger.destroy();
10295
- this.transformer.destroy();
10060
+ if (this.transformer)
10061
+ this.transformer.destroy();
10296
10062
  this.downData = this.overPath = this.enterPath = null;
10297
10063
  }
10298
10064
  }
@@ -10733,6 +10499,8 @@ function stroke(stroke, ui, canvas) {
10733
10499
  case 'center':
10734
10500
  canvas.setStroke(stroke, __strokeWidth, options);
10735
10501
  canvas.stroke();
10502
+ if (options.__useArrow)
10503
+ strokeArrow(ui, canvas);
10736
10504
  break;
10737
10505
  case 'inside':
10738
10506
  canvas.save();
@@ -10770,6 +10538,8 @@ function strokes(strokes, ui, canvas) {
10770
10538
  case 'center':
10771
10539
  canvas.setStroke(undefined, __strokeWidth, options);
10772
10540
  drawStrokesStyle(strokes, false, ui, canvas);
10541
+ if (options.__useArrow)
10542
+ strokeArrow(ui, canvas);
10773
10543
  break;
10774
10544
  case 'inside':
10775
10545
  canvas.save();
@@ -10795,6 +10565,14 @@ function strokes(strokes, ui, canvas) {
10795
10565
  }
10796
10566
  }
10797
10567
  }
10568
+ function strokeArrow(ui, canvas) {
10569
+ if (ui.__.dashPattern) {
10570
+ canvas.beginPath();
10571
+ ui.__drawPathByData(canvas, ui.__.__pathForArrow);
10572
+ canvas.dashPattern = null;
10573
+ canvas.stroke();
10574
+ }
10575
+ }
10798
10576
 
10799
10577
  const { getSpread, getOuterOf, getByMove, getIntersectData } = BoundsHelper;
10800
10578
  function shape(ui, current, options) {
@@ -12304,4 +12082,4 @@ if (platform === 'ios') {
12304
12082
  };
12305
12083
  }
12306
12084
 
12307
- export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, addInteractionWindow, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, needPlugin, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
12085
+ export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, needPlugin, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };