leafer-ui 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.
@@ -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$5.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$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
2307
2316
  const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
2308
- const { set } = PointHelper;
2317
+ const { set, toNumberPoints } = PointHelper;
2309
2318
  const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = 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(originPoints);
2313
2323
  data.push(M$5, 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$4, item.x, item.y);
2837
+ break;
2838
+ case 'L':
2839
+ data.push(L$5, item.x, item.y);
2840
+ break;
2841
+ case 'C':
2842
+ data.push(C$4, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
2843
+ break;
2844
+ case 'Q':
2845
+ data.push(Q$3, item.x1, item.y1, item.x, item.y);
2846
+ break;
2847
+ case 'Z': data.push(Z$4);
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]);
@@ -4395,13 +4426,10 @@ class LeafLayout {
4395
4426
  update() {
4396
4427
  const { leafer } = this.leaf;
4397
4428
  if (leafer) {
4398
- if (leafer.ready) {
4399
- if (leafer.watcher.changed)
4400
- leafer.layouter.layout();
4401
- }
4402
- else {
4429
+ if (leafer.ready)
4430
+ leafer.watcher.changed && leafer.layouter.layout();
4431
+ else
4403
4432
  leafer.start();
4404
- }
4405
4433
  }
4406
4434
  else {
4407
4435
  let root = this.leaf;
@@ -5159,7 +5187,7 @@ const LeafRender = {
5159
5187
  if (this.__worldOpacity) {
5160
5188
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5161
5189
  this.__drawRenderPath(canvas);
5162
- this.__.windingRule ? canvas.clip(this.__.windingRule) : canvas.clip();
5190
+ this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
5163
5191
  }
5164
5192
  },
5165
5193
  __updateWorldOpacity() {
@@ -5676,11 +5704,17 @@ let Branch = class Branch extends Leaf {
5676
5704
  add(child, index) {
5677
5705
  if (child === this)
5678
5706
  return;
5679
- child.__ || (child = UICreator.get(child.tag, child));
5707
+ const noIndex = index === undefined;
5708
+ if (!child.__) {
5709
+ if (child instanceof Array)
5710
+ return child.forEach(item => { this.add(item, index); noIndex || index++; });
5711
+ else
5712
+ child = UICreator.get(child.tag, child);
5713
+ }
5680
5714
  if (child.parent)
5681
5715
  child.parent.remove(child);
5682
5716
  child.parent = this;
5683
- index === undefined ? this.children.push(child) : this.children.splice(index, 0, child);
5717
+ noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
5684
5718
  if (child.isBranch)
5685
5719
  this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
5686
5720
  child.__layout.boxChanged || child.__layout.boxChange();
@@ -5694,9 +5728,7 @@ let Branch = class Branch extends Leaf {
5694
5728
  }
5695
5729
  this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
5696
5730
  }
5697
- addMany(...children) {
5698
- children.forEach(child => this.add(child));
5699
- }
5731
+ addMany(...children) { this.add(children); }
5700
5732
  remove(child, destroy) {
5701
5733
  if (child) {
5702
5734
  if (child.__) {
@@ -5924,7 +5956,7 @@ class LeafLevelList {
5924
5956
  }
5925
5957
  }
5926
5958
 
5927
- const version = "1.0.5";
5959
+ const version = "1.0.7";
5928
5960
 
5929
5961
  const debug$7 = Debug.get('LeaferCanvas');
5930
5962
  class LeaferCanvas extends LeaferCanvasBase {
@@ -6082,7 +6114,7 @@ class LeaferCanvas extends LeaferCanvasBase {
6082
6114
  const oldSize = {};
6083
6115
  DataHelper.copyAttrs(oldSize, this, canvasSizeAttrs);
6084
6116
  this.resize(size);
6085
- if (this.width !== undefined)
6117
+ if (this.resizeListener && this.width !== undefined)
6086
6118
  this.resizeListener(new ResizeEvent(size, oldSize));
6087
6119
  }
6088
6120
  unrealCanvas() {
@@ -6816,7 +6848,8 @@ class Picker {
6816
6848
  path.add(leaf);
6817
6849
  leaf = leaf.parent;
6818
6850
  }
6819
- path.add(this.target);
6851
+ if (this.target)
6852
+ path.add(this.target);
6820
6853
  return path;
6821
6854
  }
6822
6855
  getHitablePath(leaf) {
@@ -6902,8 +6935,8 @@ class Selector {
6902
6935
  this.innerIdMap = {};
6903
6936
  this.idMap = {};
6904
6937
  this.methods = {
6905
- id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
6906
- innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
6938
+ id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
6939
+ innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
6907
6940
  className: (leaf, name) => leaf.className === name ? 1 : 0,
6908
6941
  tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
6909
6942
  tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
@@ -6912,7 +6945,8 @@ class Selector {
6912
6945
  if (userConfig)
6913
6946
  this.config = DataHelper.default(userConfig, this.config);
6914
6947
  this.picker = new Picker(target, this);
6915
- this.__listenEvents();
6948
+ if (target)
6949
+ this.__listenEvents();
6916
6950
  }
6917
6951
  getBy(condition, branch, one, options) {
6918
6952
  switch (typeof condition) {
@@ -6947,7 +6981,7 @@ class Selector {
6947
6981
  }
6948
6982
  }
6949
6983
  getByPoint(hitPoint, hitRadius, options) {
6950
- if (Platform.name === 'node')
6984
+ if (Platform.name === 'node' && this.target)
6951
6985
  this.target.emit(LayoutEvent.CHECK_UPDATE);
6952
6986
  return this.picker.getByPoint(hitPoint, hitRadius, options);
6953
6987
  }
@@ -7077,6 +7111,13 @@ function zoomLayerType() {
7077
7111
 
7078
7112
  const TextConvert = {};
7079
7113
  const ColorConvert = {};
7114
+ const UnitConvert = {
7115
+ number(value, percentRefer) {
7116
+ if (typeof value === 'object')
7117
+ return value.type === 'percent' ? value.value * percentRefer : value.value;
7118
+ return value;
7119
+ }
7120
+ };
7080
7121
  const PathArrow = {};
7081
7122
  const Paint = {};
7082
7123
  const PaintImage = {};
@@ -7097,7 +7138,7 @@ const Transition = {
7097
7138
  }
7098
7139
  };
7099
7140
 
7100
- const { parse } = PathConvert;
7141
+ const { parse, objectToCanvasData } = PathConvert;
7101
7142
  const emptyPaint = {};
7102
7143
  const debug$4 = Debug.get('UIData');
7103
7144
  class UIData extends LeafData {
@@ -7111,10 +7152,11 @@ class UIData extends LeafData {
7111
7152
  scaleX = -scaleX;
7112
7153
  return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
7113
7154
  }
7114
- else {
7155
+ else
7115
7156
  return strokeWidth;
7116
- }
7117
7157
  }
7158
+ get __hasStroke() { return this.stroke && this.strokeWidth; }
7159
+ get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
7118
7160
  get __autoWidth() { return !this._width; }
7119
7161
  get __autoHeight() { return !this._height; }
7120
7162
  get __autoSide() { return !this._width || !this._height; }
@@ -7131,9 +7173,8 @@ class UIData extends LeafData {
7131
7173
  this.__leaf.scaleX *= -1;
7132
7174
  debug$4.warn('width < 0, instead -scaleX ', this);
7133
7175
  }
7134
- else {
7176
+ else
7135
7177
  this._width = value;
7136
- }
7137
7178
  }
7138
7179
  setHeight(value) {
7139
7180
  if (value < 0) {
@@ -7141,9 +7182,8 @@ class UIData extends LeafData {
7141
7182
  this.__leaf.scaleY *= -1;
7142
7183
  debug$4.warn('height < 0, instead -scaleY', this);
7143
7184
  }
7144
- else {
7185
+ else
7145
7186
  this._height = value;
7146
- }
7147
7187
  }
7148
7188
  setFill(value) {
7149
7189
  if (this.__naturalWidth)
@@ -7184,9 +7224,10 @@ class UIData extends LeafData {
7184
7224
  }
7185
7225
  }
7186
7226
  setPath(value) {
7187
- if (typeof value === 'string') {
7227
+ const isString = typeof value === 'string';
7228
+ if (isString || (value && typeof value[0] === 'object')) {
7188
7229
  this.__setInput('path', value);
7189
- this._path = parse(value);
7230
+ this._path = isString ? parse(value) : objectToCanvasData(value);
7190
7231
  }
7191
7232
  else {
7192
7233
  if (this.__input)
@@ -7201,12 +7242,8 @@ class UIData extends LeafData {
7201
7242
  value = value.filter((item) => item.visible !== false);
7202
7243
  this._shadow = value.length ? value : null;
7203
7244
  }
7204
- else if (value) {
7205
- this._shadow = value.visible === false ? null : [value];
7206
- }
7207
- else {
7208
- this._shadow = null;
7209
- }
7245
+ else
7246
+ this._shadow = value && value.visible !== false ? [value] : null;
7210
7247
  }
7211
7248
  setInnerShadow(value) {
7212
7249
  this.__setInput('innerShadow', value);
@@ -7215,12 +7252,8 @@ class UIData extends LeafData {
7215
7252
  value = value.filter((item) => item.visible !== false);
7216
7253
  this._innerShadow = value.length ? value : null;
7217
7254
  }
7218
- else if (value) {
7219
- this._innerShadow = value.visible === false ? null : [value];
7220
- }
7221
- else {
7222
- this._innerShadow = null;
7223
- }
7255
+ else
7256
+ this._innerShadow = value && value.visible !== false ? [value] : null;
7224
7257
  }
7225
7258
  __computePaint() {
7226
7259
  const { fill, stroke } = this.__input;
@@ -7231,24 +7264,19 @@ class UIData extends LeafData {
7231
7264
  this.__needComputePaint = false;
7232
7265
  }
7233
7266
  }
7234
- const UnitConvert = {
7235
- number(value, percentRefer) {
7236
- if (typeof value === 'object')
7237
- return value.type === 'percent' ? value.value * percentRefer : value.value;
7238
- return value;
7239
- }
7240
- };
7241
7267
 
7242
7268
  class GroupData extends UIData {
7243
7269
  }
7244
7270
 
7245
7271
  class BoxData extends GroupData {
7246
7272
  get __boxStroke() { return !this.__pathInputed; }
7273
+ get __drawAfterFill() { return this.overflow === 'hide' && this.__clipAfterFill && this.__leaf.children.length; }
7274
+ get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
7247
7275
  }
7248
7276
 
7249
7277
  class LeaferData extends GroupData {
7250
- __getInputData() {
7251
- const data = super.__getInputData();
7278
+ __getInputData(names, options) {
7279
+ const data = super.__getInputData(names, options);
7252
7280
  canvasSizeAttrs.forEach(key => delete data[key]);
7253
7281
  return data;
7254
7282
  }
@@ -7275,6 +7303,7 @@ class StarData extends UIData {
7275
7303
  }
7276
7304
 
7277
7305
  class PathData extends UIData {
7306
+ get __pathInputed() { return 2; }
7278
7307
  }
7279
7308
 
7280
7309
  class PenData extends GroupData {
@@ -7321,16 +7350,18 @@ class ImageData extends RectData {
7321
7350
  delete data.fill;
7322
7351
  return data;
7323
7352
  }
7324
- __getInputData() {
7325
- const data = super.__getInputData();
7353
+ __getInputData(names, options) {
7354
+ const data = super.__getInputData(names, options);
7326
7355
  delete data.fill;
7327
7356
  return data;
7328
7357
  }
7329
7358
  }
7330
7359
 
7331
7360
  class CanvasData extends RectData {
7332
- __getInputData() {
7333
- const data = super.__getInputData();
7361
+ get __isCanvas() { return true; }
7362
+ get __drawAfterFill() { return true; }
7363
+ __getInputData(names, options) {
7364
+ const data = super.__getInputData(names, options);
7334
7365
  data.url = this.__leaf.canvas.toDataURL('image/png');
7335
7366
  return data;
7336
7367
  }
@@ -7357,16 +7388,12 @@ const UIBounds = {
7357
7388
  let width = 0;
7358
7389
  const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7359
7390
  if (shadow)
7360
- shadow.forEach(item => {
7361
- width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5);
7362
- });
7391
+ 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));
7363
7392
  if (blur)
7364
7393
  width = Math.max(width, blur);
7365
7394
  let shapeWidth = width = Math.ceil(width);
7366
7395
  if (innerShadow)
7367
- innerShadow.forEach(item => {
7368
- shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5);
7369
- });
7396
+ 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));
7370
7397
  if (backgroundBlur)
7371
7398
  shapeWidth = Math.max(shapeWidth, backgroundBlur);
7372
7399
  this.__layout.renderShapeSpread = shapeWidth;
@@ -7448,6 +7475,16 @@ const UIRender = {
7448
7475
  if (stroke && !ignoreStroke)
7449
7476
  this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7450
7477
  }
7478
+ },
7479
+ __drawAfterFill(canvas, options) {
7480
+ if (this.__.__clipAfterFill) {
7481
+ canvas.save();
7482
+ this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
7483
+ this.__drawContent(canvas, options);
7484
+ canvas.restore();
7485
+ }
7486
+ else
7487
+ this.__drawContent(canvas, options);
7451
7488
  }
7452
7489
  };
7453
7490
  function drawFast(ui, canvas, options) {
@@ -7514,8 +7551,8 @@ let UI = UI_1 = class UI extends Leaf {
7514
7551
  return pen;
7515
7552
  }
7516
7553
  get editConfig() { return undefined; }
7517
- get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
7518
- get editInner() { return 'PathEditor'; }
7554
+ get editOuter() { return ''; }
7555
+ get editInner() { return ''; }
7519
7556
  constructor(data) {
7520
7557
  super(data);
7521
7558
  }
@@ -7526,9 +7563,8 @@ let UI = UI_1 = class UI extends Leaf {
7526
7563
  Object.assign(this, data);
7527
7564
  this.lockNormalStyle = false;
7528
7565
  }
7529
- else {
7566
+ else
7530
7567
  Object.assign(this, data);
7531
- }
7532
7568
  }
7533
7569
  get(name) {
7534
7570
  return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
@@ -7830,23 +7866,13 @@ let Group = class Group extends UI {
7830
7866
  if (data.children) {
7831
7867
  const { children } = data;
7832
7868
  delete data.children;
7833
- if (!this.children) {
7834
- this.__setBranch();
7835
- }
7836
- else {
7837
- this.clear();
7838
- }
7869
+ this.children ? this.clear() : this.__setBranch();
7839
7870
  super.set(data, isTemp);
7840
- let child;
7841
- children.forEach(childData => {
7842
- child = childData.__ ? childData : UICreator.get(childData.tag, childData);
7843
- this.add(child);
7844
- });
7871
+ children.forEach(child => this.add(child));
7845
7872
  data.children = children;
7846
7873
  }
7847
- else {
7874
+ else
7848
7875
  super.set(data, isTemp);
7849
- }
7850
7876
  }
7851
7877
  toJSON(options) {
7852
7878
  const data = super.toJSON(options);
@@ -8278,9 +8304,7 @@ let Box = class Box extends Group {
8278
8304
  }
8279
8305
  __updateStrokeSpread() { return 0; }
8280
8306
  __updateRectRenderSpread() { return 0; }
8281
- __updateRenderSpread() {
8282
- return this.__updateRectRenderSpread() || -1;
8283
- }
8307
+ __updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
8284
8308
  __updateRectBoxBounds() { }
8285
8309
  __updateBoxBounds(_secondLayout) {
8286
8310
  const data = this.__;
@@ -8300,13 +8324,11 @@ let Box = class Box extends Group {
8300
8324
  }
8301
8325
  this.__updateNaturalSize();
8302
8326
  }
8303
- else {
8327
+ else
8304
8328
  this.__updateRectBoxBounds();
8305
- }
8306
8329
  }
8307
- else {
8330
+ else
8308
8331
  this.__updateRectBoxBounds();
8309
- }
8310
8332
  }
8311
8333
  __updateStrokeBounds() { }
8312
8334
  __updateRenderBounds() {
@@ -8316,14 +8338,13 @@ let Box = class Box extends Group {
8316
8338
  super.__updateRenderBounds();
8317
8339
  copy$3(childrenRenderBounds, renderBounds);
8318
8340
  this.__updateRectRenderBounds();
8319
- isOverflow = !includes$1(renderBounds, childrenRenderBounds) || !this.pathInputed || !this.__.cornerRadius;
8341
+ isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8342
+ if (isOverflow && this.__.overflow !== 'hide')
8343
+ add(renderBounds, childrenRenderBounds);
8320
8344
  }
8321
- else {
8345
+ else
8322
8346
  this.__updateRectRenderBounds();
8323
- }
8324
- this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8325
- if (!(this.__.__drawAfterFill = this.__.overflow === 'hide') && isOverflow)
8326
- add(renderBounds, childrenRenderBounds);
8347
+ !this.isOverflow !== !isOverflow && (this.isOverflow = isOverflow);
8327
8348
  }
8328
8349
  __updateRectRenderBounds() { }
8329
8350
  __updateRectChange() { }
@@ -8343,20 +8364,9 @@ let Box = class Box extends Group {
8343
8364
  this.__renderGroup(canvas, options);
8344
8365
  }
8345
8366
  }
8346
- __drawAfterFill(canvas, options) {
8347
- const { length } = this.children;
8348
- if (this.isOverflow) {
8349
- canvas.save();
8350
- canvas.clip();
8351
- if (length)
8352
- this.__renderGroup(canvas, options);
8353
- canvas.restore();
8354
- }
8355
- else {
8356
- if (length)
8357
- this.__renderGroup(canvas, options);
8358
- }
8359
- if (this.__.stroke && length) {
8367
+ __drawContent(canvas, options) {
8368
+ this.__renderGroup(canvas, options);
8369
+ if (this.__.__hasStroke) {
8360
8370
  canvas.setWorld(this.__nowWorld);
8361
8371
  this.__drawRenderPath(canvas);
8362
8372
  }
@@ -8520,17 +8530,15 @@ let Line = class Line extends UI {
8520
8530
  if (data.__useArrow)
8521
8531
  PathArrow.addArrows(this, false);
8522
8532
  }
8523
- else {
8533
+ else
8524
8534
  super.__updateRenderPath();
8525
- }
8526
8535
  }
8527
8536
  __updateBoxBounds() {
8528
8537
  if (this.points) {
8529
8538
  toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
8530
8539
  }
8531
- else {
8540
+ else
8532
8541
  super.__updateBoxBounds();
8533
- }
8534
8542
  }
8535
8543
  };
8536
8544
  __decorate([
@@ -8668,7 +8676,6 @@ let Canvas = class Canvas extends Rect {
8668
8676
  super(data);
8669
8677
  this.canvas = Creator.canvas(this.__);
8670
8678
  this.context = this.canvas.context;
8671
- this.__.__isCanvas = this.__.__drawAfterFill = true;
8672
8679
  if (data && data.url)
8673
8680
  this.drawImage(data.url);
8674
8681
  }
@@ -8681,8 +8688,7 @@ let Canvas = class Canvas extends Rect {
8681
8688
  });
8682
8689
  }
8683
8690
  draw(ui, offset, scale, rotation) {
8684
- ui.__layout.update();
8685
- const matrix = new Matrix(ui.__world).invert();
8691
+ const matrix = new Matrix(ui.worldTransform).invert();
8686
8692
  const m = new Matrix();
8687
8693
  if (offset)
8688
8694
  m.translate(offset.x, offset.y);
@@ -8697,17 +8703,9 @@ let Canvas = class Canvas extends Rect {
8697
8703
  paint() {
8698
8704
  this.forceRender();
8699
8705
  }
8700
- __drawAfterFill(canvas, _options) {
8701
- const { width, height, cornerRadius } = this.__, { view } = this.canvas;
8702
- if (cornerRadius || this.pathInputed) {
8703
- canvas.save();
8704
- canvas.clip();
8705
- canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8706
- canvas.restore();
8707
- }
8708
- else {
8709
- canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8710
- }
8706
+ __drawContent(canvas, _options) {
8707
+ const { width, height } = this.__, { view } = this.canvas;
8708
+ canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8711
8709
  }
8712
8710
  __updateSize() {
8713
8711
  const { canvas } = this;
@@ -8751,7 +8749,6 @@ Canvas = __decorate([
8751
8749
  const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
8752
8750
  let Text = class Text extends UI {
8753
8751
  get __tag() { return 'Text'; }
8754
- get editInner() { return 'TextEditor'; }
8755
8752
  get textDrawData() {
8756
8753
  this.__layout.update();
8757
8754
  return this.__.__textDrawData;
@@ -8826,9 +8823,8 @@ let Text = class Text extends UI {
8826
8823
  layout.renderChanged = true;
8827
8824
  setList(data.__textBoxBounds = {}, [b, bounds]);
8828
8825
  }
8829
- else {
8826
+ else
8830
8827
  data.__textBoxBounds = contentBounds;
8831
- }
8832
8828
  }
8833
8829
  __updateRenderSpread() {
8834
8830
  let width = super.__updateRenderSpread();
@@ -8917,7 +8913,6 @@ let Path = class Path extends UI {
8917
8913
  get __tag() { return 'Path'; }
8918
8914
  constructor(data) {
8919
8915
  super(data);
8920
- this.__.__pathInputed = 2;
8921
8916
  }
8922
8917
  };
8923
8918
  __decorate([
@@ -9000,21 +8995,17 @@ let App = class App extends Leafer {
9000
8995
  this.tree = this.addLeafer(tree);
9001
8996
  if (sky || editor)
9002
8997
  this.sky = this.addLeafer(sky || { type: 'draw', usePartRender: false });
9003
- if (editor) {
9004
- this.editor = Creator.editor(editor);
9005
- this.sky.add(this.editor);
9006
- }
8998
+ if (editor)
8999
+ this.sky.add(this.editor = Creator.editor(editor));
9007
9000
  }
9008
9001
  }
9009
9002
  __setApp() {
9010
9003
  const { canvas } = this;
9011
9004
  const { realCanvas, view } = this.config;
9012
- if (realCanvas || view === this.canvas.view || !canvas.parentView) {
9005
+ if (realCanvas || view === this.canvas.view || !canvas.parentView)
9013
9006
  this.realCanvas = true;
9014
- }
9015
- else {
9007
+ else
9016
9008
  canvas.unrealCanvas();
9017
- }
9018
9009
  this.leafer = this;
9019
9010
  this.watcher.disable();
9020
9011
  this.layouter.disable();
@@ -9420,10 +9411,7 @@ leafer.initType = function (type) {
9420
9411
  leafer.getValidMove = function (moveX, moveY) {
9421
9412
  const { scroll, disabled } = this.app.config.move;
9422
9413
  if (scroll) {
9423
- if (Math.abs(moveX) > Math.abs(moveY))
9424
- moveY = 0;
9425
- else
9426
- moveX = 0;
9414
+ Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
9427
9415
  if (scroll === 'limit') {
9428
9416
  const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
9429
9417
  const right = x + width - this.width, bottom = y + height - this.height;
@@ -10510,17 +10498,20 @@ rect.__hitFill = box$1.__hitFill = function (inner) {
10510
10498
  };
10511
10499
 
10512
10500
  const ui = UI.prototype, group = Group.prototype;
10501
+ function getSelector(ui) {
10502
+ return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
10503
+ }
10513
10504
  ui.find = function (condition, options) {
10514
- return this.leafer ? this.leafer.selector.getBy(condition, this, false, options) : [];
10505
+ return getSelector(this).getBy(condition, this, false, options);
10515
10506
  };
10516
10507
  ui.findOne = function (condition, options) {
10517
- return this.leafer ? this.leafer.selector.getBy(condition, this, true, options) : null;
10508
+ return getSelector(this).getBy(condition, this, true, options);
10518
10509
  };
10519
10510
  group.pick = function (hitPoint, options) {
10520
10511
  this.__layout.update();
10521
10512
  if (!options)
10522
10513
  options = {};
10523
- return this.leafer ? this.leafer.selector.getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this })) : null;
10514
+ return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
10524
10515
  };
10525
10516
 
10526
10517
  const canvas$1 = LeaferCanvasBase.prototype;
@@ -11507,7 +11498,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
11507
11498
  }
11508
11499
  if (allowPaint) {
11509
11500
  canvas.save();
11510
- canvas.clip();
11501
+ ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
11511
11502
  if (paint.blendMode)
11512
11503
  canvas.blendMode = paint.blendMode;
11513
11504
  if (data.opacity)