leafer-ui 1.9.2 → 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) {
@@ -1191,10 +1194,8 @@ const BoundsHelper = {
1191
1194
  t.y += y;
1192
1195
  },
1193
1196
  scroll(t, data) {
1194
- if (data.scrollY || data.scrollX) {
1195
- t.x += data.scrollX;
1196
- t.y += data.scrollY;
1197
- }
1197
+ t.x += data.scrollX;
1198
+ t.y += data.scrollY;
1198
1199
  },
1199
1200
  getByMove(t, x, y) {
1200
1201
  t = Object.assign({}, t);
@@ -4104,7 +4105,7 @@ function createDescriptor(key, defaultValue) {
4104
4105
  return {
4105
4106
  get() {
4106
4107
  const v = this[privateKey];
4107
- return isUndefined(v) ? defaultValue : v;
4108
+ return v == null ? defaultValue : v;
4108
4109
  },
4109
4110
  set(value) {
4110
4111
  this[privateKey] = value;
@@ -4390,21 +4391,21 @@ function defineDataProcessor(target, key, defaultValue) {
4390
4391
  };
4391
4392
  } else if (typeof defaultValue === "function") {
4392
4393
  property.get = function() {
4393
- let v = this[computedKey];
4394
- return v === undefined ? defaultValue(this.__leaf) : v;
4394
+ const v = this[computedKey];
4395
+ return v == null ? defaultValue(this.__leaf) : v;
4395
4396
  };
4396
4397
  } else if (isObject(defaultValue)) {
4397
4398
  const isEmpty = isEmptyData(defaultValue);
4398
4399
  property.get = function() {
4399
- let v = this[computedKey];
4400
- 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;
4401
4402
  };
4402
4403
  }
4403
4404
  const isBox = target.isBranchLeaf;
4404
4405
  if (key === "width") {
4405
4406
  property.get = function() {
4406
4407
  const v = this[computedKey];
4407
- if (v === undefined) {
4408
+ if (v == null) {
4408
4409
  const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
4409
4410
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
4410
4411
  if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
@@ -4414,7 +4415,7 @@ function defineDataProcessor(target, key, defaultValue) {
4414
4415
  } else if (key === "height") {
4415
4416
  property.get = function() {
4416
4417
  const v = this[computedKey];
4417
- if (v === undefined) {
4418
+ if (v == null) {
4418
4419
  const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
4419
4420
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
4420
4421
  if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
@@ -5174,7 +5175,7 @@ class LeafLayout {
5174
5175
  }
5175
5176
  boxChange() {
5176
5177
  this.boxChanged = true;
5177
- this.localBoxChanged || this.localBoxChange();
5178
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
5178
5179
  this.hitCanvasChanged = true;
5179
5180
  }
5180
5181
  localBoxChange() {
@@ -5208,7 +5209,7 @@ class LeafLayout {
5208
5209
  }
5209
5210
  matrixChange() {
5210
5211
  this.matrixChanged = true;
5211
- this.localBoxChanged || this.localBoxChange();
5212
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
5212
5213
  }
5213
5214
  surfaceChange() {
5214
5215
  this.surfaceChanged = true;
@@ -6274,10 +6275,10 @@ let Leaf = class Leaf {
6274
6275
  relative.innerToWorld(world, to, distance);
6275
6276
  world = to ? to : world;
6276
6277
  }
6277
- toInnerPoint(this.worldTransform, world, to, distance);
6278
+ toInnerPoint(this.scrollWorldTransform, world, to, distance);
6278
6279
  }
6279
6280
  innerToWorld(inner, to, distance, relative) {
6280
- toOuterPoint(this.worldTransform, inner, to, distance);
6281
+ toOuterPoint(this.scrollWorldTransform, inner, to, distance);
6281
6282
  if (relative) relative.worldToInner(to ? to : inner, null, distance);
6282
6283
  }
6283
6284
  getBoxPoint(world, relative, distance, change) {
@@ -6741,7 +6742,7 @@ class LeafLevelList {
6741
6742
  }
6742
6743
  }
6743
6744
 
6744
- const version = "1.9.2";
6745
+ const version = "1.9.4";
6745
6746
 
6746
6747
  const debug$5 = Debug.get("LeaferCanvas");
6747
6748
 
@@ -9125,26 +9126,24 @@ let Box = class Box extends Group {
9125
9126
  }
9126
9127
  __updateStrokeBounds() {}
9127
9128
  __updateRenderBounds() {
9128
- let isOverflow;
9129
+ let isOverflow, isScrollMode;
9129
9130
  if (this.children.length) {
9130
- 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;
9131
9132
  const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
9132
9133
  super.__updateRenderBounds(childrenRenderBounds);
9133
- scroll(childrenRenderBounds, data);
9134
+ if (isScrollMode = overflow.includes("scroll")) {
9135
+ add(childrenRenderBounds, boxBounds);
9136
+ scroll(childrenRenderBounds, data);
9137
+ }
9134
9138
  this.__updateRectRenderBounds();
9135
9139
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
9136
- if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
9140
+ if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
9137
9141
  } else this.__updateRectRenderBounds();
9138
9142
  DataHelper.stintSet(this, "isOverflow", isOverflow);
9139
- this.__checkScroll();
9143
+ this.__checkScroll(isScrollMode);
9140
9144
  }
9141
9145
  __updateRectRenderBounds() {}
9142
- __updateWorldBounds() {
9143
- if (this.hasScroller) this.__updateScroll();
9144
- super.__updateWorldBounds();
9145
- }
9146
- __checkScroll() {}
9147
- __updateScroll() {}
9146
+ __checkScroll(_isScrollMode) {}
9148
9147
  __updateRectChange() {}
9149
9148
  __updateChange() {
9150
9149
  super.__updateChange();