leafer-game 2.3.2 → 2.3.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.
@@ -1779,6 +1779,7 @@ const Platform = {
1779
1779
  if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
1780
1780
  return url;
1781
1781
  },
1782
+ origin: {},
1782
1783
  image: {
1783
1784
  hitCanvasSize: 100,
1784
1785
  maxCacheSize: 2560 * 1600,
@@ -4902,6 +4903,7 @@ const LeafHelper = {
4902
4903
  updateComplex(_leaf) {},
4903
4904
  checkComplex(_leaf) {},
4904
4905
  updateFlowLayout(_leaf) {},
4906
+ listenPositionNode(_leaf) {},
4905
4907
  updatePositionLayout(_leaf) {},
4906
4908
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4907
4909
  const local = isObject(x) ? Object.assign({}, x) : {
@@ -6161,7 +6163,10 @@ const LeafBounds = {
6161
6163
  layout.resized = "inner";
6162
6164
  }
6163
6165
  if (layout.localBoxChanged) {
6164
- if (this.__local) this.__updateLocalBoxBounds();
6166
+ if (this.__local) {
6167
+ this.__updateLocalBoxBounds();
6168
+ if (data.__usePositionNode) LeafHelper.listenPositionNode(this);
6169
+ }
6165
6170
  layout.localBoxChanged = undefined;
6166
6171
  if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
6167
6172
  if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
@@ -7077,7 +7082,7 @@ class LeafLevelList {
7077
7082
  }
7078
7083
  }
7079
7084
 
7080
- const version = "2.3.2";
7085
+ const version = "2.3.4";
7081
7086
 
7082
7087
  if (typeof globalThis !== "undefined") {
7083
7088
  const globalLeafer = globalThis.Leafer || (globalThis.Leafer = {});
@@ -7114,7 +7119,7 @@ class LeaferCanvas extends LeaferCanvasBase {
7114
7119
  this.parentView = this.view.parentElement;
7115
7120
  if (this.parentView) {
7116
7121
  const pStyle = this.parentView.style;
7117
- pStyle.webkitUserSelect = pStyle.userSelect = "none";
7122
+ if (!config.userSelectHTML) pStyle.webkitUserSelect = pStyle.userSelect = "none";
7118
7123
  this.view.classList.add("leafer-canvas-view");
7119
7124
  }
7120
7125
  if (Platform.syncDomFont && !this.parentView) {
@@ -7294,7 +7299,7 @@ Object.assign(Creator, {
7294
7299
  });
7295
7300
 
7296
7301
  function useCanvas(_canvasType, _power) {
7297
- Platform.origin = {
7302
+ Object.assign(Platform.origin, {
7298
7303
  createCanvas(width, height) {
7299
7304
  const canvas = document.createElement("canvas");
7300
7305
  canvas.width = width;
@@ -7346,7 +7351,7 @@ function useCanvas(_canvasType, _power) {
7346
7351
  Image: Image,
7347
7352
  PointerEvent: PointerEvent,
7348
7353
  DragEvent: DragEvent
7349
- };
7354
+ });
7350
7355
  Platform.event = {
7351
7356
  stopDefault(origin) {
7352
7357
  origin.preventDefault();
@@ -7440,6 +7445,7 @@ class Watcher {
7440
7445
  this.add(event.target);
7441
7446
  }
7442
7447
  add(leaf) {
7448
+ if (!this.target) return;
7443
7449
  if (this.config.usePartLayout) this.__updatedList.add(leaf);
7444
7450
  this.update();
7445
7451
  }