@leafer-editor/worker 1.0.1 → 1.0.3

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
@@ -114,6 +114,26 @@ var LeaferUI = (function (exports) {
114
114
  const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
115
115
  num = round(num * a) / a;
116
116
  return num === -0 ? 0 : num;
117
+ },
118
+ getScaleData(scale, size, originSize, scaleData) {
119
+ if (!scaleData)
120
+ scaleData = {};
121
+ if (size) {
122
+ scaleData.scaleX = (typeof size === 'number' ? size : size.width) / originSize.width;
123
+ scaleData.scaleY = (typeof size === 'number' ? size : size.height) / originSize.height;
124
+ }
125
+ else if (scale)
126
+ MathHelper.assignScale(scaleData, scale);
127
+ return scaleData;
128
+ },
129
+ assignScale(scaleData, scale) {
130
+ if (typeof scale === 'number') {
131
+ scaleData.scaleX = scaleData.scaleY = scale;
132
+ }
133
+ else {
134
+ scaleData.scaleX = scale.x;
135
+ scaleData.scaleY = scale.y;
136
+ }
117
137
  }
118
138
  };
119
139
  const OneRadian = PI$4 / 180;
@@ -412,7 +432,7 @@ var LeaferUI = (function (exports) {
412
432
  };
413
433
  const M$9 = MatrixHelper;
414
434
 
415
- const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$2 } = MatrixHelper;
435
+ const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
416
436
  const { sin: sin$4, cos: cos$4, abs: abs$5, sqrt: sqrt$2, atan2: atan2$2, min: min$1, PI: PI$3 } = Math;
417
437
  const PointHelper = {
418
438
  defaultPoint: getPointData(),
@@ -468,7 +488,7 @@ var LeaferUI = (function (exports) {
468
488
  tempToOuterOf(t, matrix) {
469
489
  const { tempPoint: temp } = P$7;
470
490
  copy$e(temp, t);
471
- toOuterPoint$2(matrix, temp, temp);
491
+ toOuterPoint$3(matrix, temp, temp);
472
492
  return temp;
473
493
  },
474
494
  tempToInnerRadiusPointOf(t, matrix) {
@@ -487,7 +507,7 @@ var LeaferUI = (function (exports) {
487
507
  toInnerPoint$2(matrix, t, to);
488
508
  },
489
509
  toOuterOf(t, matrix, to) {
490
- toOuterPoint$2(matrix, t, to);
510
+ toOuterPoint$3(matrix, t, to);
491
511
  },
492
512
  getCenter(t, to) {
493
513
  return { x: t.x + (to.x - t.x) / 2, y: t.y + (to.y - t.y) / 2 };
@@ -767,10 +787,10 @@ var LeaferUI = (function (exports) {
767
787
  const { addPoint: addPoint$4 } = TwoPointBoundsHelper;
768
788
 
769
789
  const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$4 } = TwoPointBoundsHelper;
770
- const { toOuterPoint: toOuterPoint$1 } = MatrixHelper;
790
+ const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
771
791
  const { float, fourNumber } = MathHelper;
772
792
  const { floor, ceil: ceil$2 } = Math;
773
- let right$3, bottom$2, boundsRight, boundsBottom;
793
+ let right$4, bottom$3, boundsRight, boundsBottom;
774
794
  const point$1 = {};
775
795
  const toPoint$6 = {};
776
796
  const BoundsHelper = {
@@ -787,17 +807,24 @@ var LeaferUI = (function (exports) {
787
807
  t.width = bounds.width;
788
808
  t.height = bounds.height;
789
809
  },
790
- copyAndSpread(t, bounds, spread, isShrink) {
810
+ copyAndSpread(t, bounds, spread, isShrink, side) {
811
+ const { x, y, width, height } = bounds;
791
812
  if (spread instanceof Array) {
792
813
  const four = fourNumber(spread);
793
814
  isShrink
794
- ? B.set(t, bounds.x + four[3], bounds.y + four[0], bounds.width - four[1] - four[3], bounds.height - four[2] - four[0])
795
- : B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
815
+ ? B.set(t, x + four[3], y + four[0], width - four[1] - four[3], height - four[2] - four[0])
816
+ : B.set(t, x - four[3], y - four[0], width + four[1] + four[3], height + four[2] + four[0]);
796
817
  }
797
818
  else {
798
819
  if (isShrink)
799
820
  spread = -spread;
800
- B.set(t, bounds.x - spread, bounds.y - spread, bounds.width + spread * 2, bounds.height + spread * 2);
821
+ B.set(t, x - spread, y - spread, width + spread * 2, height + spread * 2);
822
+ }
823
+ if (side) {
824
+ if (side === 'width')
825
+ t.y = y, t.height = height;
826
+ else
827
+ t.x = x, t.width = width;
801
828
  }
802
829
  },
803
830
  minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
@@ -874,16 +901,16 @@ var LeaferUI = (function (exports) {
874
901
  else {
875
902
  point$1.x = t.x;
876
903
  point$1.y = t.y;
877
- toOuterPoint$1(matrix, point$1, toPoint$6);
904
+ toOuterPoint$2(matrix, point$1, toPoint$6);
878
905
  setPoint$5(tempPointBounds$1, toPoint$6.x, toPoint$6.y);
879
906
  point$1.x = t.x + t.width;
880
- toOuterPoint$1(matrix, point$1, toPoint$6);
907
+ toOuterPoint$2(matrix, point$1, toPoint$6);
881
908
  addPoint$3(tempPointBounds$1, toPoint$6.x, toPoint$6.y);
882
909
  point$1.y = t.y + t.height;
883
- toOuterPoint$1(matrix, point$1, toPoint$6);
910
+ toOuterPoint$2(matrix, point$1, toPoint$6);
884
911
  addPoint$3(tempPointBounds$1, toPoint$6.x, toPoint$6.y);
885
912
  point$1.x = t.x;
886
- toOuterPoint$1(matrix, point$1, toPoint$6);
913
+ toOuterPoint$2(matrix, point$1, toPoint$6);
887
914
  addPoint$3(tempPointBounds$1, toPoint$6.x, toPoint$6.y);
888
915
  toBounds$4(tempPointBounds$1, to);
889
916
  }
@@ -897,16 +924,16 @@ var LeaferUI = (function (exports) {
897
924
  const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
898
925
  return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
899
926
  },
900
- getSpread(t, spread) {
927
+ getSpread(t, spread, side) {
901
928
  const n = {};
902
- B.copyAndSpread(n, t, spread);
929
+ B.copyAndSpread(n, t, spread, false, side);
903
930
  return n;
904
931
  },
905
- spread(t, spread) {
906
- B.copyAndSpread(t, t, spread);
932
+ spread(t, spread, side) {
933
+ B.copyAndSpread(t, t, spread, false, side);
907
934
  },
908
- shrink(t, shrink) {
909
- B.copyAndSpread(t, t, shrink, true);
935
+ shrink(t, shrink, side) {
936
+ B.copyAndSpread(t, t, shrink, true, side);
910
937
  },
911
938
  ceil(t) {
912
939
  const { x, y } = t;
@@ -932,20 +959,20 @@ var LeaferUI = (function (exports) {
932
959
  t.height = float(t.height, maxLength);
933
960
  },
934
961
  add(t, bounds, isPoint) {
935
- right$3 = t.x + t.width;
936
- bottom$2 = t.y + t.height;
962
+ right$4 = t.x + t.width;
963
+ bottom$3 = t.y + t.height;
937
964
  boundsRight = bounds.x;
938
965
  boundsBottom = bounds.y;
939
966
  if (!isPoint) {
940
967
  boundsRight += bounds.width;
941
968
  boundsBottom += bounds.height;
942
969
  }
943
- right$3 = right$3 > boundsRight ? right$3 : boundsRight;
944
- bottom$2 = bottom$2 > boundsBottom ? bottom$2 : boundsBottom;
970
+ right$4 = right$4 > boundsRight ? right$4 : boundsRight;
971
+ bottom$3 = bottom$3 > boundsBottom ? bottom$3 : boundsBottom;
945
972
  t.x = t.x < bounds.x ? t.x : bounds.x;
946
973
  t.y = t.y < bounds.y ? t.y : bounds.y;
947
- t.width = right$3 - t.x;
948
- t.height = bottom$2 - t.y;
974
+ t.width = right$4 - t.x;
975
+ t.height = bottom$3 - t.y;
949
976
  },
950
977
  addList(t, list) {
951
978
  B.setListWithFn(t, list, undefined, true);
@@ -1019,16 +1046,16 @@ var LeaferUI = (function (exports) {
1019
1046
  if (!B.hit(t, other))
1020
1047
  return getBoundsData();
1021
1048
  let { x, y, width, height } = other;
1022
- right$3 = x + width;
1023
- bottom$2 = y + height;
1049
+ right$4 = x + width;
1050
+ bottom$3 = y + height;
1024
1051
  boundsRight = t.x + t.width;
1025
1052
  boundsBottom = t.y + t.height;
1026
1053
  x = x > t.x ? x : t.x;
1027
1054
  y = y > t.y ? y : t.y;
1028
- right$3 = right$3 < boundsRight ? right$3 : boundsRight;
1029
- bottom$2 = bottom$2 < boundsBottom ? bottom$2 : boundsBottom;
1030
- width = right$3 - x;
1031
- height = bottom$2 - y;
1055
+ right$4 = right$4 < boundsRight ? right$4 : boundsRight;
1056
+ bottom$3 = bottom$3 < boundsBottom ? bottom$3 : boundsBottom;
1057
+ width = right$4 - x;
1058
+ height = bottom$3 - y;
1032
1059
  return { x, y, width, height };
1033
1060
  },
1034
1061
  intersect(t, other, otherMatrix) {
@@ -1089,12 +1116,12 @@ var LeaferUI = (function (exports) {
1089
1116
  getFitMatrix(put, baseScale) {
1090
1117
  return BoundsHelper.getFitMatrix(this, put, baseScale);
1091
1118
  }
1092
- spread(fourNumber) {
1093
- BoundsHelper.spread(this, fourNumber);
1119
+ spread(fourNumber, side) {
1120
+ BoundsHelper.spread(this, fourNumber, side);
1094
1121
  return this;
1095
1122
  }
1096
- shrink(fourNumber) {
1097
- BoundsHelper.shrink(this, fourNumber);
1123
+ shrink(fourNumber, side) {
1124
+ BoundsHelper.shrink(this, fourNumber, side);
1098
1125
  return this;
1099
1126
  }
1100
1127
  ceil() {
@@ -1238,7 +1265,6 @@ var LeaferUI = (function (exports) {
1238
1265
  tempPoint: {},
1239
1266
  get: get$4,
1240
1267
  toPoint(around, bounds, to, onlySize, pointBounds) {
1241
- to || (to = {});
1242
1268
  const point = get$4(around);
1243
1269
  to.x = point.x;
1244
1270
  to.y = point.y;
@@ -1373,6 +1399,10 @@ var LeaferUI = (function (exports) {
1373
1399
  };
1374
1400
  const R = Run;
1375
1401
 
1402
+ function needPlugin(name) {
1403
+ console.error('need plugin: @leafer-in/' + name);
1404
+ }
1405
+
1376
1406
  const debug$f = Debug.get('UICreator');
1377
1407
  const UICreator = {
1378
1408
  list: {},
@@ -1635,6 +1665,9 @@ var LeaferUI = (function (exports) {
1635
1665
  Answer[Answer["YesAndSkip"] = 3] = "YesAndSkip";
1636
1666
  })(exports.Answer || (exports.Answer = {}));
1637
1667
  const emptyData = {};
1668
+ function isNull(value) {
1669
+ return value === undefined || value === null;
1670
+ }
1638
1671
 
1639
1672
  /******************************************************************************
1640
1673
  Copyright (c) Microsoft Corporation.
@@ -2400,7 +2433,7 @@ var LeaferUI = (function (exports) {
2400
2433
  let startY = y = rotationSin * radiusX * startCos + rotationCos * radiusY * startSin;
2401
2434
  let fromX = cx + x, fromY = cy + y;
2402
2435
  if (data)
2403
- data.push(L$9, fromX, fromY);
2436
+ data.push(data.length ? L$9 : M$8, fromX, fromY);
2404
2437
  if (setPointBounds)
2405
2438
  setPoint$4(setPointBounds, fromX, fromY);
2406
2439
  if (setStartPoint)
@@ -2911,60 +2944,75 @@ var LeaferUI = (function (exports) {
2911
2944
  }
2912
2945
  beginPath() {
2913
2946
  beginPath(this.__path);
2947
+ this.paint();
2914
2948
  return this;
2915
2949
  }
2916
2950
  moveTo(x, y) {
2917
2951
  moveTo$4(this.__path, x, y);
2952
+ this.paint();
2918
2953
  return this;
2919
2954
  }
2920
2955
  lineTo(x, y) {
2921
2956
  lineTo$3(this.__path, x, y);
2957
+ this.paint();
2922
2958
  return this;
2923
2959
  }
2924
2960
  bezierCurveTo(x1, y1, x2, y2, x, y) {
2925
2961
  bezierCurveTo(this.__path, x1, y1, x2, y2, x, y);
2962
+ this.paint();
2926
2963
  return this;
2927
2964
  }
2928
2965
  quadraticCurveTo(x1, y1, x, y) {
2929
2966
  quadraticCurveTo(this.__path, x1, y1, x, y);
2967
+ this.paint();
2930
2968
  return this;
2931
2969
  }
2932
2970
  closePath() {
2933
2971
  closePath$3(this.__path);
2972
+ this.paint();
2934
2973
  return this;
2935
2974
  }
2936
2975
  rect(x, y, width, height) {
2937
2976
  rect$2(this.__path, x, y, width, height);
2977
+ this.paint();
2938
2978
  return this;
2939
2979
  }
2940
2980
  roundRect(x, y, width, height, cornerRadius) {
2941
2981
  roundRect$1(this.__path, x, y, width, height, cornerRadius);
2982
+ this.paint();
2942
2983
  return this;
2943
2984
  }
2944
2985
  ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
2945
2986
  ellipse$2(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
2987
+ this.paint();
2946
2988
  return this;
2947
2989
  }
2948
2990
  arc(x, y, radius, startAngle, endAngle, anticlockwise) {
2949
2991
  arc$1(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
2992
+ this.paint();
2950
2993
  return this;
2951
2994
  }
2952
2995
  arcTo(x1, y1, x2, y2, radius) {
2953
2996
  arcTo$2(this.__path, x1, y1, x2, y2, radius);
2997
+ this.paint();
2954
2998
  return this;
2955
2999
  }
2956
3000
  drawEllipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
2957
3001
  drawEllipse(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
3002
+ this.paint();
2958
3003
  return this;
2959
3004
  }
2960
3005
  drawArc(x, y, radius, startAngle, endAngle, anticlockwise) {
2961
3006
  drawArc(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
3007
+ this.paint();
2962
3008
  return this;
2963
3009
  }
2964
3010
  drawPoints(points, curve, close) {
2965
3011
  drawPoints$2(this.__path, points, curve, close);
3012
+ this.paint();
2966
3013
  return this;
2967
3014
  }
3015
+ paint() { }
2968
3016
  }
2969
3017
 
2970
3018
  const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$4, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$4, P: P$3, U: U$3 } = PathCommandMap;
@@ -3054,8 +3102,7 @@ var LeaferUI = (function (exports) {
3054
3102
  toTwoPointBounds(data, setPointBounds) {
3055
3103
  if (!data || !data.length)
3056
3104
  return setPoint$3(setPointBounds, 0, 0);
3057
- let command;
3058
- let i = 0, x = 0, y = 0, x1, y1, toX, toY;
3105
+ let i = 0, x = 0, y = 0, x1, y1, toX, toY, command;
3059
3106
  const len = data.length;
3060
3107
  while (i < len) {
3061
3108
  command = data[i];
@@ -3711,7 +3758,7 @@ var LeaferUI = (function (exports) {
3711
3758
  set(value) {
3712
3759
  if (this.__setAttr(key, value)) {
3713
3760
  this.__layout.matrixChanged || this.__layout.matrixChange();
3714
- this.__hasAutoLayout = !!value;
3761
+ this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
3715
3762
  if (!this.__local)
3716
3763
  this.__layout.createLocal();
3717
3764
  }
@@ -3804,14 +3851,25 @@ var LeaferUI = (function (exports) {
3804
3851
  return decorateLeafAttr(defaultValue, (key) => attr({
3805
3852
  set(value) {
3806
3853
  const oldValue = this.visible;
3807
- if (this.__setAttr(key, value)) {
3808
- this.__layout.opacityChanged || this.__layout.opacityChange();
3809
- if (oldValue === 0 || value === 0)
3810
- doBoundsType(this);
3854
+ if (oldValue === true && value === 0) {
3855
+ if (this.animationOut)
3856
+ return this.__runAnimation('out', () => doVisible(this, key, value, oldValue));
3811
3857
  }
3858
+ else if (oldValue === 0 && value === true) {
3859
+ if (this.animation)
3860
+ this.__runAnimation('in');
3861
+ }
3862
+ doVisible(this, key, value, oldValue);
3812
3863
  }
3813
3864
  }));
3814
3865
  }
3866
+ function doVisible(leaf, key, value, oldValue) {
3867
+ if (leaf.__setAttr(key, value)) {
3868
+ leaf.__layout.opacityChanged || leaf.__layout.opacityChange();
3869
+ if (oldValue === 0 || value === 0)
3870
+ doBoundsType(leaf);
3871
+ }
3872
+ }
3815
3873
  function sortType(defaultValue) {
3816
3874
  return decorateLeafAttr(defaultValue, (key) => attr({
3817
3875
  set(value) {
@@ -3895,7 +3953,16 @@ var LeaferUI = (function (exports) {
3895
3953
  if (defaultValue === undefined) {
3896
3954
  property.get = function () { return this[computedKey]; };
3897
3955
  }
3898
- else if (key === 'width') {
3956
+ else if (typeof defaultValue === 'object') {
3957
+ const { clone } = DataHelper;
3958
+ property.get = function () {
3959
+ let v = this[computedKey];
3960
+ if (v === undefined)
3961
+ this[computedKey] = v = clone(defaultValue);
3962
+ return v;
3963
+ };
3964
+ }
3965
+ if (key === 'width') {
3899
3966
  property.get = function () {
3900
3967
  const v = this[computedKey];
3901
3968
  if (v === undefined) {
@@ -3986,7 +4053,7 @@ var LeaferUI = (function (exports) {
3986
4053
  };
3987
4054
  }
3988
4055
 
3989
- const { copy: copy$a, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
4056
+ const { copy: copy$a, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
3990
4057
  const matrix$3 = {};
3991
4058
  const LeafHelper = {
3992
4059
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
@@ -4051,10 +4118,9 @@ var LeaferUI = (function (exports) {
4051
4118
  }
4052
4119
  return true;
4053
4120
  },
4054
- moveWorld(t, x, y = 0) {
4121
+ moveWorld(t, x, y = 0, isInnerPoint) {
4055
4122
  const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
4056
- if (t.parent)
4057
- toInnerPoint$1(t.parent.worldTransform, local, local, true);
4123
+ isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
4058
4124
  L$3.moveLocal(t, local.x, local.y);
4059
4125
  },
4060
4126
  moveLocal(t, x, y = 0) {
@@ -4563,144 +4629,6 @@ var LeaferUI = (function (exports) {
4563
4629
  destroy() { }
4564
4630
  }
4565
4631
 
4566
- const empty = {};
4567
- const LeafEventer = {
4568
- on(type, listener, options) {
4569
- let capture, once;
4570
- if (options) {
4571
- if (options === 'once') {
4572
- once = true;
4573
- }
4574
- else if (typeof options === 'boolean') {
4575
- capture = options;
4576
- }
4577
- else {
4578
- capture = options.capture;
4579
- once = options.once;
4580
- }
4581
- }
4582
- let events;
4583
- const map = __getListenerMap(this, capture, true);
4584
- const typeList = typeof type === 'string' ? type.split(' ') : type;
4585
- const item = once ? { listener, once } : { listener };
4586
- typeList.forEach(type => {
4587
- if (type) {
4588
- events = map[type];
4589
- if (events) {
4590
- if (events.findIndex(item => item.listener === listener) === -1)
4591
- events.push(item);
4592
- }
4593
- else {
4594
- map[type] = [item];
4595
- }
4596
- }
4597
- });
4598
- },
4599
- off(type, listener, options) {
4600
- if (type) {
4601
- const typeList = typeof type === 'string' ? type.split(' ') : type;
4602
- if (listener) {
4603
- let capture;
4604
- if (options)
4605
- capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
4606
- let events, index;
4607
- const map = __getListenerMap(this, capture);
4608
- typeList.forEach(type => {
4609
- if (type) {
4610
- events = map[type];
4611
- if (events) {
4612
- index = events.findIndex(item => item.listener === listener);
4613
- if (index > -1)
4614
- events.splice(index, 1);
4615
- if (!events.length)
4616
- delete map[type];
4617
- }
4618
- }
4619
- });
4620
- }
4621
- else {
4622
- const { __bubbleMap: b, __captureMap: c } = this;
4623
- typeList.forEach(type => {
4624
- if (b)
4625
- delete b[type];
4626
- if (c)
4627
- delete c[type];
4628
- });
4629
- }
4630
- }
4631
- else {
4632
- this.__bubbleMap = this.__captureMap = undefined;
4633
- }
4634
- },
4635
- on_(type, listener, bind, options) {
4636
- if (bind)
4637
- listener = listener.bind(bind);
4638
- this.on(type, listener, options);
4639
- return { type, current: this, listener, options };
4640
- },
4641
- off_(id) {
4642
- if (!id)
4643
- return;
4644
- const list = id instanceof Array ? id : [id];
4645
- list.forEach(item => item.current.off(item.type, item.listener, item.options));
4646
- list.length = 0;
4647
- },
4648
- once(type, listener, capture) {
4649
- this.on(type, listener, { once: true, capture });
4650
- },
4651
- emit(type, event, capture) {
4652
- if (!event && EventCreator.has(type))
4653
- event = EventCreator.get(type, { type, target: this, current: this });
4654
- const map = __getListenerMap(this, capture);
4655
- const list = map[type];
4656
- if (list) {
4657
- let item;
4658
- for (let i = 0, len = list.length; i < len; i++) {
4659
- item = list[i];
4660
- item.listener(event);
4661
- if (item.once) {
4662
- this.off(type, item.listener, capture);
4663
- i--, len--;
4664
- }
4665
- if (event && event.isStopNow)
4666
- break;
4667
- }
4668
- }
4669
- this.syncEventer && this.syncEventer.emitEvent(event, capture);
4670
- },
4671
- emitEvent(event, capture) {
4672
- event.current = this;
4673
- this.emit(event.type, event, capture);
4674
- },
4675
- hasEvent(type, capture) {
4676
- if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
4677
- return true;
4678
- const { __bubbleMap: b, __captureMap: c } = this;
4679
- const hasB = b && b[type], hasC = c && c[type];
4680
- return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
4681
- },
4682
- };
4683
- function __getListenerMap(eventer, capture, create) {
4684
- if (capture) {
4685
- const { __captureMap: c } = eventer;
4686
- if (c) {
4687
- return c;
4688
- }
4689
- else {
4690
- return create ? eventer.__captureMap = {} : empty;
4691
- }
4692
- }
4693
- else {
4694
- const { __bubbleMap: b } = eventer;
4695
- if (b) {
4696
- return b;
4697
- }
4698
- else {
4699
- return create ? eventer.__bubbleMap = {} : empty;
4700
- }
4701
- }
4702
- }
4703
-
4704
4632
  class Event {
4705
4633
  constructor(type, target) {
4706
4634
  this.bubbles = false;
@@ -4735,7 +4663,10 @@ var LeaferUI = (function (exports) {
4735
4663
  }
4736
4664
  ChildEvent.ADD = 'child.add';
4737
4665
  ChildEvent.REMOVE = 'child.remove';
4738
- ChildEvent.DESTROY = 'child.destroy';
4666
+ ChildEvent.CREATED = 'created';
4667
+ ChildEvent.MOUNTED = 'mounted';
4668
+ ChildEvent.UNMOUNTED = 'unmounted';
4669
+ ChildEvent.DESTROY = 'destroy';
4739
4670
 
4740
4671
  class PropertyEvent extends Event {
4741
4672
  constructor(type, target, attrName, oldValue, newValue) {
@@ -4813,10 +4744,6 @@ var LeaferUI = (function (exports) {
4813
4744
  LayoutEvent.AGAIN = 'layout.again';
4814
4745
  LayoutEvent.END = 'layout.end';
4815
4746
 
4816
- class AnimateEvent extends Event {
4817
- }
4818
- AnimateEvent.FRAME = 'animate.frame';
4819
-
4820
4747
  class RenderEvent extends Event {
4821
4748
  constructor(type, times, bounds, options) {
4822
4749
  super(type);
@@ -4828,26 +4755,177 @@ var LeaferUI = (function (exports) {
4828
4755
  }
4829
4756
  }
4830
4757
  }
4831
- RenderEvent.REQUEST = 'render.request';
4832
- RenderEvent.START = 'render.start';
4833
- RenderEvent.BEFORE = 'render.before';
4834
- RenderEvent.RENDER = 'render';
4835
- RenderEvent.AFTER = 'render.after';
4836
- RenderEvent.AGAIN = 'render.again';
4837
- RenderEvent.END = 'render.end';
4838
- RenderEvent.NEXT = 'render.next';
4758
+ RenderEvent.REQUEST = 'render.request';
4759
+ RenderEvent.START = 'render.start';
4760
+ RenderEvent.BEFORE = 'render.before';
4761
+ RenderEvent.RENDER = 'render';
4762
+ RenderEvent.AFTER = 'render.after';
4763
+ RenderEvent.AGAIN = 'render.again';
4764
+ RenderEvent.END = 'render.end';
4765
+ RenderEvent.NEXT = 'render.next';
4766
+
4767
+ class LeaferEvent extends Event {
4768
+ }
4769
+ LeaferEvent.START = 'leafer.start';
4770
+ LeaferEvent.BEFORE_READY = 'leafer.before_ready';
4771
+ LeaferEvent.READY = 'leafer.ready';
4772
+ LeaferEvent.AFTER_READY = 'leafer.after_ready';
4773
+ LeaferEvent.VIEW_READY = 'leafer.view_ready';
4774
+ LeaferEvent.VIEW_COMPLETED = 'leafer.view_completed';
4775
+ LeaferEvent.STOP = 'leafer.stop';
4776
+ LeaferEvent.RESTART = 'leafer.restart';
4777
+ LeaferEvent.END = 'leafer.end';
4778
+
4779
+ const empty = {};
4780
+ class Eventer {
4781
+ set event(map) { this.on(map); }
4782
+ on(type, listener, options) {
4783
+ if (!listener) {
4784
+ let event, map = type;
4785
+ for (let key in map)
4786
+ event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
4787
+ return;
4788
+ }
4789
+ let capture, once;
4790
+ if (options) {
4791
+ if (options === 'once') {
4792
+ once = true;
4793
+ }
4794
+ else if (typeof options === 'boolean') {
4795
+ capture = options;
4796
+ }
4797
+ else {
4798
+ capture = options.capture;
4799
+ once = options.once;
4800
+ }
4801
+ }
4802
+ let events;
4803
+ const map = __getListenerMap(this, capture, true);
4804
+ const typeList = typeof type === 'string' ? type.split(' ') : type;
4805
+ const item = once ? { listener, once } : { listener };
4806
+ typeList.forEach(type => {
4807
+ if (type) {
4808
+ events = map[type];
4809
+ if (events) {
4810
+ if (events.findIndex(item => item.listener === listener) === -1)
4811
+ events.push(item);
4812
+ }
4813
+ else {
4814
+ map[type] = [item];
4815
+ }
4816
+ }
4817
+ });
4818
+ }
4819
+ off(type, listener, options) {
4820
+ if (type) {
4821
+ const typeList = typeof type === 'string' ? type.split(' ') : type;
4822
+ if (listener) {
4823
+ let capture;
4824
+ if (options)
4825
+ capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
4826
+ let events, index;
4827
+ const map = __getListenerMap(this, capture);
4828
+ typeList.forEach(type => {
4829
+ if (type) {
4830
+ events = map[type];
4831
+ if (events) {
4832
+ index = events.findIndex(item => item.listener === listener);
4833
+ if (index > -1)
4834
+ events.splice(index, 1);
4835
+ if (!events.length)
4836
+ delete map[type];
4837
+ }
4838
+ }
4839
+ });
4840
+ }
4841
+ else {
4842
+ const { __bubbleMap: b, __captureMap: c } = this;
4843
+ typeList.forEach(type => {
4844
+ if (b)
4845
+ delete b[type];
4846
+ if (c)
4847
+ delete c[type];
4848
+ });
4849
+ }
4850
+ }
4851
+ else {
4852
+ this.__bubbleMap = this.__captureMap = undefined;
4853
+ }
4854
+ }
4855
+ on_(type, listener, bind, options) {
4856
+ if (bind)
4857
+ listener = listener.bind(bind);
4858
+ this.on(type, listener, options);
4859
+ return { type, current: this, listener, options };
4860
+ }
4861
+ off_(id) {
4862
+ if (!id)
4863
+ return;
4864
+ const list = id instanceof Array ? id : [id];
4865
+ list.forEach(item => item.current.off(item.type, item.listener, item.options));
4866
+ list.length = 0;
4867
+ }
4868
+ once(type, listener, capture) {
4869
+ this.on(type, listener, { once: true, capture });
4870
+ }
4871
+ emit(type, event, capture) {
4872
+ if (!event && EventCreator.has(type))
4873
+ event = EventCreator.get(type, { type, target: this, current: this });
4874
+ const map = __getListenerMap(this, capture);
4875
+ const list = map[type];
4876
+ if (list) {
4877
+ let item;
4878
+ for (let i = 0, len = list.length; i < len; i++) {
4879
+ item = list[i];
4880
+ item.listener(event);
4881
+ if (item.once) {
4882
+ this.off(type, item.listener, capture);
4883
+ i--, len--;
4884
+ }
4885
+ if (event && event.isStopNow)
4886
+ break;
4887
+ }
4888
+ }
4889
+ this.syncEventer && this.syncEventer.emitEvent(event, capture);
4890
+ }
4891
+ emitEvent(event, capture) {
4892
+ event.current = this;
4893
+ this.emit(event.type, event, capture);
4894
+ }
4895
+ hasEvent(type, capture) {
4896
+ if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
4897
+ return true;
4898
+ const { __bubbleMap: b, __captureMap: c } = this;
4899
+ const hasB = b && b[type], hasC = c && c[type];
4900
+ return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
4901
+ }
4902
+ destroy() {
4903
+ this.__captureMap = this.__bubbleMap = this.syncEventer = null;
4904
+ }
4905
+ }
4906
+ function __getListenerMap(eventer, capture, create) {
4907
+ if (capture) {
4908
+ const { __captureMap: c } = eventer;
4909
+ if (c) {
4910
+ return c;
4911
+ }
4912
+ else {
4913
+ return create ? eventer.__captureMap = {} : empty;
4914
+ }
4915
+ }
4916
+ else {
4917
+ const { __bubbleMap: b } = eventer;
4918
+ if (b) {
4919
+ return b;
4920
+ }
4921
+ else {
4922
+ return create ? eventer.__bubbleMap = {} : empty;
4923
+ }
4924
+ }
4925
+ }
4839
4926
 
4840
- class LeaferEvent extends Event {
4841
- }
4842
- LeaferEvent.START = 'leafer.start';
4843
- LeaferEvent.BEFORE_READY = 'leafer.before_ready';
4844
- LeaferEvent.READY = 'leafer.ready';
4845
- LeaferEvent.AFTER_READY = 'leafer.after_ready';
4846
- LeaferEvent.VIEW_READY = 'leafer.view_ready';
4847
- LeaferEvent.VIEW_COMPLETED = 'leafer.view_completed';
4848
- LeaferEvent.STOP = 'leafer.stop';
4849
- LeaferEvent.RESTART = 'leafer.restart';
4850
- LeaferEvent.END = 'leafer.end';
4927
+ const { on, on_, off, off_, once, emit: emit$2, emitEvent: emitEvent$1, hasEvent, destroy } = Eventer.prototype;
4928
+ const LeafEventer = { on, on_, off, off_, once, emit: emit$2, emitEvent: emitEvent$1, hasEvent, destroyEventer: destroy };
4851
4929
 
4852
4930
  const { isFinite } = Number;
4853
4931
  const debug$8 = Debug.get('setAttr');
@@ -4860,9 +4938,7 @@ var LeaferUI = (function (exports) {
4860
4938
  newValue = undefined;
4861
4939
  }
4862
4940
  if (typeof newValue === 'object' || oldValue !== newValue) {
4863
- this.__[name] = newValue;
4864
- if (this.__proxyData)
4865
- this.setProxyAttr(name, newValue);
4941
+ this.__realSetAttr(name, newValue);
4866
4942
  const { CHANGE } = PropertyEvent;
4867
4943
  const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
4868
4944
  if (this.isLeafer) {
@@ -4880,12 +4956,18 @@ var LeaferUI = (function (exports) {
4880
4956
  }
4881
4957
  }
4882
4958
  else {
4883
- this.__[name] = newValue;
4884
- if (this.__proxyData)
4885
- this.setProxyAttr(name, newValue);
4959
+ this.__realSetAttr(name, newValue);
4886
4960
  return true;
4887
4961
  }
4888
4962
  },
4963
+ __realSetAttr(name, newValue) {
4964
+ const data = this.__;
4965
+ data[name] = newValue;
4966
+ if (this.__proxyData)
4967
+ this.setProxyAttr(name, newValue);
4968
+ if (data.normalStyle)
4969
+ this.lockNormalStyle || data.normalStyle[name] === undefined || (data.normalStyle[name] = newValue);
4970
+ },
4889
4971
  __getAttr(name) {
4890
4972
  if (this.__proxyData)
4891
4973
  return this.getProxyAttr(name);
@@ -4921,7 +5003,7 @@ var LeaferUI = (function (exports) {
4921
5003
 
4922
5004
  const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
4923
5005
  const { updateBounds: updateBounds$1 } = BranchHelper;
4924
- const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$8 } = BoundsHelper;
5006
+ const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$8 } = BoundsHelper;
4925
5007
  const { toBounds: toBounds$2 } = PathBounds;
4926
5008
  const LeafBounds = {
4927
5009
  __updateWorldBounds() {
@@ -4988,6 +5070,8 @@ var LeaferUI = (function (exports) {
4988
5070
  layout.boundsChanged = false;
4989
5071
  },
4990
5072
  __updateLocalBoxBounds() {
5073
+ if (this.__hasMotionPath)
5074
+ this.__updateMotionPath();
4991
5075
  if (this.__hasAutoLayout)
4992
5076
  this.__updateAutoLayout();
4993
5077
  toOuterOf$1(this.__layout.boxBounds, this.__local, this.__local);
@@ -5022,7 +5106,7 @@ var LeaferUI = (function (exports) {
5022
5106
  updateAllMatrix$2(this);
5023
5107
  updateBounds$1(this, this);
5024
5108
  if (this.__.__autoSide)
5025
- this.__updateBoxBounds();
5109
+ this.__updateBoxBounds(true);
5026
5110
  }
5027
5111
  else {
5028
5112
  updateAllMatrix$2(this);
@@ -5040,11 +5124,11 @@ var LeaferUI = (function (exports) {
5040
5124
  },
5041
5125
  __updateStrokeBounds() {
5042
5126
  const layout = this.__layout;
5043
- copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5127
+ copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5044
5128
  },
5045
5129
  __updateRenderBounds() {
5046
5130
  const layout = this.__layout;
5047
- layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$8(layout.renderBounds, layout.strokeBounds);
5131
+ layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$8(layout.renderBounds, layout.strokeBounds);
5048
5132
  }
5049
5133
  };
5050
5134
 
@@ -5140,7 +5224,7 @@ var LeaferUI = (function (exports) {
5140
5224
  const { LEAF, create } = IncrementId;
5141
5225
  const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
5142
5226
  const { toOuterOf } = BoundsHelper;
5143
- const { copy: copy$7 } = PointHelper;
5227
+ const { copy: copy$7, move: move$2 } = PointHelper;
5144
5228
  const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
5145
5229
  exports.Leaf = class Leaf {
5146
5230
  get tag() { return this.__tag; }
@@ -5167,13 +5251,16 @@ var LeaferUI = (function (exports) {
5167
5251
  get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
5168
5252
  get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
5169
5253
  get pathInputed() { return this.__.__pathInputed; }
5170
- set event(map) { let event; for (let key in map)
5171
- event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event); }
5254
+ set event(map) { this.on(map); }
5172
5255
  constructor(data) {
5173
5256
  this.innerId = create(LEAF);
5174
5257
  this.reset(data);
5258
+ if (this.__bubbleMap)
5259
+ this.__emitLifeEvent(ChildEvent.CREATED);
5175
5260
  }
5176
5261
  reset(data) {
5262
+ if (this.leafer)
5263
+ this.leafer.forceRender(this.__world);
5177
5264
  this.__world = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0, scaleX: 1, scaleY: 1 };
5178
5265
  if (data !== null)
5179
5266
  this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
@@ -5195,12 +5282,12 @@ var LeaferUI = (function (exports) {
5195
5282
  waitParent(item, bind) {
5196
5283
  if (bind)
5197
5284
  item = item.bind(bind);
5198
- this.parent ? item() : (this.__parentWait ? this.__parentWait.push(item) : this.__parentWait = [item]);
5285
+ this.parent ? item() : this.on(ChildEvent.ADD, item, 'once');
5199
5286
  }
5200
5287
  waitLeafer(item, bind) {
5201
5288
  if (bind)
5202
5289
  item = item.bind(bind);
5203
- this.leafer ? item() : (this.__leaferWait ? this.__leaferWait.push(item) : this.__leaferWait = [item]);
5290
+ this.leafer ? item() : this.on(ChildEvent.MOUNTED, item, 'once');
5204
5291
  }
5205
5292
  nextRender(item, bind, off) {
5206
5293
  this.leafer ? this.leafer.nextRender(item, bind, off) : this.waitLeafer(() => this.leafer.nextRender(item, bind, off));
@@ -5209,18 +5296,21 @@ var LeaferUI = (function (exports) {
5209
5296
  this.nextRender(item, null, 'off');
5210
5297
  }
5211
5298
  __bindLeafer(leafer) {
5212
- if (this.isLeafer) {
5213
- if (leafer !== null)
5214
- leafer = this;
5215
- }
5299
+ if (this.isLeafer && leafer !== null)
5300
+ leafer = this;
5216
5301
  if (this.leafer && !leafer)
5217
5302
  this.leafer.leafs--;
5218
5303
  this.leafer = leafer;
5219
5304
  if (leafer) {
5220
5305
  leafer.leafs++;
5221
5306
  this.__level = this.parent ? this.parent.__level + 1 : 1;
5222
- if (this.__leaferWait)
5223
- WaitHelper.run(this.__leaferWait);
5307
+ if (this.animation)
5308
+ this.__runAnimation('in');
5309
+ if (this.__bubbleMap)
5310
+ this.__emitLifeEvent(ChildEvent.MOUNTED);
5311
+ }
5312
+ else {
5313
+ this.__emitLifeEvent(ChildEvent.UNMOUNTED);
5224
5314
  }
5225
5315
  if (this.isBranch) {
5226
5316
  const { children } = this;
@@ -5229,7 +5319,7 @@ var LeaferUI = (function (exports) {
5229
5319
  }
5230
5320
  }
5231
5321
  }
5232
- set(_data) { }
5322
+ set(_data, _isTemp) { }
5233
5323
  get(_name) { return undefined; }
5234
5324
  setAttr(name, value) { this[name] = value; }
5235
5325
  getAttr(name) { return this[name]; }
@@ -5254,6 +5344,7 @@ var LeaferUI = (function (exports) {
5254
5344
  findOne(_condition, _options) { return undefined; }
5255
5345
  findId(_id) { return undefined; }
5256
5346
  focus(_value) { }
5347
+ updateState() { }
5257
5348
  updateLayout() {
5258
5349
  this.__layout.update();
5259
5350
  }
@@ -5361,11 +5452,24 @@ var LeaferUI = (function (exports) {
5361
5452
  if (relative)
5362
5453
  relative.worldToInner(to ? to : inner, null, distance);
5363
5454
  }
5455
+ getBoxPoint(world, relative, distance, change) {
5456
+ return this.getBoxPointByInner(this.getInnerPoint(world, relative, distance, change), null, null, true);
5457
+ }
5458
+ getBoxPointByInner(inner, _relative, _distance, change) {
5459
+ const point = change ? inner : Object.assign({}, inner), { x, y } = this.boxBounds;
5460
+ move$2(point, -x, -y);
5461
+ return point;
5462
+ }
5364
5463
  getInnerPoint(world, relative, distance, change) {
5365
5464
  const point = change ? world : {};
5366
5465
  this.worldToInner(world, point, distance, relative);
5367
5466
  return point;
5368
5467
  }
5468
+ getInnerPointByBox(box, _relative, _distance, change) {
5469
+ const point = change ? box : Object.assign({}, box), { x, y } = this.boxBounds;
5470
+ move$2(point, x, y);
5471
+ return point;
5472
+ }
5369
5473
  getInnerPointByLocal(local, _relative, distance, change) {
5370
5474
  return this.getInnerPoint(local, this.parent, distance, change);
5371
5475
  }
@@ -5377,20 +5481,23 @@ var LeaferUI = (function (exports) {
5377
5481
  getLocalPointByInner(inner, _relative, distance, change) {
5378
5482
  return this.getWorldPoint(inner, this.parent, distance, change);
5379
5483
  }
5484
+ getPagePoint(world, relative, distance, change) {
5485
+ const layer = this.leafer ? this.leafer.zoomLayer : this;
5486
+ return layer.getInnerPoint(world, relative, distance, change);
5487
+ }
5380
5488
  getWorldPoint(inner, relative, distance, change) {
5381
5489
  const point = change ? inner : {};
5382
5490
  this.innerToWorld(inner, point, distance, relative);
5383
5491
  return point;
5384
5492
  }
5493
+ getWorldPointByBox(box, relative, distance, change) {
5494
+ return this.getWorldPoint(this.getInnerPointByBox(box, null, null, change), relative, distance, true);
5495
+ }
5385
5496
  getWorldPointByLocal(local, relative, distance, change) {
5386
5497
  const point = change ? local : {};
5387
5498
  this.localToWorld(local, point, distance, relative);
5388
5499
  return point;
5389
5500
  }
5390
- getPagePoint(world, relative, distance, change) {
5391
- const layer = this.leafer ? this.leafer.zoomLayer : this;
5392
- return layer.getInnerPoint(world, relative, distance, change);
5393
- }
5394
5501
  getWorldPointByPage(page, relative, distance, change) {
5395
5502
  const layer = this.leafer ? this.leafer.zoomLayer : this;
5396
5503
  return layer.getWorldPoint(page, relative, distance, change);
@@ -5404,6 +5511,9 @@ var LeaferUI = (function (exports) {
5404
5511
  move(x, y) {
5405
5512
  moveLocal(this, x, y);
5406
5513
  }
5514
+ moveInner(x, y) {
5515
+ moveWorld(this, x, y, true);
5516
+ }
5407
5517
  scaleOf(origin, scaleX, scaleY, resize) {
5408
5518
  zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
5409
5519
  }
@@ -5456,6 +5566,17 @@ var LeaferUI = (function (exports) {
5456
5566
  __drawRenderPath(_canvas) { }
5457
5567
  __updatePath() { }
5458
5568
  __updateRenderPath() { }
5569
+ getMotionPathData() {
5570
+ return needPlugin('path');
5571
+ }
5572
+ getMotionPoint(_motionDistance) {
5573
+ return needPlugin('path');
5574
+ }
5575
+ getMotionTotal() {
5576
+ return 0;
5577
+ }
5578
+ __updateMotionPath() { }
5579
+ __runAnimation(_type, _complete) { }
5459
5580
  __updateSortChildren() { }
5460
5581
  add(_child, _index) { }
5461
5582
  remove(_child, destroy) {
@@ -5481,6 +5602,10 @@ var LeaferUI = (function (exports) {
5481
5602
  fn = boundsType;
5482
5603
  fn(defaultValue)(this.prototype, attrName);
5483
5604
  }
5605
+ __emitLifeEvent(type) {
5606
+ if (this.hasEvent(type))
5607
+ this.emitEvent(new ChildEvent(type, this, this.parent));
5608
+ }
5484
5609
  destroy() {
5485
5610
  if (!this.destroyed) {
5486
5611
  const { parent } = this;
@@ -5488,11 +5613,10 @@ var LeaferUI = (function (exports) {
5488
5613
  this.remove();
5489
5614
  if (this.children)
5490
5615
  this.removeAll(true);
5491
- if (this.hasEvent(ChildEvent.DESTROY))
5492
- this.emitEvent(new ChildEvent(ChildEvent.DESTROY, this, parent));
5616
+ this.__emitLifeEvent(ChildEvent.DESTROY);
5493
5617
  this.__.destroy();
5494
5618
  this.__layout.destroy();
5495
- this.__captureMap = this.__bubbleMap = this.__parentWait = this.__leaferWait = null;
5619
+ this.destroyEventer();
5496
5620
  this.destroyed = true;
5497
5621
  }
5498
5622
  }
@@ -5558,8 +5682,8 @@ var LeaferUI = (function (exports) {
5558
5682
  this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
5559
5683
  child.__layout.boxChanged || child.__layout.boxChange();
5560
5684
  child.__layout.matrixChanged || child.__layout.matrixChange();
5561
- if (child.__parentWait)
5562
- WaitHelper.run(child.__parentWait);
5685
+ if (child.__bubbleMap)
5686
+ child.__emitLifeEvent(ChildEvent.ADD);
5563
5687
  if (this.leafer) {
5564
5688
  child.__bindLeafer(this.leafer);
5565
5689
  if (this.leafer.created)
@@ -5572,16 +5696,10 @@ var LeaferUI = (function (exports) {
5572
5696
  }
5573
5697
  remove(child, destroy) {
5574
5698
  if (child) {
5575
- const index = this.children.indexOf(child);
5576
- if (index > -1) {
5577
- this.children.splice(index, 1);
5578
- if (child.isBranch)
5579
- this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1;
5580
- this.__preRemove();
5581
- this.__realRemoveChild(child);
5582
- if (destroy)
5583
- child.destroy();
5584
- }
5699
+ if (child.animationOut)
5700
+ child.__runAnimation('out', () => this.__remove(child, destroy));
5701
+ else
5702
+ this.__remove(child, destroy);
5585
5703
  }
5586
5704
  else if (child === undefined) {
5587
5705
  super.remove(null, destroy);
@@ -5603,6 +5721,18 @@ var LeaferUI = (function (exports) {
5603
5721
  clear() {
5604
5722
  this.removeAll(true);
5605
5723
  }
5724
+ __remove(child, destroy) {
5725
+ const index = this.children.indexOf(child);
5726
+ if (index > -1) {
5727
+ this.children.splice(index, 1);
5728
+ if (child.isBranch)
5729
+ this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1;
5730
+ this.__preRemove();
5731
+ this.__realRemoveChild(child);
5732
+ if (destroy)
5733
+ child.destroy();
5734
+ }
5735
+ }
5606
5736
  __preRemove() {
5607
5737
  if (this.__hasMask)
5608
5738
  this.__updateMask();
@@ -5612,6 +5742,7 @@ var LeaferUI = (function (exports) {
5612
5742
  this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
5613
5743
  }
5614
5744
  __realRemoveChild(child) {
5745
+ child.__emitLifeEvent(ChildEvent.REMOVE);
5615
5746
  child.parent = null;
5616
5747
  if (this.leafer) {
5617
5748
  child.__bindLeafer(null);
@@ -5624,8 +5755,6 @@ var LeaferUI = (function (exports) {
5624
5755
  }
5625
5756
  __emitChildEvent(type, child) {
5626
5757
  const event = new ChildEvent(type, child, this);
5627
- if (child.hasEvent(type))
5628
- child.emitEvent(event);
5629
5758
  if (this.hasEvent(type) && !this.isLeafer)
5630
5759
  this.emitEvent(event);
5631
5760
  this.leafer.emitEvent(event);
@@ -5788,8 +5917,7 @@ var LeaferUI = (function (exports) {
5788
5917
  }
5789
5918
  }
5790
5919
 
5791
- const version = "1.0.1";
5792
- const inviteCode = {};
5920
+ const version = "1.0.3";
5793
5921
 
5794
5922
  class LeaferCanvas extends LeaferCanvasBase {
5795
5923
  get allowBackgroundColor() { return true; }
@@ -6016,9 +6144,13 @@ var LeaferUI = (function (exports) {
6016
6144
  });
6017
6145
  }
6018
6146
  function updateChange(updateList) {
6147
+ let layout;
6019
6148
  updateList.list.forEach(leaf => {
6020
- if (leaf.__layout.opacityChanged)
6149
+ layout = leaf.__layout;
6150
+ if (layout.opacityChanged)
6021
6151
  updateAllWorldOpacity(leaf);
6152
+ if (layout.stateStyleChanged)
6153
+ setTimeout(() => layout.stateStyleChanged && leaf.updateState());
6022
6154
  leaf.__updateChange();
6023
6155
  });
6024
6156
  }
@@ -6384,7 +6516,6 @@ var LeaferUI = (function (exports) {
6384
6516
  Platform.requestRender(() => {
6385
6517
  this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - startTime)));
6386
6518
  if (this.running) {
6387
- this.target.emit(AnimateEvent.FRAME);
6388
6519
  if (this.changed && this.canvas.view)
6389
6520
  this.render();
6390
6521
  this.target.emit(RenderEvent.NEXT);
@@ -6729,36 +6860,6 @@ var LeaferUI = (function (exports) {
6729
6860
  });
6730
6861
  Platform.layout = Layouter.fullLayout;
6731
6862
 
6732
- const TextConvert = {};
6733
- const ColorConvert = {};
6734
- const PathArrow = {};
6735
- const Paint = {};
6736
- const PaintImage = {};
6737
- const PaintGradient = {};
6738
- const Effect = {};
6739
- const Export = {};
6740
- const State = {};
6741
-
6742
- function stateType(defaultValue) {
6743
- return decorateLeafAttr(defaultValue, (key) => attr({
6744
- set(value) {
6745
- this.__setAttr(key, value);
6746
- this.waitLeafer(() => { if (State.setStyle)
6747
- State.setStyle(this, key + 'Style', value); });
6748
- }
6749
- }));
6750
- }
6751
- function arrowType(defaultValue) {
6752
- return decorateLeafAttr(defaultValue, (key) => attr({
6753
- set(value) {
6754
- if (this.__setAttr(key, value)) {
6755
- const data = this.__;
6756
- data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6757
- doStrokeType(this);
6758
- }
6759
- }
6760
- }));
6761
- }
6762
6863
  function effectType(defaultValue) {
6763
6864
  return decorateLeafAttr(defaultValue, (key) => attr({
6764
6865
  set(value) {
@@ -6793,10 +6894,33 @@ var LeaferUI = (function (exports) {
6793
6894
  };
6794
6895
  }
6795
6896
 
6897
+ const TextConvert = {};
6898
+ const ColorConvert = {};
6899
+ const PathArrow = {};
6900
+ const Paint = {};
6901
+ const PaintImage = {};
6902
+ const PaintGradient = {};
6903
+ const Effect = {};
6904
+ const Export = {};
6905
+ const State = {
6906
+ setStyleName(_leaf, _styleName, _value) { return needPlugin('state'); },
6907
+ set(_leaf, _stateName) { return needPlugin('state'); }
6908
+ };
6909
+ const Transition = {
6910
+ list: {},
6911
+ register(attrName, fn) {
6912
+ Transition.list[attrName] = fn;
6913
+ },
6914
+ get(attrName) {
6915
+ return Transition.list[attrName];
6916
+ }
6917
+ };
6918
+
6796
6919
  const { parse } = PathConvert;
6797
6920
  const emptyPaint = {};
6798
6921
  const debug$5 = Debug.get('UIData');
6799
6922
  class UIData extends LeafData {
6923
+ get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
6800
6924
  get __strokeWidth() {
6801
6925
  const { strokeWidth, strokeWidthFixed } = this;
6802
6926
  if (strokeWidthFixed) {
@@ -6815,9 +6939,10 @@ var LeaferUI = (function (exports) {
6815
6939
  get __autoSide() { return !this._width || !this._height; }
6816
6940
  get __autoSize() { return !this._width && !this._height; }
6817
6941
  setVisible(value) {
6818
- if (this.__leaf.leafer)
6819
- this.__leaf.leafer.watcher.hasVisible = true;
6820
6942
  this._visible = value;
6943
+ const { leafer } = this.__leaf;
6944
+ if (leafer)
6945
+ leafer.watcher.hasVisible = true;
6821
6946
  }
6822
6947
  setWidth(value) {
6823
6948
  if (value < 0) {
@@ -6941,6 +7066,11 @@ var LeaferUI = (function (exports) {
6941
7066
  }
6942
7067
 
6943
7068
  class LeaferData extends GroupData {
7069
+ __getInputData() {
7070
+ const data = super.__getInputData();
7071
+ canvasSizeAttrs.forEach(key => delete data[key]);
7072
+ return data;
7073
+ }
6944
7074
  }
6945
7075
 
6946
7076
  class FrameData extends BoxData {
@@ -7003,7 +7133,7 @@ var LeaferUI = (function (exports) {
7003
7133
  __setImageFill(value) {
7004
7134
  if (this.__leaf.image)
7005
7135
  this.__leaf.image = null;
7006
- this.fill = value ? { type: 'image', mode: 'strench', url: value } : undefined;
7136
+ this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
7007
7137
  }
7008
7138
  __getData() {
7009
7139
  const data = super.__getData();
@@ -7018,6 +7148,11 @@ var LeaferUI = (function (exports) {
7018
7148
  }
7019
7149
 
7020
7150
  class CanvasData extends RectData {
7151
+ __getInputData() {
7152
+ const data = super.__getInputData();
7153
+ data.url = this.__leaf.canvas.toDataURL('image/png');
7154
+ return data;
7155
+ }
7021
7156
  }
7022
7157
 
7023
7158
  const UIBounds = {
@@ -7188,19 +7323,8 @@ var LeaferUI = (function (exports) {
7188
7323
  exports.UI = UI_1 = class UI extends exports.Leaf {
7189
7324
  get app() { return this.leafer && this.leafer.app; }
7190
7325
  get isFrame() { return false; }
7191
- set scale(value) {
7192
- if (typeof value === 'number') {
7193
- this.scaleX = this.scaleY = value;
7194
- }
7195
- else {
7196
- this.scaleX = value.x;
7197
- this.scaleY = value.y;
7198
- }
7199
- }
7200
- get scale() {
7201
- const { scaleX, scaleY } = this;
7202
- return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
7203
- }
7326
+ set scale(value) { MathHelper.assignScale(this, value); }
7327
+ get scale() { return this.__.scale; }
7204
7328
  get pen() {
7205
7329
  const { path } = this.__;
7206
7330
  pen.set(this.path = path || []);
@@ -7215,8 +7339,15 @@ var LeaferUI = (function (exports) {
7215
7339
  super(data);
7216
7340
  }
7217
7341
  reset(_data) { }
7218
- set(data) {
7219
- Object.assign(this, data);
7342
+ set(data, isTemp) {
7343
+ if (isTemp) {
7344
+ this.lockNormalStyle = true;
7345
+ Object.assign(this, data);
7346
+ this.lockNormalStyle = false;
7347
+ }
7348
+ else {
7349
+ Object.assign(this, data);
7350
+ }
7220
7351
  }
7221
7352
  get(name) {
7222
7353
  return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
@@ -7279,11 +7410,18 @@ var LeaferUI = (function (exports) {
7279
7410
  drawer.rect(x, y, width, height);
7280
7411
  }
7281
7412
  }
7413
+ animate(_keyframe, _options, _type, _isTemp) {
7414
+ return needPlugin('animate');
7415
+ }
7416
+ killAnimate(_type) { }
7282
7417
  export(filename, options) {
7283
7418
  return Export.export(this, filename, options);
7284
7419
  }
7285
- clone() {
7286
- return UI_1.one(this.toJSON());
7420
+ clone(newData) {
7421
+ const json = this.toJSON();
7422
+ if (newData)
7423
+ Object.assign(json, newData);
7424
+ return UI_1.one(json);
7287
7425
  }
7288
7426
  static one(data, x, y, width, height) {
7289
7427
  return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height);
@@ -7299,6 +7437,8 @@ var LeaferUI = (function (exports) {
7299
7437
  static setEditInner(_editorName) { }
7300
7438
  destroy() {
7301
7439
  this.fill = this.stroke = null;
7440
+ if (this.__animate)
7441
+ this.killAnimate();
7302
7442
  super.destroy();
7303
7443
  }
7304
7444
  };
@@ -7326,12 +7466,6 @@ var LeaferUI = (function (exports) {
7326
7466
  __decorate([
7327
7467
  visibleType(true)
7328
7468
  ], exports.UI.prototype, "visible", void 0);
7329
- __decorate([
7330
- stateType(false)
7331
- ], exports.UI.prototype, "selected", void 0);
7332
- __decorate([
7333
- stateType(false)
7334
- ], exports.UI.prototype, "disabled", void 0);
7335
7469
  __decorate([
7336
7470
  surfaceType(false)
7337
7471
  ], exports.UI.prototype, "locked", void 0);
@@ -7404,45 +7538,9 @@ var LeaferUI = (function (exports) {
7404
7538
  __decorate([
7405
7539
  pathType(true)
7406
7540
  ], exports.UI.prototype, "closed", void 0);
7407
- __decorate([
7408
- autoLayoutType(false)
7409
- ], exports.UI.prototype, "flow", void 0);
7410
7541
  __decorate([
7411
7542
  boundsType(0)
7412
7543
  ], exports.UI.prototype, "padding", void 0);
7413
- __decorate([
7414
- boundsType(0)
7415
- ], exports.UI.prototype, "gap", void 0);
7416
- __decorate([
7417
- boundsType('top-left')
7418
- ], exports.UI.prototype, "flowAlign", void 0);
7419
- __decorate([
7420
- boundsType(false)
7421
- ], exports.UI.prototype, "flowWrap", void 0);
7422
- __decorate([
7423
- boundsType('box')
7424
- ], exports.UI.prototype, "itemBox", void 0);
7425
- __decorate([
7426
- boundsType(true)
7427
- ], exports.UI.prototype, "inFlow", void 0);
7428
- __decorate([
7429
- boundsType()
7430
- ], exports.UI.prototype, "autoWidth", void 0);
7431
- __decorate([
7432
- boundsType()
7433
- ], exports.UI.prototype, "autoHeight", void 0);
7434
- __decorate([
7435
- boundsType()
7436
- ], exports.UI.prototype, "lockRatio", void 0);
7437
- __decorate([
7438
- boundsType()
7439
- ], exports.UI.prototype, "autoBox", void 0);
7440
- __decorate([
7441
- boundsType()
7442
- ], exports.UI.prototype, "widthRange", void 0);
7443
- __decorate([
7444
- boundsType()
7445
- ], exports.UI.prototype, "heightRange", void 0);
7446
7544
  __decorate([
7447
7545
  dataType(false)
7448
7546
  ], exports.UI.prototype, "draggable", void 0);
@@ -7506,12 +7604,6 @@ var LeaferUI = (function (exports) {
7506
7604
  __decorate([
7507
7605
  strokeType(10)
7508
7606
  ], exports.UI.prototype, "miterLimit", void 0);
7509
- __decorate([
7510
- arrowType('none')
7511
- ], exports.UI.prototype, "startArrow", void 0);
7512
- __decorate([
7513
- arrowType('none')
7514
- ], exports.UI.prototype, "endArrow", void 0);
7515
7607
  __decorate([
7516
7608
  pathType(0)
7517
7609
  ], exports.UI.prototype, "cornerRadius", void 0);
@@ -7533,24 +7625,6 @@ var LeaferUI = (function (exports) {
7533
7625
  __decorate([
7534
7626
  effectType()
7535
7627
  ], exports.UI.prototype, "grayscale", void 0);
7536
- __decorate([
7537
- dataType()
7538
- ], exports.UI.prototype, "normalStyle", void 0);
7539
- __decorate([
7540
- dataType()
7541
- ], exports.UI.prototype, "hoverStyle", void 0);
7542
- __decorate([
7543
- dataType()
7544
- ], exports.UI.prototype, "pressStyle", void 0);
7545
- __decorate([
7546
- dataType()
7547
- ], exports.UI.prototype, "focusStyle", void 0);
7548
- __decorate([
7549
- dataType()
7550
- ], exports.UI.prototype, "selectedStyle", void 0);
7551
- __decorate([
7552
- dataType()
7553
- ], exports.UI.prototype, "disabledStyle", void 0);
7554
7628
  __decorate([
7555
7629
  dataType({})
7556
7630
  ], exports.UI.prototype, "data", void 0);
@@ -7577,7 +7651,7 @@ var LeaferUI = (function (exports) {
7577
7651
  if (!this.children)
7578
7652
  this.children = [];
7579
7653
  }
7580
- set(data) {
7654
+ set(data, isTemp) {
7581
7655
  if (data.children) {
7582
7656
  const { children } = data;
7583
7657
  delete data.children;
@@ -7587,7 +7661,7 @@ var LeaferUI = (function (exports) {
7587
7661
  else {
7588
7662
  this.clear();
7589
7663
  }
7590
- super.set(data);
7664
+ super.set(data, isTemp);
7591
7665
  let child;
7592
7666
  children.forEach(childData => {
7593
7667
  child = childData.__ ? childData : UICreator.get(childData.tag, childData);
@@ -7596,7 +7670,7 @@ var LeaferUI = (function (exports) {
7596
7670
  data.children = children;
7597
7671
  }
7598
7672
  else {
7599
- super.set(data);
7673
+ super.set(data, isTemp);
7600
7674
  }
7601
7675
  }
7602
7676
  toJSON(options) {
@@ -7923,13 +7997,20 @@ var LeaferUI = (function (exports) {
7923
7997
  }
7924
7998
  }
7925
7999
  zoom(_zoomType, _padding, _fixedScale) {
7926
- return debug$4.error('need @leafer-in/view');
8000
+ return needPlugin('view');
7927
8001
  }
7928
8002
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
7929
8003
  getValidScale(changeScale) { return changeScale; }
7930
8004
  getWorldPointByClient(clientPoint, updateClient) {
7931
8005
  return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
7932
8006
  }
8007
+ getPagePointByClient(clientPoint, updateClient) {
8008
+ return this.getPagePoint(this.getWorldPointByClient(clientPoint, updateClient));
8009
+ }
8010
+ updateClientBounds() {
8011
+ this.canvas && this.canvas.updateClientBounds();
8012
+ }
8013
+ receiveEvent(_event) { }
7933
8014
  __checkUpdateLayout() {
7934
8015
  this.__layout.update();
7935
8016
  }
@@ -8013,7 +8094,7 @@ var LeaferUI = (function (exports) {
8013
8094
  const rect$1 = exports.Rect.prototype;
8014
8095
  const group$1 = exports.Group.prototype;
8015
8096
  const childrenRenderBounds = {};
8016
- const { copy: copy$6, add, includes: includes$1 } = BoundsHelper;
8097
+ const { copy: copy$6, add, includes: includes$1, copyAndSpread: copyAndSpread$1 } = BoundsHelper;
8017
8098
  exports.Box = class Box extends exports.Group {
8018
8099
  get __tag() { return 'Box'; }
8019
8100
  get isBranchLeaf() { return true; }
@@ -8027,20 +8108,23 @@ var LeaferUI = (function (exports) {
8027
8108
  return this.__updateRectRenderSpread() || -1;
8028
8109
  }
8029
8110
  __updateRectBoxBounds() { }
8030
- __updateBoxBounds() {
8111
+ __updateBoxBounds(secondLayout) {
8031
8112
  const data = this.__;
8032
8113
  if (this.children.length) {
8033
8114
  if (data.__autoSide) {
8034
8115
  if (this.leafer && this.leafer.ready)
8035
8116
  this.leafer.layouter.addExtra(this);
8036
8117
  super.__updateBoxBounds();
8118
+ const { boxBounds } = this.__layout;
8037
8119
  if (!data.__autoSize) {
8038
- const b = this.__layout.boxBounds;
8039
- if (!data.__autoWidth)
8040
- b.height += b.y, b.width = data.width, b.x = b.y = 0;
8041
- if (!data.__autoHeight)
8042
- b.width += b.x, b.height = data.height, b.y = b.x = 0;
8120
+ if (data.__autoWidth)
8121
+ boxBounds.width += boxBounds.x, boxBounds.height = data.height, boxBounds.y = boxBounds.x = 0;
8122
+ else
8123
+ boxBounds.height += boxBounds.y, boxBounds.width = data.width, boxBounds.x = boxBounds.y = 0;
8043
8124
  }
8125
+ if (secondLayout && data.flow && data.padding)
8126
+ copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : (data.__autoWidth ? 'width' : 'height'));
8127
+ this.__updateNaturalSize();
8044
8128
  }
8045
8129
  else {
8046
8130
  this.__updateRectBoxBounds();
@@ -8060,13 +8144,13 @@ var LeaferUI = (function (exports) {
8060
8144
  super.__updateRenderBounds();
8061
8145
  copy$6(childrenRenderBounds, renderBounds);
8062
8146
  this.__updateRectRenderBounds();
8063
- isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
8147
+ isOverflow = !includes$1(renderBounds, childrenRenderBounds) || !this.pathInputed || !this.__.cornerRadius;
8064
8148
  }
8065
8149
  else {
8066
8150
  this.__updateRectRenderBounds();
8067
8151
  }
8068
8152
  this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8069
- if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
8153
+ if (!(this.__.__drawAfterFill = this.__.overflow === 'hide') && isOverflow)
8070
8154
  add(renderBounds, childrenRenderBounds);
8071
8155
  }
8072
8156
  __updateRectRenderBounds() { }
@@ -8400,14 +8484,26 @@ var LeaferUI = (function (exports) {
8400
8484
  exports.Image = __decorate([
8401
8485
  registerUI()
8402
8486
  ], exports.Image);
8487
+ const MyImage = exports.Image;
8403
8488
 
8404
8489
  exports.Canvas = class Canvas extends exports.Rect {
8405
8490
  get __tag() { return 'Canvas'; }
8491
+ get ready() { return !this.url; }
8406
8492
  constructor(data) {
8407
8493
  super(data);
8408
8494
  this.canvas = Creator.canvas(this.__);
8409
8495
  this.context = this.canvas.context;
8410
8496
  this.__.__isCanvas = this.__.__drawAfterFill = true;
8497
+ if (data && data.url)
8498
+ this.drawImage(data.url);
8499
+ }
8500
+ drawImage(url) {
8501
+ new LeaferImage({ url }).load((image) => {
8502
+ this.context.drawImage(image.view, 0, 0);
8503
+ this.url = undefined;
8504
+ this.paint();
8505
+ this.emitEvent(new ImageEvent(ImageEvent.LOADED, { image }));
8506
+ });
8411
8507
  }
8412
8508
  draw(ui, offset, scale, rotation) {
8413
8509
  ui.__layout.update();
@@ -8424,19 +8520,18 @@ var LeaferUI = (function (exports) {
8424
8520
  this.paint();
8425
8521
  }
8426
8522
  paint() {
8427
- this.forceUpdate('fill');
8523
+ this.forceRender();
8428
8524
  }
8429
8525
  __drawAfterFill(canvas, _options) {
8430
- const origin = this.canvas.view;
8431
- const { width, height } = this;
8432
- if (this.__.cornerRadius || this.pathInputed) {
8526
+ const { width, height, cornerRadius } = this.__, { view } = this.canvas;
8527
+ if (cornerRadius || this.pathInputed) {
8433
8528
  canvas.save();
8434
8529
  canvas.clip();
8435
- canvas.drawImage(this.canvas.view, 0, 0, origin.width, origin.height, 0, 0, width, height);
8530
+ canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8436
8531
  canvas.restore();
8437
8532
  }
8438
8533
  else {
8439
- canvas.drawImage(this.canvas.view, 0, 0, origin.width, origin.height, 0, 0, width, height);
8534
+ canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8440
8535
  }
8441
8536
  }
8442
8537
  __updateSize() {
@@ -8466,7 +8561,7 @@ var LeaferUI = (function (exports) {
8466
8561
  resizeType(100)
8467
8562
  ], exports.Canvas.prototype, "height", void 0);
8468
8563
  __decorate([
8469
- resizeType(Platform.devicePixelRatio)
8564
+ resizeType(1)
8470
8565
  ], exports.Canvas.prototype, "pixelRatio", void 0);
8471
8566
  __decorate([
8472
8567
  resizeType(true)
@@ -8490,13 +8585,13 @@ var LeaferUI = (function (exports) {
8490
8585
  super(data);
8491
8586
  }
8492
8587
  __drawHitPath(canvas) {
8493
- const { __lineHeight, __baseLine, __textDrawData: data } = this.__;
8588
+ const { __lineHeight, fontSize, __baseLine, __textDrawData: data } = this.__;
8494
8589
  canvas.beginPath();
8495
8590
  if (this.__.__letterSpacing < 0) {
8496
8591
  this.__drawPathByData(canvas);
8497
8592
  }
8498
8593
  else {
8499
- data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight));
8594
+ data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
8500
8595
  }
8501
8596
  }
8502
8597
  __drawPathByData(drawer, _data) {
@@ -8689,7 +8784,8 @@ var LeaferUI = (function (exports) {
8689
8784
  drawPoints(_points, _curve, _close) { return this; }
8690
8785
  clearPath() { return this; }
8691
8786
  paint() {
8692
- this.pathElement.forceUpdate('path');
8787
+ if (!this.pathElement.__layout.boxChanged)
8788
+ this.pathElement.forceUpdate('path');
8693
8789
  }
8694
8790
  };
8695
8791
  __decorate([
@@ -8699,7 +8795,7 @@ var LeaferUI = (function (exports) {
8699
8795
  penPathType()
8700
8796
  ], exports.Pen.prototype, "path", void 0);
8701
8797
  exports.Pen = __decorate([
8702
- useModule(PathCreator, ['set', 'beginPath', 'path']),
8798
+ useModule(PathCreator, ['set', 'beginPath', 'path', 'paint']),
8703
8799
  registerUI()
8704
8800
  ], exports.Pen);
8705
8801
  function penPathType() {
@@ -8878,21 +8974,29 @@ var LeaferUI = (function (exports) {
8878
8974
  constructor(params) {
8879
8975
  super(params.type);
8880
8976
  this.bubbles = true;
8977
+ this.getInner = this.getInnerPoint;
8978
+ this.getLocal = this.getLocalPoint;
8979
+ this.getPage = this.getPagePoint;
8881
8980
  Object.assign(this, params);
8882
8981
  }
8883
- getPage() {
8884
- return this.current.getPagePoint(this);
8982
+ getBoxPoint(relative) {
8983
+ if (!relative)
8984
+ relative = this.current;
8985
+ return relative.getBoxPoint(this);
8885
8986
  }
8886
- getInner(relative) {
8987
+ getInnerPoint(relative) {
8887
8988
  if (!relative)
8888
8989
  relative = this.current;
8889
8990
  return relative.getInnerPoint(this);
8890
8991
  }
8891
- getLocal(relative) {
8992
+ getLocalPoint(relative) {
8892
8993
  if (!relative)
8893
8994
  relative = this.current;
8894
8995
  return relative.getLocalPoint(this);
8895
8996
  }
8997
+ getPagePoint() {
8998
+ return this.current.getPagePoint(this);
8999
+ }
8896
9000
  static changeName(oldName, newName) {
8897
9001
  EventCreator.changeName(oldName, newName);
8898
9002
  }
@@ -8922,6 +9026,7 @@ var LeaferUI = (function (exports) {
8922
9026
  exports.PointerEvent = __decorate([
8923
9027
  registerUIEvent()
8924
9028
  ], exports.PointerEvent);
9029
+ const MyPointerEvent = exports.PointerEvent;
8925
9030
 
8926
9031
  const move$1 = {};
8927
9032
  exports.DragEvent = class DragEvent extends exports.PointerEvent {
@@ -8999,7 +9104,7 @@ var LeaferUI = (function (exports) {
8999
9104
  }
9000
9105
  getPageBounds() {
9001
9106
  const total = this.getPageTotal();
9002
- const start = this.getPage();
9107
+ const start = this.getPagePoint();
9003
9108
  const bounds = {};
9004
9109
  BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
9005
9110
  BoundsHelper.unsign(bounds);
@@ -9021,6 +9126,7 @@ var LeaferUI = (function (exports) {
9021
9126
  exports.DragEvent = __decorate([
9022
9127
  registerUIEvent()
9023
9128
  ], exports.DragEvent);
9129
+ const MyDragEvent = exports.DragEvent;
9024
9130
 
9025
9131
  exports.DropEvent = class DropEvent extends exports.PointerEvent {
9026
9132
  static setList(data) {
@@ -9102,36 +9208,32 @@ var LeaferUI = (function (exports) {
9102
9208
 
9103
9209
  function document$1(leafer) {
9104
9210
  addInteractionWindow(leafer);
9105
- leafer.config.move.scroll = 'limit';
9106
- leafer.config.zoom.min = 1;
9211
+ const { move, zoom } = leafer.config;
9212
+ move.scroll = 'limit';
9213
+ zoom.min = 1;
9214
+ }
9215
+
9216
+ function block(leafer) {
9217
+ const { config } = leafer;
9218
+ (config.wheel || (config.wheel = {})).preventDefault = false;
9219
+ (config.touch || (config.touch = {})).preventDefault = 'auto';
9107
9220
  }
9108
9221
 
9109
9222
  const debug$3 = Debug.get('LeaferTypeCreator');
9110
9223
  const LeaferTypeCreator = {
9111
9224
  list: {},
9112
9225
  register(name, fn) {
9113
- if (list$1[name]) {
9114
- debug$3.repeat(name);
9115
- }
9116
- else {
9117
- list$1[name] = fn;
9118
- }
9226
+ list$1[name] ? debug$3.repeat(name) : list$1[name] = fn;
9119
9227
  },
9120
9228
  run(name, leafer) {
9121
9229
  const fn = list$1[name];
9122
- if (fn) {
9123
- fn(leafer);
9124
- }
9125
- else {
9126
- debug$3.error('no', name);
9127
- }
9230
+ fn && fn(leafer);
9128
9231
  }
9129
9232
  };
9130
9233
  const { list: list$1, register } = LeaferTypeCreator;
9131
- register('draw', () => { });
9132
- register('custom', () => { });
9133
9234
  register('design', addInteractionWindow);
9134
9235
  register('document', document$1);
9236
+ register('block', block);
9135
9237
 
9136
9238
  const leafer = exports.Leafer.prototype;
9137
9239
  leafer.initType = function (type) {
@@ -9320,7 +9422,13 @@ var LeaferUI = (function (exports) {
9320
9422
  find.add(list[i]);
9321
9423
  }
9322
9424
  return find;
9323
- }
9425
+ },
9426
+ pathCanDrag(path) {
9427
+ return path && path.list.some(item => item.draggable || item.editable || (!item.isLeafer && item.hasEvent(exports.DragEvent.DRAG)));
9428
+ },
9429
+ pathHasOutside(path) {
9430
+ return path && path.list.some(item => item.isOutside);
9431
+ },
9324
9432
  };
9325
9433
  const I = InteractionHelper;
9326
9434
 
@@ -9580,7 +9688,7 @@ var LeaferUI = (function (exports) {
9580
9688
  if (leaf.destroyed)
9581
9689
  return false;
9582
9690
  if (leaf.__.hitSelf && !exclude(leaf, excludePath)) {
9583
- if (State.updateEventStyle)
9691
+ if (State.updateEventStyle && !capture)
9584
9692
  State.updateEventStyle(leaf, type);
9585
9693
  if (leaf.hasEvent(type, capture)) {
9586
9694
  data.phase = capture ? 1 : ((leaf === data.target) ? 2 : 3);
@@ -9630,15 +9738,18 @@ var LeaferUI = (function (exports) {
9630
9738
  swipeDistance: 20,
9631
9739
  preventDefaultMenu: true
9632
9740
  },
9741
+ touch: {
9742
+ preventDefault: true
9743
+ },
9633
9744
  cursor: true,
9634
9745
  keyEvent: true
9635
9746
  };
9636
9747
 
9637
- const { pathHasEventType, getMoveEventData, getZoomEventData, getRotateEventData } = InteractionHelper;
9748
+ const { pathHasEventType, getMoveEventData, getZoomEventData, getRotateEventData, pathCanDrag, pathHasOutside } = InteractionHelper;
9638
9749
  class InteractionBase {
9639
9750
  get dragging() { return this.dragger.dragging; }
9640
9751
  get transforming() { return this.transformer.transforming; }
9641
- get moveMode() { return this.config.move.drag || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
9752
+ get moveMode() { return this.config.move.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
9642
9753
  get canHover() { return this.config.pointer.hover && !this.config.mobile; }
9643
9754
  get isDragEmpty() { return this.config.move.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
9644
9755
  get isMobileDragEmpty() { return this.config.move.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
@@ -9647,7 +9758,7 @@ var LeaferUI = (function (exports) {
9647
9758
  get isHoldSpaceKey() { return this.config.move.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
9648
9759
  get hitRadius() { return this.config.pointer.hitRadius; }
9649
9760
  constructor(target, canvas, selector, userConfig) {
9650
- this.config = config$1;
9761
+ this.config = DataHelper.clone(config$1);
9651
9762
  this.tapCount = 0;
9652
9763
  this.downKeyMap = {};
9653
9764
  this.target = target;
@@ -9682,7 +9793,7 @@ var LeaferUI = (function (exports) {
9682
9793
  this.tapWait();
9683
9794
  this.longPressWait(data);
9684
9795
  }
9685
- this.waitMenuTap = PointerButton.right(data);
9796
+ this.waitRightTap = PointerButton.right(data);
9686
9797
  this.dragger.setDragData(data);
9687
9798
  if (!this.isHoldRightKey)
9688
9799
  this.updateCursor(data);
@@ -9710,7 +9821,7 @@ var LeaferUI = (function (exports) {
9710
9821
  if (canDrag) {
9711
9822
  if (this.waitTap)
9712
9823
  this.pointerWaitCancel();
9713
- this.waitMenuTap = false;
9824
+ this.waitRightTap = false;
9714
9825
  }
9715
9826
  this.dragger.checkDrag(data, canDrag);
9716
9827
  }
@@ -9764,10 +9875,15 @@ var LeaferUI = (function (exports) {
9764
9875
  menu(data) {
9765
9876
  this.findPath(data);
9766
9877
  this.emit(exports.PointerEvent.MENU, data);
9878
+ this.waitMenuTap = true;
9879
+ if (!this.downData && this.waitRightTap)
9880
+ this.menuTap(data);
9767
9881
  }
9768
9882
  menuTap(data) {
9769
- if (this.waitMenuTap)
9883
+ if (this.waitRightTap && this.waitMenuTap) {
9770
9884
  this.emit(exports.PointerEvent.MENU_TAP, data);
9885
+ this.waitRightTap = this.waitMenuTap = false;
9886
+ }
9771
9887
  }
9772
9888
  move(data) {
9773
9889
  this.transformer.move(data);
@@ -9899,11 +10015,11 @@ var LeaferUI = (function (exports) {
9899
10015
  return app.editor && (!data.path.has(app.editor) && data.path.has(app.tree) && !data.target.syncEventer);
9900
10016
  }
9901
10017
  checkPath(data, useDefaultPath) {
9902
- if (useDefaultPath || this.canMove(data))
10018
+ if (useDefaultPath || (this.moveMode && !pathHasOutside(data.path)))
9903
10019
  data.path = this.defaultPath;
9904
10020
  }
9905
10021
  canMove(data) {
9906
- return this.moveMode && data && data.path.list.every(item => !item.isOutside);
10022
+ return data && (this.moveMode || (this.config.move.drag === 'auto' && !pathCanDrag(data.path))) && !pathHasOutside(data.path);
9907
10023
  }
9908
10024
  isDrag(leaf) {
9909
10025
  return this.dragger.getList().has(leaf);
@@ -10132,8 +10248,8 @@ var LeaferUI = (function (exports) {
10132
10248
  this.__drawRenderPath(canvas); };
10133
10249
 
10134
10250
  const matrix$2 = new Matrix();
10135
- const ui$2 = exports.UI.prototype;
10136
- ui$2.__updateHitCanvas = function () {
10251
+ const ui$3 = exports.UI.prototype;
10252
+ ui$3.__updateHitCanvas = function () {
10137
10253
  const data = this.__, { hitCanvasManager } = this.leafer;
10138
10254
  const isHitPixelFill = (data.__pixelFill || data.__isCanvas) && data.hitFill === 'pixel';
10139
10255
  const isHitPixelStroke = data.__pixelStroke && data.hitStroke === 'pixel';
@@ -10160,7 +10276,7 @@ var LeaferUI = (function (exports) {
10160
10276
  this.__drawHitPath(h);
10161
10277
  h.setStrokeOptions(data);
10162
10278
  };
10163
- ui$2.__hit = function (inner) {
10279
+ ui$3.__hit = function (inner) {
10164
10280
  if (Platform.name === 'miniapp')
10165
10281
  this.__drawHitPath(this.__hitCanvas);
10166
10282
  const data = this.__;
@@ -10200,23 +10316,23 @@ var LeaferUI = (function (exports) {
10200
10316
  return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
10201
10317
  };
10202
10318
 
10203
- const ui$1 = new exports.UI();
10319
+ const ui$2 = new exports.UI();
10204
10320
  const rect = exports.Rect.prototype;
10205
10321
  rect.__updateHitCanvas = function () {
10206
10322
  if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
10207
- ui$1.__updateHitCanvas.call(this);
10323
+ ui$2.__updateHitCanvas.call(this);
10208
10324
  else if (this.__hitCanvas)
10209
10325
  this.__hitCanvas = null;
10210
10326
  };
10211
10327
  rect.__hitFill = function (inner) {
10212
- return this.__hitCanvas ? ui$1.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
10328
+ return this.__hitCanvas ? ui$2.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
10213
10329
  };
10214
10330
 
10215
- const ui = exports.UI.prototype, group = exports.Group.prototype;
10216
- ui.find = function (condition, options) {
10331
+ const ui$1 = exports.UI.prototype, group = exports.Group.prototype;
10332
+ ui$1.find = function (condition, options) {
10217
10333
  return this.leafer ? this.leafer.selector.getBy(condition, this, false, options) : [];
10218
10334
  };
10219
- ui.findOne = function (condition, options) {
10335
+ ui$1.findOne = function (condition, options) {
10220
10336
  return this.leafer ? this.leafer.selector.getBy(condition, this, true, options) : null;
10221
10337
  };
10222
10338
  group.pick = function (hitPoint, options) {
@@ -10598,16 +10714,21 @@ var LeaferUI = (function (exports) {
10598
10714
  const { get: get$2, translate } = MatrixHelper;
10599
10715
  const tempBox = new Bounds();
10600
10716
  const tempPoint = {};
10717
+ const tempScaleData = {};
10601
10718
  function createData(leafPaint, image, paint, box) {
10602
- const { blendMode } = paint;
10719
+ const { blendMode, sync } = paint;
10603
10720
  if (blendMode)
10604
10721
  leafPaint.blendMode = blendMode;
10722
+ if (sync)
10723
+ leafPaint.sync = sync;
10605
10724
  leafPaint.data = getPatternData(paint, box, image);
10606
10725
  }
10607
10726
  function getPatternData(paint, box, image) {
10608
10727
  let { width, height } = image;
10609
10728
  if (paint.padding)
10610
10729
  box = tempBox.set(box).shrink(paint.padding);
10730
+ if (paint.mode === 'strench')
10731
+ paint.mode = 'stretch';
10611
10732
  const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
10612
10733
  const sameBox = box.width === width && box.height === height;
10613
10734
  const data = { mode };
@@ -10621,13 +10742,10 @@ var LeaferUI = (function (exports) {
10621
10742
  x += (box.width - width * scaleX) / 2, y += (box.height - height * scaleY) / 2;
10622
10743
  }
10623
10744
  }
10624
- else if (size) {
10625
- scaleX = (typeof size === 'number' ? size : size.width) / width;
10626
- scaleY = (typeof size === 'number' ? size : size.height) / height;
10627
- }
10628
- else if (scale) {
10629
- scaleX = typeof scale === 'number' ? scale : scale.x;
10630
- scaleY = typeof scale === 'number' ? scale : scale.y;
10745
+ else if (scale || size) {
10746
+ MathHelper.getScaleData(scale, size, image, tempScaleData);
10747
+ scaleX = tempScaleData.scaleX;
10748
+ scaleY = tempScaleData.scaleY;
10631
10749
  }
10632
10750
  if (align) {
10633
10751
  const imageBounds = { x, y, width: swapWidth, height: swapHeight };
@@ -10639,7 +10757,7 @@ var LeaferUI = (function (exports) {
10639
10757
  if (offset)
10640
10758
  x += offset.x, y += offset.y;
10641
10759
  switch (mode) {
10642
- case 'strench':
10760
+ case 'stretch':
10643
10761
  if (!sameBox)
10644
10762
  width = box.width, height = box.height;
10645
10763
  break;
@@ -10666,7 +10784,7 @@ var LeaferUI = (function (exports) {
10666
10784
  translate(data.transform, box.x, box.y);
10667
10785
  }
10668
10786
  }
10669
- if (scaleX && mode !== 'strench') {
10787
+ if (scaleX && mode !== 'stretch') {
10670
10788
  data.scaleX = scaleX;
10671
10789
  data.scaleY = scaleY;
10672
10790
  }
@@ -10770,7 +10888,7 @@ var LeaferUI = (function (exports) {
10770
10888
  const { ceil, abs: abs$2 } = Math;
10771
10889
  function createPattern(ui, paint, pixelRatio) {
10772
10890
  let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
10773
- const id = scaleX + '-' + scaleY;
10891
+ const id = scaleX + '-' + scaleY + '-' + pixelRatio;
10774
10892
  if (paint.patternId !== id && !ui.destroyed) {
10775
10893
  scaleX = abs$2(scaleX);
10776
10894
  scaleY = abs$2(scaleY);
@@ -10832,7 +10950,8 @@ var LeaferUI = (function (exports) {
10832
10950
  const { abs: abs$1 } = Math;
10833
10951
  function checkImage(ui, canvas, paint, allowPaint) {
10834
10952
  const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
10835
- if (!paint.data || (paint.patternId === scaleX + '-' + scaleY && !Export.running)) {
10953
+ const { pixelRatio } = canvas;
10954
+ if (!paint.data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
10836
10955
  return false;
10837
10956
  }
10838
10957
  else {
@@ -10840,8 +10959,8 @@ var LeaferUI = (function (exports) {
10840
10959
  if (allowPaint) {
10841
10960
  if (!data.repeat) {
10842
10961
  let { width, height } = data;
10843
- width *= abs$1(scaleX) * canvas.pixelRatio;
10844
- height *= abs$1(scaleY) * canvas.pixelRatio;
10962
+ width *= abs$1(scaleX) * pixelRatio;
10963
+ height *= abs$1(scaleY) * pixelRatio;
10845
10964
  if (data.scaleX) {
10846
10965
  width *= data.scaleX;
10847
10966
  height *= data.scaleY;
@@ -10866,15 +10985,15 @@ var LeaferUI = (function (exports) {
10866
10985
  return true;
10867
10986
  }
10868
10987
  else {
10869
- if (!paint.style || Export.running) {
10870
- createPattern(ui, paint, canvas.pixelRatio);
10988
+ if (!paint.style || paint.sync || Export.running) {
10989
+ createPattern(ui, paint, pixelRatio);
10871
10990
  }
10872
10991
  else {
10873
10992
  if (!paint.patternTask) {
10874
10993
  paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
10875
10994
  paint.patternTask = null;
10876
10995
  if (canvas.bounds.hit(ui.__nowWorld))
10877
- createPattern(ui, paint, canvas.pixelRatio);
10996
+ createPattern(ui, paint, pixelRatio);
10878
10997
  ui.forceUpdate('surface');
10879
10998
  }), 300);
10880
10999
  }
@@ -10938,14 +11057,16 @@ var LeaferUI = (function (exports) {
10938
11057
  return data;
10939
11058
  }
10940
11059
  function applyStops(gradient, stops, opacity) {
10941
- let stop;
10942
- for (let i = 0, len = stops.length; i < len; i++) {
10943
- stop = stops[i];
10944
- if (typeof stop === 'string') {
10945
- gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
10946
- }
10947
- else {
10948
- gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
11060
+ if (stops) {
11061
+ let stop;
11062
+ for (let i = 0, len = stops.length; i < len; i++) {
11063
+ stop = stops[i];
11064
+ if (typeof stop === 'string') {
11065
+ gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
11066
+ }
11067
+ else {
11068
+ gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
11069
+ }
10949
11070
  }
10950
11071
  }
10951
11072
  }
@@ -11634,7 +11755,7 @@ var LeaferUI = (function (exports) {
11634
11755
  }
11635
11756
  }
11636
11757
 
11637
- const { top: top$1, right: right$2, bottom: bottom$1, left: left$2 } = exports.Direction4;
11758
+ const { top: top$2, right: right$3, bottom: bottom$2, left: left$3 } = exports.Direction4;
11638
11759
  function getDrawData(content, style) {
11639
11760
  if (typeof content !== 'string')
11640
11761
  content = String(content);
@@ -11644,12 +11765,12 @@ var LeaferUI = (function (exports) {
11644
11765
  const { textDecoration, __font, __padding: padding } = style;
11645
11766
  if (padding) {
11646
11767
  if (width) {
11647
- x = padding[left$2];
11648
- width -= (padding[right$2] + padding[left$2]);
11768
+ x = padding[left$3];
11769
+ width -= (padding[right$3] + padding[left$3]);
11649
11770
  }
11650
11771
  if (height) {
11651
- y = padding[top$1];
11652
- height -= (padding[top$1] + padding[bottom$1]);
11772
+ y = padding[top$2];
11773
+ height -= (padding[top$2] + padding[bottom$2]);
11653
11774
  }
11654
11775
  }
11655
11776
  const drawData = {
@@ -11673,19 +11794,19 @@ var LeaferUI = (function (exports) {
11673
11794
  if (!width) {
11674
11795
  switch (style.textAlign) {
11675
11796
  case 'left':
11676
- offsetText(drawData, 'x', padding[left$2]);
11797
+ offsetText(drawData, 'x', padding[left$3]);
11677
11798
  break;
11678
11799
  case 'right':
11679
- offsetText(drawData, 'x', -padding[right$2]);
11800
+ offsetText(drawData, 'x', -padding[right$3]);
11680
11801
  }
11681
11802
  }
11682
11803
  if (!height) {
11683
11804
  switch (style.verticalAlign) {
11684
11805
  case 'top':
11685
- offsetText(drawData, 'y', padding[top$1]);
11806
+ offsetText(drawData, 'y', padding[top$2]);
11686
11807
  break;
11687
11808
  case 'bottom':
11688
- offsetText(drawData, 'y', -padding[bottom$1]);
11809
+ offsetText(drawData, 'y', -padding[bottom$2]);
11689
11810
  }
11690
11811
  }
11691
11812
  }
@@ -11701,10 +11822,15 @@ var LeaferUI = (function (exports) {
11701
11822
  };
11702
11823
 
11703
11824
  function string(color, opacity) {
11704
- if (typeof color === 'string')
11705
- return color;
11825
+ const doOpacity = typeof opacity === 'number' && opacity !== 1;
11826
+ if (typeof color === 'string') {
11827
+ if (doOpacity && ColorConvert.object)
11828
+ color = ColorConvert.object(color);
11829
+ else
11830
+ return color;
11831
+ }
11706
11832
  let a = color.a === undefined ? 1 : color.a;
11707
- if (opacity)
11833
+ if (doOpacity)
11708
11834
  a *= opacity;
11709
11835
  const rgb = color.r + ',' + color.g + ',' + color.b;
11710
11836
  return a === 1 ? 'rgb(' + rgb + ')' : 'rgba(' + rgb + ',' + a + ')';
@@ -11736,6 +11862,7 @@ var LeaferUI = (function (exports) {
11736
11862
  export(leaf, filename, options) {
11737
11863
  this.running = true;
11738
11864
  const fileType = FileHelper.fileType(filename);
11865
+ const isDownload = filename.includes('.');
11739
11866
  options = FileHelper.getExportOptions(options);
11740
11867
  return addTask((success) => new Promise((resolve) => {
11741
11868
  const over = (result) => {
@@ -11745,19 +11872,13 @@ var LeaferUI = (function (exports) {
11745
11872
  };
11746
11873
  const { toURL } = Platform;
11747
11874
  const { download } = Platform.origin;
11748
- if (filename === 'json') {
11749
- return over({ data: leaf.toJSON(options.json) });
11750
- }
11751
- else if (fileType === 'json') {
11752
- download(toURL(JSON.stringify(leaf.toJSON(options.json)), 'text'), filename);
11753
- return over({ data: true });
11875
+ if (fileType === 'json') {
11876
+ isDownload && download(toURL(JSON.stringify(leaf.toJSON(options.json)), 'text'), filename);
11877
+ return over({ data: isDownload ? true : leaf.toJSON(options.json) });
11754
11878
  }
11755
- if (filename === 'svg') {
11756
- return over({ data: leaf.toSVG() });
11757
- }
11758
- else if (fileType === 'svg') {
11759
- download(toURL(leaf.toSVG(), 'svg'), filename);
11760
- return over({ data: true });
11879
+ if (fileType === 'svg') {
11880
+ isDownload && download(toURL(leaf.toSVG(), 'svg'), filename);
11881
+ return over({ data: isDownload ? true : leaf.toSVG() });
11761
11882
  }
11762
11883
  const { leafer } = leaf;
11763
11884
  if (leafer) {
@@ -11766,14 +11887,8 @@ var LeaferUI = (function (exports) {
11766
11887
  let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
11767
11888
  const { worldTransform, isLeafer, isFrame } = leaf;
11768
11889
  const { slice, trim, onCanvas } = options;
11769
- let scale = options.scale || 1;
11770
- let pixelRatio = options.pixelRatio || 1;
11771
11890
  const smooth = options.smooth === undefined ? leafer.config.smooth : options.smooth;
11772
11891
  const contextSettings = options.contextSettings || leafer.config.contextSettings;
11773
- if (leaf.isApp) {
11774
- scale *= pixelRatio;
11775
- pixelRatio = leaf.app.pixelRatio;
11776
- }
11777
11892
  const screenshot = options.screenshot || leaf.isApp;
11778
11893
  const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
11779
11894
  const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
@@ -11807,9 +11922,17 @@ var LeaferUI = (function (exports) {
11807
11922
  }
11808
11923
  renderBounds = leaf.getBounds('render', relative);
11809
11924
  }
11810
- const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
11925
+ const scaleData = { scaleX: 1, scaleY: 1 };
11926
+ MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
11927
+ let pixelRatio = options.pixelRatio || 1;
11928
+ if (leaf.isApp) {
11929
+ scaleData.scaleX *= pixelRatio;
11930
+ scaleData.scaleY *= pixelRatio;
11931
+ pixelRatio = leaf.app.pixelRatio;
11932
+ }
11933
+ const { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
11934
+ const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
11811
11935
  let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio, smooth, contextSettings });
11812
- const renderOptions = { matrix: matrix.scale(1 / scale).invert().translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
11813
11936
  let sliceLeaf;
11814
11937
  if (slice) {
11815
11938
  sliceLeaf = leaf;
@@ -11930,9 +12053,6 @@ var LeaferUI = (function (exports) {
11930
12053
  command = data[i];
11931
12054
  switch (command) {
11932
12055
  case M$2:
11933
- scalePoints(data, scaleX, scaleY, i, 1);
11934
- i += 3;
11935
- break;
11936
12056
  case L$2:
11937
12057
  scalePoints(data, scaleX, scaleY, i, 1);
11938
12058
  i += 3;
@@ -11999,6 +12119,7 @@ var LeaferUI = (function (exports) {
11999
12119
  const { scalePoints } = PathScaler;
12000
12120
 
12001
12121
  const matrix$1 = MatrixHelper.get();
12122
+ const { topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottom: bottom$1, left: left$2 } = exports.Direction9;
12002
12123
  function scaleResize(leaf, scaleX, scaleY) {
12003
12124
  if (leaf.pathInputed) {
12004
12125
  scaleResizePath(leaf, scaleX, scaleY);
@@ -12011,15 +12132,36 @@ var LeaferUI = (function (exports) {
12011
12132
  }
12012
12133
  }
12013
12134
  function scaleResizeFontSize(leaf, scaleX, scaleY) {
12014
- const { width, height } = leaf.__localBoxBounds;
12015
- if (scaleX !== 1) {
12016
- leaf.fontSize *= scaleX;
12017
- leaf.y -= height * (scaleX - scaleY) / 2;
12018
- }
12019
- else if (scaleY !== 1) {
12020
- leaf.fontSize *= scaleY;
12021
- leaf.x -= width * (scaleY - scaleX) / 2;
12135
+ const { app } = leaf;
12136
+ const editor = app && app.editor;
12137
+ let fontScale = scaleX;
12138
+ if (editor.editing) {
12139
+ const layout = leaf.__layout;
12140
+ let { width, height } = layout.boxBounds;
12141
+ width *= scaleY - scaleX;
12142
+ height *= scaleX - scaleY;
12143
+ switch (editor.resizeDirection) {
12144
+ case top$1:
12145
+ case bottom$1:
12146
+ fontScale = scaleY;
12147
+ layout.affectScaleOrRotation ? leaf.moveInner(-width / 2, 0) : leaf.x -= width / 2;
12148
+ break;
12149
+ case left$2:
12150
+ case right$2:
12151
+ layout.affectScaleOrRotation ? leaf.moveInner(0, -height / 2) : leaf.y -= height / 2;
12152
+ break;
12153
+ case topLeft$1:
12154
+ case topRight$1:
12155
+ layout.affectScaleOrRotation ? leaf.moveInner(0, -height) : leaf.y -= height;
12156
+ break;
12157
+ }
12022
12158
  }
12159
+ leaf.fontSize *= fontScale;
12160
+ const data = leaf.__;
12161
+ if (!data.__autoWidth)
12162
+ leaf.width *= fontScale;
12163
+ if (!data.__autoHeight)
12164
+ leaf.height *= fontScale;
12023
12165
  }
12024
12166
  function scaleResizePath(leaf, scaleX, scaleY) {
12025
12167
  PathScaler.scale(leaf.__.path, scaleX, scaleY);
@@ -12065,7 +12207,7 @@ var LeaferUI = (function (exports) {
12065
12207
  this.scaleOf(this.__layout.boxBounds, this.__.lockRatio ? scale : 1, scale, true);
12066
12208
  };
12067
12209
  exports.Text.prototype.__scaleResize = function (scaleX, scaleY) {
12068
- if (this.__.__autoSize && (this.__.resizeFontSize || (this.editConfig && this.editConfig.editSize === 'font-size'))) {
12210
+ if (this.__.resizeFontSize || (this.editConfig && this.editConfig.editSize === 'font-size')) {
12069
12211
  scaleResizeFontSize(this, scaleX, scaleY);
12070
12212
  }
12071
12213
  else {
@@ -12389,7 +12531,7 @@ var LeaferUI = (function (exports) {
12389
12531
  if (this.allowDrag(e)) {
12390
12532
  const { editor } = this;
12391
12533
  const { stroke, area } = editor.mergeConfig;
12392
- const { x, y } = e.getInner(this);
12534
+ const { x, y } = e.getInnerPoint(this);
12393
12535
  this.bounds.set(x, y);
12394
12536
  this.selectArea.setStyle({ visible: true, stroke, x, y }, area);
12395
12537
  this.selectArea.setBounds(this.bounds.get());
@@ -12561,7 +12703,19 @@ var LeaferUI = (function (exports) {
12561
12703
  if (lockRatio) {
12562
12704
  const unlockSide = lockRatio === 'corner' && direction % 2;
12563
12705
  if (!unlockSide) {
12564
- const scale = Math.sqrt(Math.abs(scaleX * scaleY));
12706
+ let scale;
12707
+ switch (direction) {
12708
+ case top:
12709
+ case bottom:
12710
+ scale = scaleY;
12711
+ break;
12712
+ case left$1:
12713
+ case right$1:
12714
+ scale = scaleX;
12715
+ break;
12716
+ default:
12717
+ scale = Math.sqrt(Math.abs(scaleX * scaleY));
12718
+ }
12565
12719
  scaleX = scaleX < 0 ? -scale : scale;
12566
12720
  scaleY = scaleY < 0 ? -scale : scale;
12567
12721
  }
@@ -12583,7 +12737,8 @@ var LeaferUI = (function (exports) {
12583
12737
  const nowHeight = boxBounds.height * element.scaleY;
12584
12738
  scaleY = within(nowHeight * scaleY, heightRange) / nowHeight;
12585
12739
  }
12586
- toPoint(around || align, boxBounds, origin);
12740
+ toPoint(around || align, boxBounds, origin, true);
12741
+ console.log({ origin, scaleX, scaleY, direction, lockRatio, around });
12587
12742
  return { origin, scaleX, scaleY, direction, lockRatio, around };
12588
12743
  },
12589
12744
  getRotateData(bounds, direction, current, last, around) {
@@ -12604,7 +12759,7 @@ var LeaferUI = (function (exports) {
12604
12759
  default:
12605
12760
  align = 'center';
12606
12761
  }
12607
- toPoint(around || align, bounds, origin);
12762
+ toPoint(around || align, bounds, origin, true);
12608
12763
  return { origin, rotation: PointHelper.getRotation(last, origin, current) };
12609
12764
  },
12610
12765
  getSkewData(bounds, direction, move, around) {
@@ -12631,10 +12786,10 @@ var LeaferUI = (function (exports) {
12631
12786
  align = 'left';
12632
12787
  skewY = 1;
12633
12788
  }
12634
- const { x, y, width, height } = bounds;
12635
- last.x = x + last.x * width;
12636
- last.y = y + last.y * height;
12637
- toPoint(around || align, bounds, origin);
12789
+ const { width, height } = bounds;
12790
+ last.x = last.x * width;
12791
+ last.y = last.y * height;
12792
+ toPoint(around || align, bounds, origin, true);
12638
12793
  const rotation = PointHelper.getRotation(last, origin, { x: last.x + (skewX ? move.x : 0), y: last.y + (skewY ? move.y : 0) });
12639
12794
  skewX ? skewX = -rotation : skewY = rotation;
12640
12795
  return { origin, skewX, skewY };
@@ -12915,6 +13070,7 @@ var LeaferUI = (function (exports) {
12915
13070
  }
12916
13071
  else if (e.current.pointType === 'resize') {
12917
13072
  editor.dragStartBounds = Object.assign({}, editor.element.getLayoutBounds('box', 'local'));
13073
+ editor.resizeDirection = e.current.direction;
12918
13074
  }
12919
13075
  }
12920
13076
  onDragEnd(e) {
@@ -12922,6 +13078,7 @@ var LeaferUI = (function (exports) {
12922
13078
  this.moving = false;
12923
13079
  if (e.current.name === 'rect')
12924
13080
  this.editor.opacity = 1;
13081
+ this.editor.resizeDirection = undefined;
12925
13082
  }
12926
13083
  onDrag(e) {
12927
13084
  const { editor } = this;
@@ -13128,6 +13285,7 @@ ${filterStyle}
13128
13285
  }
13129
13286
  else {
13130
13287
  editor.leafList.reset();
13288
+ editor.closeInnerEditor();
13131
13289
  }
13132
13290
  editor.emitEvent(new EditorEvent(EditorEvent.SELECT, { editor, value: target, oldValue }));
13133
13291
  editor.checkOpenedGroups();
@@ -13266,7 +13424,7 @@ ${filterStyle}
13266
13424
  get buttons() { return this.editBox.buttons; }
13267
13425
  constructor(userConfig, data) {
13268
13426
  super(data);
13269
- this.config = config;
13427
+ this.config = DataHelper.clone(config);
13270
13428
  this.leafList = new LeafList();
13271
13429
  this.openedGroupList = new LeafList();
13272
13430
  this.simulateTarget = new exports.Rect({ visible: false });
@@ -13356,7 +13514,7 @@ ${filterStyle}
13356
13514
  let { around, lockRatio, resizeable, flipable, editSize } = this.mergeConfig;
13357
13515
  if (e instanceof exports.ZoomEvent) {
13358
13516
  if (resizeable === 'zoom')
13359
- e.stop(), this.scaleOf(element.getInnerPoint(e), e.scale, e.scale);
13517
+ e.stop(), this.scaleOf(element.getBoxPoint(e), e.scale, e.scale);
13360
13518
  }
13361
13519
  else {
13362
13520
  const { direction } = e.current;
@@ -13381,13 +13539,13 @@ ${filterStyle}
13381
13539
  let origin, rotation;
13382
13540
  if (e instanceof exports.RotateEvent) {
13383
13541
  if (rotateable === 'rotate')
13384
- e.stop(), rotation = e.rotation, origin = element.getInnerPoint(e);
13542
+ e.stop(), rotation = e.rotation, origin = element.getBoxPoint(e);
13385
13543
  else
13386
13544
  return;
13387
13545
  }
13388
13546
  else {
13389
13547
  const last = { x: e.x - e.moveX, y: e.y - e.moveY };
13390
- const data = EditDataHelper.getRotateData(element.boxBounds, direction, e.getInner(element), element.getInnerPoint(last), e.shiftKey ? null : (element.around || element.origin || around || 'center'));
13548
+ const data = EditDataHelper.getRotateData(element.boxBounds, direction, e.getBoxPoint(element), element.getBoxPoint(last), e.shiftKey ? null : (element.around || element.origin || around || 'center'));
13391
13549
  rotation = data.rotation;
13392
13550
  origin = data.origin;
13393
13551
  }
@@ -14308,6 +14466,21 @@ ${filterStyle}
14308
14466
  data[startIndex + 1] = point.y;
14309
14467
  }
14310
14468
 
14469
+ function arrowType(defaultValue) {
14470
+ return decorateLeafAttr(defaultValue, (key) => attr({
14471
+ set(value) {
14472
+ if (this.__setAttr(key, value)) {
14473
+ const data = this.__;
14474
+ data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
14475
+ doStrokeType(this);
14476
+ }
14477
+ }
14478
+ }));
14479
+ }
14480
+
14481
+ const ui = exports.UI.prototype;
14482
+ arrowType('none')(ui, 'startArrow');
14483
+ arrowType('none')(ui, 'endArrow');
14311
14484
  Object.assign(PathArrow, PathArrowModule);
14312
14485
 
14313
14486
  const textCaseMap = {
@@ -14388,26 +14561,42 @@ ${filterStyle}
14388
14561
  onLoad() {
14389
14562
  const { editor } = this;
14390
14563
  const { config } = editor.app;
14391
- this._keyEvent = config.keyEvent;
14392
- config.keyEvent = false;
14393
14564
  const text = this.editTarget;
14394
14565
  text.visible = false;
14566
+ this.isHTMLText = !(text instanceof exports.Text);
14567
+ this._keyEvent = config.keyEvent;
14568
+ config.keyEvent = false;
14395
14569
  const div = this.editDom = document.createElement('div');
14396
14570
  const { style } = div;
14397
14571
  div.contentEditable = 'true';
14398
- div.innerText = text.text;
14399
14572
  style.position = 'fixed';
14400
14573
  style.transformOrigin = 'left top';
14401
14574
  style.boxSizing = 'border-box';
14402
- const { scaleX, scaleY } = text.worldTransform;
14403
- this.textScale = Math.max(Math.abs(scaleX), Math.abs(scaleY));
14404
- const fontSize = text.fontSize * this.textScale;
14405
- if (fontSize < 12)
14406
- this.textScale *= 12 / fontSize;
14407
- editor.app.view.appendChild(div);
14575
+ if (this.isHTMLText) {
14576
+ div.innerHTML = text.text;
14577
+ this.textScale = 1;
14578
+ }
14579
+ else {
14580
+ div.innerText = text.text;
14581
+ const { scaleX, scaleY } = text.worldTransform;
14582
+ this.textScale = Math.max(Math.abs(scaleX), Math.abs(scaleY));
14583
+ const fontSize = text.fontSize * this.textScale;
14584
+ if (fontSize < 12)
14585
+ this.textScale *= 12 / fontSize;
14586
+ }
14587
+ const { view } = editor.app;
14588
+ (this.inBody = view instanceof HTMLCanvasElement) ? document.body.appendChild(div) : view.appendChild(div);
14408
14589
  this.eventIds = [
14409
- editor.app.on_(exports.PointerEvent.DOWN, (e) => { if (e.origin.target !== div)
14410
- editor.closeInnerEditor(); })
14590
+ editor.app.on_(exports.PointerEvent.DOWN, (e) => {
14591
+ let { target } = e.origin, find;
14592
+ while (target) {
14593
+ if (target === div)
14594
+ find = true;
14595
+ target = target.parentElement;
14596
+ }
14597
+ if (!find)
14598
+ editor.closeInnerEditor();
14599
+ })
14411
14600
  ];
14412
14601
  this.onFocus = this.onFocus.bind(this);
14413
14602
  this.onInput = this.onInput.bind(this);
@@ -14432,7 +14621,8 @@ ${filterStyle}
14432
14621
  selection.addRange(range);
14433
14622
  }
14434
14623
  onInput() {
14435
- this.editTarget.text = this.editDom.innerText.replace(/\n\n/, '\n');
14624
+ const { editDom } = this;
14625
+ this.editTarget.text = this.isHTMLText ? editDom.innerHTML : editDom.innerText.replace(/\n\n/, '\n');
14436
14626
  }
14437
14627
  onFocus() {
14438
14628
  this.editDom.style.outline = 'none';
@@ -14444,14 +14634,14 @@ ${filterStyle}
14444
14634
  onUpdate() {
14445
14635
  const { editTarget: text, textScale } = this;
14446
14636
  const { style } = this.editDom;
14447
- const { x, y } = text.app.tree.clientBounds;
14637
+ const { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
14448
14638
  const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale);
14449
14639
  style.transform = `matrix(${a},${b},${c},${d},${e},${f})`;
14450
14640
  style.left = x - window.scrollX + 'px';
14451
14641
  style.top = y - window.scrollY + 'px';
14452
14642
  style.width = text.width * textScale + (text.__.__autoWidth ? 20 : 0) + 'px';
14453
14643
  style.height = text.height * textScale + (text.__.__autoHeight ? 20 : 0) + 'px';
14454
- updateStyle(this.editDom, text, this.textScale);
14644
+ this.isHTMLText || updateStyle(this.editDom, text, this.textScale);
14455
14645
  }
14456
14646
  onUnload() {
14457
14647
  const { editTarget: text, editor, editDom: dom } = this;
@@ -14482,11 +14672,13 @@ ${filterStyle}
14482
14672
 
14483
14673
  exports.HTMLText = class HTMLText extends exports.Image {
14484
14674
  get __tag() { return 'HTMLText'; }
14675
+ get editInner() { return 'TextEditor'; }
14485
14676
  constructor(data) {
14486
14677
  super(data);
14487
14678
  }
14488
14679
  __updateBoxBounds() {
14489
- if (this.__.__htmlChanged) {
14680
+ const data = this.__;
14681
+ if (data.__htmlChanged) {
14490
14682
  const div = document.createElement('div');
14491
14683
  const { style } = div;
14492
14684
  style.all = 'initial';
@@ -14495,9 +14687,9 @@ ${filterStyle}
14495
14687
  div.innerHTML = this.text;
14496
14688
  document.body.appendChild(div);
14497
14689
  const { width, height } = div.getBoundingClientRect();
14498
- const italicWidth = 10;
14499
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width + italicWidth}" height="${height}">
14500
- <foreignObject width="${width + italicWidth}" height="${height}">
14690
+ const realWidth = width + 10;
14691
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${realWidth}" height="${height}">
14692
+ <foreignObject width="${realWidth}" height="${height}">
14501
14693
  <style>
14502
14694
  * {
14503
14695
  margin: 0;
@@ -14510,8 +14702,10 @@ ${filterStyle}
14510
14702
  </body>
14511
14703
  </foreignObject>
14512
14704
  </svg>`;
14513
- this.__.__setImageFill('data:image/svg+xml,' + encodeURIComponent(svg));
14514
- this.__.__htmlChanged = false;
14705
+ data.__setImageFill('data:image/svg+xml,' + encodeURIComponent(svg));
14706
+ data.__naturalWidth = realWidth / data.pixelRatio;
14707
+ data.__naturalHeight = height / data.pixelRatio;
14708
+ data.__htmlChanged = false;
14515
14709
  div.remove();
14516
14710
  }
14517
14711
  super.__updateBoxBounds();
@@ -14528,7 +14722,6 @@ ${filterStyle}
14528
14722
  ], exports.HTMLText);
14529
14723
 
14530
14724
  exports.AlignHelper = AlignHelper;
14531
- exports.AnimateEvent = AnimateEvent;
14532
14725
  exports.AroundHelper = AroundHelper;
14533
14726
  exports.ArrowData = ArrowData;
14534
14727
  exports.AutoBounds = AutoBounds;
@@ -14565,6 +14758,7 @@ ${filterStyle}
14565
14758
  exports.EllipseHelper = EllipseHelper;
14566
14759
  exports.Event = Event;
14567
14760
  exports.EventCreator = EventCreator;
14761
+ exports.Eventer = Eventer;
14568
14762
  exports.Export = Export;
14569
14763
  exports.FileHelper = FileHelper;
14570
14764
  exports.FrameData = FrameData;
@@ -14604,6 +14798,9 @@ ${filterStyle}
14604
14798
  exports.Matrix = Matrix;
14605
14799
  exports.MatrixHelper = MatrixHelper;
14606
14800
  exports.MultiTouchHelper = MultiTouchHelper;
14801
+ exports.MyDragEvent = MyDragEvent;
14802
+ exports.MyImage = MyImage;
14803
+ exports.MyPointerEvent = MyPointerEvent;
14607
14804
  exports.NeedConvertToCanvasCommandMap = NeedConvertToCanvasCommandMap;
14608
14805
  exports.OneRadian = OneRadian;
14609
14806
  exports.PI2 = PI2;
@@ -14651,6 +14848,7 @@ ${filterStyle}
14651
14848
  exports.TaskProcessor = TaskProcessor;
14652
14849
  exports.TextConvert = TextConvert;
14653
14850
  exports.TextData = TextData;
14851
+ exports.Transition = Transition;
14654
14852
  exports.TwoPointBoundsHelper = TwoPointBoundsHelper;
14655
14853
  exports.UIBounds = UIBounds;
14656
14854
  exports.UICreator = UICreator;
@@ -14687,10 +14885,11 @@ ${filterStyle}
14687
14885
  exports.getMatrixData = getMatrixData;
14688
14886
  exports.getPointData = getPointData;
14689
14887
  exports.hitType = hitType;
14690
- exports.inviteCode = inviteCode;
14888
+ exports.isNull = isNull;
14691
14889
  exports.layoutProcessor = layoutProcessor;
14692
14890
  exports.maskType = maskType;
14693
14891
  exports.naturalBoundsType = naturalBoundsType;
14892
+ exports.needPlugin = needPlugin;
14694
14893
  exports.opacityType = opacityType;
14695
14894
  exports.pathInputType = pathInputType;
14696
14895
  exports.pathType = pathType;
@@ -14711,7 +14910,6 @@ ${filterStyle}
14711
14910
  exports.scaleResizePoints = scaleResizePoints;
14712
14911
  exports.scaleType = scaleType;
14713
14912
  exports.sortType = sortType;
14714
- exports.stateType = stateType;
14715
14913
  exports.strokeType = strokeType;
14716
14914
  exports.surfaceType = surfaceType;
14717
14915
  exports.tempBounds = tempBounds$1;