leafer-ui 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
  const debug$7 = Debug.get('LeaferCanvas');
5965
5965
  class LeaferCanvas extends LeaferCanvasBase {
@@ -6851,7 +6851,8 @@ class Picker {
6851
6851
  path.add(leaf);
6852
6852
  leaf = leaf.parent;
6853
6853
  }
6854
- path.add(this.target);
6854
+ if (this.target)
6855
+ path.add(this.target);
6855
6856
  return path;
6856
6857
  }
6857
6858
  getHitablePath(leaf) {
@@ -6937,8 +6938,8 @@ class Selector {
6937
6938
  this.innerIdMap = {};
6938
6939
  this.idMap = {};
6939
6940
  this.methods = {
6940
- id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
6941
- innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
6941
+ id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
6942
+ innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
6942
6943
  className: (leaf, name) => leaf.className === name ? 1 : 0,
6943
6944
  tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
6944
6945
  tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
@@ -6947,7 +6948,8 @@ class Selector {
6947
6948
  if (userConfig)
6948
6949
  this.config = DataHelper.default(userConfig, this.config);
6949
6950
  this.picker = new Picker(target, this);
6950
- this.__listenEvents();
6951
+ if (target)
6952
+ this.__listenEvents();
6951
6953
  }
6952
6954
  getBy(condition, branch, one, options) {
6953
6955
  switch (typeof condition) {
@@ -6982,7 +6984,7 @@ class Selector {
6982
6984
  }
6983
6985
  }
6984
6986
  getByPoint(hitPoint, hitRadius, options) {
6985
- if (Platform.name === 'node')
6987
+ if (Platform.name === 'node' && this.target)
6986
6988
  this.target.emit(LayoutEvent.CHECK_UPDATE);
6987
6989
  return this.picker.getByPoint(hitPoint, hitRadius, options);
6988
6990
  }
@@ -7131,12 +7133,8 @@ const State = {
7131
7133
  };
7132
7134
  const Transition = {
7133
7135
  list: {},
7134
- register(attrName, fn) {
7135
- Transition.list[attrName] = fn;
7136
- },
7137
- get(attrName) {
7138
- return Transition.list[attrName];
7139
- }
7136
+ register(attrName, fn) { Transition.list[attrName] = fn; },
7137
+ get(attrName) { return Transition.list[attrName]; }
7140
7138
  };
7141
7139
 
7142
7140
  const { parse, objectToCanvasData } = PathConvert;
@@ -7582,8 +7580,8 @@ let UI = UI_1 = class UI extends Leaf {
7582
7580
  pen.set(path = []), this.__drawPathByBox(pen);
7583
7581
  return curve ? PathConvert.toCanvasData(path, true) : path;
7584
7582
  }
7585
- getPathString(curve, pathForRender) {
7586
- return PathConvert.stringify(this.getPath(curve, pathForRender));
7583
+ getPathString(curve, pathForRender, floatLength) {
7584
+ return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
7587
7585
  }
7588
7586
  load() {
7589
7587
  this.__.__computePaint();
@@ -7992,11 +7990,11 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7992
7990
  start() {
7993
7991
  clearTimeout(this.__startTimer);
7994
7992
  if (!this.running && this.canvas) {
7993
+ this.running = true;
7995
7994
  this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
7996
7995
  this.__controllers.forEach(item => item.start());
7997
7996
  if (!this.isApp)
7998
7997
  this.renderer.render();
7999
- this.running = true;
8000
7998
  }
8001
7999
  }
8002
8000
  stop() {
@@ -8102,12 +8100,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8102
8100
  }
8103
8101
  __changeFill(newValue) {
8104
8102
  this.config.fill = newValue;
8105
- if (this.canvas.allowBackgroundColor) {
8103
+ if (this.canvas.allowBackgroundColor)
8106
8104
  this.canvas.backgroundColor = newValue;
8107
- }
8108
- else {
8105
+ else
8109
8106
  this.forceRender();
8110
- }
8111
8107
  }
8112
8108
  __onCreated() {
8113
8109
  this.created = true;
@@ -8174,13 +8170,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8174
8170
  if (bind)
8175
8171
  item = item.bind(bind);
8176
8172
  this.__viewCompletedWait.push(item);
8177
- if (this.viewCompleted) {
8173
+ if (this.viewCompleted)
8178
8174
  this.__checkViewCompleted(false);
8179
- }
8180
- else {
8181
- if (!this.running)
8182
- this.start();
8183
- }
8175
+ else if (!this.running)
8176
+ this.start();
8184
8177
  }
8185
8178
  nextRender(item, bind, off) {
8186
8179
  if (bind)
@@ -8194,9 +8187,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8194
8187
  }
8195
8188
  }
8196
8189
  }
8197
- else {
8190
+ else
8198
8191
  list.push(item);
8199
- }
8200
8192
  }
8201
8193
  zoom(_zoomType, _padding, _fixedScale) {
8202
8194
  return needPlugin('view');
@@ -8240,10 +8232,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8240
8232
  this.stop();
8241
8233
  this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
8242
8234
  this.__removeListenEvents();
8243
- this.__controllers.forEach(item => {
8244
- if (!(this.parent && item === this.interaction))
8245
- item.destroy();
8246
- });
8235
+ this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
8247
8236
  this.__controllers.length = 0;
8248
8237
  if (!this.parent) {
8249
8238
  if (this.selector)
@@ -8776,23 +8765,23 @@ let Text = class Text extends UI {
8776
8765
  }
8777
8766
  __updateTextDrawData() {
8778
8767
  const data = this.__;
8779
- data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
8780
- }
8781
- __updateBoxBounds() {
8782
- const data = this.__;
8783
- const layout = this.__layout;
8784
8768
  const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
8785
- const autoWidth = data.__autoWidth;
8786
- const autoHeight = data.__autoHeight;
8787
8769
  data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
8788
8770
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
8789
8771
  data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
8790
8772
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
8791
8773
  data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
8792
8774
  data.__clipText = textOverflow !== 'show' && !data.__autoSize;
8775
+ data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
8776
+ }
8777
+ __updateBoxBounds() {
8778
+ const data = this.__;
8779
+ const layout = this.__layout;
8780
+ const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
8793
8781
  this.__updateTextDrawData();
8794
8782
  const { bounds } = data.__textDrawData;
8795
8783
  const b = layout.boxBounds;
8784
+ console.log(bounds, autoWidth, autoHeight);
8796
8785
  if (data.__lineHeight < fontSize)
8797
8786
  spread(bounds, fontSize / 2);
8798
8787
  if (autoWidth || autoHeight) {
@@ -8802,20 +8791,15 @@ let Text = class Text extends UI {
8802
8791
  b.height = autoHeight ? bounds.height : data.height;
8803
8792
  if (padding) {
8804
8793
  const [top, right, bottom, left] = data.__padding;
8805
- if (autoWidth) {
8806
- b.x -= left;
8807
- b.width += (right + left);
8808
- }
8809
- if (autoHeight) {
8810
- b.y -= top;
8811
- b.height += (bottom + top);
8812
- }
8794
+ if (autoWidth)
8795
+ b.x -= left, b.width += (right + left);
8796
+ if (autoHeight)
8797
+ b.y -= top, b.height += (bottom + top);
8813
8798
  }
8814
8799
  this.__updateNaturalSize();
8815
8800
  }
8816
- else {
8801
+ else
8817
8802
  super.__updateBoxBounds();
8818
- }
8819
8803
  if (italic)
8820
8804
  b.width += fontSize * 0.16;
8821
8805
  const contentBounds = includes(b, bounds) ? b : bounds;
@@ -8824,9 +8808,8 @@ let Text = class Text extends UI {
8824
8808
  layout.renderChanged = true;
8825
8809
  setList(data.__textBoxBounds = {}, [b, bounds]);
8826
8810
  }
8827
- else {
8811
+ else
8828
8812
  data.__textBoxBounds = contentBounds;
8829
- }
8830
8813
  }
8831
8814
  __updateRenderSpread() {
8832
8815
  let width = super.__updateRenderSpread();
@@ -8939,11 +8922,7 @@ let Pen = class Pen extends Group {
8939
8922
  this.add(path);
8940
8923
  return this;
8941
8924
  }
8942
- beginPath() {
8943
- this.__path.length = 0;
8944
- this.paint();
8945
- return this;
8946
- }
8925
+ beginPath() { return this; }
8947
8926
  moveTo(_x, _y) { return this; }
8948
8927
  lineTo(_x, _y) { return this; }
8949
8928
  bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
@@ -8970,7 +8949,7 @@ __decorate([
8970
8949
  penPathType()
8971
8950
  ], Pen.prototype, "path", void 0);
8972
8951
  Pen = __decorate([
8973
- useModule(PathCreator, ['set', 'beginPath', 'path', 'paint']),
8952
+ useModule(PathCreator, ['set', 'path', 'paint']),
8974
8953
  registerUI()
8975
8954
  ], Pen);
8976
8955
  function penPathType() {
@@ -9072,10 +9051,9 @@ let App = class App extends Leafer {
9072
9051
  }
9073
9052
  __render(canvas, options) {
9074
9053
  if (canvas.context) {
9075
- if (options.matrix) {
9076
- const { a, b, c, d, e, f } = options.matrix;
9077
- canvas.setTransform(a, b, c, d, e, f);
9078
- }
9054
+ const m = options.matrix;
9055
+ if (m)
9056
+ canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
9079
9057
  this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
9080
9058
  }
9081
9059
  }
@@ -9145,9 +9123,6 @@ class UIEvent extends Event {
9145
9123
  constructor(params) {
9146
9124
  super(params.type);
9147
9125
  this.bubbles = true;
9148
- this.getInner = this.getInnerPoint;
9149
- this.getLocal = this.getLocalPoint;
9150
- this.getPage = this.getPagePoint;
9151
9126
  Object.assign(this, params);
9152
9127
  }
9153
9128
  getBoxPoint(relative) {
@@ -9168,6 +9143,9 @@ class UIEvent extends Event {
9168
9143
  getPagePoint() {
9169
9144
  return this.current.getPagePoint(this);
9170
9145
  }
9146
+ getInner(relative) { return this.getInnerPoint(relative); }
9147
+ getLocal(relative) { return this.getLocalPoint(relative); }
9148
+ getPage() { return this.getPagePoint(); }
9171
9149
  static changeName(oldName, newName) {
9172
9150
  EventCreator.changeName(oldName, newName);
9173
9151
  }
@@ -9199,7 +9177,7 @@ PointerEvent = __decorate([
9199
9177
  ], PointerEvent);
9200
9178
  const MyPointerEvent = PointerEvent;
9201
9179
 
9202
- const move = {};
9180
+ const tempMove = {};
9203
9181
  let DragEvent = class DragEvent extends PointerEvent {
9204
9182
  static setList(data) {
9205
9183
  this.list = data instanceof LeafList ? data : new LeafList(data);
@@ -9250,19 +9228,19 @@ let DragEvent = class DragEvent extends PointerEvent {
9250
9228
  }
9251
9229
  getPageMove(total) {
9252
9230
  this.assignMove(total);
9253
- return this.current.getPagePoint(move, null, true);
9231
+ return this.current.getPagePoint(tempMove, null, true);
9254
9232
  }
9255
9233
  getInnerMove(relative, total) {
9256
9234
  if (!relative)
9257
9235
  relative = this.current;
9258
9236
  this.assignMove(total);
9259
- return relative.getInnerPoint(move, null, true);
9237
+ return relative.getInnerPoint(tempMove, null, true);
9260
9238
  }
9261
9239
  getLocalMove(relative, total) {
9262
9240
  if (!relative)
9263
9241
  relative = this.current;
9264
9242
  this.assignMove(total);
9265
- return relative.getLocalPoint(move, null, true);
9243
+ return relative.getLocalPoint(tempMove, null, true);
9266
9244
  }
9267
9245
  getPageTotal() {
9268
9246
  return this.getPageMove(true);
@@ -9282,8 +9260,8 @@ let DragEvent = class DragEvent extends PointerEvent {
9282
9260
  return bounds;
9283
9261
  }
9284
9262
  assignMove(total) {
9285
- move.x = total ? this.totalX : this.moveX;
9286
- move.y = total ? this.totalY : this.moveY;
9263
+ tempMove.x = total ? this.totalX : this.moveX;
9264
+ tempMove.y = total ? this.totalY : this.moveY;
9287
9265
  }
9288
9266
  };
9289
9267
  DragEvent.BEFORE_DRAG = 'drag.before_drag';
@@ -9697,9 +9675,8 @@ class Dragger {
9697
9675
  interaction.emit(DragEvent.OVER, data, path);
9698
9676
  }
9699
9677
  }
9700
- else {
9678
+ else
9701
9679
  interaction.emit(DragEvent.OVER, data, path);
9702
- }
9703
9680
  }
9704
9681
  dragEnterOrLeave(data) {
9705
9682
  const { interaction } = this;
@@ -9720,9 +9697,8 @@ class Dragger {
9720
9697
  this.drag(data);
9721
9698
  this.animate(() => { this.dragEnd(data, 1); });
9722
9699
  }
9723
- else {
9700
+ else
9724
9701
  this.dragEndReal(data);
9725
- }
9726
9702
  }
9727
9703
  dragEndReal(data) {
9728
9704
  const { interaction, downData, dragData } = this;
@@ -9919,14 +9895,16 @@ const { pathHasEventType, getMoveEventData: getMoveEventData$1, getZoomEventData
9919
9895
  class InteractionBase {
9920
9896
  get dragging() { return this.dragger.dragging; }
9921
9897
  get transforming() { return this.transformer.transforming; }
9922
- get moveMode() { return this.config.move.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
9923
- get canHover() { return this.config.pointer.hover && !this.config.mobile; }
9924
- get isDragEmpty() { return this.config.move.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
9925
- get isMobileDragEmpty() { return this.config.move.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
9926
- get isHoldMiddleKey() { return this.config.move.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
9927
- get isHoldRightKey() { return this.config.move.holdRightKey && this.downData && PointerButton.right(this.downData); }
9928
- get isHoldSpaceKey() { return this.config.move.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
9929
- get hitRadius() { return this.config.pointer.hitRadius; }
9898
+ get moveMode() { return this.m.drag === true || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
9899
+ get canHover() { return this.p.hover && !this.config.mobile; }
9900
+ get isDragEmpty() { return this.m.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
9901
+ get isMobileDragEmpty() { return this.m.dragEmpty && !this.canHover && this.downData && this.isTreePath(this.downData); }
9902
+ get isHoldMiddleKey() { return this.m.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
9903
+ get isHoldRightKey() { return this.m.holdRightKey && this.downData && PointerButton.right(this.downData); }
9904
+ get isHoldSpaceKey() { return this.m.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
9905
+ get m() { return this.config.move; }
9906
+ get p() { return this.config.pointer; }
9907
+ get hitRadius() { return this.p.hitRadius; }
9930
9908
  constructor(target, canvas, selector, userConfig) {
9931
9909
  this.config = DataHelper.clone(config);
9932
9910
  this.tapCount = 0;
@@ -9984,7 +9962,7 @@ class InteractionBase {
9984
9962
  }
9985
9963
  }
9986
9964
  pointerMoveReal(data) {
9987
- const { dragHover, dragDistance } = this.config.pointer;
9965
+ const { dragHover, dragDistance } = this.p;
9988
9966
  this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
9989
9967
  if (this.downData) {
9990
9968
  const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
@@ -10169,7 +10147,7 @@ class InteractionBase {
10169
10147
  }
10170
10148
  }
10171
10149
  findPath(data, options) {
10172
- const { hitRadius, through } = this.config.pointer;
10150
+ const { hitRadius, through } = this.p;
10173
10151
  const { bottomList } = this;
10174
10152
  const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
10175
10153
  if (find.throughPath)
@@ -10191,7 +10169,7 @@ class InteractionBase {
10191
10169
  data.path = this.defaultPath;
10192
10170
  }
10193
10171
  canMove(data) {
10194
- return data && (this.moveMode || (this.config.move.drag === 'auto' && !pathCanDrag$1(data.path))) && !pathHasOutside(data.path);
10172
+ return data && (this.moveMode || (this.m.drag === 'auto' && !pathCanDrag$1(data.path))) && !pathHasOutside(data.path);
10195
10173
  }
10196
10174
  isDrag(leaf) {
10197
10175
  return this.dragger.getList().has(leaf);
@@ -10289,7 +10267,7 @@ class InteractionBase {
10289
10267
  this.longPressTimer = setTimeout(() => {
10290
10268
  this.longPressed = true;
10291
10269
  this.emit(PointerEvent.LONG_PRESS, data);
10292
- }, this.config.pointer.longPressTime);
10270
+ }, this.p.longPressTime);
10293
10271
  }
10294
10272
  longTap(data) {
10295
10273
  let hasLong;
@@ -10500,17 +10478,20 @@ rect.__hitFill = box$1.__hitFill = function (inner) {
10500
10478
  };
10501
10479
 
10502
10480
  const ui = UI.prototype, group = Group.prototype;
10481
+ function getSelector(ui) {
10482
+ return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
10483
+ }
10503
10484
  ui.find = function (condition, options) {
10504
- return this.leafer ? this.leafer.selector.getBy(condition, this, false, options) : [];
10485
+ return getSelector(this).getBy(condition, this, false, options);
10505
10486
  };
10506
10487
  ui.findOne = function (condition, options) {
10507
- return this.leafer ? this.leafer.selector.getBy(condition, this, true, options) : null;
10488
+ return getSelector(this).getBy(condition, this, true, options);
10508
10489
  };
10509
10490
  group.pick = function (hitPoint, options) {
10510
10491
  this.__layout.update();
10511
10492
  if (!options)
10512
10493
  options = {};
10513
- return this.leafer ? this.leafer.selector.getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this })) : null;
10494
+ return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
10514
10495
  };
10515
10496
 
10516
10497
  const canvas$1 = LeaferCanvasBase.prototype;
@@ -10891,14 +10872,10 @@ function fillText(ui, canvas) {
10891
10872
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
10892
10873
  for (let i = 0, len = rows.length; i < len; i++) {
10893
10874
  row = rows[i];
10894
- if (row.text) {
10875
+ if (row.text)
10895
10876
  canvas.fillText(row.text, row.x, row.y);
10896
- }
10897
- else if (row.data) {
10898
- row.data.forEach(charData => {
10899
- canvas.fillText(charData.char, charData.x, row.y);
10900
- });
10901
- }
10877
+ else if (row.data)
10878
+ row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
10902
10879
  if (decorationY)
10903
10880
  canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
10904
10881
  }
@@ -10964,12 +10941,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
10964
10941
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
10965
10942
  fillText(ui, out);
10966
10943
  out.blendMode = 'normal';
10967
- if (ui.__worldFlipped) {
10944
+ if (ui.__worldFlipped)
10968
10945
  canvas.copyWorldByReset(out, ui.__nowWorld);
10969
- }
10970
- else {
10946
+ else
10971
10947
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
10972
- }
10973
10948
  out.recycle(ui.__nowWorld);
10974
10949
  }
10975
10950
  function drawTextStroke(ui, canvas) {
@@ -10977,14 +10952,10 @@ function drawTextStroke(ui, canvas) {
10977
10952
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
10978
10953
  for (let i = 0, len = rows.length; i < len; i++) {
10979
10954
  row = rows[i];
10980
- if (row.text) {
10955
+ if (row.text)
10981
10956
  canvas.strokeText(row.text, row.x, row.y);
10982
- }
10983
- else if (row.data) {
10984
- row.data.forEach(charData => {
10985
- canvas.strokeText(charData.char, charData.x, row.y);
10986
- });
10987
- }
10957
+ else if (row.data)
10958
+ row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
10988
10959
  if (decorationY)
10989
10960
  canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
10990
10961
  }
@@ -11037,12 +11008,10 @@ function stroke(stroke, ui, canvas) {
11037
11008
  out.stroke();
11038
11009
  options.windingRule ? out.clip(options.windingRule) : out.clip();
11039
11010
  out.clearWorld(ui.__layout.renderBounds);
11040
- if (ui.__worldFlipped) {
11011
+ if (ui.__worldFlipped)
11041
11012
  canvas.copyWorldByReset(out, ui.__nowWorld);
11042
- }
11043
- else {
11013
+ else
11044
11014
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
11045
- }
11046
11015
  out.recycle(ui.__nowWorld);
11047
11016
  break;
11048
11017
  }
@@ -11077,12 +11046,10 @@ function strokes(strokes, ui, canvas) {
11077
11046
  drawStrokesStyle(strokes, false, ui, out);
11078
11047
  options.windingRule ? out.clip(options.windingRule) : out.clip();
11079
11048
  out.clearWorld(renderBounds);
11080
- if (ui.__worldFlipped) {
11049
+ if (ui.__worldFlipped)
11081
11050
  canvas.copyWorldByReset(out, ui.__nowWorld);
11082
- }
11083
- else {
11051
+ else
11084
11052
  canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
11085
- }
11086
11053
  out.recycle(ui.__nowWorld);
11087
11054
  break;
11088
11055
  }
@@ -11146,12 +11113,7 @@ function compute(attrName, ui) {
11146
11113
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
11147
11114
  if (leafPaints.length && leafPaints[0].image)
11148
11115
  hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
11149
- if (attrName === 'fill') {
11150
- data.__pixelFill = hasOpacityPixel;
11151
- }
11152
- else {
11153
- data.__pixelStroke = hasOpacityPixel;
11154
- }
11116
+ attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
11155
11117
  }
11156
11118
  function getLeafPaint(attrName, paint, ui) {
11157
11119
  if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)