leafer-ui 1.9.10 → 1.9.11

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.
@@ -3840,7 +3840,12 @@ class TaskProcessor {
3840
3840
  runTask() {
3841
3841
  const task = this.list[this.index];
3842
3842
  if (!task) {
3843
- this.nextTask();
3843
+ this.timer = setTimeout(() => this.nextTask());
3844
+ return;
3845
+ }
3846
+ if (task.isCancel) {
3847
+ this.index++;
3848
+ this.runTask();
3844
3849
  return;
3845
3850
  }
3846
3851
  task.run().then(() => {
@@ -3871,16 +3876,15 @@ class TaskProcessor {
3871
3876
  }
3872
3877
  setParallelList() {
3873
3878
  let task;
3879
+ const {config: config, list: list, index: index} = this;
3874
3880
  this.parallelList = [];
3875
3881
  this.parallelSuccessNumber = 0;
3876
- let end = this.index + this.config.parallel;
3877
- if (end > this.list.length) end = this.list.length;
3878
- for (let i = this.index; i < end; i++) {
3879
- task = this.list[i];
3880
- if (task.parallel) {
3881
- this.parallelList.push(task);
3882
- } else {
3883
- break;
3882
+ let end = index + config.parallel;
3883
+ if (end > list.length) end = list.length;
3884
+ if (config.parallel > 1) {
3885
+ for (let i = index; i < end; i++) {
3886
+ task = list[i];
3887
+ if (task.parallel) this.parallelList.push(task); else break;
3884
3888
  }
3885
3889
  }
3886
3890
  }
@@ -6815,7 +6819,7 @@ class LeafLevelList {
6815
6819
  }
6816
6820
  }
6817
6821
 
6818
- const version = "1.9.10";
6822
+ const version = "1.9.11";
6819
6823
 
6820
6824
  const debug$5 = Debug.get("LeaferCanvas");
6821
6825
 
@@ -9978,7 +9982,7 @@ class UIEvent extends Event {
9978
9982
  }
9979
9983
  }
9980
9984
 
9981
- const {float: float, sign: sign} = MathHelper, {min: min, max: max$2, abs: abs$2} = Math;
9985
+ const {min: min, max: max$2, abs: abs$2} = Math, {float: float, sign: sign} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
9982
9986
 
9983
9987
  const tempContent = new Bounds, tempDragBounds = new Bounds;
9984
9988
 
@@ -10028,26 +10032,27 @@ const DragBoundsHelper = {
10028
10032
  tempContent.set(content).scaleOf(origin, scale.x, scale.y);
10029
10033
  const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
10030
10034
  const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
10031
- let correctScaleX, correctScaleY, aScale, bScale, aSize, bSize;
10035
+ let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
10032
10036
  if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
10033
- correctScaleX = scale.x < 0 ? 1 / scale.x : 1;
10034
- if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX, 1);
10037
+ if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
10035
10038
  aSize = float(tempContent.minX - tempDragBounds.minX);
10036
10039
  bSize = float(tempDragBounds.maxX - tempContent.maxX);
10037
10040
  aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
10038
10041
  bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
10039
10042
  correctScaleX *= max$2(aScale, bScale);
10040
10043
  } else {
10041
- if (scale.x < 0) tempContent.unsign();
10044
+ if (scale.x < 0) {
10045
+ if (float(minX(content) - minX(dragBounds)) <= 0 || float(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
10046
+ tempContent.unsign();
10047
+ }
10042
10048
  aSize = float(tempDragBounds.minX - tempContent.minX);
10043
10049
  bSize = float(tempContent.maxX - tempDragBounds.maxX);
10044
10050
  aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
10045
10051
  bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
10046
- correctScaleX = min(aScale, bScale);
10052
+ correctScaleX *= min(aScale, bScale);
10047
10053
  }
10048
10054
  if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
10049
- correctScaleY = scale.y < 0 ? 1 / scale.y : 1;
10050
- if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY);
10055
+ if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
10051
10056
  aSize = float(tempContent.minY - tempDragBounds.minY);
10052
10057
  bSize = float(tempDragBounds.maxY - tempContent.maxY);
10053
10058
  aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
@@ -10059,12 +10064,15 @@ const DragBoundsHelper = {
10059
10064
  correctScaleY = sign(correctScaleY) * aScale;
10060
10065
  }
10061
10066
  } else {
10062
- if (scale.y < 0) tempContent.unsign();
10067
+ if (scale.y < 0) {
10068
+ if (float(minY(content) - minY(dragBounds)) <= 0 || float(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
10069
+ tempContent.unsign();
10070
+ }
10063
10071
  aSize = float(tempDragBounds.minY - tempContent.minY);
10064
10072
  bSize = float(tempContent.maxY - tempDragBounds.maxY);
10065
10073
  aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
10066
10074
  bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
10067
- correctScaleY = min(aScale, bScale);
10075
+ correctScaleY *= min(aScale, bScale);
10068
10076
  }
10069
10077
  scale.x *= isFinite(correctScaleX) ? correctScaleX : 1;
10070
10078
  scale.y *= isFinite(correctScaleY) ? correctScaleY : 1;
@@ -11144,9 +11152,9 @@ const ui$1 = UI.prototype;
11144
11152
 
11145
11153
  ui$1.__updateHitCanvas = function() {
11146
11154
  if (this.__box) this.__box.__updateHitCanvas();
11147
- const leafer = this.leafer || this.parent && this.parent.leafer;
11148
- if (!leafer) return;
11149
- const data = this.__, {hitCanvasManager: hitCanvasManager} = leafer;
11155
+ const {hitCanvasManager: hitCanvasManager} = this.leafer || this.parent && this.parent.leafer || {};
11156
+ if (!hitCanvasManager) return;
11157
+ const data = this.__;
11150
11158
  const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === "pixel";
11151
11159
  const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === "pixel";
11152
11160
  const isHitPixel = isHitPixelFill || isHitPixelStroke;
@@ -12558,11 +12566,11 @@ function getShadowRenderSpread(_ui, shadow) {
12558
12566
 
12559
12567
  function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
12560
12568
  if (shadow.spread) {
12561
- const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
12569
+ const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
12562
12570
  tempMatrix.set().scaleOfOuter({
12563
12571
  x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
12564
12572
  y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
12565
- }, spreadScale);
12573
+ }, 1 + spread / width, 1 + spread / height);
12566
12574
  return tempMatrix;
12567
12575
  }
12568
12576
  return undefined;