leafer-ui 1.9.3 → 1.9.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
@@ -49,7 +49,7 @@ var LeaferUI = function(exports) {
49
49
  return value === undefined;
50
50
  }
51
51
  function isNull(value) {
52
- return value === undefined || value === null;
52
+ return value == null;
53
53
  }
54
54
  function isString(value) {
55
55
  return typeof value === "string";
@@ -285,6 +285,9 @@ var LeaferUI = function(exports) {
285
285
  num = round$3(num * a) / a;
286
286
  return num === -0 ? 0 : num;
287
287
  },
288
+ sign(num) {
289
+ return num < 0 ? -1 : 1;
290
+ },
288
291
  getScaleData(scale, size, originSize, scaleData) {
289
292
  if (!scaleData) scaleData = {};
290
293
  if (size) {
@@ -3867,7 +3870,7 @@ var LeaferUI = function(exports) {
3867
3870
  return {
3868
3871
  get() {
3869
3872
  const v = this[privateKey];
3870
- return isUndefined(v) ? defaultValue : v;
3873
+ return v == null ? defaultValue : v;
3871
3874
  },
3872
3875
  set(value) {
3873
3876
  this[privateKey] = value;
@@ -4120,21 +4123,21 @@ var LeaferUI = function(exports) {
4120
4123
  };
4121
4124
  } else if (typeof defaultValue === "function") {
4122
4125
  property.get = function() {
4123
- let v = this[computedKey];
4124
- return v === undefined ? defaultValue(this.__leaf) : v;
4126
+ const v = this[computedKey];
4127
+ return v == null ? defaultValue(this.__leaf) : v;
4125
4128
  };
4126
4129
  } else if (isObject(defaultValue)) {
4127
4130
  const isEmpty = isEmptyData(defaultValue);
4128
4131
  property.get = function() {
4129
- let v = this[computedKey];
4130
- return v === undefined ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
4132
+ const v = this[computedKey];
4133
+ return v == null ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
4131
4134
  };
4132
4135
  }
4133
4136
  const isBox = target.isBranchLeaf;
4134
4137
  if (key === "width") {
4135
4138
  property.get = function() {
4136
4139
  const v = this[computedKey];
4137
- if (v === undefined) {
4140
+ if (v == null) {
4138
4141
  const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
4139
4142
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
4140
4143
  if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
@@ -4144,7 +4147,7 @@ var LeaferUI = function(exports) {
4144
4147
  } else if (key === "height") {
4145
4148
  property.get = function() {
4146
4149
  const v = this[computedKey];
4147
- if (v === undefined) {
4150
+ if (v == null) {
4148
4151
  const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
4149
4152
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
4150
4153
  if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
@@ -4876,7 +4879,7 @@ var LeaferUI = function(exports) {
4876
4879
  }
4877
4880
  boxChange() {
4878
4881
  this.boxChanged = true;
4879
- this.localBoxChanged || this.localBoxChange();
4882
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
4880
4883
  this.hitCanvasChanged = true;
4881
4884
  }
4882
4885
  localBoxChange() {
@@ -4910,7 +4913,7 @@ var LeaferUI = function(exports) {
4910
4913
  }
4911
4914
  matrixChange() {
4912
4915
  this.matrixChanged = true;
4913
- this.localBoxChanged || this.localBoxChange();
4916
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
4914
4917
  }
4915
4918
  surfaceChange() {
4916
4919
  this.surfaceChanged = true;
@@ -5884,10 +5887,10 @@ var LeaferUI = function(exports) {
5884
5887
  relative.innerToWorld(world, to, distance);
5885
5888
  world = to ? to : world;
5886
5889
  }
5887
- toInnerPoint(this.worldTransform, world, to, distance);
5890
+ toInnerPoint(this.scrollWorldTransform, world, to, distance);
5888
5891
  }
5889
5892
  innerToWorld(inner, to, distance, relative) {
5890
- toOuterPoint(this.worldTransform, inner, to, distance);
5893
+ toOuterPoint(this.scrollWorldTransform, inner, to, distance);
5891
5894
  if (relative) relative.worldToInner(to ? to : inner, null, distance);
5892
5895
  }
5893
5896
  getBoxPoint(world, relative, distance, change) {
@@ -6341,7 +6344,7 @@ var LeaferUI = function(exports) {
6341
6344
  this.levelMap = null;
6342
6345
  }
6343
6346
  }
6344
- const version = "1.9.3";
6347
+ const version = "1.9.4";
6345
6348
  const debug$5 = Debug.get("LeaferCanvas");
6346
6349
  class LeaferCanvas extends LeaferCanvasBase {
6347
6350
  set zIndex(zIndex) {
@@ -8553,29 +8556,24 @@ var LeaferUI = function(exports) {
8553
8556
  }
8554
8557
  __updateStrokeBounds() {}
8555
8558
  __updateRenderBounds() {
8556
- let isOverflow;
8559
+ let isOverflow, isScrollMode;
8557
8560
  if (this.children.length) {
8558
- const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
8561
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
8559
8562
  const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
8560
8563
  super.__updateRenderBounds(childrenRenderBounds);
8561
- if (data.overflow.includes("scroll")) {
8564
+ if (isScrollMode = overflow.includes("scroll")) {
8562
8565
  add(childrenRenderBounds, boxBounds);
8563
8566
  scroll(childrenRenderBounds, data);
8564
8567
  }
8565
8568
  this.__updateRectRenderBounds();
8566
8569
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8567
- if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
8570
+ if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
8568
8571
  } else this.__updateRectRenderBounds();
8569
8572
  DataHelper.stintSet(this, "isOverflow", isOverflow);
8570
- this.__checkScroll();
8573
+ this.__checkScroll(isScrollMode);
8571
8574
  }
8572
8575
  __updateRectRenderBounds() {}
8573
- __updateWorldBounds() {
8574
- if (this.hasScroller) this.__updateScroll();
8575
- super.__updateWorldBounds();
8576
- }
8577
- __checkScroll() {}
8578
- __updateScroll() {}
8576
+ __checkScroll(_isScrollMode) {}
8579
8577
  __updateRectChange() {}
8580
8578
  __updateChange() {
8581
8579
  super.__updateChange();