@leafer-editor/worker 1.0.5 → 1.0.6

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.
@@ -552,6 +552,12 @@ const PointHelper = {
552
552
  to.y = t.y + sin$4(r) * distance;
553
553
  return to;
554
554
  },
555
+ toNumberPoints(originPoints) {
556
+ let points = originPoints;
557
+ if (typeof originPoints[0] === 'object')
558
+ points = [], originPoints.forEach(p => points.push(p.x, p.y));
559
+ return points;
560
+ },
555
561
  reset(t) {
556
562
  P$7.reset(t);
557
563
  }
@@ -1542,7 +1548,10 @@ const { assign } = DataHelper;
1542
1548
 
1543
1549
  class LeafData {
1544
1550
  get __useNaturalRatio() { return true; }
1545
- get __isLinePath() { return this.path && this.path.length === 6; }
1551
+ get __isLinePath() {
1552
+ const { path } = this;
1553
+ return path && path.length === 6 && path[0] === 1;
1554
+ }
1546
1555
  get __blendMode() {
1547
1556
  if (this.eraser && this.eraser !== 'path')
1548
1557
  return 'destination-out';
@@ -2305,11 +2314,12 @@ const RectHelper = {
2305
2314
 
2306
2315
  const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$4, PI: PI$2, sqrt: sqrt$1, pow } = Math;
2307
2316
  const { setPoint: setPoint$4, addPoint: addPoint$2 } = TwoPointBoundsHelper;
2308
- const { set } = PointHelper;
2317
+ const { set, toNumberPoints: toNumberPoints$1 } = PointHelper;
2309
2318
  const { M: M$8, L: L$9, C: C$8, Q: Q$7, Z: Z$7 } = PathCommandMap;
2310
2319
  const tempPoint$2 = {};
2311
2320
  const BezierHelper = {
2312
- points(data, points, curve, close) {
2321
+ points(data, originPoints, curve, close) {
2322
+ let points = toNumberPoints$1(originPoints);
2313
2323
  data.push(M$8, points[0], points[1]);
2314
2324
  if (curve && points.length > 5) {
2315
2325
  let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
@@ -2818,6 +2828,27 @@ const PathConvert = {
2818
2828
  }
2819
2829
  return data;
2820
2830
  },
2831
+ objectToCanvasData(list) {
2832
+ const data = [];
2833
+ list.forEach(item => {
2834
+ switch (item.name) {
2835
+ case 'M':
2836
+ data.push(M$7, item.x, item.y);
2837
+ break;
2838
+ case 'L':
2839
+ data.push(L$8, item.x, item.y);
2840
+ break;
2841
+ case 'C':
2842
+ data.push(C$7, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
2843
+ break;
2844
+ case 'Q':
2845
+ data.push(Q$6, item.x1, item.y1, item.x, item.y);
2846
+ break;
2847
+ case 'Z': data.push(Z$6);
2848
+ }
2849
+ });
2850
+ return data;
2851
+ },
2821
2852
  copyData(data, old, index, count) {
2822
2853
  for (let i = index, end = index + count; i < end; i++) {
2823
2854
  data.push(old[i]);
@@ -5159,7 +5190,7 @@ const LeafRender = {
5159
5190
  if (this.__worldOpacity) {
5160
5191
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5161
5192
  this.__drawRenderPath(canvas);
5162
- this.__.windingRule ? canvas.clip(this.__.windingRule) : canvas.clip();
5193
+ this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
5163
5194
  }
5164
5195
  },
5165
5196
  __updateWorldOpacity() {
@@ -5676,11 +5707,17 @@ let Branch = class Branch extends Leaf {
5676
5707
  add(child, index) {
5677
5708
  if (child === this)
5678
5709
  return;
5679
- child.__ || (child = UICreator.get(child.tag, child));
5710
+ const noIndex = index === undefined;
5711
+ if (!child.__) {
5712
+ if (child instanceof Array)
5713
+ return child.forEach(item => { this.add(item, index); noIndex || index++; });
5714
+ else
5715
+ child = UICreator.get(child.tag, child);
5716
+ }
5680
5717
  if (child.parent)
5681
5718
  child.parent.remove(child);
5682
5719
  child.parent = this;
5683
- index === undefined ? this.children.push(child) : this.children.splice(index, 0, child);
5720
+ noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
5684
5721
  if (child.isBranch)
5685
5722
  this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
5686
5723
  child.__layout.boxChanged || child.__layout.boxChange();
@@ -5694,9 +5731,7 @@ let Branch = class Branch extends Leaf {
5694
5731
  }
5695
5732
  this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
5696
5733
  }
5697
- addMany(...children) {
5698
- children.forEach(child => this.add(child));
5699
- }
5734
+ addMany(...children) { this.add(children); }
5700
5735
  remove(child, destroy) {
5701
5736
  if (child) {
5702
5737
  if (child.__) {
@@ -5924,7 +5959,7 @@ class LeafLevelList {
5924
5959
  }
5925
5960
  }
5926
5961
 
5927
- const version = "1.0.5";
5962
+ const version = "1.0.6";
5928
5963
 
5929
5964
  class LeaferCanvas extends LeaferCanvasBase {
5930
5965
  get allowBackgroundColor() { return true; }
@@ -6904,6 +6939,13 @@ function zoomLayerType() {
6904
6939
 
6905
6940
  const TextConvert = {};
6906
6941
  const ColorConvert = {};
6942
+ const UnitConvert = {
6943
+ number(value, percentRefer) {
6944
+ if (typeof value === 'object')
6945
+ return value.type === 'percent' ? value.value * percentRefer : value.value;
6946
+ return value;
6947
+ }
6948
+ };
6907
6949
  const PathArrow = {};
6908
6950
  const Paint = {};
6909
6951
  const PaintImage = {};
@@ -6924,7 +6966,7 @@ const Transition = {
6924
6966
  }
6925
6967
  };
6926
6968
 
6927
- const { parse } = PathConvert;
6969
+ const { parse, objectToCanvasData } = PathConvert;
6928
6970
  const emptyPaint = {};
6929
6971
  const debug$5 = Debug.get('UIData');
6930
6972
  class UIData extends LeafData {
@@ -6938,10 +6980,11 @@ class UIData extends LeafData {
6938
6980
  scaleX = -scaleX;
6939
6981
  return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
6940
6982
  }
6941
- else {
6983
+ else
6942
6984
  return strokeWidth;
6943
- }
6944
6985
  }
6986
+ get __hasStroke() { return this.stroke && this.strokeWidth; }
6987
+ get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
6945
6988
  get __autoWidth() { return !this._width; }
6946
6989
  get __autoHeight() { return !this._height; }
6947
6990
  get __autoSide() { return !this._width || !this._height; }
@@ -6958,9 +7001,8 @@ class UIData extends LeafData {
6958
7001
  this.__leaf.scaleX *= -1;
6959
7002
  debug$5.warn('width < 0, instead -scaleX ', this);
6960
7003
  }
6961
- else {
7004
+ else
6962
7005
  this._width = value;
6963
- }
6964
7006
  }
6965
7007
  setHeight(value) {
6966
7008
  if (value < 0) {
@@ -6968,9 +7010,8 @@ class UIData extends LeafData {
6968
7010
  this.__leaf.scaleY *= -1;
6969
7011
  debug$5.warn('height < 0, instead -scaleY', this);
6970
7012
  }
6971
- else {
7013
+ else
6972
7014
  this._height = value;
6973
- }
6974
7015
  }
6975
7016
  setFill(value) {
6976
7017
  if (this.__naturalWidth)
@@ -7011,9 +7052,10 @@ class UIData extends LeafData {
7011
7052
  }
7012
7053
  }
7013
7054
  setPath(value) {
7014
- if (typeof value === 'string') {
7055
+ const isString = typeof value === 'string';
7056
+ if (isString || (value && typeof value[0] === 'object')) {
7015
7057
  this.__setInput('path', value);
7016
- this._path = parse(value);
7058
+ this._path = isString ? parse(value) : objectToCanvasData(value);
7017
7059
  }
7018
7060
  else {
7019
7061
  if (this.__input)
@@ -7028,12 +7070,8 @@ class UIData extends LeafData {
7028
7070
  value = value.filter((item) => item.visible !== false);
7029
7071
  this._shadow = value.length ? value : null;
7030
7072
  }
7031
- else if (value) {
7032
- this._shadow = value.visible === false ? null : [value];
7033
- }
7034
- else {
7035
- this._shadow = null;
7036
- }
7073
+ else
7074
+ this._shadow = value && value.visible !== false ? [value] : null;
7037
7075
  }
7038
7076
  setInnerShadow(value) {
7039
7077
  this.__setInput('innerShadow', value);
@@ -7042,12 +7080,8 @@ class UIData extends LeafData {
7042
7080
  value = value.filter((item) => item.visible !== false);
7043
7081
  this._innerShadow = value.length ? value : null;
7044
7082
  }
7045
- else if (value) {
7046
- this._innerShadow = value.visible === false ? null : [value];
7047
- }
7048
- else {
7049
- this._innerShadow = null;
7050
- }
7083
+ else
7084
+ this._innerShadow = value && value.visible !== false ? [value] : null;
7051
7085
  }
7052
7086
  __computePaint() {
7053
7087
  const { fill, stroke } = this.__input;
@@ -7058,24 +7092,19 @@ class UIData extends LeafData {
7058
7092
  this.__needComputePaint = false;
7059
7093
  }
7060
7094
  }
7061
- const UnitConvert = {
7062
- number(value, percentRefer) {
7063
- if (typeof value === 'object')
7064
- return value.type === 'percent' ? value.value * percentRefer : value.value;
7065
- return value;
7066
- }
7067
- };
7068
7095
 
7069
7096
  class GroupData extends UIData {
7070
7097
  }
7071
7098
 
7072
7099
  class BoxData extends GroupData {
7073
7100
  get __boxStroke() { return !this.__pathInputed; }
7101
+ get __drawAfterFill() { return this.overflow === 'hide' && this.__clipAfterFill && this.__leaf.children.length; }
7102
+ get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
7074
7103
  }
7075
7104
 
7076
7105
  class LeaferData extends GroupData {
7077
- __getInputData() {
7078
- const data = super.__getInputData();
7106
+ __getInputData(names, options) {
7107
+ const data = super.__getInputData(names, options);
7079
7108
  canvasSizeAttrs.forEach(key => delete data[key]);
7080
7109
  return data;
7081
7110
  }
@@ -7102,6 +7131,7 @@ class StarData extends UIData {
7102
7131
  }
7103
7132
 
7104
7133
  class PathData extends UIData {
7134
+ get __pathInputed() { return 2; }
7105
7135
  }
7106
7136
 
7107
7137
  class PenData extends GroupData {
@@ -7148,16 +7178,18 @@ class ImageData extends RectData {
7148
7178
  delete data.fill;
7149
7179
  return data;
7150
7180
  }
7151
- __getInputData() {
7152
- const data = super.__getInputData();
7181
+ __getInputData(names, options) {
7182
+ const data = super.__getInputData(names, options);
7153
7183
  delete data.fill;
7154
7184
  return data;
7155
7185
  }
7156
7186
  }
7157
7187
 
7158
7188
  class CanvasData extends RectData {
7159
- __getInputData() {
7160
- const data = super.__getInputData();
7189
+ get __isCanvas() { return true; }
7190
+ get __drawAfterFill() { return true; }
7191
+ __getInputData(names, options) {
7192
+ const data = super.__getInputData(names, options);
7161
7193
  data.url = this.__leaf.canvas.toDataURL('image/png');
7162
7194
  return data;
7163
7195
  }
@@ -7184,16 +7216,12 @@ const UIBounds = {
7184
7216
  let width = 0;
7185
7217
  const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7186
7218
  if (shadow)
7187
- shadow.forEach(item => {
7188
- width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5);
7189
- });
7219
+ shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
7190
7220
  if (blur)
7191
7221
  width = Math.max(width, blur);
7192
7222
  let shapeWidth = width = Math.ceil(width);
7193
7223
  if (innerShadow)
7194
- innerShadow.forEach(item => {
7195
- shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5);
7196
- });
7224
+ innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
7197
7225
  if (backgroundBlur)
7198
7226
  shapeWidth = Math.max(shapeWidth, backgroundBlur);
7199
7227
  this.__layout.renderShapeSpread = shapeWidth;
@@ -7275,6 +7303,16 @@ const UIRender = {
7275
7303
  if (stroke && !ignoreStroke)
7276
7304
  this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7277
7305
  }
7306
+ },
7307
+ __drawAfterFill(canvas, options) {
7308
+ if (this.__.__clipAfterFill) {
7309
+ canvas.save();
7310
+ this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
7311
+ this.__drawContent(canvas, options);
7312
+ canvas.restore();
7313
+ }
7314
+ else
7315
+ this.__drawContent(canvas, options);
7278
7316
  }
7279
7317
  };
7280
7318
  function drawFast(ui, canvas, options) {
@@ -7341,8 +7379,8 @@ let UI = UI_1 = class UI extends Leaf {
7341
7379
  return pen;
7342
7380
  }
7343
7381
  get editConfig() { return undefined; }
7344
- get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
7345
- get editInner() { return 'PathEditor'; }
7382
+ get editOuter() { return ''; }
7383
+ get editInner() { return ''; }
7346
7384
  constructor(data) {
7347
7385
  super(data);
7348
7386
  }
@@ -7353,9 +7391,8 @@ let UI = UI_1 = class UI extends Leaf {
7353
7391
  Object.assign(this, data);
7354
7392
  this.lockNormalStyle = false;
7355
7393
  }
7356
- else {
7394
+ else
7357
7395
  Object.assign(this, data);
7358
- }
7359
7396
  }
7360
7397
  get(name) {
7361
7398
  return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
@@ -7657,23 +7694,13 @@ let Group = class Group extends UI {
7657
7694
  if (data.children) {
7658
7695
  const { children } = data;
7659
7696
  delete data.children;
7660
- if (!this.children) {
7661
- this.__setBranch();
7662
- }
7663
- else {
7664
- this.clear();
7665
- }
7697
+ this.children ? this.clear() : this.__setBranch();
7666
7698
  super.set(data, isTemp);
7667
- let child;
7668
- children.forEach(childData => {
7669
- child = childData.__ ? childData : UICreator.get(childData.tag, childData);
7670
- this.add(child);
7671
- });
7699
+ children.forEach(child => this.add(child));
7672
7700
  data.children = children;
7673
7701
  }
7674
- else {
7702
+ else
7675
7703
  super.set(data, isTemp);
7676
- }
7677
7704
  }
7678
7705
  toJSON(options) {
7679
7706
  const data = super.toJSON(options);
@@ -8105,9 +8132,7 @@ let Box = class Box extends Group {
8105
8132
  }
8106
8133
  __updateStrokeSpread() { return 0; }
8107
8134
  __updateRectRenderSpread() { return 0; }
8108
- __updateRenderSpread() {
8109
- return this.__updateRectRenderSpread() || -1;
8110
- }
8135
+ __updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
8111
8136
  __updateRectBoxBounds() { }
8112
8137
  __updateBoxBounds(_secondLayout) {
8113
8138
  const data = this.__;
@@ -8127,13 +8152,11 @@ let Box = class Box extends Group {
8127
8152
  }
8128
8153
  this.__updateNaturalSize();
8129
8154
  }
8130
- else {
8155
+ else
8131
8156
  this.__updateRectBoxBounds();
8132
- }
8133
8157
  }
8134
- else {
8158
+ else
8135
8159
  this.__updateRectBoxBounds();
8136
- }
8137
8160
  }
8138
8161
  __updateStrokeBounds() { }
8139
8162
  __updateRenderBounds() {
@@ -8143,14 +8166,13 @@ let Box = class Box extends Group {
8143
8166
  super.__updateRenderBounds();
8144
8167
  copy$6(childrenRenderBounds, renderBounds);
8145
8168
  this.__updateRectRenderBounds();
8146
- isOverflow = !includes$1(renderBounds, childrenRenderBounds) || !this.pathInputed || !this.__.cornerRadius;
8169
+ isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8170
+ if (isOverflow && this.__.overflow !== 'hide')
8171
+ add(renderBounds, childrenRenderBounds);
8147
8172
  }
8148
- else {
8173
+ else
8149
8174
  this.__updateRectRenderBounds();
8150
- }
8151
- this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8152
- if (!(this.__.__drawAfterFill = this.__.overflow === 'hide') && isOverflow)
8153
- add(renderBounds, childrenRenderBounds);
8175
+ !this.isOverflow !== !isOverflow && (this.isOverflow = isOverflow);
8154
8176
  }
8155
8177
  __updateRectRenderBounds() { }
8156
8178
  __updateRectChange() { }
@@ -8170,20 +8192,9 @@ let Box = class Box extends Group {
8170
8192
  this.__renderGroup(canvas, options);
8171
8193
  }
8172
8194
  }
8173
- __drawAfterFill(canvas, options) {
8174
- const { length } = this.children;
8175
- if (this.isOverflow) {
8176
- canvas.save();
8177
- canvas.clip();
8178
- if (length)
8179
- this.__renderGroup(canvas, options);
8180
- canvas.restore();
8181
- }
8182
- else {
8183
- if (length)
8184
- this.__renderGroup(canvas, options);
8185
- }
8186
- if (this.__.stroke && length) {
8195
+ __drawContent(canvas, options) {
8196
+ this.__renderGroup(canvas, options);
8197
+ if (this.__.__hasStroke) {
8187
8198
  canvas.setWorld(this.__nowWorld);
8188
8199
  this.__drawRenderPath(canvas);
8189
8200
  }
@@ -8347,17 +8358,15 @@ let Line = class Line extends UI {
8347
8358
  if (data.__useArrow)
8348
8359
  PathArrow.addArrows(this, false);
8349
8360
  }
8350
- else {
8361
+ else
8351
8362
  super.__updateRenderPath();
8352
- }
8353
8363
  }
8354
8364
  __updateBoxBounds() {
8355
8365
  if (this.points) {
8356
8366
  toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
8357
8367
  }
8358
- else {
8368
+ else
8359
8369
  super.__updateBoxBounds();
8360
- }
8361
8370
  }
8362
8371
  };
8363
8372
  __decorate([
@@ -8495,7 +8504,6 @@ let Canvas = class Canvas extends Rect {
8495
8504
  super(data);
8496
8505
  this.canvas = Creator.canvas(this.__);
8497
8506
  this.context = this.canvas.context;
8498
- this.__.__isCanvas = this.__.__drawAfterFill = true;
8499
8507
  if (data && data.url)
8500
8508
  this.drawImage(data.url);
8501
8509
  }
@@ -8508,8 +8516,7 @@ let Canvas = class Canvas extends Rect {
8508
8516
  });
8509
8517
  }
8510
8518
  draw(ui, offset, scale, rotation) {
8511
- ui.__layout.update();
8512
- const matrix = new Matrix(ui.__world).invert();
8519
+ const matrix = new Matrix(ui.worldTransform).invert();
8513
8520
  const m = new Matrix();
8514
8521
  if (offset)
8515
8522
  m.translate(offset.x, offset.y);
@@ -8524,17 +8531,9 @@ let Canvas = class Canvas extends Rect {
8524
8531
  paint() {
8525
8532
  this.forceRender();
8526
8533
  }
8527
- __drawAfterFill(canvas, _options) {
8528
- const { width, height, cornerRadius } = this.__, { view } = this.canvas;
8529
- if (cornerRadius || this.pathInputed) {
8530
- canvas.save();
8531
- canvas.clip();
8532
- canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8533
- canvas.restore();
8534
- }
8535
- else {
8536
- canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8537
- }
8534
+ __drawContent(canvas, _options) {
8535
+ const { width, height } = this.__, { view } = this.canvas;
8536
+ canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8538
8537
  }
8539
8538
  __updateSize() {
8540
8539
  const { canvas } = this;
@@ -8578,7 +8577,6 @@ Canvas = __decorate([
8578
8577
  const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
8579
8578
  let Text = class Text extends UI {
8580
8579
  get __tag() { return 'Text'; }
8581
- get editInner() { return 'TextEditor'; }
8582
8580
  get textDrawData() {
8583
8581
  this.__layout.update();
8584
8582
  return this.__.__textDrawData;
@@ -8744,7 +8742,6 @@ let Path = class Path extends UI {
8744
8742
  get __tag() { return 'Path'; }
8745
8743
  constructor(data) {
8746
8744
  super(data);
8747
- this.__.__pathInputed = 2;
8748
8745
  }
8749
8746
  };
8750
8747
  __decorate([
@@ -8827,21 +8824,17 @@ let App = class App extends Leafer {
8827
8824
  this.tree = this.addLeafer(tree);
8828
8825
  if (sky || editor)
8829
8826
  this.sky = this.addLeafer(sky || { type: 'draw', usePartRender: false });
8830
- if (editor) {
8831
- this.editor = Creator.editor(editor);
8832
- this.sky.add(this.editor);
8833
- }
8827
+ if (editor)
8828
+ this.sky.add(this.editor = Creator.editor(editor));
8834
8829
  }
8835
8830
  }
8836
8831
  __setApp() {
8837
8832
  const { canvas } = this;
8838
8833
  const { realCanvas, view } = this.config;
8839
- if (realCanvas || view === this.canvas.view || !canvas.parentView) {
8834
+ if (realCanvas || view === this.canvas.view || !canvas.parentView)
8840
8835
  this.realCanvas = true;
8841
- }
8842
- else {
8836
+ else
8843
8837
  canvas.unrealCanvas();
8844
- }
8845
8838
  this.leafer = this;
8846
8839
  this.watcher.disable();
8847
8840
  this.layouter.disable();
@@ -9247,10 +9240,7 @@ leafer.initType = function (type) {
9247
9240
  leafer.getValidMove = function (moveX, moveY) {
9248
9241
  const { scroll, disabled } = this.app.config.move;
9249
9242
  if (scroll) {
9250
- if (Math.abs(moveX) > Math.abs(moveY))
9251
- moveY = 0;
9252
- else
9253
- moveX = 0;
9243
+ Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
9254
9244
  if (scroll === 'limit') {
9255
9245
  const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
9256
9246
  const right = x + width - this.width, bottom = y + height - this.height;
@@ -10982,7 +10972,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
10982
10972
  }
10983
10973
  if (allowPaint) {
10984
10974
  canvas.save();
10985
- canvas.clip();
10975
+ ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
10986
10976
  if (paint.blendMode)
10987
10977
  canvas.blendMode = paint.blendMode;
10988
10978
  if (data.opacity)
@@ -12183,8 +12173,9 @@ function scaleResizePath(leaf, scaleX, scaleY) {
12183
12173
  leaf.path = leaf.__.path;
12184
12174
  }
12185
12175
  function scaleResizePoints(leaf, scaleX, scaleY) {
12186
- PathScaler.scalePoints(leaf.__.points, scaleX, scaleY);
12187
- leaf.points = leaf.__.points;
12176
+ const { points } = leaf;
12177
+ typeof points[0] === 'object' ? points.forEach(p => { p.x *= scaleX, p.y *= scaleY; }) : PathScaler.scalePoints(points, scaleX, scaleY);
12178
+ leaf.points = points;
12188
12179
  }
12189
12180
  function scaleResizeGroup(group, scaleX, scaleY) {
12190
12181
  const { children } = group;
@@ -13847,7 +13838,8 @@ class Editor extends Group {
13847
13838
  this.simulateTarget.destroy();
13848
13839
  Object.values(this.editToolList).forEach(item => item.destroy());
13849
13840
  this.editToolList = {};
13850
- this.target = this.hoverTarget = this.simulateTarget = this.editTool = this.innerEditor = null;
13841
+ this.target = this.hoverTarget = null;
13842
+ this.simulateTarget = this.editTool = this.innerEditor = null;
13851
13843
  super.destroy();
13852
13844
  }
13853
13845
  }
@@ -13979,7 +13971,7 @@ EditTool = __decorate([
13979
13971
  ], EditTool);
13980
13972
 
13981
13973
  const { left, right } = Direction9;
13982
- const { move, copy: copy$1 } = PointHelper;
13974
+ const { move, copy: copy$1, toNumberPoints } = PointHelper;
13983
13975
  let LineEditTool = class LineEditTool extends EditTool {
13984
13976
  constructor() {
13985
13977
  super(...arguments);
@@ -14021,14 +14013,8 @@ let LineEditTool = class LineEditTool extends EditTool {
14021
14013
  }
14022
14014
  getInnerMove(ui, event, lockRatio) {
14023
14015
  const movePoint = event.getInnerMove(ui);
14024
- if (lockRatio) {
14025
- if (Math.abs(movePoint.x) > Math.abs(movePoint.y)) {
14026
- movePoint.y = 0;
14027
- }
14028
- else {
14029
- movePoint.x = 0;
14030
- }
14031
- }
14016
+ if (lockRatio)
14017
+ Math.abs(movePoint.x) > Math.abs(movePoint.y) ? movePoint.y = 0 : movePoint.x = 0;
14032
14018
  return movePoint;
14033
14019
  }
14034
14020
  getFromToByPath(path) {
@@ -14037,7 +14023,8 @@ let LineEditTool = class LineEditTool extends EditTool {
14037
14023
  to: { x: path[4], y: path[5] }
14038
14024
  };
14039
14025
  }
14040
- getFromToByPoints(points) {
14026
+ getFromToByPoints(originPoints) {
14027
+ const points = toNumberPoints(originPoints);
14041
14028
  return {
14042
14029
  from: { x: points[0], y: points[1] },
14043
14030
  to: { x: points[2], y: points[3] }
@@ -14090,6 +14077,15 @@ LineEditTool = __decorate([
14090
14077
  ], LineEditTool);
14091
14078
 
14092
14079
  Creator.editor = function (options) { return new Editor(options); };
14080
+ defineKey(UI.prototype, 'editOuter', {
14081
+ get() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
14082
+ });
14083
+ defineKey(UI.prototype, 'editInner', {
14084
+ get() { return 'PathEditor'; }
14085
+ });
14086
+ defineKey(Text.prototype, 'editInner', {
14087
+ get() { return 'TextEditor'; }
14088
+ });
14093
14089
  UI.setEditConfig = function (config) {
14094
14090
  defineKey(this.prototype, 'editConfig', {
14095
14091
  get() { return typeof config === 'function' ? config(this) : config; }