@leafer-draw/worker 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.
package/dist/worker.js CHANGED
@@ -111,7 +111,7 @@ var LeaferUI = (function (exports) {
111
111
  return rotation - oldRotation;
112
112
  },
113
113
  float(num, maxLength) {
114
- const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
114
+ const a = maxLength !== undefined ? pow$1(10, maxLength) : 1000000000000;
115
115
  num = round(num * a) / a;
116
116
  return num === -0 ? 0 : num;
117
117
  },
@@ -1377,7 +1377,7 @@ var LeaferUI = (function (exports) {
1377
1377
  }
1378
1378
  const D$4 = Debug;
1379
1379
 
1380
- const debug$d = Debug.get('RunTime');
1380
+ const debug$e = Debug.get('RunTime');
1381
1381
  const Run = {
1382
1382
  currentId: 0,
1383
1383
  currentName: '',
@@ -1395,7 +1395,7 @@ var LeaferUI = (function (exports) {
1395
1395
  const time = R.idMap[id], name = R.nameMap[id];
1396
1396
  const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
1397
1397
  R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
1398
- debug$d.log(name, duration, 'ms');
1398
+ debug$e.log(name, duration, 'ms');
1399
1399
  },
1400
1400
  endOfName(name, microsecond) {
1401
1401
  const id = R.nameToIdMap[name];
@@ -1409,18 +1409,18 @@ var LeaferUI = (function (exports) {
1409
1409
  console.error('need plugin: @leafer-in/' + name);
1410
1410
  }
1411
1411
 
1412
- const debug$c = Debug.get('UICreator');
1412
+ const debug$d = Debug.get('UICreator');
1413
1413
  const UICreator = {
1414
1414
  list: {},
1415
1415
  register(UI) {
1416
1416
  const { __tag: tag } = UI.prototype;
1417
1417
  if (list$1[tag])
1418
- debug$c.repeat(tag);
1418
+ debug$d.repeat(tag);
1419
1419
  list$1[tag] = UI;
1420
1420
  },
1421
1421
  get(tag, data, x, y, width, height) {
1422
1422
  if (!list$1[tag])
1423
- debug$c.error('not register ' + tag);
1423
+ debug$d.error('not register ' + tag);
1424
1424
  const ui = new list$1[tag](data);
1425
1425
  if (x !== undefined) {
1426
1426
  ui.x = x;
@@ -1436,7 +1436,7 @@ var LeaferUI = (function (exports) {
1436
1436
  };
1437
1437
  const { list: list$1 } = UICreator;
1438
1438
 
1439
- const debug$b = Debug.get('EventCreator');
1439
+ const debug$c = Debug.get('EventCreator');
1440
1440
  const EventCreator = {
1441
1441
  nameList: {},
1442
1442
  register(Event) {
@@ -1444,7 +1444,7 @@ var LeaferUI = (function (exports) {
1444
1444
  Object.keys(Event).forEach(key => {
1445
1445
  name = Event[key];
1446
1446
  if (typeof name === 'string')
1447
- nameList[name] && debug$b.repeat(name), nameList[name] = Event;
1447
+ nameList[name] && debug$c.repeat(name), nameList[name] = Event;
1448
1448
  });
1449
1449
  },
1450
1450
  changeName(oldName, newName) {
@@ -1516,17 +1516,19 @@ var LeaferUI = (function (exports) {
1516
1516
  assign(t, defaultData);
1517
1517
  return t;
1518
1518
  },
1519
- assign(t, merge) {
1519
+ assign(t, merge, exclude) {
1520
1520
  let value;
1521
1521
  Object.keys(merge).forEach(key => {
1522
- var _a;
1522
+ var _a, _b;
1523
1523
  value = merge[key];
1524
- if ((value === null || value === void 0 ? void 0 : value.constructor) === Object) {
1525
- (((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object) ? assign(t[key], merge[key]) : t[key] = merge[key];
1526
- }
1527
- else {
1528
- t[key] = merge[key];
1524
+ if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
1525
+ return assign(t[key], merge[key], exclude && exclude[key]);
1526
+ if (exclude && (key in exclude)) {
1527
+ if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
1528
+ assign(t[key] = {}, merge[key], exclude[key]);
1529
+ return;
1529
1530
  }
1531
+ t[key] = merge[key];
1530
1532
  });
1531
1533
  },
1532
1534
  copyAttrs(t, from, include) {
@@ -2598,7 +2600,7 @@ var LeaferUI = (function (exports) {
2598
2600
  const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$4, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$4, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
2599
2601
  const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2600
2602
  const { ellipticalArc } = EllipseHelper;
2601
- const debug$a = Debug.get('PathConvert');
2603
+ const debug$b = Debug.get('PathConvert');
2602
2604
  const setEndPoint$1 = {};
2603
2605
  const PathConvert = {
2604
2606
  current: { dot: 0 },
@@ -2839,7 +2841,7 @@ var LeaferUI = (function (exports) {
2839
2841
  i += 6;
2840
2842
  break;
2841
2843
  default:
2842
- debug$a.error(`command: ${command} [index:${i}]`, old);
2844
+ debug$b.error(`command: ${command} [index:${i}]`, old);
2843
2845
  return data;
2844
2846
  }
2845
2847
  lastCommand = command;
@@ -3064,7 +3066,7 @@ var LeaferUI = (function (exports) {
3064
3066
  }
3065
3067
 
3066
3068
  const { M: M$2, L: L$3, C: C$2, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1 } = PathCommandMap;
3067
- const debug$9 = Debug.get('PathDrawer');
3069
+ const debug$a = Debug.get('PathDrawer');
3068
3070
  const PathDrawer = {
3069
3071
  drawPathByData(drawer, data) {
3070
3072
  if (!data)
@@ -3127,7 +3129,7 @@ var LeaferUI = (function (exports) {
3127
3129
  i += 6;
3128
3130
  break;
3129
3131
  default:
3130
- debug$9.error(`command: ${command} [index:${i}]`, data);
3132
+ debug$a.error(`command: ${command} [index:${i}]`, data);
3131
3133
  return;
3132
3134
  }
3133
3135
  }
@@ -3137,7 +3139,7 @@ var LeaferUI = (function (exports) {
3137
3139
  const { M: M$1, L: L$2, C: C$1, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
3138
3140
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
3139
3141
  const { addPointBounds, copy: copy$7, addPoint: addPoint$1, setPoint: setPoint$1, addBounds, toBounds: toBounds$3 } = TwoPointBoundsHelper;
3140
- const debug$8 = Debug.get('PathBounds');
3142
+ const debug$9 = Debug.get('PathBounds');
3141
3143
  let radius, radiusX, radiusY;
3142
3144
  const tempPointBounds = {};
3143
3145
  const setPointBounds = {};
@@ -3245,7 +3247,7 @@ var LeaferUI = (function (exports) {
3245
3247
  i += 6;
3246
3248
  break;
3247
3249
  default:
3248
- debug$8.error(`command: ${command} [index:${i}]`, data);
3250
+ debug$9.error(`command: ${command} [index:${i}]`, data);
3249
3251
  return;
3250
3252
  }
3251
3253
  }
@@ -3361,7 +3363,7 @@ var LeaferUI = (function (exports) {
3361
3363
  const F = FileHelper;
3362
3364
  F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
3363
3365
 
3364
- const debug$7 = Debug.get('TaskProcessor');
3366
+ const debug$8 = Debug.get('TaskProcessor');
3365
3367
  class TaskItem {
3366
3368
  constructor(task) {
3367
3369
  this.parallel = true;
@@ -3376,7 +3378,7 @@ var LeaferUI = (function (exports) {
3376
3378
  yield this.task();
3377
3379
  }
3378
3380
  catch (error) {
3379
- debug$7.error(error);
3381
+ debug$8.error(error);
3380
3382
  }
3381
3383
  });
3382
3384
  }
@@ -3894,6 +3896,8 @@ var LeaferUI = (function (exports) {
3894
3896
  return decorateLeafAttr(defaultValue, (key) => attr({
3895
3897
  set(value) {
3896
3898
  this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange());
3899
+ if (this.mask)
3900
+ checkMask(this);
3897
3901
  }
3898
3902
  }));
3899
3903
  }
@@ -3910,9 +3914,20 @@ var LeaferUI = (function (exports) {
3910
3914
  this.__runAnimation('in');
3911
3915
  }
3912
3916
  doVisible(this, key, value, oldValue);
3917
+ if (this.mask)
3918
+ checkMask(this);
3913
3919
  }
3914
3920
  }));
3915
3921
  }
3922
+ function checkMask(leaf) {
3923
+ const { parent } = leaf;
3924
+ if (parent) {
3925
+ const { __hasMask } = parent;
3926
+ parent.__updateMask();
3927
+ if (__hasMask !== parent.__hasMask)
3928
+ parent.forceUpdate();
3929
+ }
3930
+ }
3916
3931
  function doVisible(leaf, key, value, oldValue) {
3917
3932
  if (leaf.__setAttr(key, value)) {
3918
3933
  leaf.__layout.opacityChanged || leaf.__layout.opacityChange();
@@ -4050,7 +4065,7 @@ var LeaferUI = (function (exports) {
4050
4065
  defineKey(data, key, property);
4051
4066
  }
4052
4067
 
4053
- const debug$6 = new Debug('rewrite');
4068
+ const debug$7 = new Debug('rewrite');
4054
4069
  const list = [];
4055
4070
  const excludeNames = ['destroy', 'constructor'];
4056
4071
  function rewrite(method) {
@@ -4067,7 +4082,7 @@ var LeaferUI = (function (exports) {
4067
4082
  if (list.length) {
4068
4083
  list.forEach(item => {
4069
4084
  if (error)
4070
- debug$6.error(item.name, '需在Class上装饰@rewriteAble()');
4085
+ debug$7.error(item.name, '需在Class上装饰@rewriteAble()');
4071
4086
  item.run();
4072
4087
  });
4073
4088
  list.length = 0;
@@ -4168,20 +4183,17 @@ var LeaferUI = (function (exports) {
4168
4183
  }
4169
4184
  return true;
4170
4185
  },
4171
- moveWorld(t, x, y = 0, isInnerPoint) {
4186
+ moveWorld(t, x, y = 0, isInnerPoint, transition) {
4172
4187
  const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
4173
4188
  isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
4174
- L.moveLocal(t, local.x, local.y);
4189
+ L.moveLocal(t, local.x, local.y, transition);
4175
4190
  },
4176
- moveLocal(t, x, y = 0) {
4177
- if (typeof x === 'object') {
4178
- t.x += x.x;
4179
- t.y += x.y;
4180
- }
4181
- else {
4182
- t.x += x;
4183
- t.y += y;
4184
- }
4191
+ moveLocal(t, x, y = 0, transition) {
4192
+ if (typeof x === 'object')
4193
+ y = x.y, x = x.x;
4194
+ x += t.x;
4195
+ y += t.y;
4196
+ transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
4185
4197
  },
4186
4198
  zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4187
4199
  L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
@@ -4978,13 +4990,13 @@ var LeaferUI = (function (exports) {
4978
4990
  const LeafEventer = { on, on_, off, off_, once, emit: emit$1, emitEvent, hasEvent, destroyEventer: destroy };
4979
4991
 
4980
4992
  const { isFinite } = Number;
4981
- const debug$5 = Debug.get('setAttr');
4993
+ const debug$6 = Debug.get('setAttr');
4982
4994
  const LeafDataProxy = {
4983
4995
  __setAttr(name, newValue, checkFiniteNumber) {
4984
4996
  if (this.leaferIsCreated) {
4985
4997
  const oldValue = this.__.__getInput(name);
4986
4998
  if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
4987
- debug$5.warn(this.innerName, name, newValue);
4999
+ debug$6.warn(this.innerName, name, newValue);
4988
5000
  newValue = undefined;
4989
5001
  }
4990
5002
  if (typeof newValue === 'object' || oldValue !== newValue) {
@@ -5440,8 +5452,8 @@ var LeaferUI = (function (exports) {
5440
5452
  canvas.clearRect(r.x, r.y, r.width, r.height);
5441
5453
  canvas.restore();
5442
5454
  }
5443
- __updateMask(value) {
5444
- this.__hasMask = value ? true : this.children.some(item => item.__.mask);
5455
+ __updateMask(_value) {
5456
+ this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
5445
5457
  }
5446
5458
  __renderMask(_canvas, _options) { }
5447
5459
  __getNowWorld(options) {
@@ -5561,11 +5573,11 @@ var LeaferUI = (function (exports) {
5561
5573
  transform(matrix, resize) {
5562
5574
  transform(this, matrix, resize);
5563
5575
  }
5564
- move(x, y) {
5565
- moveLocal(this, x, y);
5576
+ move(x, y, transition) {
5577
+ moveLocal(this, x, y, transition);
5566
5578
  }
5567
- moveInner(x, y) {
5568
- moveWorld(this, x, y, true);
5579
+ moveInner(x, y, transition) {
5580
+ moveWorld(this, x, y, true, transition);
5569
5581
  }
5570
5582
  scaleOf(origin, scaleX, scaleY, resize) {
5571
5583
  zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
@@ -5579,8 +5591,8 @@ var LeaferUI = (function (exports) {
5579
5591
  transformWorld(worldTransform, resize) {
5580
5592
  transformWorld(this, worldTransform, resize);
5581
5593
  }
5582
- moveWorld(x, y) {
5583
- moveWorld(this, x, y);
5594
+ moveWorld(x, y, transition) {
5595
+ moveWorld(this, x, y, false, transition);
5584
5596
  }
5585
5597
  scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5586
5598
  zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
@@ -5684,6 +5696,7 @@ var LeaferUI = (function (exports) {
5684
5696
  const { setListWithFn } = BoundsHelper;
5685
5697
  const { sort } = BranchHelper;
5686
5698
  const { localBoxBounds, localStrokeBounds, localRenderBounds, maskLocalBoxBounds, maskLocalStrokeBounds, maskLocalRenderBounds } = LeafBoundsHelper;
5699
+ const debug$5 = new Debug('Branch');
5687
5700
  exports.Branch = class Branch extends exports.Leaf {
5688
5701
  __updateStrokeSpread() {
5689
5702
  const { children } = this;
@@ -5724,8 +5737,8 @@ var LeaferUI = (function (exports) {
5724
5737
  }
5725
5738
  }
5726
5739
  add(child, index) {
5727
- if (child === this)
5728
- return;
5740
+ if (child === this || child.destroyed)
5741
+ return debug$5.warn('add self or destroyed');
5729
5742
  const noIndex = index === undefined;
5730
5743
  if (!child.__) {
5731
5744
  if (child instanceof Array)
@@ -5739,8 +5752,9 @@ var LeaferUI = (function (exports) {
5739
5752
  noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
5740
5753
  if (child.isBranch)
5741
5754
  this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
5742
- child.__layout.boxChanged || child.__layout.boxChange();
5743
- child.__layout.matrixChanged || child.__layout.matrixChange();
5755
+ const childLayout = child.__layout;
5756
+ childLayout.boxChanged || childLayout.boxChange();
5757
+ childLayout.matrixChanged || childLayout.matrixChange();
5744
5758
  if (child.__bubbleMap)
5745
5759
  child.__emitLifeEvent(ChildEvent.ADD);
5746
5760
  if (this.leafer) {
@@ -5978,7 +5992,7 @@ var LeaferUI = (function (exports) {
5978
5992
  }
5979
5993
  }
5980
5994
 
5981
- const version = "1.0.10";
5995
+ const version = "1.1.1";
5982
5996
 
5983
5997
  class LeaferCanvas extends LeaferCanvasBase {
5984
5998
  get allowBackgroundColor() { return true; }
@@ -6423,25 +6437,25 @@ var LeaferUI = (function (exports) {
6423
6437
  if (userConfig)
6424
6438
  this.config = DataHelper.default(userConfig, this.config);
6425
6439
  this.__listenEvents();
6426
- this.__requestRender();
6427
6440
  }
6428
6441
  start() {
6429
6442
  this.running = true;
6443
+ this.update(false);
6430
6444
  }
6431
6445
  stop() {
6432
6446
  this.running = false;
6433
6447
  }
6434
- update() {
6435
- this.changed = true;
6448
+ update(change = true) {
6449
+ if (!this.changed)
6450
+ this.changed = change;
6451
+ this.__requestRender();
6436
6452
  }
6437
6453
  requestLayout() {
6438
6454
  this.target.emit(LayoutEvent.REQUEST);
6439
6455
  }
6440
6456
  render(callback) {
6441
- if (!(this.running && this.canvas.view)) {
6442
- this.changed = true;
6443
- return;
6444
- }
6457
+ if (!(this.running && this.canvas.view))
6458
+ return this.update();
6445
6459
  const { target } = this;
6446
6460
  this.times = 0;
6447
6461
  this.totalBounds = new Bounds();
@@ -6575,16 +6589,17 @@ var LeaferUI = (function (exports) {
6575
6589
  }
6576
6590
  }
6577
6591
  __requestRender() {
6578
- const startTime = Date.now();
6592
+ if (this.requestTime)
6593
+ return;
6594
+ const requestTime = this.requestTime = Date.now();
6579
6595
  Platform.requestRender(() => {
6580
- this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - startTime)));
6596
+ this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
6597
+ this.requestTime = 0;
6581
6598
  if (this.running) {
6582
6599
  if (this.changed && this.canvas.view)
6583
6600
  this.render();
6584
6601
  this.target.emit(RenderEvent.NEXT);
6585
6602
  }
6586
- if (this.target)
6587
- this.__requestRender();
6588
6603
  });
6589
6604
  }
6590
6605
  __onResize(e) {
@@ -6600,7 +6615,7 @@ var LeaferUI = (function (exports) {
6600
6615
  }
6601
6616
  }
6602
6617
  this.addBlock(new Bounds(0, 0, 1, 1));
6603
- this.changed = true;
6618
+ this.update();
6604
6619
  }
6605
6620
  __onLayoutEnd(event) {
6606
6621
  if (event.data)
@@ -6735,7 +6750,7 @@ var LeaferUI = (function (exports) {
6735
6750
  return true;
6736
6751
  return t.fill && this.__hasStroke;
6737
6752
  }
6738
- get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
6753
+ get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
6739
6754
  get __autoWidth() { return !this._width; }
6740
6755
  get __autoHeight() { return !this._height; }
6741
6756
  get __autoSide() { return !this._width || !this._height; }
@@ -6849,7 +6864,7 @@ var LeaferUI = (function (exports) {
6849
6864
 
6850
6865
  class BoxData extends GroupData {
6851
6866
  get __boxStroke() { return !this.__pathInputed; }
6852
- get __drawAfterFill() { return this.overflow === 'hide' && this.__clipAfterFill && this.__leaf.children.length; }
6867
+ get __drawAfterFill() { const t = this; return (t.overflow === 'hide' && (t.__clipAfterFill || t.innerShadow) && t.__leaf.children.length); }
6853
6868
  get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
6854
6869
  }
6855
6870
 
@@ -7135,11 +7150,15 @@ var LeaferUI = (function (exports) {
7135
7150
  super(data);
7136
7151
  }
7137
7152
  reset(_data) { }
7138
- set(data, isTemp) {
7139
- if (isTemp) {
7140
- this.lockNormalStyle = true;
7141
- Object.assign(this, data);
7142
- this.lockNormalStyle = false;
7153
+ set(data, transition) {
7154
+ if (transition) {
7155
+ if (transition === 'temp') {
7156
+ this.lockNormalStyle = true;
7157
+ Object.assign(this, data);
7158
+ this.lockNormalStyle = false;
7159
+ }
7160
+ else
7161
+ this.animate(data, transition);
7143
7162
  }
7144
7163
  else
7145
7164
  Object.assign(this, data);
@@ -7449,17 +7468,17 @@ var LeaferUI = (function (exports) {
7449
7468
  if (!this.children)
7450
7469
  this.children = [];
7451
7470
  }
7452
- set(data, isTemp) {
7471
+ set(data, transition) {
7453
7472
  if (data.children) {
7454
7473
  const { children } = data;
7455
7474
  delete data.children;
7456
7475
  this.children ? this.clear() : this.__setBranch();
7457
- super.set(data, isTemp);
7476
+ super.set(data, transition);
7458
7477
  children.forEach(child => this.add(child));
7459
7478
  data.children = children;
7460
7479
  }
7461
7480
  else
7462
- super.set(data, isTemp);
7481
+ super.set(data, transition);
7463
7482
  }
7464
7483
  toJSON(options) {
7465
7484
  const data = super.toJSON(options);
@@ -7505,20 +7524,10 @@ var LeaferUI = (function (exports) {
7505
7524
  constructor(userConfig, data) {
7506
7525
  super(data);
7507
7526
  this.config = {
7508
- type: 'design',
7509
7527
  start: true,
7510
7528
  hittable: true,
7511
7529
  smooth: true,
7512
- lazySpeard: 100,
7513
- zoom: {
7514
- min: 0.01,
7515
- max: 256
7516
- },
7517
- move: {
7518
- holdSpaceKey: true,
7519
- holdMiddleKey: true,
7520
- autoDistance: 2
7521
- }
7530
+ lazySpeard: 100
7522
7531
  };
7523
7532
  this.leafs = 0;
7524
7533
  this.__eventIds = [];
@@ -7535,23 +7544,27 @@ var LeaferUI = (function (exports) {
7535
7544
  init(userConfig, parentApp) {
7536
7545
  if (this.canvas)
7537
7546
  return;
7538
- this.__setLeafer(this);
7539
- if (userConfig)
7540
- DataHelper.assign(this.config, userConfig);
7541
7547
  let start;
7542
7548
  const { config } = this;
7543
- this.initType(config.type);
7549
+ this.__setLeafer(this);
7550
+ if (parentApp) {
7551
+ this.parentApp = parentApp;
7552
+ this.__bindApp(parentApp);
7553
+ start = parentApp.running;
7554
+ }
7555
+ if (userConfig) {
7556
+ this.parent = parentApp;
7557
+ this.initType(userConfig.type);
7558
+ this.parent = undefined;
7559
+ DataHelper.assign(config, userConfig);
7560
+ }
7544
7561
  const canvas = this.canvas = Creator.canvas(config);
7545
7562
  this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
7546
7563
  if (this.isApp)
7547
7564
  this.__setApp();
7548
7565
  this.__checkAutoLayout(config, parentApp);
7549
7566
  this.view = canvas.view;
7550
- if (parentApp) {
7551
- this.__bindApp(parentApp);
7552
- start = parentApp.running;
7553
- }
7554
- else {
7567
+ if (!parentApp) {
7555
7568
  this.selector = Creator.selector(this);
7556
7569
  this.interaction = Creator.interaction(this, canvas, this.selector, config);
7557
7570
  if (this.interaction) {
@@ -7572,8 +7585,8 @@ var LeaferUI = (function (exports) {
7572
7585
  }
7573
7586
  onInit() { }
7574
7587
  initType(_type) { }
7575
- set(data) {
7576
- this.waitInit(() => { super.set(data); });
7588
+ set(data, transition) {
7589
+ this.waitInit(() => { super.set(data, transition); });
7577
7590
  }
7578
7591
  start() {
7579
7592
  clearTimeout(this.__startTimer);
@@ -7608,7 +7621,11 @@ var LeaferUI = (function (exports) {
7608
7621
  forceRender(bounds) {
7609
7622
  this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
7610
7623
  if (this.viewReady)
7611
- this.renderer.update();
7624
+ this.renderer.render();
7625
+ }
7626
+ requestRender(change = false) {
7627
+ if (this.renderer)
7628
+ this.renderer.update(change);
7612
7629
  }
7613
7630
  updateCursor(cursor) {
7614
7631
  const i = this.interaction;
@@ -7716,8 +7733,10 @@ var LeaferUI = (function (exports) {
7716
7733
  const { imageReady } = this;
7717
7734
  if (imageReady && !this.viewCompleted)
7718
7735
  this.__checkViewCompleted();
7719
- if (!imageReady)
7736
+ if (!imageReady) {
7720
7737
  this.viewCompleted = false;
7738
+ this.requestRender();
7739
+ }
7721
7740
  }
7722
7741
  }
7723
7742
  __checkViewCompleted(emit = true) {
@@ -7775,6 +7794,7 @@ var LeaferUI = (function (exports) {
7775
7794
  }
7776
7795
  else
7777
7796
  list.push(item);
7797
+ this.requestRender();
7778
7798
  }
7779
7799
  zoom(_zoomType, _padding, _fixedScale) {
7780
7800
  return needPlugin('view');
@@ -7828,7 +7848,7 @@ var LeaferUI = (function (exports) {
7828
7848
  this.canvasManager.destroy();
7829
7849
  }
7830
7850
  this.canvas.destroy();
7831
- this.config.view = this.view = null;
7851
+ this.config.view = this.view = this.parentApp = null;
7832
7852
  if (this.userConfig)
7833
7853
  this.userConfig.view = null;
7834
7854
  super.destroy();
@@ -8668,6 +8688,8 @@ var LeaferUI = (function (exports) {
8668
8688
  case 'center':
8669
8689
  canvas.setStroke(stroke, __strokeWidth, options);
8670
8690
  canvas.stroke();
8691
+ if (options.__useArrow)
8692
+ strokeArrow(ui, canvas);
8671
8693
  break;
8672
8694
  case 'inside':
8673
8695
  canvas.save();
@@ -8705,6 +8727,8 @@ var LeaferUI = (function (exports) {
8705
8727
  case 'center':
8706
8728
  canvas.setStroke(undefined, __strokeWidth, options);
8707
8729
  drawStrokesStyle(strokes, false, ui, canvas);
8730
+ if (options.__useArrow)
8731
+ strokeArrow(ui, canvas);
8708
8732
  break;
8709
8733
  case 'inside':
8710
8734
  canvas.save();
@@ -8730,6 +8754,14 @@ var LeaferUI = (function (exports) {
8730
8754
  }
8731
8755
  }
8732
8756
  }
8757
+ function strokeArrow(ui, canvas) {
8758
+ if (ui.__.dashPattern) {
8759
+ canvas.beginPath();
8760
+ ui.__drawPathByData(canvas, ui.__.__pathForArrow);
8761
+ canvas.dashPattern = null;
8762
+ canvas.stroke();
8763
+ }
8764
+ }
8733
8765
 
8734
8766
  const { getSpread, getOuterOf, getByMove, getIntersectData } = BoundsHelper;
8735
8767
  function shape(ui, current, options) {