leafer-ui 2.0.3 → 2.0.5

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.
@@ -5620,7 +5620,7 @@ class BoundsEvent extends Event {
5620
5620
  }
5621
5621
  }
5622
5622
  static emitWorld(leaf) {
5623
- if (leaf.leaferIsReady) leaf.emit(WORLD, this);
5623
+ if (leaf.leaferIsReady) leaf.emit(WORLD, leaf);
5624
5624
  }
5625
5625
  }
5626
5626
 
@@ -6581,14 +6581,16 @@ let Leaf = class Leaf {
6581
6581
  relative.innerToWorld(world, to, distance);
6582
6582
  world = to ? to : world;
6583
6583
  }
6584
- toInnerPoint(this.scrollWorldTransform, world, to, distance);
6584
+ toInnerPoint(this.worldTransform, world, to, distance);
6585
6585
  }
6586
6586
  innerToWorld(inner, to, distance, relative) {
6587
- toOuterPoint(this.scrollWorldTransform, inner, to, distance);
6587
+ toOuterPoint(this.worldTransform, inner, to, distance);
6588
6588
  if (relative) relative.worldToInner(to ? to : inner, null, distance);
6589
6589
  }
6590
6590
  getBoxPoint(world, relative, distance, change) {
6591
- return this.getBoxPointByInner(this.getInnerPoint(world, relative, distance, change), null, null, true);
6591
+ const inner = this.getInnerPoint(world, relative, distance, change);
6592
+ if (distance) return inner;
6593
+ return this.getBoxPointByInner(inner, null, null, true);
6592
6594
  }
6593
6595
  getBoxPointByInner(inner, _relative, _distance, change) {
6594
6596
  const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
@@ -7051,7 +7053,7 @@ class LeafLevelList {
7051
7053
  }
7052
7054
  }
7053
7055
 
7054
- const version = "2.0.3";
7056
+ const version = "2.0.5";
7055
7057
 
7056
7058
  const debug$5 = Debug.get("LeaferCanvas");
7057
7059
 
@@ -8434,7 +8436,11 @@ class EllipseData extends UIData {
8434
8436
 
8435
8437
  class PolygonData extends LineData {}
8436
8438
 
8437
- class StarData extends UIData {}
8439
+ class StarData extends UIData {
8440
+ get __boxStroke() {
8441
+ return !this.__pathInputed;
8442
+ }
8443
+ }
8438
8444
 
8439
8445
  class PathData extends UIData {
8440
8446
  get __pathInputed() {
@@ -9446,6 +9452,9 @@ let Box = class Box extends Group {
9446
9452
  get isBranchLeaf() {
9447
9453
  return true;
9448
9454
  }
9455
+ get __useSelfBox() {
9456
+ return this.pathInputed;
9457
+ }
9449
9458
  constructor(data) {
9450
9459
  super(data);
9451
9460
  this.__layout.renderChanged || this.__layout.renderChange();
@@ -9461,7 +9470,7 @@ let Box = class Box extends Group {
9461
9470
  }
9462
9471
  __updateRectBoxBounds() {}
9463
9472
  __updateBoxBounds(_secondLayout) {
9464
- if (this.children.length && !this.pathInputed) {
9473
+ if (this.children.length && !this.__useSelfBox) {
9465
9474
  const data = this.__;
9466
9475
  if (data.__autoSide) {
9467
9476
  if (data.__hasSurface) this.__extraUpdate();
@@ -11193,6 +11202,14 @@ class InteractionBase {
11193
11202
  stopDragAnimate() {
11194
11203
  this.dragger.stopAnimate();
11195
11204
  }
11205
+ replaceDownTarget(target) {
11206
+ const {downData: downData} = this;
11207
+ if (downData && target) {
11208
+ const {path: path} = downData;
11209
+ path.remove(path.list[0]);
11210
+ path.addAt(target, 0);
11211
+ }
11212
+ }
11196
11213
  updateDownData(data, options, merge) {
11197
11214
  const {downData: downData} = this;
11198
11215
  if (!data && downData) data = downData;
@@ -11624,6 +11641,10 @@ const KeyEventHelper = {
11624
11641
  const {pathCanDrag: pathCanDrag} = InteractionHelper;
11625
11642
 
11626
11643
  class Interaction extends InteractionBase {
11644
+ get windowTarget() {
11645
+ const {view: view} = this;
11646
+ return view && view.ownerDocument || window;
11647
+ }
11627
11648
  get notPointer() {
11628
11649
  const {p: p} = this;
11629
11650
  return p.type !== "pointer" || p.touch || this.useMultiTouch;
@@ -11669,7 +11690,7 @@ class Interaction extends InteractionBase {
11669
11690
  }
11670
11691
  for (let name in windowEvents) {
11671
11692
  windowEvents[name] = windowEvents[name].bind(this);
11672
- window.addEventListener(name, windowEvents[name]);
11693
+ this.windowTarget.addEventListener(name, windowEvents[name]);
11673
11694
  }
11674
11695
  }
11675
11696
  __removeListenEvents() {
@@ -11680,7 +11701,7 @@ class Interaction extends InteractionBase {
11680
11701
  this.viewEvents = {};
11681
11702
  }
11682
11703
  for (let name in windowEvents) {
11683
- window.removeEventListener(name, windowEvents[name]);
11704
+ this.windowTarget.removeEventListener(name, windowEvents[name]);
11684
11705
  this.windowEvents = {};
11685
11706
  }
11686
11707
  }
@@ -11700,7 +11721,8 @@ class Interaction extends InteractionBase {
11700
11721
  if (wheel.preventDefault) e.preventDefault();
11701
11722
  }
11702
11723
  preventWindowPointer(e) {
11703
- return !this.downData && e.target !== this.view;
11724
+ if (this.downData || e.target === this.view) return false;
11725
+ return this.config.shadowDOM && e.composedPath ? !e.composedPath().includes(this.view) : true;
11704
11726
  }
11705
11727
  onKeyDown(e) {
11706
11728
  this.keyDown(KeyEventHelper.convert(e));
@@ -12607,7 +12629,7 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
12607
12629
  if (drawImage) {
12608
12630
  if (data.repeat) {
12609
12631
  drawImage = false;
12610
- } else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
12632
+ } else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" || exporting)) {
12611
12633
  drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
12612
12634
  }
12613
12635
  }
@@ -13160,7 +13182,7 @@ function createRows(drawData, content, style) {
13160
13182
  }, row = {
13161
13183
  words: []
13162
13184
  };
13163
- if (__letterSpacing) content = [ ...content ];
13185
+ content = [ ...content ];
13164
13186
  for (let i = 0, len = content.length; i < len; i++) {
13165
13187
  char = content[i];
13166
13188
  if (char === "\n") {