@leafer-ui/worker 1.0.6 → 1.0.8

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
@@ -2961,7 +2961,6 @@ var LeaferUI = (function (exports) {
2961
2961
  set path(value) { this.__path = value; }
2962
2962
  get path() { return this.__path; }
2963
2963
  constructor(path) {
2964
- this.clearPath = this.beginPath;
2965
2964
  this.set(path);
2966
2965
  }
2967
2966
  set(path) {
@@ -3043,6 +3042,9 @@ var LeaferUI = (function (exports) {
3043
3042
  this.paint();
3044
3043
  return this;
3045
3044
  }
3045
+ clearPath() {
3046
+ return this.beginPath();
3047
+ }
3046
3048
  paint() { }
3047
3049
  }
3048
3050
 
@@ -3638,6 +3640,8 @@ var LeaferUI = (function (exports) {
3638
3640
  else {
3639
3641
  if (url.includes('.' + format) || url.includes('.' + FileHelper.upperCaseTypeMap[format]))
3640
3642
  return true;
3643
+ else if (format === 'png' && !url.includes('.'))
3644
+ return true;
3641
3645
  }
3642
3646
  return false;
3643
3647
  },
@@ -4429,13 +4433,10 @@ var LeaferUI = (function (exports) {
4429
4433
  update() {
4430
4434
  const { leafer } = this.leaf;
4431
4435
  if (leafer) {
4432
- if (leafer.ready) {
4433
- if (leafer.watcher.changed)
4434
- leafer.layouter.layout();
4435
- }
4436
- else {
4436
+ if (leafer.ready)
4437
+ leafer.watcher.changed && leafer.layouter.layout();
4438
+ else
4437
4439
  leafer.start();
4438
- }
4439
4440
  }
4440
4441
  else {
4441
4442
  let root = this.leaf;
@@ -5258,7 +5259,7 @@ var LeaferUI = (function (exports) {
5258
5259
  const { LEAF, create } = IncrementId;
5259
5260
  const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
5260
5261
  const { toOuterOf } = BoundsHelper;
5261
- const { copy: copy$4, move: move$1 } = PointHelper;
5262
+ const { copy: copy$4, move } = PointHelper;
5262
5263
  const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
5263
5264
  exports.Leaf = class Leaf {
5264
5265
  get tag() { return this.__tag; }
@@ -5493,7 +5494,7 @@ var LeaferUI = (function (exports) {
5493
5494
  }
5494
5495
  getBoxPointByInner(inner, _relative, _distance, change) {
5495
5496
  const point = change ? inner : Object.assign({}, inner), { x, y } = this.boxBounds;
5496
- move$1(point, -x, -y);
5497
+ move(point, -x, -y);
5497
5498
  return point;
5498
5499
  }
5499
5500
  getInnerPoint(world, relative, distance, change) {
@@ -5503,7 +5504,7 @@ var LeaferUI = (function (exports) {
5503
5504
  }
5504
5505
  getInnerPointByBox(box, _relative, _distance, change) {
5505
5506
  const point = change ? box : Object.assign({}, box), { x, y } = this.boxBounds;
5506
- move$1(point, x, y);
5507
+ move(point, x, y);
5507
5508
  return point;
5508
5509
  }
5509
5510
  getInnerPointByLocal(local, _relative, distance, change) {
@@ -5644,11 +5645,10 @@ var LeaferUI = (function (exports) {
5644
5645
  }
5645
5646
  destroy() {
5646
5647
  if (!this.destroyed) {
5647
- const { parent } = this;
5648
- if (parent)
5648
+ if (this.parent)
5649
5649
  this.remove();
5650
5650
  if (this.children)
5651
- this.removeAll(true);
5651
+ this.clear();
5652
5652
  this.__emitLifeEvent(ChildEvent.DESTROY);
5653
5653
  this.__.destroy();
5654
5654
  this.__layout.destroy();
@@ -5962,7 +5962,7 @@ var LeaferUI = (function (exports) {
5962
5962
  }
5963
5963
  }
5964
5964
 
5965
- const version = "1.0.6";
5965
+ const version = "1.0.8";
5966
5966
 
5967
5967
  class LeaferCanvas extends LeaferCanvasBase {
5968
5968
  get allowBackgroundColor() { return true; }
@@ -6681,7 +6681,8 @@ var LeaferUI = (function (exports) {
6681
6681
  path.add(leaf);
6682
6682
  leaf = leaf.parent;
6683
6683
  }
6684
- path.add(this.target);
6684
+ if (this.target)
6685
+ path.add(this.target);
6685
6686
  return path;
6686
6687
  }
6687
6688
  getHitablePath(leaf) {
@@ -6767,8 +6768,8 @@ var LeaferUI = (function (exports) {
6767
6768
  this.innerIdMap = {};
6768
6769
  this.idMap = {};
6769
6770
  this.methods = {
6770
- id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
6771
- innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
6771
+ id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
6772
+ innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
6772
6773
  className: (leaf, name) => leaf.className === name ? 1 : 0,
6773
6774
  tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
6774
6775
  tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
@@ -6777,7 +6778,8 @@ var LeaferUI = (function (exports) {
6777
6778
  if (userConfig)
6778
6779
  this.config = DataHelper.default(userConfig, this.config);
6779
6780
  this.picker = new Picker(target, this);
6780
- this.__listenEvents();
6781
+ if (target)
6782
+ this.__listenEvents();
6781
6783
  }
6782
6784
  getBy(condition, branch, one, options) {
6783
6785
  switch (typeof condition) {
@@ -6812,7 +6814,7 @@ var LeaferUI = (function (exports) {
6812
6814
  }
6813
6815
  }
6814
6816
  getByPoint(hitPoint, hitRadius, options) {
6815
- if (Platform.name === 'node')
6817
+ if (Platform.name === 'node' && this.target)
6816
6818
  this.target.emit(LayoutEvent.CHECK_UPDATE);
6817
6819
  return this.picker.getByPoint(hitPoint, hitRadius, options);
6818
6820
  }
@@ -6961,12 +6963,8 @@ var LeaferUI = (function (exports) {
6961
6963
  };
6962
6964
  const Transition = {
6963
6965
  list: {},
6964
- register(attrName, fn) {
6965
- Transition.list[attrName] = fn;
6966
- },
6967
- get(attrName) {
6968
- return Transition.list[attrName];
6969
- }
6966
+ register(attrName, fn) { Transition.list[attrName] = fn; },
6967
+ get(attrName) { return Transition.list[attrName]; }
6970
6968
  };
6971
6969
 
6972
6970
  const { parse, objectToCanvasData } = PathConvert;
@@ -7412,8 +7410,8 @@ var LeaferUI = (function (exports) {
7412
7410
  pen.set(path = []), this.__drawPathByBox(pen);
7413
7411
  return curve ? PathConvert.toCanvasData(path, true) : path;
7414
7412
  }
7415
- getPathString(curve, pathForRender) {
7416
- return PathConvert.stringify(this.getPath(curve, pathForRender));
7413
+ getPathString(curve, pathForRender, floatLength) {
7414
+ return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
7417
7415
  }
7418
7416
  load() {
7419
7417
  this.__.__computePaint();
@@ -7822,11 +7820,11 @@ var LeaferUI = (function (exports) {
7822
7820
  start() {
7823
7821
  clearTimeout(this.__startTimer);
7824
7822
  if (!this.running && this.canvas) {
7823
+ this.running = true;
7825
7824
  this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
7826
7825
  this.__controllers.forEach(item => item.start());
7827
7826
  if (!this.isApp)
7828
7827
  this.renderer.render();
7829
- this.running = true;
7830
7828
  }
7831
7829
  }
7832
7830
  stop() {
@@ -7932,12 +7930,10 @@ var LeaferUI = (function (exports) {
7932
7930
  }
7933
7931
  __changeFill(newValue) {
7934
7932
  this.config.fill = newValue;
7935
- if (this.canvas.allowBackgroundColor) {
7933
+ if (this.canvas.allowBackgroundColor)
7936
7934
  this.canvas.backgroundColor = newValue;
7937
- }
7938
- else {
7935
+ else
7939
7936
  this.forceRender();
7940
- }
7941
7937
  }
7942
7938
  __onCreated() {
7943
7939
  this.created = true;
@@ -8004,13 +8000,10 @@ var LeaferUI = (function (exports) {
8004
8000
  if (bind)
8005
8001
  item = item.bind(bind);
8006
8002
  this.__viewCompletedWait.push(item);
8007
- if (this.viewCompleted) {
8003
+ if (this.viewCompleted)
8008
8004
  this.__checkViewCompleted(false);
8009
- }
8010
- else {
8011
- if (!this.running)
8012
- this.start();
8013
- }
8005
+ else if (!this.running)
8006
+ this.start();
8014
8007
  }
8015
8008
  nextRender(item, bind, off) {
8016
8009
  if (bind)
@@ -8024,9 +8017,8 @@ var LeaferUI = (function (exports) {
8024
8017
  }
8025
8018
  }
8026
8019
  }
8027
- else {
8020
+ else
8028
8021
  list.push(item);
8029
- }
8030
8022
  }
8031
8023
  zoom(_zoomType, _padding, _fixedScale) {
8032
8024
  return needPlugin('view');
@@ -8070,10 +8062,7 @@ var LeaferUI = (function (exports) {
8070
8062
  this.stop();
8071
8063
  this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
8072
8064
  this.__removeListenEvents();
8073
- this.__controllers.forEach(item => {
8074
- if (!(this.parent && item === this.interaction))
8075
- item.destroy();
8076
- });
8065
+ this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
8077
8066
  this.__controllers.length = 0;
8078
8067
  if (!this.parent) {
8079
8068
  if (this.selector)
@@ -8606,23 +8595,23 @@ var LeaferUI = (function (exports) {
8606
8595
  }
8607
8596
  __updateTextDrawData() {
8608
8597
  const data = this.__;
8609
- data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
8610
- }
8611
- __updateBoxBounds() {
8612
- const data = this.__;
8613
- const layout = this.__layout;
8614
8598
  const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
8615
- const autoWidth = data.__autoWidth;
8616
- const autoHeight = data.__autoHeight;
8617
8599
  data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
8618
8600
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
8619
8601
  data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
8620
8602
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
8621
8603
  data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
8622
8604
  data.__clipText = textOverflow !== 'show' && !data.__autoSize;
8605
+ data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
8606
+ }
8607
+ __updateBoxBounds() {
8608
+ const data = this.__;
8609
+ const layout = this.__layout;
8610
+ const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
8623
8611
  this.__updateTextDrawData();
8624
8612
  const { bounds } = data.__textDrawData;
8625
8613
  const b = layout.boxBounds;
8614
+ console.log(bounds, autoWidth, autoHeight);
8626
8615
  if (data.__lineHeight < fontSize)
8627
8616
  spread(bounds, fontSize / 2);
8628
8617
  if (autoWidth || autoHeight) {
@@ -8632,20 +8621,15 @@ var LeaferUI = (function (exports) {
8632
8621
  b.height = autoHeight ? bounds.height : data.height;
8633
8622
  if (padding) {
8634
8623
  const [top, right, bottom, left] = data.__padding;
8635
- if (autoWidth) {
8636
- b.x -= left;
8637
- b.width += (right + left);
8638
- }
8639
- if (autoHeight) {
8640
- b.y -= top;
8641
- b.height += (bottom + top);
8642
- }
8624
+ if (autoWidth)
8625
+ b.x -= left, b.width += (right + left);
8626
+ if (autoHeight)
8627
+ b.y -= top, b.height += (bottom + top);
8643
8628
  }
8644
8629
  this.__updateNaturalSize();
8645
8630
  }
8646
- else {
8631
+ else
8647
8632
  super.__updateBoxBounds();
8648
- }
8649
8633
  if (italic)
8650
8634
  b.width += fontSize * 0.16;
8651
8635
  const contentBounds = includes(b, bounds) ? b : bounds;
@@ -8654,9 +8638,8 @@ var LeaferUI = (function (exports) {
8654
8638
  layout.renderChanged = true;
8655
8639
  setList(data.__textBoxBounds = {}, [b, bounds]);
8656
8640
  }
8657
- else {
8641
+ else
8658
8642
  data.__textBoxBounds = contentBounds;
8659
- }
8660
8643
  }
8661
8644
  __updateRenderSpread() {
8662
8645
  let width = super.__updateRenderSpread();
@@ -8769,11 +8752,7 @@ var LeaferUI = (function (exports) {
8769
8752
  this.add(path);
8770
8753
  return this;
8771
8754
  }
8772
- beginPath() {
8773
- this.__path.length = 0;
8774
- this.paint();
8775
- return this;
8776
- }
8755
+ beginPath() { return this; }
8777
8756
  moveTo(_x, _y) { return this; }
8778
8757
  lineTo(_x, _y) { return this; }
8779
8758
  bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
@@ -8800,7 +8779,7 @@ var LeaferUI = (function (exports) {
8800
8779
  penPathType()
8801
8780
  ], exports.Pen.prototype, "path", void 0);
8802
8781
  exports.Pen = __decorate([
8803
- useModule(PathCreator, ['set', 'beginPath', 'path', 'paint']),
8782
+ useModule(PathCreator, ['set', 'path', 'paint']),
8804
8783
  registerUI()
8805
8784
  ], exports.Pen);
8806
8785
  function penPathType() {
@@ -8902,10 +8881,9 @@ var LeaferUI = (function (exports) {
8902
8881
  }
8903
8882
  __render(canvas, options) {
8904
8883
  if (canvas.context) {
8905
- if (options.matrix) {
8906
- const { a, b, c, d, e, f } = options.matrix;
8907
- canvas.setTransform(a, b, c, d, e, f);
8908
- }
8884
+ const m = options.matrix;
8885
+ if (m)
8886
+ canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
8909
8887
  this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
8910
8888
  }
8911
8889
  }
@@ -8975,9 +8953,6 @@ var LeaferUI = (function (exports) {
8975
8953
  constructor(params) {
8976
8954
  super(params.type);
8977
8955
  this.bubbles = true;
8978
- this.getInner = this.getInnerPoint;
8979
- this.getLocal = this.getLocalPoint;
8980
- this.getPage = this.getPagePoint;
8981
8956
  Object.assign(this, params);
8982
8957
  }
8983
8958
  getBoxPoint(relative) {
@@ -8998,6 +8973,9 @@ var LeaferUI = (function (exports) {
8998
8973
  getPagePoint() {
8999
8974
  return this.current.getPagePoint(this);
9000
8975
  }
8976
+ getInner(relative) { return this.getInnerPoint(relative); }
8977
+ getLocal(relative) { return this.getLocalPoint(relative); }
8978
+ getPage() { return this.getPagePoint(); }
9001
8979
  static changeName(oldName, newName) {
9002
8980
  EventCreator.changeName(oldName, newName);
9003
8981
  }
@@ -9029,7 +9007,7 @@ var LeaferUI = (function (exports) {
9029
9007
  ], exports.PointerEvent);
9030
9008
  const MyPointerEvent = exports.PointerEvent;
9031
9009
 
9032
- const move = {};
9010
+ const tempMove = {};
9033
9011
  exports.DragEvent = class DragEvent extends exports.PointerEvent {
9034
9012
  static setList(data) {
9035
9013
  this.list = data instanceof LeafList ? data : new LeafList(data);
@@ -9080,19 +9058,19 @@ var LeaferUI = (function (exports) {
9080
9058
  }
9081
9059
  getPageMove(total) {
9082
9060
  this.assignMove(total);
9083
- return this.current.getPagePoint(move, null, true);
9061
+ return this.current.getPagePoint(tempMove, null, true);
9084
9062
  }
9085
9063
  getInnerMove(relative, total) {
9086
9064
  if (!relative)
9087
9065
  relative = this.current;
9088
9066
  this.assignMove(total);
9089
- return relative.getInnerPoint(move, null, true);
9067
+ return relative.getInnerPoint(tempMove, null, true);
9090
9068
  }
9091
9069
  getLocalMove(relative, total) {
9092
9070
  if (!relative)
9093
9071
  relative = this.current;
9094
9072
  this.assignMove(total);
9095
- return relative.getLocalPoint(move, null, true);
9073
+ return relative.getLocalPoint(tempMove, null, true);
9096
9074
  }
9097
9075
  getPageTotal() {
9098
9076
  return this.getPageMove(true);
@@ -9112,8 +9090,8 @@ var LeaferUI = (function (exports) {
9112
9090
  return bounds;
9113
9091
  }
9114
9092
  assignMove(total) {
9115
- move.x = total ? this.totalX : this.moveX;
9116
- move.y = total ? this.totalY : this.moveY;
9093
+ tempMove.x = total ? this.totalX : this.moveX;
9094
+ tempMove.y = total ? this.totalY : this.moveY;
9117
9095
  }
9118
9096
  };
9119
9097
  exports.DragEvent.BEFORE_DRAG = 'drag.before_drag';
@@ -9527,9 +9505,8 @@ var LeaferUI = (function (exports) {
9527
9505
  interaction.emit(exports.DragEvent.OVER, data, path);
9528
9506
  }
9529
9507
  }
9530
- else {
9508
+ else
9531
9509
  interaction.emit(exports.DragEvent.OVER, data, path);
9532
- }
9533
9510
  }
9534
9511
  dragEnterOrLeave(data) {
9535
9512
  const { interaction } = this;
@@ -9550,9 +9527,8 @@ var LeaferUI = (function (exports) {
9550
9527
  this.drag(data);
9551
9528
  this.animate(() => { this.dragEnd(data, 1); });
9552
9529
  }
9553
- else {
9530
+ else
9554
9531
  this.dragEndReal(data);
9555
- }
9556
9532
  }
9557
9533
  dragEndReal(data) {
9558
9534
  const { interaction, downData, dragData } = this;
@@ -9749,14 +9725,16 @@ var LeaferUI = (function (exports) {
9749
9725
  class InteractionBase {
9750
9726
  get dragging() { return this.dragger.dragging; }
9751
9727
  get transforming() { return this.transformer.transforming; }
9752
- get moveMode() { return this.config.move.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
9753
- get canHover() { return this.config.pointer.hover && !this.config.mobile; }
9754
- get isDragEmpty() { return this.config.move.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
9755
- get isMobileDragEmpty() { return this.config.move.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
9756
- get isHoldMiddleKey() { return this.config.move.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
9757
- get isHoldRightKey() { return this.config.move.holdRightKey && this.downData && PointerButton.right(this.downData); }
9758
- get isHoldSpaceKey() { return this.config.move.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
9759
- get hitRadius() { return this.config.pointer.hitRadius; }
9728
+ get moveMode() { return this.m.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
9729
+ get canHover() { return this.p.hover && !this.config.mobile; }
9730
+ get isDragEmpty() { return this.m.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
9731
+ get isMobileDragEmpty() { return this.m.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
9732
+ get isHoldMiddleKey() { return this.m.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
9733
+ get isHoldRightKey() { return this.m.holdRightKey && this.downData && PointerButton.right(this.downData); }
9734
+ get isHoldSpaceKey() { return this.m.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
9735
+ get m() { return this.config.move; }
9736
+ get p() { return this.config.pointer; }
9737
+ get hitRadius() { return this.p.hitRadius; }
9760
9738
  constructor(target, canvas, selector, userConfig) {
9761
9739
  this.config = DataHelper.clone(config);
9762
9740
  this.tapCount = 0;
@@ -9814,7 +9792,7 @@ var LeaferUI = (function (exports) {
9814
9792
  }
9815
9793
  }
9816
9794
  pointerMoveReal(data) {
9817
- const { dragHover, dragDistance } = this.config.pointer;
9795
+ const { dragHover, dragDistance } = this.p;
9818
9796
  this.emit(exports.PointerEvent.BEFORE_MOVE, data, this.defaultPath);
9819
9797
  if (this.downData) {
9820
9798
  const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
@@ -9999,7 +9977,7 @@ var LeaferUI = (function (exports) {
9999
9977
  }
10000
9978
  }
10001
9979
  findPath(data, options) {
10002
- const { hitRadius, through } = this.config.pointer;
9980
+ const { hitRadius, through } = this.p;
10003
9981
  const { bottomList } = this;
10004
9982
  const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
10005
9983
  if (find.throughPath)
@@ -10021,7 +9999,7 @@ var LeaferUI = (function (exports) {
10021
9999
  data.path = this.defaultPath;
10022
10000
  }
10023
10001
  canMove(data) {
10024
- return data && (this.moveMode || (this.config.move.drag === 'auto' && !pathCanDrag(data.path))) && !pathHasOutside(data.path);
10002
+ return data && (this.moveMode || (this.m.drag === 'auto' && !pathCanDrag(data.path))) && !pathHasOutside(data.path);
10025
10003
  }
10026
10004
  isDrag(leaf) {
10027
10005
  return this.dragger.getList().has(leaf);
@@ -10119,7 +10097,7 @@ var LeaferUI = (function (exports) {
10119
10097
  this.longPressTimer = setTimeout(() => {
10120
10098
  this.longPressed = true;
10121
10099
  this.emit(exports.PointerEvent.LONG_PRESS, data);
10122
- }, this.config.pointer.longPressTime);
10100
+ }, this.p.longPressTime);
10123
10101
  }
10124
10102
  longTap(data) {
10125
10103
  let hasLong;
@@ -10330,17 +10308,20 @@ var LeaferUI = (function (exports) {
10330
10308
  };
10331
10309
 
10332
10310
  const ui = exports.UI.prototype, group = exports.Group.prototype;
10311
+ function getSelector(ui) {
10312
+ return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
10313
+ }
10333
10314
  ui.find = function (condition, options) {
10334
- return this.leafer ? this.leafer.selector.getBy(condition, this, false, options) : [];
10315
+ return getSelector(this).getBy(condition, this, false, options);
10335
10316
  };
10336
10317
  ui.findOne = function (condition, options) {
10337
- return this.leafer ? this.leafer.selector.getBy(condition, this, true, options) : null;
10318
+ return getSelector(this).getBy(condition, this, true, options);
10338
10319
  };
10339
10320
  group.pick = function (hitPoint, options) {
10340
10321
  this.__layout.update();
10341
10322
  if (!options)
10342
10323
  options = {};
10343
- return this.leafer ? this.leafer.selector.getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this })) : null;
10324
+ return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
10344
10325
  };
10345
10326
 
10346
10327
  const canvas$1 = LeaferCanvasBase.prototype;
@@ -10369,14 +10350,10 @@ var LeaferUI = (function (exports) {
10369
10350
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
10370
10351
  for (let i = 0, len = rows.length; i < len; i++) {
10371
10352
  row = rows[i];
10372
- if (row.text) {
10353
+ if (row.text)
10373
10354
  canvas.fillText(row.text, row.x, row.y);
10374
- }
10375
- else if (row.data) {
10376
- row.data.forEach(charData => {
10377
- canvas.fillText(charData.char, charData.x, row.y);
10378
- });
10379
- }
10355
+ else if (row.data)
10356
+ row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
10380
10357
  if (decorationY)
10381
10358
  canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
10382
10359
  }
@@ -10442,12 +10419,10 @@ var LeaferUI = (function (exports) {
10442
10419
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
10443
10420
  fillText(ui, out);
10444
10421
  out.blendMode = 'normal';
10445
- if (ui.__worldFlipped) {
10422
+ if (ui.__worldFlipped)
10446
10423
  canvas.copyWorldByReset(out, ui.__nowWorld);
10447
- }
10448
- else {
10424
+ else
10449
10425
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
10450
- }
10451
10426
  out.recycle(ui.__nowWorld);
10452
10427
  }
10453
10428
  function drawTextStroke(ui, canvas) {
@@ -10455,14 +10430,10 @@ var LeaferUI = (function (exports) {
10455
10430
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
10456
10431
  for (let i = 0, len = rows.length; i < len; i++) {
10457
10432
  row = rows[i];
10458
- if (row.text) {
10433
+ if (row.text)
10459
10434
  canvas.strokeText(row.text, row.x, row.y);
10460
- }
10461
- else if (row.data) {
10462
- row.data.forEach(charData => {
10463
- canvas.strokeText(charData.char, charData.x, row.y);
10464
- });
10465
- }
10435
+ else if (row.data)
10436
+ row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
10466
10437
  if (decorationY)
10467
10438
  canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
10468
10439
  }
@@ -10515,12 +10486,10 @@ var LeaferUI = (function (exports) {
10515
10486
  out.stroke();
10516
10487
  options.windingRule ? out.clip(options.windingRule) : out.clip();
10517
10488
  out.clearWorld(ui.__layout.renderBounds);
10518
- if (ui.__worldFlipped) {
10489
+ if (ui.__worldFlipped)
10519
10490
  canvas.copyWorldByReset(out, ui.__nowWorld);
10520
- }
10521
- else {
10491
+ else
10522
10492
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
10523
- }
10524
10493
  out.recycle(ui.__nowWorld);
10525
10494
  break;
10526
10495
  }
@@ -10555,12 +10524,10 @@ var LeaferUI = (function (exports) {
10555
10524
  drawStrokesStyle(strokes, false, ui, out);
10556
10525
  options.windingRule ? out.clip(options.windingRule) : out.clip();
10557
10526
  out.clearWorld(renderBounds);
10558
- if (ui.__worldFlipped) {
10527
+ if (ui.__worldFlipped)
10559
10528
  canvas.copyWorldByReset(out, ui.__nowWorld);
10560
- }
10561
- else {
10529
+ else
10562
10530
  canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
10563
- }
10564
10531
  out.recycle(ui.__nowWorld);
10565
10532
  break;
10566
10533
  }
@@ -10624,12 +10591,7 @@ var LeaferUI = (function (exports) {
10624
10591
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
10625
10592
  if (leafPaints.length && leafPaints[0].image)
10626
10593
  hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
10627
- if (attrName === 'fill') {
10628
- data.__pixelFill = hasOpacityPixel;
10629
- }
10630
- else {
10631
- data.__pixelStroke = hasOpacityPixel;
10632
- }
10594
+ attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
10633
10595
  }
10634
10596
  function getLeafPaint(attrName, paint, ui) {
10635
10597
  if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)