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