@leafer-game/worker 2.1.5 → 2.1.6

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
@@ -3499,7 +3499,7 @@ var LeaferUI = function(exports) {
3499
3499
  const {arcTo: arcTo} = PathCommandDataHelper;
3500
3500
  const PathCorner = {
3501
3501
  smooth(data, cornerRadius, _cornerSmoothing) {
3502
- let command, lastCommand, commandLen;
3502
+ let command, lastCommand, commandLen, startXIndex, startYIndex, smoothLen;
3503
3503
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3504
3504
  if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
3505
3505
  const len = data.length, three = len === 9;
@@ -3508,6 +3508,11 @@ var LeaferUI = function(exports) {
3508
3508
  command = data[i];
3509
3509
  switch (command) {
3510
3510
  case M$1:
3511
+ smoothLen = smooth.length;
3512
+ if (smoothLen && lastCommand !== Z$1) {
3513
+ smooth[startXIndex] = startX;
3514
+ smooth[startYIndex] = startY;
3515
+ }
3511
3516
  startX = lastX = data[i + 1];
3512
3517
  startY = lastY = data[i + 2];
3513
3518
  i += 3;
@@ -3518,6 +3523,8 @@ var LeaferUI = function(exports) {
3518
3523
  } else {
3519
3524
  smooth.push(M$1, startX, startY);
3520
3525
  }
3526
+ startXIndex = smoothLen + 1;
3527
+ startYIndex = smoothLen + 2;
3521
3528
  break;
3522
3529
 
3523
3530
  case L$2:
@@ -3556,8 +3563,8 @@ var LeaferUI = function(exports) {
3556
3563
  lastCommand = command;
3557
3564
  }
3558
3565
  if (command !== Z$1) {
3559
- smooth[1] = startX;
3560
- smooth[2] = startY;
3566
+ smooth[startXIndex] = startX;
3567
+ smooth[startYIndex] = startY;
3561
3568
  }
3562
3569
  return smooth;
3563
3570
  }
@@ -6560,7 +6567,7 @@ var LeaferUI = function(exports) {
6560
6567
  this.levelMap = null;
6561
6568
  }
6562
6569
  }
6563
- const version = "2.1.5";
6570
+ const version = "2.1.6";
6564
6571
  class LeaferCanvas extends LeaferCanvasBase {
6565
6572
  get allowBackgroundColor() {
6566
6573
  return true;
@@ -10953,8 +10960,9 @@ var LeaferUI = function(exports) {
10953
10960
  break;
10954
10961
 
10955
10962
  case "repeat":
10956
- case "brush":
10957
10963
  if (!sameBox || scaleX || rotation || skew) PaintImage.repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
10964
+
10965
+ case "brush":
10958
10966
  if (!repeat) data.repeat = "repeat";
10959
10967
  const count = isObject(repeat);
10960
10968
  if (gap || count) data.gap = getGapData(gap, count && repeat, tempImage.width, tempImage.height, box);
@@ -10965,7 +10973,7 @@ var LeaferUI = function(exports) {
10965
10973
  default:
10966
10974
  if (scaleX) PaintImage.fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
10967
10975
  }
10968
- if (!data.transform) {
10976
+ if (!data.transform && mode !== "brush") {
10969
10977
  if (box.x || box.y) translate$1(data.transform = get$3(), box.x, box.y);
10970
10978
  }
10971
10979
  if (scaleX) {
@@ -11081,8 +11089,9 @@ var LeaferUI = function(exports) {
11081
11089
  let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
11082
11090
  if (paint.patternId !== id && !ui.destroyed) {
11083
11091
  if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
11084
- const {image: image, brush: brush, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11085
- let imageMatrix, xGap, yGap, {width: width, height: height} = image;
11092
+ const {image: image, brush: brush, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11093
+ let imageMatrix, xGap, yGap, {width: width, height: height} = image, {opacity: opacity} = paint.originPaint;
11094
+ if (brush || opacity === 1) opacity = undefined;
11086
11095
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
11087
11096
  width *= scaleX;
11088
11097
  height *= scaleY;