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.
@@ -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
  const debug$5 = Debug.get("LeaferCanvas");
6745
6748
 
@@ -9123,29 +9126,24 @@ let Box = class Box extends Group {
9123
9126
  }
9124
9127
  __updateStrokeBounds() {}
9125
9128
  __updateRenderBounds() {
9126
- let isOverflow;
9129
+ let isOverflow, isScrollMode;
9127
9130
  if (this.children.length) {
9128
- const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
9131
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
9129
9132
  const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
9130
9133
  super.__updateRenderBounds(childrenRenderBounds);
9131
- if (data.overflow.includes("scroll")) {
9134
+ if (isScrollMode = overflow.includes("scroll")) {
9132
9135
  add(childrenRenderBounds, boxBounds);
9133
9136
  scroll(childrenRenderBounds, data);
9134
9137
  }
9135
9138
  this.__updateRectRenderBounds();
9136
9139
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
9137
- if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
9140
+ if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
9138
9141
  } else this.__updateRectRenderBounds();
9139
9142
  DataHelper.stintSet(this, "isOverflow", isOverflow);
9140
- this.__checkScroll();
9143
+ this.__checkScroll(isScrollMode);
9141
9144
  }
9142
9145
  __updateRectRenderBounds() {}
9143
- __updateWorldBounds() {
9144
- if (this.hasScroller) this.__updateScroll();
9145
- super.__updateWorldBounds();
9146
- }
9147
- __checkScroll() {}
9148
- __updateScroll() {}
9146
+ __checkScroll(_isScrollMode) {}
9149
9147
  __updateRectChange() {}
9150
9148
  __updateChange() {
9151
9149
  super.__updateChange();