@leafer/core 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/lib/core.cjs CHANGED
@@ -110,7 +110,7 @@ const MathHelper = {
110
110
  return rotation - oldRotation;
111
111
  },
112
112
  float(num, maxLength) {
113
- const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
113
+ const a = maxLength !== undefined ? pow$1(10, maxLength) : 1000000000000;
114
114
  num = round(num * a) / a;
115
115
  return num === -0 ? 0 : num;
116
116
  },
@@ -1376,7 +1376,7 @@ function getNameList(name) {
1376
1376
  }
1377
1377
  const D$4 = Debug;
1378
1378
 
1379
- const debug$8 = Debug.get('RunTime');
1379
+ const debug$9 = Debug.get('RunTime');
1380
1380
  const Run = {
1381
1381
  currentId: 0,
1382
1382
  currentName: '',
@@ -1394,7 +1394,7 @@ const Run = {
1394
1394
  const time = R.idMap[id], name = R.nameMap[id];
1395
1395
  const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
1396
1396
  R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
1397
- debug$8.log(name, duration, 'ms');
1397
+ debug$9.log(name, duration, 'ms');
1398
1398
  },
1399
1399
  endOfName(name, microsecond) {
1400
1400
  const id = R.nameToIdMap[name];
@@ -1408,18 +1408,18 @@ function needPlugin(name) {
1408
1408
  console.error('need plugin: @leafer-in/' + name);
1409
1409
  }
1410
1410
 
1411
- const debug$7 = Debug.get('UICreator');
1411
+ const debug$8 = Debug.get('UICreator');
1412
1412
  const UICreator = {
1413
1413
  list: {},
1414
1414
  register(UI) {
1415
1415
  const { __tag: tag } = UI.prototype;
1416
1416
  if (list$1[tag])
1417
- debug$7.repeat(tag);
1417
+ debug$8.repeat(tag);
1418
1418
  list$1[tag] = UI;
1419
1419
  },
1420
1420
  get(tag, data, x, y, width, height) {
1421
1421
  if (!list$1[tag])
1422
- debug$7.error('not register ' + tag);
1422
+ debug$8.error('not register ' + tag);
1423
1423
  const ui = new list$1[tag](data);
1424
1424
  if (x !== undefined) {
1425
1425
  ui.x = x;
@@ -1435,7 +1435,7 @@ const UICreator = {
1435
1435
  };
1436
1436
  const { list: list$1 } = UICreator;
1437
1437
 
1438
- const debug$6 = Debug.get('EventCreator');
1438
+ const debug$7 = Debug.get('EventCreator');
1439
1439
  const EventCreator = {
1440
1440
  nameList: {},
1441
1441
  register(Event) {
@@ -1443,7 +1443,7 @@ const EventCreator = {
1443
1443
  Object.keys(Event).forEach(key => {
1444
1444
  name = Event[key];
1445
1445
  if (typeof name === 'string')
1446
- nameList[name] && debug$6.repeat(name), nameList[name] = Event;
1446
+ nameList[name] && debug$7.repeat(name), nameList[name] = Event;
1447
1447
  });
1448
1448
  },
1449
1449
  changeName(oldName, newName) {
@@ -1515,17 +1515,19 @@ const DataHelper = {
1515
1515
  assign(t, defaultData);
1516
1516
  return t;
1517
1517
  },
1518
- assign(t, merge) {
1518
+ assign(t, merge, exclude) {
1519
1519
  let value;
1520
1520
  Object.keys(merge).forEach(key => {
1521
- var _a;
1521
+ var _a, _b;
1522
1522
  value = merge[key];
1523
- if ((value === null || value === void 0 ? void 0 : value.constructor) === Object) {
1524
- (((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object) ? assign(t[key], merge[key]) : t[key] = merge[key];
1525
- }
1526
- else {
1527
- t[key] = merge[key];
1523
+ if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
1524
+ return assign(t[key], merge[key], exclude && exclude[key]);
1525
+ if (exclude && (key in exclude)) {
1526
+ if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
1527
+ assign(t[key] = {}, merge[key], exclude[key]);
1528
+ return;
1528
1529
  }
1530
+ t[key] = merge[key];
1529
1531
  });
1530
1532
  },
1531
1533
  copyAttrs(t, from, include) {
@@ -2597,7 +2599,7 @@ const EllipseHelper = {
2597
2599
  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;
2598
2600
  const { rect: rect$1, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$3, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2599
2601
  const { ellipticalArc } = EllipseHelper;
2600
- const debug$5 = Debug.get('PathConvert');
2602
+ const debug$6 = Debug.get('PathConvert');
2601
2603
  const setEndPoint$1 = {};
2602
2604
  const PathConvert = {
2603
2605
  current: { dot: 0 },
@@ -2838,7 +2840,7 @@ const PathConvert = {
2838
2840
  i += 6;
2839
2841
  break;
2840
2842
  default:
2841
- debug$5.error(`command: ${command} [index:${i}]`, old);
2843
+ debug$6.error(`command: ${command} [index:${i}]`, old);
2842
2844
  return data;
2843
2845
  }
2844
2846
  lastCommand = command;
@@ -3063,7 +3065,7 @@ class PathCreator {
3063
3065
  }
3064
3066
 
3065
3067
  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;
3066
- const debug$4 = Debug.get('PathDrawer');
3068
+ const debug$5 = Debug.get('PathDrawer');
3067
3069
  const PathDrawer = {
3068
3070
  drawPathByData(drawer, data) {
3069
3071
  if (!data)
@@ -3126,7 +3128,7 @@ const PathDrawer = {
3126
3128
  i += 6;
3127
3129
  break;
3128
3130
  default:
3129
- debug$4.error(`command: ${command} [index:${i}]`, data);
3131
+ debug$5.error(`command: ${command} [index:${i}]`, data);
3130
3132
  return;
3131
3133
  }
3132
3134
  }
@@ -3136,7 +3138,7 @@ const PathDrawer = {
3136
3138
  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;
3137
3139
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse } = BezierHelper;
3138
3140
  const { addPointBounds, copy: copy$4, addPoint, setPoint, addBounds, toBounds: toBounds$1 } = TwoPointBoundsHelper;
3139
- const debug$3 = Debug.get('PathBounds');
3141
+ const debug$4 = Debug.get('PathBounds');
3140
3142
  let radius, radiusX, radiusY;
3141
3143
  const tempPointBounds = {};
3142
3144
  const setPointBounds = {};
@@ -3244,7 +3246,7 @@ const PathBounds = {
3244
3246
  i += 6;
3245
3247
  break;
3246
3248
  default:
3247
- debug$3.error(`command: ${command} [index:${i}]`, data);
3249
+ debug$4.error(`command: ${command} [index:${i}]`, data);
3248
3250
  return;
3249
3251
  }
3250
3252
  }
@@ -3360,7 +3362,7 @@ const FileHelper = {
3360
3362
  const F = FileHelper;
3361
3363
  F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
3362
3364
 
3363
- const debug$2 = Debug.get('TaskProcessor');
3365
+ const debug$3 = Debug.get('TaskProcessor');
3364
3366
  class TaskItem {
3365
3367
  constructor(task) {
3366
3368
  this.parallel = true;
@@ -3375,7 +3377,7 @@ class TaskItem {
3375
3377
  yield this.task();
3376
3378
  }
3377
3379
  catch (error) {
3378
- debug$2.error(error);
3380
+ debug$3.error(error);
3379
3381
  }
3380
3382
  });
3381
3383
  }
@@ -3893,6 +3895,8 @@ function opacityType(defaultValue) {
3893
3895
  return decorateLeafAttr(defaultValue, (key) => attr({
3894
3896
  set(value) {
3895
3897
  this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange());
3898
+ if (this.mask)
3899
+ checkMask(this);
3896
3900
  }
3897
3901
  }));
3898
3902
  }
@@ -3909,9 +3913,20 @@ function visibleType(defaultValue) {
3909
3913
  this.__runAnimation('in');
3910
3914
  }
3911
3915
  doVisible(this, key, value, oldValue);
3916
+ if (this.mask)
3917
+ checkMask(this);
3912
3918
  }
3913
3919
  }));
3914
3920
  }
3921
+ function checkMask(leaf) {
3922
+ const { parent } = leaf;
3923
+ if (parent) {
3924
+ const { __hasMask } = parent;
3925
+ parent.__updateMask();
3926
+ if (__hasMask !== parent.__hasMask)
3927
+ parent.forceUpdate();
3928
+ }
3929
+ }
3915
3930
  function doVisible(leaf, key, value, oldValue) {
3916
3931
  if (leaf.__setAttr(key, value)) {
3917
3932
  leaf.__layout.opacityChanged || leaf.__layout.opacityChange();
@@ -4049,7 +4064,7 @@ function defineDataProcessor(target, key, defaultValue) {
4049
4064
  defineKey(data, key, property);
4050
4065
  }
4051
4066
 
4052
- const debug$1 = new Debug('rewrite');
4067
+ const debug$2 = new Debug('rewrite');
4053
4068
  const list = [];
4054
4069
  const excludeNames = ['destroy', 'constructor'];
4055
4070
  function rewrite(method) {
@@ -4066,7 +4081,7 @@ function doRewrite(error) {
4066
4081
  if (list.length) {
4067
4082
  list.forEach(item => {
4068
4083
  if (error)
4069
- debug$1.error(item.name, '需在Class上装饰@rewriteAble()');
4084
+ debug$2.error(item.name, '需在Class上装饰@rewriteAble()');
4070
4085
  item.run();
4071
4086
  });
4072
4087
  list.length = 0;
@@ -4167,20 +4182,17 @@ const LeafHelper = {
4167
4182
  }
4168
4183
  return true;
4169
4184
  },
4170
- moveWorld(t, x, y = 0, isInnerPoint) {
4185
+ moveWorld(t, x, y = 0, isInnerPoint, transition) {
4171
4186
  const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
4172
4187
  isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
4173
- L.moveLocal(t, local.x, local.y);
4188
+ L.moveLocal(t, local.x, local.y, transition);
4174
4189
  },
4175
- moveLocal(t, x, y = 0) {
4176
- if (typeof x === 'object') {
4177
- t.x += x.x;
4178
- t.y += x.y;
4179
- }
4180
- else {
4181
- t.x += x;
4182
- t.y += y;
4183
- }
4190
+ moveLocal(t, x, y = 0, transition) {
4191
+ if (typeof x === 'object')
4192
+ y = x.y, x = x.x;
4193
+ x += t.x;
4194
+ y += t.y;
4195
+ transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
4184
4196
  },
4185
4197
  zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4186
4198
  L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
@@ -4977,13 +4989,13 @@ const { on, on_, off, off_, once, emit, emitEvent, hasEvent, destroy } = Eventer
4977
4989
  const LeafEventer = { on, on_, off, off_, once, emit, emitEvent, hasEvent, destroyEventer: destroy };
4978
4990
 
4979
4991
  const { isFinite } = Number;
4980
- const debug = Debug.get('setAttr');
4992
+ const debug$1 = Debug.get('setAttr');
4981
4993
  const LeafDataProxy = {
4982
4994
  __setAttr(name, newValue, checkFiniteNumber) {
4983
4995
  if (this.leaferIsCreated) {
4984
4996
  const oldValue = this.__.__getInput(name);
4985
4997
  if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
4986
- debug.warn(this.innerName, name, newValue);
4998
+ debug$1.warn(this.innerName, name, newValue);
4987
4999
  newValue = undefined;
4988
5000
  }
4989
5001
  if (typeof newValue === 'object' || oldValue !== newValue) {
@@ -5439,8 +5451,8 @@ exports.Leaf = class Leaf {
5439
5451
  canvas.clearRect(r.x, r.y, r.width, r.height);
5440
5452
  canvas.restore();
5441
5453
  }
5442
- __updateMask(value) {
5443
- this.__hasMask = value ? true : this.children.some(item => item.__.mask);
5454
+ __updateMask(_value) {
5455
+ this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
5444
5456
  }
5445
5457
  __renderMask(_canvas, _options) { }
5446
5458
  __getNowWorld(options) {
@@ -5560,11 +5572,11 @@ exports.Leaf = class Leaf {
5560
5572
  transform(matrix, resize) {
5561
5573
  transform(this, matrix, resize);
5562
5574
  }
5563
- move(x, y) {
5564
- moveLocal(this, x, y);
5575
+ move(x, y, transition) {
5576
+ moveLocal(this, x, y, transition);
5565
5577
  }
5566
- moveInner(x, y) {
5567
- moveWorld(this, x, y, true);
5578
+ moveInner(x, y, transition) {
5579
+ moveWorld(this, x, y, true, transition);
5568
5580
  }
5569
5581
  scaleOf(origin, scaleX, scaleY, resize) {
5570
5582
  zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
@@ -5578,8 +5590,8 @@ exports.Leaf = class Leaf {
5578
5590
  transformWorld(worldTransform, resize) {
5579
5591
  transformWorld(this, worldTransform, resize);
5580
5592
  }
5581
- moveWorld(x, y) {
5582
- moveWorld(this, x, y);
5593
+ moveWorld(x, y, transition) {
5594
+ moveWorld(this, x, y, false, transition);
5583
5595
  }
5584
5596
  scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5585
5597
  zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
@@ -5683,6 +5695,7 @@ exports.Leaf = __decorate([
5683
5695
  const { setListWithFn } = BoundsHelper;
5684
5696
  const { sort } = BranchHelper;
5685
5697
  const { localBoxBounds, localStrokeBounds, localRenderBounds, maskLocalBoxBounds, maskLocalStrokeBounds, maskLocalRenderBounds } = LeafBoundsHelper;
5698
+ const debug = new Debug('Branch');
5686
5699
  exports.Branch = class Branch extends exports.Leaf {
5687
5700
  __updateStrokeSpread() {
5688
5701
  const { children } = this;
@@ -5723,8 +5736,8 @@ exports.Branch = class Branch extends exports.Leaf {
5723
5736
  }
5724
5737
  }
5725
5738
  add(child, index) {
5726
- if (child === this)
5727
- return;
5739
+ if (child === this || child.destroyed)
5740
+ return debug.warn('add self or destroyed');
5728
5741
  const noIndex = index === undefined;
5729
5742
  if (!child.__) {
5730
5743
  if (child instanceof Array)
@@ -5738,8 +5751,9 @@ exports.Branch = class Branch extends exports.Leaf {
5738
5751
  noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
5739
5752
  if (child.isBranch)
5740
5753
  this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
5741
- child.__layout.boxChanged || child.__layout.boxChange();
5742
- child.__layout.matrixChanged || child.__layout.matrixChange();
5754
+ const childLayout = child.__layout;
5755
+ childLayout.boxChanged || childLayout.boxChange();
5756
+ childLayout.matrixChanged || childLayout.matrixChange();
5743
5757
  if (child.__bubbleMap)
5744
5758
  child.__emitLifeEvent(ChildEvent.ADD);
5745
5759
  if (this.leafer) {
@@ -5977,7 +5991,7 @@ class LeafLevelList {
5977
5991
  }
5978
5992
  }
5979
5993
 
5980
- const version = "1.0.10";
5994
+ const version = "1.1.1";
5981
5995
 
5982
5996
  exports.AlignHelper = AlignHelper;
5983
5997
  exports.AroundHelper = AroundHelper;
package/lib/core.esm.js CHANGED
@@ -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
  },
@@ -1374,7 +1374,7 @@ function getNameList(name) {
1374
1374
  }
1375
1375
  const D$4 = Debug;
1376
1376
 
1377
- const debug$8 = Debug.get('RunTime');
1377
+ const debug$9 = Debug.get('RunTime');
1378
1378
  const Run = {
1379
1379
  currentId: 0,
1380
1380
  currentName: '',
@@ -1392,7 +1392,7 @@ const Run = {
1392
1392
  const time = R.idMap[id], name = R.nameMap[id];
1393
1393
  const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
1394
1394
  R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
1395
- debug$8.log(name, duration, 'ms');
1395
+ debug$9.log(name, duration, 'ms');
1396
1396
  },
1397
1397
  endOfName(name, microsecond) {
1398
1398
  const id = R.nameToIdMap[name];
@@ -1406,18 +1406,18 @@ function needPlugin(name) {
1406
1406
  console.error('need plugin: @leafer-in/' + name);
1407
1407
  }
1408
1408
 
1409
- const debug$7 = Debug.get('UICreator');
1409
+ const debug$8 = Debug.get('UICreator');
1410
1410
  const UICreator = {
1411
1411
  list: {},
1412
1412
  register(UI) {
1413
1413
  const { __tag: tag } = UI.prototype;
1414
1414
  if (list$1[tag])
1415
- debug$7.repeat(tag);
1415
+ debug$8.repeat(tag);
1416
1416
  list$1[tag] = UI;
1417
1417
  },
1418
1418
  get(tag, data, x, y, width, height) {
1419
1419
  if (!list$1[tag])
1420
- debug$7.error('not register ' + tag);
1420
+ debug$8.error('not register ' + tag);
1421
1421
  const ui = new list$1[tag](data);
1422
1422
  if (x !== undefined) {
1423
1423
  ui.x = x;
@@ -1433,7 +1433,7 @@ const UICreator = {
1433
1433
  };
1434
1434
  const { list: list$1 } = UICreator;
1435
1435
 
1436
- const debug$6 = Debug.get('EventCreator');
1436
+ const debug$7 = Debug.get('EventCreator');
1437
1437
  const EventCreator = {
1438
1438
  nameList: {},
1439
1439
  register(Event) {
@@ -1441,7 +1441,7 @@ const EventCreator = {
1441
1441
  Object.keys(Event).forEach(key => {
1442
1442
  name = Event[key];
1443
1443
  if (typeof name === 'string')
1444
- nameList[name] && debug$6.repeat(name), nameList[name] = Event;
1444
+ nameList[name] && debug$7.repeat(name), nameList[name] = Event;
1445
1445
  });
1446
1446
  },
1447
1447
  changeName(oldName, newName) {
@@ -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) {
@@ -2595,7 +2597,7 @@ const EllipseHelper = {
2595
2597
  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;
2596
2598
  const { rect: rect$1, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$3, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2597
2599
  const { ellipticalArc } = EllipseHelper;
2598
- const debug$5 = Debug.get('PathConvert');
2600
+ const debug$6 = Debug.get('PathConvert');
2599
2601
  const setEndPoint$1 = {};
2600
2602
  const PathConvert = {
2601
2603
  current: { dot: 0 },
@@ -2836,7 +2838,7 @@ const PathConvert = {
2836
2838
  i += 6;
2837
2839
  break;
2838
2840
  default:
2839
- debug$5.error(`command: ${command} [index:${i}]`, old);
2841
+ debug$6.error(`command: ${command} [index:${i}]`, old);
2840
2842
  return data;
2841
2843
  }
2842
2844
  lastCommand = command;
@@ -3061,7 +3063,7 @@ class PathCreator {
3061
3063
  }
3062
3064
 
3063
3065
  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;
3064
- const debug$4 = Debug.get('PathDrawer');
3066
+ const debug$5 = Debug.get('PathDrawer');
3065
3067
  const PathDrawer = {
3066
3068
  drawPathByData(drawer, data) {
3067
3069
  if (!data)
@@ -3124,7 +3126,7 @@ const PathDrawer = {
3124
3126
  i += 6;
3125
3127
  break;
3126
3128
  default:
3127
- debug$4.error(`command: ${command} [index:${i}]`, data);
3129
+ debug$5.error(`command: ${command} [index:${i}]`, data);
3128
3130
  return;
3129
3131
  }
3130
3132
  }
@@ -3134,7 +3136,7 @@ const PathDrawer = {
3134
3136
  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;
3135
3137
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse } = BezierHelper;
3136
3138
  const { addPointBounds, copy: copy$4, addPoint, setPoint, addBounds, toBounds: toBounds$1 } = TwoPointBoundsHelper;
3137
- const debug$3 = Debug.get('PathBounds');
3139
+ const debug$4 = Debug.get('PathBounds');
3138
3140
  let radius, radiusX, radiusY;
3139
3141
  const tempPointBounds = {};
3140
3142
  const setPointBounds = {};
@@ -3242,7 +3244,7 @@ const PathBounds = {
3242
3244
  i += 6;
3243
3245
  break;
3244
3246
  default:
3245
- debug$3.error(`command: ${command} [index:${i}]`, data);
3247
+ debug$4.error(`command: ${command} [index:${i}]`, data);
3246
3248
  return;
3247
3249
  }
3248
3250
  }
@@ -3358,7 +3360,7 @@ const FileHelper = {
3358
3360
  const F = FileHelper;
3359
3361
  F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
3360
3362
 
3361
- const debug$2 = Debug.get('TaskProcessor');
3363
+ const debug$3 = Debug.get('TaskProcessor');
3362
3364
  class TaskItem {
3363
3365
  constructor(task) {
3364
3366
  this.parallel = true;
@@ -3373,7 +3375,7 @@ class TaskItem {
3373
3375
  yield this.task();
3374
3376
  }
3375
3377
  catch (error) {
3376
- debug$2.error(error);
3378
+ debug$3.error(error);
3377
3379
  }
3378
3380
  });
3379
3381
  }
@@ -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();
@@ -4047,7 +4062,7 @@ function defineDataProcessor(target, key, defaultValue) {
4047
4062
  defineKey(data, key, property);
4048
4063
  }
4049
4064
 
4050
- const debug$1 = new Debug('rewrite');
4065
+ const debug$2 = new Debug('rewrite');
4051
4066
  const list = [];
4052
4067
  const excludeNames = ['destroy', 'constructor'];
4053
4068
  function rewrite(method) {
@@ -4064,7 +4079,7 @@ function doRewrite(error) {
4064
4079
  if (list.length) {
4065
4080
  list.forEach(item => {
4066
4081
  if (error)
4067
- debug$1.error(item.name, '需在Class上装饰@rewriteAble()');
4082
+ debug$2.error(item.name, '需在Class上装饰@rewriteAble()');
4068
4083
  item.run();
4069
4084
  });
4070
4085
  list.length = 0;
@@ -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);
@@ -4975,13 +4987,13 @@ const { on, on_, off, off_, once, emit, emitEvent, hasEvent, destroy } = Eventer
4975
4987
  const LeafEventer = { on, on_, off, off_, once, emit, emitEvent, hasEvent, destroyEventer: destroy };
4976
4988
 
4977
4989
  const { isFinite } = Number;
4978
- const debug = Debug.get('setAttr');
4990
+ const debug$1 = Debug.get('setAttr');
4979
4991
  const LeafDataProxy = {
4980
4992
  __setAttr(name, newValue, checkFiniteNumber) {
4981
4993
  if (this.leaferIsCreated) {
4982
4994
  const oldValue = this.__.__getInput(name);
4983
4995
  if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
4984
- debug.warn(this.innerName, name, newValue);
4996
+ debug$1.warn(this.innerName, name, newValue);
4985
4997
  newValue = undefined;
4986
4998
  }
4987
4999
  if (typeof newValue === 'object' || oldValue !== newValue) {
@@ -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 = 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.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,6 +5989,6 @@ class LeafLevelList {
5975
5989
  }
5976
5990
  }
5977
5991
 
5978
- const version = "1.0.10";
5992
+ const version = "1.1.1";
5979
5993
 
5980
5994
  export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, needPlugin, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, useModule, version, visibleType };