leafer-draw 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.
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) {
@@ -1129,10 +1132,8 @@ var LeaferUI = function(exports) {
1129
1132
  t.y += y;
1130
1133
  },
1131
1134
  scroll(t, data) {
1132
- if (data.scrollY || data.scrollX) {
1133
- t.x += data.scrollX;
1134
- t.y += data.scrollY;
1135
- }
1135
+ t.x += data.scrollX;
1136
+ t.y += data.scrollY;
1136
1137
  },
1137
1138
  getByMove(t, x, y) {
1138
1139
  t = Object.assign({}, t);
@@ -3869,7 +3870,7 @@ var LeaferUI = function(exports) {
3869
3870
  return {
3870
3871
  get() {
3871
3872
  const v = this[privateKey];
3872
- return isUndefined(v) ? defaultValue : v;
3873
+ return v == null ? defaultValue : v;
3873
3874
  },
3874
3875
  set(value) {
3875
3876
  this[privateKey] = value;
@@ -4122,21 +4123,21 @@ var LeaferUI = function(exports) {
4122
4123
  };
4123
4124
  } else if (typeof defaultValue === "function") {
4124
4125
  property.get = function() {
4125
- let v = this[computedKey];
4126
- return v === undefined ? defaultValue(this.__leaf) : v;
4126
+ const v = this[computedKey];
4127
+ return v == null ? defaultValue(this.__leaf) : v;
4127
4128
  };
4128
4129
  } else if (isObject(defaultValue)) {
4129
4130
  const isEmpty = isEmptyData(defaultValue);
4130
4131
  property.get = function() {
4131
- let v = this[computedKey];
4132
- 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;
4133
4134
  };
4134
4135
  }
4135
4136
  const isBox = target.isBranchLeaf;
4136
4137
  if (key === "width") {
4137
4138
  property.get = function() {
4138
4139
  const v = this[computedKey];
4139
- if (v === undefined) {
4140
+ if (v == null) {
4140
4141
  const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
4141
4142
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
4142
4143
  if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
@@ -4146,7 +4147,7 @@ var LeaferUI = function(exports) {
4146
4147
  } else if (key === "height") {
4147
4148
  property.get = function() {
4148
4149
  const v = this[computedKey];
4149
- if (v === undefined) {
4150
+ if (v == null) {
4150
4151
  const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
4151
4152
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
4152
4153
  if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
@@ -4878,7 +4879,7 @@ var LeaferUI = function(exports) {
4878
4879
  }
4879
4880
  boxChange() {
4880
4881
  this.boxChanged = true;
4881
- this.localBoxChanged || this.localBoxChange();
4882
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
4882
4883
  this.hitCanvasChanged = true;
4883
4884
  }
4884
4885
  localBoxChange() {
@@ -4912,7 +4913,7 @@ var LeaferUI = function(exports) {
4912
4913
  }
4913
4914
  matrixChange() {
4914
4915
  this.matrixChanged = true;
4915
- this.localBoxChanged || this.localBoxChange();
4916
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
4916
4917
  }
4917
4918
  surfaceChange() {
4918
4919
  this.surfaceChanged = true;
@@ -5886,10 +5887,10 @@ var LeaferUI = function(exports) {
5886
5887
  relative.innerToWorld(world, to, distance);
5887
5888
  world = to ? to : world;
5888
5889
  }
5889
- toInnerPoint(this.worldTransform, world, to, distance);
5890
+ toInnerPoint(this.scrollWorldTransform, world, to, distance);
5890
5891
  }
5891
5892
  innerToWorld(inner, to, distance, relative) {
5892
- toOuterPoint(this.worldTransform, inner, to, distance);
5893
+ toOuterPoint(this.scrollWorldTransform, inner, to, distance);
5893
5894
  if (relative) relative.worldToInner(to ? to : inner, null, distance);
5894
5895
  }
5895
5896
  getBoxPoint(world, relative, distance, change) {
@@ -6343,7 +6344,7 @@ var LeaferUI = function(exports) {
6343
6344
  this.levelMap = null;
6344
6345
  }
6345
6346
  }
6346
- const version = "1.9.2";
6347
+ const version = "1.9.4";
6347
6348
  const debug$4 = Debug.get("LeaferCanvas");
6348
6349
  class LeaferCanvas extends LeaferCanvasBase {
6349
6350
  set zIndex(zIndex) {
@@ -8375,26 +8376,24 @@ var LeaferUI = function(exports) {
8375
8376
  }
8376
8377
  __updateStrokeBounds() {}
8377
8378
  __updateRenderBounds() {
8378
- let isOverflow;
8379
+ let isOverflow, isScrollMode;
8379
8380
  if (this.children.length) {
8380
- const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
8381
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
8381
8382
  const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
8382
8383
  super.__updateRenderBounds(childrenRenderBounds);
8383
- scroll(childrenRenderBounds, data);
8384
+ if (isScrollMode = overflow.includes("scroll")) {
8385
+ add(childrenRenderBounds, boxBounds);
8386
+ scroll(childrenRenderBounds, data);
8387
+ }
8384
8388
  this.__updateRectRenderBounds();
8385
8389
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8386
- if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
8390
+ if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
8387
8391
  } else this.__updateRectRenderBounds();
8388
8392
  DataHelper.stintSet(this, "isOverflow", isOverflow);
8389
- this.__checkScroll();
8393
+ this.__checkScroll(isScrollMode);
8390
8394
  }
8391
8395
  __updateRectRenderBounds() {}
8392
- __updateWorldBounds() {
8393
- if (this.hasScroller) this.__updateScroll();
8394
- super.__updateWorldBounds();
8395
- }
8396
- __checkScroll() {}
8397
- __updateScroll() {}
8396
+ __checkScroll(_isScrollMode) {}
8398
8397
  __updateRectChange() {}
8399
8398
  __updateChange() {
8400
8399
  super.__updateChange();