@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.
@@ -2958,7 +2958,6 @@ class PathCreator {
2958
2958
  set path(value) { this.__path = value; }
2959
2959
  get path() { return this.__path; }
2960
2960
  constructor(path) {
2961
- this.clearPath = this.beginPath;
2962
2961
  this.set(path);
2963
2962
  }
2964
2963
  set(path) {
@@ -3040,6 +3039,9 @@ class PathCreator {
3040
3039
  this.paint();
3041
3040
  return this;
3042
3041
  }
3042
+ clearPath() {
3043
+ return this.beginPath();
3044
+ }
3043
3045
  paint() { }
3044
3046
  }
3045
3047
 
@@ -3635,6 +3637,8 @@ const ImageManager = {
3635
3637
  else {
3636
3638
  if (url.includes('.' + format) || url.includes('.' + FileHelper.upperCaseTypeMap[format]))
3637
3639
  return true;
3640
+ else if (format === 'png' && !url.includes('.'))
3641
+ return true;
3638
3642
  }
3639
3643
  return false;
3640
3644
  },
@@ -4426,13 +4430,10 @@ class LeafLayout {
4426
4430
  update() {
4427
4431
  const { leafer } = this.leaf;
4428
4432
  if (leafer) {
4429
- if (leafer.ready) {
4430
- if (leafer.watcher.changed)
4431
- leafer.layouter.layout();
4432
- }
4433
- else {
4433
+ if (leafer.ready)
4434
+ leafer.watcher.changed && leafer.layouter.layout();
4435
+ else
4434
4436
  leafer.start();
4435
- }
4436
4437
  }
4437
4438
  else {
4438
4439
  let root = this.leaf;
@@ -5255,7 +5256,7 @@ const BranchRender = {
5255
5256
  const { LEAF, create } = IncrementId;
5256
5257
  const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
5257
5258
  const { toOuterOf } = BoundsHelper;
5258
- const { copy: copy$4, move: move$1 } = PointHelper;
5259
+ const { copy: copy$4, move } = PointHelper;
5259
5260
  const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
5260
5261
  let Leaf = class Leaf {
5261
5262
  get tag() { return this.__tag; }
@@ -5490,7 +5491,7 @@ let Leaf = class Leaf {
5490
5491
  }
5491
5492
  getBoxPointByInner(inner, _relative, _distance, change) {
5492
5493
  const point = change ? inner : Object.assign({}, inner), { x, y } = this.boxBounds;
5493
- move$1(point, -x, -y);
5494
+ move(point, -x, -y);
5494
5495
  return point;
5495
5496
  }
5496
5497
  getInnerPoint(world, relative, distance, change) {
@@ -5500,7 +5501,7 @@ let Leaf = class Leaf {
5500
5501
  }
5501
5502
  getInnerPointByBox(box, _relative, _distance, change) {
5502
5503
  const point = change ? box : Object.assign({}, box), { x, y } = this.boxBounds;
5503
- move$1(point, x, y);
5504
+ move(point, x, y);
5504
5505
  return point;
5505
5506
  }
5506
5507
  getInnerPointByLocal(local, _relative, distance, change) {
@@ -5641,11 +5642,10 @@ let Leaf = class Leaf {
5641
5642
  }
5642
5643
  destroy() {
5643
5644
  if (!this.destroyed) {
5644
- const { parent } = this;
5645
- if (parent)
5645
+ if (this.parent)
5646
5646
  this.remove();
5647
5647
  if (this.children)
5648
- this.removeAll(true);
5648
+ this.clear();
5649
5649
  this.__emitLifeEvent(ChildEvent.DESTROY);
5650
5650
  this.__.destroy();
5651
5651
  this.__layout.destroy();
@@ -5959,7 +5959,7 @@ class LeafLevelList {
5959
5959
  }
5960
5960
  }
5961
5961
 
5962
- const version = "1.0.6";
5962
+ const version = "1.0.8";
5963
5963
 
5964
5964
  class LeaferCanvas extends LeaferCanvasBase {
5965
5965
  get allowBackgroundColor() { return true; }
@@ -6678,7 +6678,8 @@ class Picker {
6678
6678
  path.add(leaf);
6679
6679
  leaf = leaf.parent;
6680
6680
  }
6681
- path.add(this.target);
6681
+ if (this.target)
6682
+ path.add(this.target);
6682
6683
  return path;
6683
6684
  }
6684
6685
  getHitablePath(leaf) {
@@ -6764,8 +6765,8 @@ class Selector {
6764
6765
  this.innerIdMap = {};
6765
6766
  this.idMap = {};
6766
6767
  this.methods = {
6767
- id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
6768
- 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,
6769
6770
  className: (leaf, name) => leaf.className === name ? 1 : 0,
6770
6771
  tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
6771
6772
  tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
@@ -6774,7 +6775,8 @@ class Selector {
6774
6775
  if (userConfig)
6775
6776
  this.config = DataHelper.default(userConfig, this.config);
6776
6777
  this.picker = new Picker(target, this);
6777
- this.__listenEvents();
6778
+ if (target)
6779
+ this.__listenEvents();
6778
6780
  }
6779
6781
  getBy(condition, branch, one, options) {
6780
6782
  switch (typeof condition) {
@@ -6809,7 +6811,7 @@ class Selector {
6809
6811
  }
6810
6812
  }
6811
6813
  getByPoint(hitPoint, hitRadius, options) {
6812
- if (Platform.name === 'node')
6814
+ if (Platform.name === 'node' && this.target)
6813
6815
  this.target.emit(LayoutEvent.CHECK_UPDATE);
6814
6816
  return this.picker.getByPoint(hitPoint, hitRadius, options);
6815
6817
  }
@@ -6958,12 +6960,8 @@ const State = {
6958
6960
  };
6959
6961
  const Transition = {
6960
6962
  list: {},
6961
- register(attrName, fn) {
6962
- Transition.list[attrName] = fn;
6963
- },
6964
- get(attrName) {
6965
- return Transition.list[attrName];
6966
- }
6963
+ register(attrName, fn) { Transition.list[attrName] = fn; },
6964
+ get(attrName) { return Transition.list[attrName]; }
6967
6965
  };
6968
6966
 
6969
6967
  const { parse, objectToCanvasData } = PathConvert;
@@ -7409,8 +7407,8 @@ let UI = UI_1 = class UI extends Leaf {
7409
7407
  pen.set(path = []), this.__drawPathByBox(pen);
7410
7408
  return curve ? PathConvert.toCanvasData(path, true) : path;
7411
7409
  }
7412
- getPathString(curve, pathForRender) {
7413
- return PathConvert.stringify(this.getPath(curve, pathForRender));
7410
+ getPathString(curve, pathForRender, floatLength) {
7411
+ return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
7414
7412
  }
7415
7413
  load() {
7416
7414
  this.__.__computePaint();
@@ -7819,11 +7817,11 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7819
7817
  start() {
7820
7818
  clearTimeout(this.__startTimer);
7821
7819
  if (!this.running && this.canvas) {
7820
+ this.running = true;
7822
7821
  this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
7823
7822
  this.__controllers.forEach(item => item.start());
7824
7823
  if (!this.isApp)
7825
7824
  this.renderer.render();
7826
- this.running = true;
7827
7825
  }
7828
7826
  }
7829
7827
  stop() {
@@ -7929,12 +7927,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7929
7927
  }
7930
7928
  __changeFill(newValue) {
7931
7929
  this.config.fill = newValue;
7932
- if (this.canvas.allowBackgroundColor) {
7930
+ if (this.canvas.allowBackgroundColor)
7933
7931
  this.canvas.backgroundColor = newValue;
7934
- }
7935
- else {
7932
+ else
7936
7933
  this.forceRender();
7937
- }
7938
7934
  }
7939
7935
  __onCreated() {
7940
7936
  this.created = true;
@@ -8001,13 +7997,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8001
7997
  if (bind)
8002
7998
  item = item.bind(bind);
8003
7999
  this.__viewCompletedWait.push(item);
8004
- if (this.viewCompleted) {
8000
+ if (this.viewCompleted)
8005
8001
  this.__checkViewCompleted(false);
8006
- }
8007
- else {
8008
- if (!this.running)
8009
- this.start();
8010
- }
8002
+ else if (!this.running)
8003
+ this.start();
8011
8004
  }
8012
8005
  nextRender(item, bind, off) {
8013
8006
  if (bind)
@@ -8021,9 +8014,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8021
8014
  }
8022
8015
  }
8023
8016
  }
8024
- else {
8017
+ else
8025
8018
  list.push(item);
8026
- }
8027
8019
  }
8028
8020
  zoom(_zoomType, _padding, _fixedScale) {
8029
8021
  return needPlugin('view');
@@ -8067,10 +8059,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8067
8059
  this.stop();
8068
8060
  this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
8069
8061
  this.__removeListenEvents();
8070
- this.__controllers.forEach(item => {
8071
- if (!(this.parent && item === this.interaction))
8072
- item.destroy();
8073
- });
8062
+ this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
8074
8063
  this.__controllers.length = 0;
8075
8064
  if (!this.parent) {
8076
8065
  if (this.selector)
@@ -8603,23 +8592,23 @@ let Text = class Text extends UI {
8603
8592
  }
8604
8593
  __updateTextDrawData() {
8605
8594
  const data = this.__;
8606
- data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
8607
- }
8608
- __updateBoxBounds() {
8609
- const data = this.__;
8610
- const layout = this.__layout;
8611
8595
  const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
8612
- const autoWidth = data.__autoWidth;
8613
- const autoHeight = data.__autoHeight;
8614
8596
  data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
8615
8597
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
8616
8598
  data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
8617
8599
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
8618
8600
  data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
8619
8601
  data.__clipText = textOverflow !== 'show' && !data.__autoSize;
8602
+ data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
8603
+ }
8604
+ __updateBoxBounds() {
8605
+ const data = this.__;
8606
+ const layout = this.__layout;
8607
+ const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
8620
8608
  this.__updateTextDrawData();
8621
8609
  const { bounds } = data.__textDrawData;
8622
8610
  const b = layout.boxBounds;
8611
+ console.log(bounds, autoWidth, autoHeight);
8623
8612
  if (data.__lineHeight < fontSize)
8624
8613
  spread(bounds, fontSize / 2);
8625
8614
  if (autoWidth || autoHeight) {
@@ -8629,20 +8618,15 @@ let Text = class Text extends UI {
8629
8618
  b.height = autoHeight ? bounds.height : data.height;
8630
8619
  if (padding) {
8631
8620
  const [top, right, bottom, left] = data.__padding;
8632
- if (autoWidth) {
8633
- b.x -= left;
8634
- b.width += (right + left);
8635
- }
8636
- if (autoHeight) {
8637
- b.y -= top;
8638
- b.height += (bottom + top);
8639
- }
8621
+ if (autoWidth)
8622
+ b.x -= left, b.width += (right + left);
8623
+ if (autoHeight)
8624
+ b.y -= top, b.height += (bottom + top);
8640
8625
  }
8641
8626
  this.__updateNaturalSize();
8642
8627
  }
8643
- else {
8628
+ else
8644
8629
  super.__updateBoxBounds();
8645
- }
8646
8630
  if (italic)
8647
8631
  b.width += fontSize * 0.16;
8648
8632
  const contentBounds = includes(b, bounds) ? b : bounds;
@@ -8651,9 +8635,8 @@ let Text = class Text extends UI {
8651
8635
  layout.renderChanged = true;
8652
8636
  setList(data.__textBoxBounds = {}, [b, bounds]);
8653
8637
  }
8654
- else {
8638
+ else
8655
8639
  data.__textBoxBounds = contentBounds;
8656
- }
8657
8640
  }
8658
8641
  __updateRenderSpread() {
8659
8642
  let width = super.__updateRenderSpread();
@@ -8766,11 +8749,7 @@ let Pen = class Pen extends Group {
8766
8749
  this.add(path);
8767
8750
  return this;
8768
8751
  }
8769
- beginPath() {
8770
- this.__path.length = 0;
8771
- this.paint();
8772
- return this;
8773
- }
8752
+ beginPath() { return this; }
8774
8753
  moveTo(_x, _y) { return this; }
8775
8754
  lineTo(_x, _y) { return this; }
8776
8755
  bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
@@ -8797,7 +8776,7 @@ __decorate([
8797
8776
  penPathType()
8798
8777
  ], Pen.prototype, "path", void 0);
8799
8778
  Pen = __decorate([
8800
- useModule(PathCreator, ['set', 'beginPath', 'path', 'paint']),
8779
+ useModule(PathCreator, ['set', 'path', 'paint']),
8801
8780
  registerUI()
8802
8781
  ], Pen);
8803
8782
  function penPathType() {
@@ -8899,10 +8878,9 @@ let App = class App extends Leafer {
8899
8878
  }
8900
8879
  __render(canvas, options) {
8901
8880
  if (canvas.context) {
8902
- if (options.matrix) {
8903
- const { a, b, c, d, e, f } = options.matrix;
8904
- canvas.setTransform(a, b, c, d, e, f);
8905
- }
8881
+ const m = options.matrix;
8882
+ if (m)
8883
+ canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
8906
8884
  this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
8907
8885
  }
8908
8886
  }
@@ -8972,9 +8950,6 @@ class UIEvent extends Event {
8972
8950
  constructor(params) {
8973
8951
  super(params.type);
8974
8952
  this.bubbles = true;
8975
- this.getInner = this.getInnerPoint;
8976
- this.getLocal = this.getLocalPoint;
8977
- this.getPage = this.getPagePoint;
8978
8953
  Object.assign(this, params);
8979
8954
  }
8980
8955
  getBoxPoint(relative) {
@@ -8995,6 +8970,9 @@ class UIEvent extends Event {
8995
8970
  getPagePoint() {
8996
8971
  return this.current.getPagePoint(this);
8997
8972
  }
8973
+ getInner(relative) { return this.getInnerPoint(relative); }
8974
+ getLocal(relative) { return this.getLocalPoint(relative); }
8975
+ getPage() { return this.getPagePoint(); }
8998
8976
  static changeName(oldName, newName) {
8999
8977
  EventCreator.changeName(oldName, newName);
9000
8978
  }
@@ -9026,7 +9004,7 @@ PointerEvent = __decorate([
9026
9004
  ], PointerEvent);
9027
9005
  const MyPointerEvent = PointerEvent;
9028
9006
 
9029
- const move = {};
9007
+ const tempMove = {};
9030
9008
  let DragEvent = class DragEvent extends PointerEvent {
9031
9009
  static setList(data) {
9032
9010
  this.list = data instanceof LeafList ? data : new LeafList(data);
@@ -9077,19 +9055,19 @@ let DragEvent = class DragEvent extends PointerEvent {
9077
9055
  }
9078
9056
  getPageMove(total) {
9079
9057
  this.assignMove(total);
9080
- return this.current.getPagePoint(move, null, true);
9058
+ return this.current.getPagePoint(tempMove, null, true);
9081
9059
  }
9082
9060
  getInnerMove(relative, total) {
9083
9061
  if (!relative)
9084
9062
  relative = this.current;
9085
9063
  this.assignMove(total);
9086
- return relative.getInnerPoint(move, null, true);
9064
+ return relative.getInnerPoint(tempMove, null, true);
9087
9065
  }
9088
9066
  getLocalMove(relative, total) {
9089
9067
  if (!relative)
9090
9068
  relative = this.current;
9091
9069
  this.assignMove(total);
9092
- return relative.getLocalPoint(move, null, true);
9070
+ return relative.getLocalPoint(tempMove, null, true);
9093
9071
  }
9094
9072
  getPageTotal() {
9095
9073
  return this.getPageMove(true);
@@ -9109,8 +9087,8 @@ let DragEvent = class DragEvent extends PointerEvent {
9109
9087
  return bounds;
9110
9088
  }
9111
9089
  assignMove(total) {
9112
- move.x = total ? this.totalX : this.moveX;
9113
- move.y = total ? this.totalY : this.moveY;
9090
+ tempMove.x = total ? this.totalX : this.moveX;
9091
+ tempMove.y = total ? this.totalY : this.moveY;
9114
9092
  }
9115
9093
  };
9116
9094
  DragEvent.BEFORE_DRAG = 'drag.before_drag';
@@ -9524,9 +9502,8 @@ class Dragger {
9524
9502
  interaction.emit(DragEvent.OVER, data, path);
9525
9503
  }
9526
9504
  }
9527
- else {
9505
+ else
9528
9506
  interaction.emit(DragEvent.OVER, data, path);
9529
- }
9530
9507
  }
9531
9508
  dragEnterOrLeave(data) {
9532
9509
  const { interaction } = this;
@@ -9547,9 +9524,8 @@ class Dragger {
9547
9524
  this.drag(data);
9548
9525
  this.animate(() => { this.dragEnd(data, 1); });
9549
9526
  }
9550
- else {
9527
+ else
9551
9528
  this.dragEndReal(data);
9552
- }
9553
9529
  }
9554
9530
  dragEndReal(data) {
9555
9531
  const { interaction, downData, dragData } = this;
@@ -9746,14 +9722,16 @@ const { pathHasEventType, getMoveEventData, getZoomEventData, getRotateEventData
9746
9722
  class InteractionBase {
9747
9723
  get dragging() { return this.dragger.dragging; }
9748
9724
  get transforming() { return this.transformer.transforming; }
9749
- get moveMode() { return this.config.move.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
9750
- get canHover() { return this.config.pointer.hover && !this.config.mobile; }
9751
- get isDragEmpty() { return this.config.move.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
9752
- get isMobileDragEmpty() { return this.config.move.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
9753
- get isHoldMiddleKey() { return this.config.move.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
9754
- get isHoldRightKey() { return this.config.move.holdRightKey && this.downData && PointerButton.right(this.downData); }
9755
- get isHoldSpaceKey() { return this.config.move.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
9756
- get hitRadius() { return this.config.pointer.hitRadius; }
9725
+ get moveMode() { return this.m.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
9726
+ get canHover() { return this.p.hover && !this.config.mobile; }
9727
+ get isDragEmpty() { return this.m.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
9728
+ get isMobileDragEmpty() { return this.m.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
9729
+ get isHoldMiddleKey() { return this.m.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
9730
+ get isHoldRightKey() { return this.m.holdRightKey && this.downData && PointerButton.right(this.downData); }
9731
+ get isHoldSpaceKey() { return this.m.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
9732
+ get m() { return this.config.move; }
9733
+ get p() { return this.config.pointer; }
9734
+ get hitRadius() { return this.p.hitRadius; }
9757
9735
  constructor(target, canvas, selector, userConfig) {
9758
9736
  this.config = DataHelper.clone(config);
9759
9737
  this.tapCount = 0;
@@ -9811,7 +9789,7 @@ class InteractionBase {
9811
9789
  }
9812
9790
  }
9813
9791
  pointerMoveReal(data) {
9814
- const { dragHover, dragDistance } = this.config.pointer;
9792
+ const { dragHover, dragDistance } = this.p;
9815
9793
  this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
9816
9794
  if (this.downData) {
9817
9795
  const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
@@ -9996,7 +9974,7 @@ class InteractionBase {
9996
9974
  }
9997
9975
  }
9998
9976
  findPath(data, options) {
9999
- const { hitRadius, through } = this.config.pointer;
9977
+ const { hitRadius, through } = this.p;
10000
9978
  const { bottomList } = this;
10001
9979
  const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
10002
9980
  if (find.throughPath)
@@ -10018,7 +9996,7 @@ class InteractionBase {
10018
9996
  data.path = this.defaultPath;
10019
9997
  }
10020
9998
  canMove(data) {
10021
- return data && (this.moveMode || (this.config.move.drag === 'auto' && !pathCanDrag(data.path))) && !pathHasOutside(data.path);
9999
+ return data && (this.moveMode || (this.m.drag === 'auto' && !pathCanDrag(data.path))) && !pathHasOutside(data.path);
10022
10000
  }
10023
10001
  isDrag(leaf) {
10024
10002
  return this.dragger.getList().has(leaf);
@@ -10116,7 +10094,7 @@ class InteractionBase {
10116
10094
  this.longPressTimer = setTimeout(() => {
10117
10095
  this.longPressed = true;
10118
10096
  this.emit(PointerEvent.LONG_PRESS, data);
10119
- }, this.config.pointer.longPressTime);
10097
+ }, this.p.longPressTime);
10120
10098
  }
10121
10099
  longTap(data) {
10122
10100
  let hasLong;
@@ -10327,17 +10305,20 @@ rect.__hitFill = box$1.__hitFill = function (inner) {
10327
10305
  };
10328
10306
 
10329
10307
  const ui = UI.prototype, group = Group.prototype;
10308
+ function getSelector(ui) {
10309
+ return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
10310
+ }
10330
10311
  ui.find = function (condition, options) {
10331
- return this.leafer ? this.leafer.selector.getBy(condition, this, false, options) : [];
10312
+ return getSelector(this).getBy(condition, this, false, options);
10332
10313
  };
10333
10314
  ui.findOne = function (condition, options) {
10334
- return this.leafer ? this.leafer.selector.getBy(condition, this, true, options) : null;
10315
+ return getSelector(this).getBy(condition, this, true, options);
10335
10316
  };
10336
10317
  group.pick = function (hitPoint, options) {
10337
10318
  this.__layout.update();
10338
10319
  if (!options)
10339
10320
  options = {};
10340
- return this.leafer ? this.leafer.selector.getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this })) : null;
10321
+ return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
10341
10322
  };
10342
10323
 
10343
10324
  const canvas$1 = LeaferCanvasBase.prototype;
@@ -10366,14 +10347,10 @@ function fillText(ui, canvas) {
10366
10347
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
10367
10348
  for (let i = 0, len = rows.length; i < len; i++) {
10368
10349
  row = rows[i];
10369
- if (row.text) {
10350
+ if (row.text)
10370
10351
  canvas.fillText(row.text, row.x, row.y);
10371
- }
10372
- else if (row.data) {
10373
- row.data.forEach(charData => {
10374
- canvas.fillText(charData.char, charData.x, row.y);
10375
- });
10376
- }
10352
+ else if (row.data)
10353
+ row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
10377
10354
  if (decorationY)
10378
10355
  canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
10379
10356
  }
@@ -10439,12 +10416,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
10439
10416
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
10440
10417
  fillText(ui, out);
10441
10418
  out.blendMode = 'normal';
10442
- if (ui.__worldFlipped) {
10419
+ if (ui.__worldFlipped)
10443
10420
  canvas.copyWorldByReset(out, ui.__nowWorld);
10444
- }
10445
- else {
10421
+ else
10446
10422
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
10447
- }
10448
10423
  out.recycle(ui.__nowWorld);
10449
10424
  }
10450
10425
  function drawTextStroke(ui, canvas) {
@@ -10452,14 +10427,10 @@ function drawTextStroke(ui, canvas) {
10452
10427
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
10453
10428
  for (let i = 0, len = rows.length; i < len; i++) {
10454
10429
  row = rows[i];
10455
- if (row.text) {
10430
+ if (row.text)
10456
10431
  canvas.strokeText(row.text, row.x, row.y);
10457
- }
10458
- else if (row.data) {
10459
- row.data.forEach(charData => {
10460
- canvas.strokeText(charData.char, charData.x, row.y);
10461
- });
10462
- }
10432
+ else if (row.data)
10433
+ row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
10463
10434
  if (decorationY)
10464
10435
  canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
10465
10436
  }
@@ -10512,12 +10483,10 @@ function stroke(stroke, ui, canvas) {
10512
10483
  out.stroke();
10513
10484
  options.windingRule ? out.clip(options.windingRule) : out.clip();
10514
10485
  out.clearWorld(ui.__layout.renderBounds);
10515
- if (ui.__worldFlipped) {
10486
+ if (ui.__worldFlipped)
10516
10487
  canvas.copyWorldByReset(out, ui.__nowWorld);
10517
- }
10518
- else {
10488
+ else
10519
10489
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
10520
- }
10521
10490
  out.recycle(ui.__nowWorld);
10522
10491
  break;
10523
10492
  }
@@ -10552,12 +10521,10 @@ function strokes(strokes, ui, canvas) {
10552
10521
  drawStrokesStyle(strokes, false, ui, out);
10553
10522
  options.windingRule ? out.clip(options.windingRule) : out.clip();
10554
10523
  out.clearWorld(renderBounds);
10555
- if (ui.__worldFlipped) {
10524
+ if (ui.__worldFlipped)
10556
10525
  canvas.copyWorldByReset(out, ui.__nowWorld);
10557
- }
10558
- else {
10526
+ else
10559
10527
  canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
10560
- }
10561
10528
  out.recycle(ui.__nowWorld);
10562
10529
  break;
10563
10530
  }
@@ -10621,12 +10588,7 @@ function compute(attrName, ui) {
10621
10588
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
10622
10589
  if (leafPaints.length && leafPaints[0].image)
10623
10590
  hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
10624
- if (attrName === 'fill') {
10625
- data.__pixelFill = hasOpacityPixel;
10626
- }
10627
- else {
10628
- data.__pixelStroke = hasOpacityPixel;
10629
- }
10591
+ attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
10630
10592
  }
10631
10593
  function getLeafPaint(attrName, paint, ui) {
10632
10594
  if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)