@leafer-ui/worker 1.0.5 → 1.0.7

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
@@ -555,6 +555,12 @@ var LeaferUI = (function (exports) {
555
555
  to.y = t.y + sin$4(r) * distance;
556
556
  return to;
557
557
  },
558
+ toNumberPoints(originPoints) {
559
+ let points = originPoints;
560
+ if (typeof originPoints[0] === 'object')
561
+ points = [], originPoints.forEach(p => points.push(p.x, p.y));
562
+ return points;
563
+ },
558
564
  reset(t) {
559
565
  P$5.reset(t);
560
566
  }
@@ -1545,7 +1551,10 @@ var LeaferUI = (function (exports) {
1545
1551
 
1546
1552
  class LeafData {
1547
1553
  get __useNaturalRatio() { return true; }
1548
- get __isLinePath() { return this.path && this.path.length === 6; }
1554
+ get __isLinePath() {
1555
+ const { path } = this;
1556
+ return path && path.length === 6 && path[0] === 1;
1557
+ }
1549
1558
  get __blendMode() {
1550
1559
  if (this.eraser && this.eraser !== 'path')
1551
1560
  return 'destination-out';
@@ -2308,11 +2317,12 @@ var LeaferUI = (function (exports) {
2308
2317
 
2309
2318
  const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
2310
2319
  const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
2311
- const { set } = PointHelper;
2320
+ const { set, toNumberPoints } = PointHelper;
2312
2321
  const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
2313
2322
  const tempPoint$2 = {};
2314
2323
  const BezierHelper = {
2315
- points(data, points, curve, close) {
2324
+ points(data, originPoints, curve, close) {
2325
+ let points = toNumberPoints(originPoints);
2316
2326
  data.push(M$5, points[0], points[1]);
2317
2327
  if (curve && points.length > 5) {
2318
2328
  let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
@@ -2821,6 +2831,27 @@ var LeaferUI = (function (exports) {
2821
2831
  }
2822
2832
  return data;
2823
2833
  },
2834
+ objectToCanvasData(list) {
2835
+ const data = [];
2836
+ list.forEach(item => {
2837
+ switch (item.name) {
2838
+ case 'M':
2839
+ data.push(M$4, item.x, item.y);
2840
+ break;
2841
+ case 'L':
2842
+ data.push(L$5, item.x, item.y);
2843
+ break;
2844
+ case 'C':
2845
+ data.push(C$4, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
2846
+ break;
2847
+ case 'Q':
2848
+ data.push(Q$3, item.x1, item.y1, item.x, item.y);
2849
+ break;
2850
+ case 'Z': data.push(Z$4);
2851
+ }
2852
+ });
2853
+ return data;
2854
+ },
2824
2855
  copyData(data, old, index, count) {
2825
2856
  for (let i = index, end = index + count; i < end; i++) {
2826
2857
  data.push(old[i]);
@@ -4398,13 +4429,10 @@ var LeaferUI = (function (exports) {
4398
4429
  update() {
4399
4430
  const { leafer } = this.leaf;
4400
4431
  if (leafer) {
4401
- if (leafer.ready) {
4402
- if (leafer.watcher.changed)
4403
- leafer.layouter.layout();
4404
- }
4405
- else {
4432
+ if (leafer.ready)
4433
+ leafer.watcher.changed && leafer.layouter.layout();
4434
+ else
4406
4435
  leafer.start();
4407
- }
4408
4436
  }
4409
4437
  else {
4410
4438
  let root = this.leaf;
@@ -5162,7 +5190,7 @@ var LeaferUI = (function (exports) {
5162
5190
  if (this.__worldOpacity) {
5163
5191
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5164
5192
  this.__drawRenderPath(canvas);
5165
- this.__.windingRule ? canvas.clip(this.__.windingRule) : canvas.clip();
5193
+ this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
5166
5194
  }
5167
5195
  },
5168
5196
  __updateWorldOpacity() {
@@ -5679,11 +5707,17 @@ var LeaferUI = (function (exports) {
5679
5707
  add(child, index) {
5680
5708
  if (child === this)
5681
5709
  return;
5682
- 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
+ }
5683
5717
  if (child.parent)
5684
5718
  child.parent.remove(child);
5685
5719
  child.parent = this;
5686
- index === undefined ? this.children.push(child) : this.children.splice(index, 0, child);
5720
+ noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
5687
5721
  if (child.isBranch)
5688
5722
  this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
5689
5723
  child.__layout.boxChanged || child.__layout.boxChange();
@@ -5697,9 +5731,7 @@ var LeaferUI = (function (exports) {
5697
5731
  }
5698
5732
  this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
5699
5733
  }
5700
- addMany(...children) {
5701
- children.forEach(child => this.add(child));
5702
- }
5734
+ addMany(...children) { this.add(children); }
5703
5735
  remove(child, destroy) {
5704
5736
  if (child) {
5705
5737
  if (child.__) {
@@ -5927,7 +5959,7 @@ var LeaferUI = (function (exports) {
5927
5959
  }
5928
5960
  }
5929
5961
 
5930
- const version = "1.0.5";
5962
+ const version = "1.0.7";
5931
5963
 
5932
5964
  class LeaferCanvas extends LeaferCanvasBase {
5933
5965
  get allowBackgroundColor() { return true; }
@@ -6646,7 +6678,8 @@ var LeaferUI = (function (exports) {
6646
6678
  path.add(leaf);
6647
6679
  leaf = leaf.parent;
6648
6680
  }
6649
- path.add(this.target);
6681
+ if (this.target)
6682
+ path.add(this.target);
6650
6683
  return path;
6651
6684
  }
6652
6685
  getHitablePath(leaf) {
@@ -6732,8 +6765,8 @@ var LeaferUI = (function (exports) {
6732
6765
  this.innerIdMap = {};
6733
6766
  this.idMap = {};
6734
6767
  this.methods = {
6735
- id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
6736
- innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
6768
+ id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
6769
+ innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
6737
6770
  className: (leaf, name) => leaf.className === name ? 1 : 0,
6738
6771
  tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
6739
6772
  tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
@@ -6742,7 +6775,8 @@ var LeaferUI = (function (exports) {
6742
6775
  if (userConfig)
6743
6776
  this.config = DataHelper.default(userConfig, this.config);
6744
6777
  this.picker = new Picker(target, this);
6745
- this.__listenEvents();
6778
+ if (target)
6779
+ this.__listenEvents();
6746
6780
  }
6747
6781
  getBy(condition, branch, one, options) {
6748
6782
  switch (typeof condition) {
@@ -6777,7 +6811,7 @@ var LeaferUI = (function (exports) {
6777
6811
  }
6778
6812
  }
6779
6813
  getByPoint(hitPoint, hitRadius, options) {
6780
- if (Platform.name === 'node')
6814
+ if (Platform.name === 'node' && this.target)
6781
6815
  this.target.emit(LayoutEvent.CHECK_UPDATE);
6782
6816
  return this.picker.getByPoint(hitPoint, hitRadius, options);
6783
6817
  }
@@ -6907,6 +6941,13 @@ var LeaferUI = (function (exports) {
6907
6941
 
6908
6942
  const TextConvert = {};
6909
6943
  const ColorConvert = {};
6944
+ const UnitConvert = {
6945
+ number(value, percentRefer) {
6946
+ if (typeof value === 'object')
6947
+ return value.type === 'percent' ? value.value * percentRefer : value.value;
6948
+ return value;
6949
+ }
6950
+ };
6910
6951
  const PathArrow = {};
6911
6952
  const Paint = {};
6912
6953
  const PaintImage = {};
@@ -6927,7 +6968,7 @@ var LeaferUI = (function (exports) {
6927
6968
  }
6928
6969
  };
6929
6970
 
6930
- const { parse } = PathConvert;
6971
+ const { parse, objectToCanvasData } = PathConvert;
6931
6972
  const emptyPaint = {};
6932
6973
  const debug$4 = Debug.get('UIData');
6933
6974
  class UIData extends LeafData {
@@ -6941,10 +6982,11 @@ var LeaferUI = (function (exports) {
6941
6982
  scaleX = -scaleX;
6942
6983
  return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
6943
6984
  }
6944
- else {
6985
+ else
6945
6986
  return strokeWidth;
6946
- }
6947
6987
  }
6988
+ get __hasStroke() { return this.stroke && this.strokeWidth; }
6989
+ get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
6948
6990
  get __autoWidth() { return !this._width; }
6949
6991
  get __autoHeight() { return !this._height; }
6950
6992
  get __autoSide() { return !this._width || !this._height; }
@@ -6961,9 +7003,8 @@ var LeaferUI = (function (exports) {
6961
7003
  this.__leaf.scaleX *= -1;
6962
7004
  debug$4.warn('width < 0, instead -scaleX ', this);
6963
7005
  }
6964
- else {
7006
+ else
6965
7007
  this._width = value;
6966
- }
6967
7008
  }
6968
7009
  setHeight(value) {
6969
7010
  if (value < 0) {
@@ -6971,9 +7012,8 @@ var LeaferUI = (function (exports) {
6971
7012
  this.__leaf.scaleY *= -1;
6972
7013
  debug$4.warn('height < 0, instead -scaleY', this);
6973
7014
  }
6974
- else {
7015
+ else
6975
7016
  this._height = value;
6976
- }
6977
7017
  }
6978
7018
  setFill(value) {
6979
7019
  if (this.__naturalWidth)
@@ -7014,9 +7054,10 @@ var LeaferUI = (function (exports) {
7014
7054
  }
7015
7055
  }
7016
7056
  setPath(value) {
7017
- if (typeof value === 'string') {
7057
+ const isString = typeof value === 'string';
7058
+ if (isString || (value && typeof value[0] === 'object')) {
7018
7059
  this.__setInput('path', value);
7019
- this._path = parse(value);
7060
+ this._path = isString ? parse(value) : objectToCanvasData(value);
7020
7061
  }
7021
7062
  else {
7022
7063
  if (this.__input)
@@ -7031,12 +7072,8 @@ var LeaferUI = (function (exports) {
7031
7072
  value = value.filter((item) => item.visible !== false);
7032
7073
  this._shadow = value.length ? value : null;
7033
7074
  }
7034
- else if (value) {
7035
- this._shadow = value.visible === false ? null : [value];
7036
- }
7037
- else {
7038
- this._shadow = null;
7039
- }
7075
+ else
7076
+ this._shadow = value && value.visible !== false ? [value] : null;
7040
7077
  }
7041
7078
  setInnerShadow(value) {
7042
7079
  this.__setInput('innerShadow', value);
@@ -7045,12 +7082,8 @@ var LeaferUI = (function (exports) {
7045
7082
  value = value.filter((item) => item.visible !== false);
7046
7083
  this._innerShadow = value.length ? value : null;
7047
7084
  }
7048
- else if (value) {
7049
- this._innerShadow = value.visible === false ? null : [value];
7050
- }
7051
- else {
7052
- this._innerShadow = null;
7053
- }
7085
+ else
7086
+ this._innerShadow = value && value.visible !== false ? [value] : null;
7054
7087
  }
7055
7088
  __computePaint() {
7056
7089
  const { fill, stroke } = this.__input;
@@ -7061,24 +7094,19 @@ var LeaferUI = (function (exports) {
7061
7094
  this.__needComputePaint = false;
7062
7095
  }
7063
7096
  }
7064
- const UnitConvert = {
7065
- number(value, percentRefer) {
7066
- if (typeof value === 'object')
7067
- return value.type === 'percent' ? value.value * percentRefer : value.value;
7068
- return value;
7069
- }
7070
- };
7071
7097
 
7072
7098
  class GroupData extends UIData {
7073
7099
  }
7074
7100
 
7075
7101
  class BoxData extends GroupData {
7076
7102
  get __boxStroke() { return !this.__pathInputed; }
7103
+ get __drawAfterFill() { return this.overflow === 'hide' && this.__clipAfterFill && this.__leaf.children.length; }
7104
+ get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
7077
7105
  }
7078
7106
 
7079
7107
  class LeaferData extends GroupData {
7080
- __getInputData() {
7081
- const data = super.__getInputData();
7108
+ __getInputData(names, options) {
7109
+ const data = super.__getInputData(names, options);
7082
7110
  canvasSizeAttrs.forEach(key => delete data[key]);
7083
7111
  return data;
7084
7112
  }
@@ -7105,6 +7133,7 @@ var LeaferUI = (function (exports) {
7105
7133
  }
7106
7134
 
7107
7135
  class PathData extends UIData {
7136
+ get __pathInputed() { return 2; }
7108
7137
  }
7109
7138
 
7110
7139
  class PenData extends GroupData {
@@ -7151,16 +7180,18 @@ var LeaferUI = (function (exports) {
7151
7180
  delete data.fill;
7152
7181
  return data;
7153
7182
  }
7154
- __getInputData() {
7155
- const data = super.__getInputData();
7183
+ __getInputData(names, options) {
7184
+ const data = super.__getInputData(names, options);
7156
7185
  delete data.fill;
7157
7186
  return data;
7158
7187
  }
7159
7188
  }
7160
7189
 
7161
7190
  class CanvasData extends RectData {
7162
- __getInputData() {
7163
- const data = super.__getInputData();
7191
+ get __isCanvas() { return true; }
7192
+ get __drawAfterFill() { return true; }
7193
+ __getInputData(names, options) {
7194
+ const data = super.__getInputData(names, options);
7164
7195
  data.url = this.__leaf.canvas.toDataURL('image/png');
7165
7196
  return data;
7166
7197
  }
@@ -7187,16 +7218,12 @@ var LeaferUI = (function (exports) {
7187
7218
  let width = 0;
7188
7219
  const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7189
7220
  if (shadow)
7190
- shadow.forEach(item => {
7191
- width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5);
7192
- });
7221
+ 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));
7193
7222
  if (blur)
7194
7223
  width = Math.max(width, blur);
7195
7224
  let shapeWidth = width = Math.ceil(width);
7196
7225
  if (innerShadow)
7197
- innerShadow.forEach(item => {
7198
- shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5);
7199
- });
7226
+ 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));
7200
7227
  if (backgroundBlur)
7201
7228
  shapeWidth = Math.max(shapeWidth, backgroundBlur);
7202
7229
  this.__layout.renderShapeSpread = shapeWidth;
@@ -7278,6 +7305,16 @@ var LeaferUI = (function (exports) {
7278
7305
  if (stroke && !ignoreStroke)
7279
7306
  this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7280
7307
  }
7308
+ },
7309
+ __drawAfterFill(canvas, options) {
7310
+ if (this.__.__clipAfterFill) {
7311
+ canvas.save();
7312
+ this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
7313
+ this.__drawContent(canvas, options);
7314
+ canvas.restore();
7315
+ }
7316
+ else
7317
+ this.__drawContent(canvas, options);
7281
7318
  }
7282
7319
  };
7283
7320
  function drawFast(ui, canvas, options) {
@@ -7344,8 +7381,8 @@ var LeaferUI = (function (exports) {
7344
7381
  return pen;
7345
7382
  }
7346
7383
  get editConfig() { return undefined; }
7347
- get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
7348
- get editInner() { return 'PathEditor'; }
7384
+ get editOuter() { return ''; }
7385
+ get editInner() { return ''; }
7349
7386
  constructor(data) {
7350
7387
  super(data);
7351
7388
  }
@@ -7356,9 +7393,8 @@ var LeaferUI = (function (exports) {
7356
7393
  Object.assign(this, data);
7357
7394
  this.lockNormalStyle = false;
7358
7395
  }
7359
- else {
7396
+ else
7360
7397
  Object.assign(this, data);
7361
- }
7362
7398
  }
7363
7399
  get(name) {
7364
7400
  return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
@@ -7660,23 +7696,13 @@ var LeaferUI = (function (exports) {
7660
7696
  if (data.children) {
7661
7697
  const { children } = data;
7662
7698
  delete data.children;
7663
- if (!this.children) {
7664
- this.__setBranch();
7665
- }
7666
- else {
7667
- this.clear();
7668
- }
7699
+ this.children ? this.clear() : this.__setBranch();
7669
7700
  super.set(data, isTemp);
7670
- let child;
7671
- children.forEach(childData => {
7672
- child = childData.__ ? childData : UICreator.get(childData.tag, childData);
7673
- this.add(child);
7674
- });
7701
+ children.forEach(child => this.add(child));
7675
7702
  data.children = children;
7676
7703
  }
7677
- else {
7704
+ else
7678
7705
  super.set(data, isTemp);
7679
- }
7680
7706
  }
7681
7707
  toJSON(options) {
7682
7708
  const data = super.toJSON(options);
@@ -8108,9 +8134,7 @@ var LeaferUI = (function (exports) {
8108
8134
  }
8109
8135
  __updateStrokeSpread() { return 0; }
8110
8136
  __updateRectRenderSpread() { return 0; }
8111
- __updateRenderSpread() {
8112
- return this.__updateRectRenderSpread() || -1;
8113
- }
8137
+ __updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
8114
8138
  __updateRectBoxBounds() { }
8115
8139
  __updateBoxBounds(_secondLayout) {
8116
8140
  const data = this.__;
@@ -8130,13 +8154,11 @@ var LeaferUI = (function (exports) {
8130
8154
  }
8131
8155
  this.__updateNaturalSize();
8132
8156
  }
8133
- else {
8157
+ else
8134
8158
  this.__updateRectBoxBounds();
8135
- }
8136
8159
  }
8137
- else {
8160
+ else
8138
8161
  this.__updateRectBoxBounds();
8139
- }
8140
8162
  }
8141
8163
  __updateStrokeBounds() { }
8142
8164
  __updateRenderBounds() {
@@ -8146,14 +8168,13 @@ var LeaferUI = (function (exports) {
8146
8168
  super.__updateRenderBounds();
8147
8169
  copy$3(childrenRenderBounds, renderBounds);
8148
8170
  this.__updateRectRenderBounds();
8149
- isOverflow = !includes$1(renderBounds, childrenRenderBounds) || !this.pathInputed || !this.__.cornerRadius;
8171
+ isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8172
+ if (isOverflow && this.__.overflow !== 'hide')
8173
+ add(renderBounds, childrenRenderBounds);
8150
8174
  }
8151
- else {
8175
+ else
8152
8176
  this.__updateRectRenderBounds();
8153
- }
8154
- this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8155
- if (!(this.__.__drawAfterFill = this.__.overflow === 'hide') && isOverflow)
8156
- add(renderBounds, childrenRenderBounds);
8177
+ !this.isOverflow !== !isOverflow && (this.isOverflow = isOverflow);
8157
8178
  }
8158
8179
  __updateRectRenderBounds() { }
8159
8180
  __updateRectChange() { }
@@ -8173,20 +8194,9 @@ var LeaferUI = (function (exports) {
8173
8194
  this.__renderGroup(canvas, options);
8174
8195
  }
8175
8196
  }
8176
- __drawAfterFill(canvas, options) {
8177
- const { length } = this.children;
8178
- if (this.isOverflow) {
8179
- canvas.save();
8180
- canvas.clip();
8181
- if (length)
8182
- this.__renderGroup(canvas, options);
8183
- canvas.restore();
8184
- }
8185
- else {
8186
- if (length)
8187
- this.__renderGroup(canvas, options);
8188
- }
8189
- if (this.__.stroke && length) {
8197
+ __drawContent(canvas, options) {
8198
+ this.__renderGroup(canvas, options);
8199
+ if (this.__.__hasStroke) {
8190
8200
  canvas.setWorld(this.__nowWorld);
8191
8201
  this.__drawRenderPath(canvas);
8192
8202
  }
@@ -8350,17 +8360,15 @@ var LeaferUI = (function (exports) {
8350
8360
  if (data.__useArrow)
8351
8361
  PathArrow.addArrows(this, false);
8352
8362
  }
8353
- else {
8363
+ else
8354
8364
  super.__updateRenderPath();
8355
- }
8356
8365
  }
8357
8366
  __updateBoxBounds() {
8358
8367
  if (this.points) {
8359
8368
  toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
8360
8369
  }
8361
- else {
8370
+ else
8362
8371
  super.__updateBoxBounds();
8363
- }
8364
8372
  }
8365
8373
  };
8366
8374
  __decorate([
@@ -8498,7 +8506,6 @@ var LeaferUI = (function (exports) {
8498
8506
  super(data);
8499
8507
  this.canvas = Creator.canvas(this.__);
8500
8508
  this.context = this.canvas.context;
8501
- this.__.__isCanvas = this.__.__drawAfterFill = true;
8502
8509
  if (data && data.url)
8503
8510
  this.drawImage(data.url);
8504
8511
  }
@@ -8511,8 +8518,7 @@ var LeaferUI = (function (exports) {
8511
8518
  });
8512
8519
  }
8513
8520
  draw(ui, offset, scale, rotation) {
8514
- ui.__layout.update();
8515
- const matrix = new Matrix(ui.__world).invert();
8521
+ const matrix = new Matrix(ui.worldTransform).invert();
8516
8522
  const m = new Matrix();
8517
8523
  if (offset)
8518
8524
  m.translate(offset.x, offset.y);
@@ -8527,17 +8533,9 @@ var LeaferUI = (function (exports) {
8527
8533
  paint() {
8528
8534
  this.forceRender();
8529
8535
  }
8530
- __drawAfterFill(canvas, _options) {
8531
- const { width, height, cornerRadius } = this.__, { view } = this.canvas;
8532
- if (cornerRadius || this.pathInputed) {
8533
- canvas.save();
8534
- canvas.clip();
8535
- canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8536
- canvas.restore();
8537
- }
8538
- else {
8539
- canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8540
- }
8536
+ __drawContent(canvas, _options) {
8537
+ const { width, height } = this.__, { view } = this.canvas;
8538
+ canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8541
8539
  }
8542
8540
  __updateSize() {
8543
8541
  const { canvas } = this;
@@ -8581,7 +8579,6 @@ var LeaferUI = (function (exports) {
8581
8579
  const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
8582
8580
  exports.Text = class Text extends exports.UI {
8583
8581
  get __tag() { return 'Text'; }
8584
- get editInner() { return 'TextEditor'; }
8585
8582
  get textDrawData() {
8586
8583
  this.__layout.update();
8587
8584
  return this.__.__textDrawData;
@@ -8656,9 +8653,8 @@ var LeaferUI = (function (exports) {
8656
8653
  layout.renderChanged = true;
8657
8654
  setList(data.__textBoxBounds = {}, [b, bounds]);
8658
8655
  }
8659
- else {
8656
+ else
8660
8657
  data.__textBoxBounds = contentBounds;
8661
- }
8662
8658
  }
8663
8659
  __updateRenderSpread() {
8664
8660
  let width = super.__updateRenderSpread();
@@ -8747,7 +8743,6 @@ var LeaferUI = (function (exports) {
8747
8743
  get __tag() { return 'Path'; }
8748
8744
  constructor(data) {
8749
8745
  super(data);
8750
- this.__.__pathInputed = 2;
8751
8746
  }
8752
8747
  };
8753
8748
  __decorate([
@@ -8830,21 +8825,17 @@ var LeaferUI = (function (exports) {
8830
8825
  this.tree = this.addLeafer(tree);
8831
8826
  if (sky || editor)
8832
8827
  this.sky = this.addLeafer(sky || { type: 'draw', usePartRender: false });
8833
- if (editor) {
8834
- this.editor = Creator.editor(editor);
8835
- this.sky.add(this.editor);
8836
- }
8828
+ if (editor)
8829
+ this.sky.add(this.editor = Creator.editor(editor));
8837
8830
  }
8838
8831
  }
8839
8832
  __setApp() {
8840
8833
  const { canvas } = this;
8841
8834
  const { realCanvas, view } = this.config;
8842
- if (realCanvas || view === this.canvas.view || !canvas.parentView) {
8835
+ if (realCanvas || view === this.canvas.view || !canvas.parentView)
8843
8836
  this.realCanvas = true;
8844
- }
8845
- else {
8837
+ else
8846
8838
  canvas.unrealCanvas();
8847
- }
8848
8839
  this.leafer = this;
8849
8840
  this.watcher.disable();
8850
8841
  this.layouter.disable();
@@ -9250,10 +9241,7 @@ var LeaferUI = (function (exports) {
9250
9241
  leafer.getValidMove = function (moveX, moveY) {
9251
9242
  const { scroll, disabled } = this.app.config.move;
9252
9243
  if (scroll) {
9253
- if (Math.abs(moveX) > Math.abs(moveY))
9254
- moveY = 0;
9255
- else
9256
- moveX = 0;
9244
+ Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
9257
9245
  if (scroll === 'limit') {
9258
9246
  const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
9259
9247
  const right = x + width - this.width, bottom = y + height - this.height;
@@ -10340,17 +10328,20 @@ var LeaferUI = (function (exports) {
10340
10328
  };
10341
10329
 
10342
10330
  const ui = exports.UI.prototype, group = exports.Group.prototype;
10331
+ function getSelector(ui) {
10332
+ return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
10333
+ }
10343
10334
  ui.find = function (condition, options) {
10344
- return this.leafer ? this.leafer.selector.getBy(condition, this, false, options) : [];
10335
+ return getSelector(this).getBy(condition, this, false, options);
10345
10336
  };
10346
10337
  ui.findOne = function (condition, options) {
10347
- return this.leafer ? this.leafer.selector.getBy(condition, this, true, options) : null;
10338
+ return getSelector(this).getBy(condition, this, true, options);
10348
10339
  };
10349
10340
  group.pick = function (hitPoint, options) {
10350
10341
  this.__layout.update();
10351
10342
  if (!options)
10352
10343
  options = {};
10353
- return this.leafer ? this.leafer.selector.getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this })) : null;
10344
+ return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
10354
10345
  };
10355
10346
 
10356
10347
  const canvas$1 = LeaferCanvasBase.prototype;
@@ -10985,7 +10976,7 @@ var LeaferUI = (function (exports) {
10985
10976
  }
10986
10977
  if (allowPaint) {
10987
10978
  canvas.save();
10988
- canvas.clip();
10979
+ ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
10989
10980
  if (paint.blendMode)
10990
10981
  canvas.blendMode = paint.blendMode;
10991
10982
  if (data.opacity)