@leafer-ui/worker 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
  class LeaferCanvas extends LeaferCanvasBase {
6747
6748
  get allowBackgroundColor() {
@@ -8940,26 +8941,24 @@ let Box = class Box extends Group {
8940
8941
  }
8941
8942
  __updateStrokeBounds() {}
8942
8943
  __updateRenderBounds() {
8943
- let isOverflow;
8944
+ let isOverflow, isScrollMode;
8944
8945
  if (this.children.length) {
8945
- const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
8946
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
8946
8947
  const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
8947
8948
  super.__updateRenderBounds(childrenRenderBounds);
8948
- scroll(childrenRenderBounds, data);
8949
+ if (isScrollMode = overflow.includes("scroll")) {
8950
+ add(childrenRenderBounds, boxBounds);
8951
+ scroll(childrenRenderBounds, data);
8952
+ }
8949
8953
  this.__updateRectRenderBounds();
8950
8954
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8951
- if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
8955
+ if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
8952
8956
  } else this.__updateRectRenderBounds();
8953
8957
  DataHelper.stintSet(this, "isOverflow", isOverflow);
8954
- this.__checkScroll();
8958
+ this.__checkScroll(isScrollMode);
8955
8959
  }
8956
8960
  __updateRectRenderBounds() {}
8957
- __updateWorldBounds() {
8958
- if (this.hasScroller) this.__updateScroll();
8959
- super.__updateWorldBounds();
8960
- }
8961
- __checkScroll() {}
8962
- __updateScroll() {}
8961
+ __checkScroll(_isScrollMode) {}
8963
8962
  __updateRectChange() {}
8964
8963
  __updateChange() {
8965
8964
  super.__updateChange();