@leafer-ui/worker 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/worker.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
  class LeaferCanvas extends LeaferCanvasBase {
6346
6349
  get allowBackgroundColor() {
6347
6350
  return true;
@@ -8368,29 +8371,24 @@ var LeaferUI = function(exports) {
8368
8371
  }
8369
8372
  __updateStrokeBounds() {}
8370
8373
  __updateRenderBounds() {
8371
- let isOverflow;
8374
+ let isOverflow, isScrollMode;
8372
8375
  if (this.children.length) {
8373
- const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
8376
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
8374
8377
  const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
8375
8378
  super.__updateRenderBounds(childrenRenderBounds);
8376
- if (data.overflow.includes("scroll")) {
8379
+ if (isScrollMode = overflow.includes("scroll")) {
8377
8380
  add(childrenRenderBounds, boxBounds);
8378
8381
  scroll(childrenRenderBounds, data);
8379
8382
  }
8380
8383
  this.__updateRectRenderBounds();
8381
8384
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8382
- if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
8385
+ if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
8383
8386
  } else this.__updateRectRenderBounds();
8384
8387
  DataHelper.stintSet(this, "isOverflow", isOverflow);
8385
- this.__checkScroll();
8388
+ this.__checkScroll(isScrollMode);
8386
8389
  }
8387
8390
  __updateRectRenderBounds() {}
8388
- __updateWorldBounds() {
8389
- if (this.hasScroller) this.__updateScroll();
8390
- super.__updateWorldBounds();
8391
- }
8392
- __checkScroll() {}
8393
- __updateScroll() {}
8391
+ __checkScroll(_isScrollMode) {}
8394
8392
  __updateRectChange() {}
8395
8393
  __updateChange() {
8396
8394
  super.__updateChange();