@leafer-draw/miniapp 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() {
@@ -8908,26 +8909,24 @@ let Box = class Box extends Group {
8908
8909
  }
8909
8910
  __updateStrokeBounds() {}
8910
8911
  __updateRenderBounds() {
8911
- let isOverflow;
8912
+ let isOverflow, isScrollMode;
8912
8913
  if (this.children.length) {
8913
- const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
8914
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
8914
8915
  const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
8915
8916
  super.__updateRenderBounds(childrenRenderBounds);
8916
- scroll(childrenRenderBounds, data);
8917
+ if (isScrollMode = overflow.includes("scroll")) {
8918
+ add(childrenRenderBounds, boxBounds);
8919
+ scroll(childrenRenderBounds, data);
8920
+ }
8917
8921
  this.__updateRectRenderBounds();
8918
8922
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8919
- if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
8923
+ if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
8920
8924
  } else this.__updateRectRenderBounds();
8921
8925
  DataHelper.stintSet(this, "isOverflow", isOverflow);
8922
- this.__checkScroll();
8926
+ this.__checkScroll(isScrollMode);
8923
8927
  }
8924
8928
  __updateRectRenderBounds() {}
8925
- __updateWorldBounds() {
8926
- if (this.hasScroller) this.__updateScroll();
8927
- super.__updateWorldBounds();
8928
- }
8929
- __checkScroll() {}
8930
- __updateScroll() {}
8929
+ __checkScroll(_isScrollMode) {}
8931
8930
  __updateRectChange() {}
8932
8931
  __updateChange() {
8933
8932
  super.__updateChange();