leafer-game 2.0.3 → 2.0.4

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/web.js CHANGED
@@ -5289,7 +5289,7 @@ var LeaferUI = function(exports) {
5289
5289
  }
5290
5290
  }
5291
5291
  static emitWorld(leaf) {
5292
- if (leaf.leaferIsReady) leaf.emit(WORLD, this);
5292
+ if (leaf.leaferIsReady) leaf.emit(WORLD, leaf);
5293
5293
  }
5294
5294
  }
5295
5295
  BoundsEvent.RESIZE = "bounds.resize";
@@ -6175,14 +6175,16 @@ var LeaferUI = function(exports) {
6175
6175
  relative.innerToWorld(world, to, distance);
6176
6176
  world = to ? to : world;
6177
6177
  }
6178
- toInnerPoint(this.scrollWorldTransform, world, to, distance);
6178
+ toInnerPoint(this.worldTransform, world, to, distance);
6179
6179
  }
6180
6180
  innerToWorld(inner, to, distance, relative) {
6181
- toOuterPoint(this.scrollWorldTransform, inner, to, distance);
6181
+ toOuterPoint(this.worldTransform, inner, to, distance);
6182
6182
  if (relative) relative.worldToInner(to ? to : inner, null, distance);
6183
6183
  }
6184
6184
  getBoxPoint(world, relative, distance, change) {
6185
- return this.getBoxPointByInner(this.getInnerPoint(world, relative, distance, change), null, null, true);
6185
+ const inner = this.getInnerPoint(world, relative, distance, change);
6186
+ if (distance) return inner;
6187
+ return this.getBoxPointByInner(inner, null, null, true);
6186
6188
  }
6187
6189
  getBoxPointByInner(inner, _relative, _distance, change) {
6188
6190
  const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
@@ -6635,7 +6637,7 @@ var LeaferUI = function(exports) {
6635
6637
  this.levelMap = null;
6636
6638
  }
6637
6639
  }
6638
- const version = "2.0.3";
6640
+ const version = "2.0.4";
6639
6641
  const debug$5 = Debug.get("LeaferCanvas");
6640
6642
  class LeaferCanvas extends LeaferCanvasBase {
6641
6643
  set zIndex(zIndex) {
@@ -7951,7 +7953,11 @@ var LeaferUI = function(exports) {
7951
7953
  }
7952
7954
  }
7953
7955
  class PolygonData extends LineData {}
7954
- class StarData extends UIData {}
7956
+ class StarData extends UIData {
7957
+ get __boxStroke() {
7958
+ return !this.__pathInputed;
7959
+ }
7960
+ }
7955
7961
  class PathData extends UIData {
7956
7962
  get __pathInputed() {
7957
7963
  return 2;
@@ -8856,6 +8862,9 @@ var LeaferUI = function(exports) {
8856
8862
  get isBranchLeaf() {
8857
8863
  return true;
8858
8864
  }
8865
+ get __useSelfBox() {
8866
+ return this.pathInputed;
8867
+ }
8859
8868
  constructor(data) {
8860
8869
  super(data);
8861
8870
  this.__layout.renderChanged || this.__layout.renderChange();
@@ -8871,7 +8880,7 @@ var LeaferUI = function(exports) {
8871
8880
  }
8872
8881
  __updateRectBoxBounds() {}
8873
8882
  __updateBoxBounds(_secondLayout) {
8874
- if (this.children.length && !this.pathInputed) {
8883
+ if (this.children.length && !this.__useSelfBox) {
8875
8884
  const data = this.__;
8876
8885
  if (data.__autoSide) {
8877
8886
  if (data.__hasSurface) this.__extraUpdate();
@@ -10400,6 +10409,14 @@ var LeaferUI = function(exports) {
10400
10409
  stopDragAnimate() {
10401
10410
  this.dragger.stopAnimate();
10402
10411
  }
10412
+ replaceDownTarget(target) {
10413
+ const {downData: downData} = this;
10414
+ if (downData && target) {
10415
+ const {path: path} = downData;
10416
+ path.remove(path.list[0]);
10417
+ path.addAt(target, 0);
10418
+ }
10419
+ }
10403
10420
  updateDownData(data, options, merge) {
10404
10421
  const {downData: downData} = this;
10405
10422
  if (!data && downData) data = downData;
@@ -10800,6 +10817,10 @@ var LeaferUI = function(exports) {
10800
10817
  };
10801
10818
  const {pathCanDrag: pathCanDrag} = InteractionHelper;
10802
10819
  class Interaction extends InteractionBase {
10820
+ get windowTarget() {
10821
+ const {view: view} = this;
10822
+ return view && view.ownerDocument || window;
10823
+ }
10803
10824
  get notPointer() {
10804
10825
  const {p: p} = this;
10805
10826
  return p.type !== "pointer" || p.touch || this.useMultiTouch;
@@ -10845,7 +10866,7 @@ var LeaferUI = function(exports) {
10845
10866
  }
10846
10867
  for (let name in windowEvents) {
10847
10868
  windowEvents[name] = windowEvents[name].bind(this);
10848
- window.addEventListener(name, windowEvents[name]);
10869
+ this.windowTarget.addEventListener(name, windowEvents[name]);
10849
10870
  }
10850
10871
  }
10851
10872
  __removeListenEvents() {
@@ -10856,7 +10877,7 @@ var LeaferUI = function(exports) {
10856
10877
  this.viewEvents = {};
10857
10878
  }
10858
10879
  for (let name in windowEvents) {
10859
- window.removeEventListener(name, windowEvents[name]);
10880
+ this.windowTarget.removeEventListener(name, windowEvents[name]);
10860
10881
  this.windowEvents = {};
10861
10882
  }
10862
10883
  }
@@ -10876,7 +10897,8 @@ var LeaferUI = function(exports) {
10876
10897
  if (wheel.preventDefault) e.preventDefault();
10877
10898
  }
10878
10899
  preventWindowPointer(e) {
10879
- return !this.downData && e.target !== this.view;
10900
+ if (this.downData || e.target === this.view) return false;
10901
+ return this.config.shadowDOM && e.composedPath ? !e.composedPath().includes(this.view) : true;
10880
10902
  }
10881
10903
  onKeyDown(e) {
10882
10904
  this.keyDown(KeyEventHelper.convert(e));
@@ -11731,7 +11753,7 @@ var LeaferUI = function(exports) {
11731
11753
  if (drawImage) {
11732
11754
  if (data.repeat) {
11733
11755
  drawImage = false;
11734
- } else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
11756
+ } else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" || exporting)) {
11735
11757
  drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
11736
11758
  }
11737
11759
  }
@@ -12211,7 +12233,7 @@ var LeaferUI = function(exports) {
12211
12233
  }, row = {
12212
12234
  words: []
12213
12235
  };
12214
- if (__letterSpacing) content = [ ...content ];
12236
+ content = [ ...content ];
12215
12237
  for (let i = 0, len = content.length; i < len; i++) {
12216
12238
  char = content[i];
12217
12239
  if (char === "\n") {