@leafer-ui/miniapp 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.
@@ -54,7 +54,7 @@ function isUndefined(value) {
54
54
  }
55
55
 
56
56
  function isNull(value) {
57
- return value === undefined || value === null;
57
+ return value == null;
58
58
  }
59
59
 
60
60
  function isString(value) {
@@ -304,6 +304,9 @@ const MathHelper = {
304
304
  num = round$3(num * a) / a;
305
305
  return num === -0 ? 0 : num;
306
306
  },
307
+ sign(num) {
308
+ return num < 0 ? -1 : 1;
309
+ },
307
310
  getScaleData(scale, size, originSize, scaleData) {
308
311
  if (!scaleData) scaleData = {};
309
312
  if (size) {
@@ -4102,7 +4105,7 @@ function createDescriptor(key, defaultValue) {
4102
4105
  return {
4103
4106
  get() {
4104
4107
  const v = this[privateKey];
4105
- return isUndefined(v) ? defaultValue : v;
4108
+ return v == null ? defaultValue : v;
4106
4109
  },
4107
4110
  set(value) {
4108
4111
  this[privateKey] = value;
@@ -4388,21 +4391,21 @@ function defineDataProcessor(target, key, defaultValue) {
4388
4391
  };
4389
4392
  } else if (typeof defaultValue === "function") {
4390
4393
  property.get = function() {
4391
- let v = this[computedKey];
4392
- return v === undefined ? defaultValue(this.__leaf) : v;
4394
+ const v = this[computedKey];
4395
+ return v == null ? defaultValue(this.__leaf) : v;
4393
4396
  };
4394
4397
  } else if (isObject(defaultValue)) {
4395
4398
  const isEmpty = isEmptyData(defaultValue);
4396
4399
  property.get = function() {
4397
- let v = this[computedKey];
4398
- return v === undefined ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
4400
+ const v = this[computedKey];
4401
+ return v == null ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
4399
4402
  };
4400
4403
  }
4401
4404
  const isBox = target.isBranchLeaf;
4402
4405
  if (key === "width") {
4403
4406
  property.get = function() {
4404
4407
  const v = this[computedKey];
4405
- if (v === undefined) {
4408
+ if (v == null) {
4406
4409
  const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
4407
4410
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
4408
4411
  if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
@@ -4412,7 +4415,7 @@ function defineDataProcessor(target, key, defaultValue) {
4412
4415
  } else if (key === "height") {
4413
4416
  property.get = function() {
4414
4417
  const v = this[computedKey];
4415
- if (v === undefined) {
4418
+ if (v == null) {
4416
4419
  const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
4417
4420
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
4418
4421
  if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
@@ -5172,7 +5175,7 @@ class LeafLayout {
5172
5175
  }
5173
5176
  boxChange() {
5174
5177
  this.boxChanged = true;
5175
- this.localBoxChanged || this.localBoxChange();
5178
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
5176
5179
  this.hitCanvasChanged = true;
5177
5180
  }
5178
5181
  localBoxChange() {
@@ -5206,7 +5209,7 @@ class LeafLayout {
5206
5209
  }
5207
5210
  matrixChange() {
5208
5211
  this.matrixChanged = true;
5209
- this.localBoxChanged || this.localBoxChange();
5212
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
5210
5213
  }
5211
5214
  surfaceChange() {
5212
5215
  this.surfaceChanged = true;
@@ -6272,10 +6275,10 @@ let Leaf = class Leaf {
6272
6275
  relative.innerToWorld(world, to, distance);
6273
6276
  world = to ? to : world;
6274
6277
  }
6275
- toInnerPoint(this.worldTransform, world, to, distance);
6278
+ toInnerPoint(this.scrollWorldTransform, world, to, distance);
6276
6279
  }
6277
6280
  innerToWorld(inner, to, distance, relative) {
6278
- toOuterPoint(this.worldTransform, inner, to, distance);
6281
+ toOuterPoint(this.scrollWorldTransform, inner, to, distance);
6279
6282
  if (relative) relative.worldToInner(to ? to : inner, null, distance);
6280
6283
  }
6281
6284
  getBoxPoint(world, relative, distance, change) {
@@ -6739,7 +6742,7 @@ class LeafLevelList {
6739
6742
  }
6740
6743
  }
6741
6744
 
6742
- const version = "1.9.3";
6745
+ const version = "1.9.4";
6743
6746
 
6744
6747
  class LeaferCanvas extends LeaferCanvasBase {
6745
6748
  get allowBackgroundColor() {
@@ -9089,29 +9092,24 @@ let Box = class Box extends Group {
9089
9092
  }
9090
9093
  __updateStrokeBounds() {}
9091
9094
  __updateRenderBounds() {
9092
- let isOverflow;
9095
+ let isOverflow, isScrollMode;
9093
9096
  if (this.children.length) {
9094
- const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
9097
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
9095
9098
  const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
9096
9099
  super.__updateRenderBounds(childrenRenderBounds);
9097
- if (data.overflow.includes("scroll")) {
9100
+ if (isScrollMode = overflow.includes("scroll")) {
9098
9101
  add(childrenRenderBounds, boxBounds);
9099
9102
  scroll(childrenRenderBounds, data);
9100
9103
  }
9101
9104
  this.__updateRectRenderBounds();
9102
9105
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
9103
- if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
9106
+ if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
9104
9107
  } else this.__updateRectRenderBounds();
9105
9108
  DataHelper.stintSet(this, "isOverflow", isOverflow);
9106
- this.__checkScroll();
9109
+ this.__checkScroll(isScrollMode);
9107
9110
  }
9108
9111
  __updateRectRenderBounds() {}
9109
- __updateWorldBounds() {
9110
- if (this.hasScroller) this.__updateScroll();
9111
- super.__updateWorldBounds();
9112
- }
9113
- __checkScroll() {}
9114
- __updateScroll() {}
9112
+ __checkScroll(_isScrollMode) {}
9115
9113
  __updateRectChange() {}
9116
9114
  __updateChange() {
9117
9115
  super.__updateChange();