leafer-game 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/web.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
  const debug$5 = Debug.get("LeaferCanvas");
6565
6572
  class LeaferCanvas extends LeaferCanvasBase {
6566
6573
  set zIndex(zIndex) {
@@ -11476,8 +11483,9 @@ var LeaferUI = function(exports) {
11476
11483
  break;
11477
11484
 
11478
11485
  case "repeat":
11479
- case "brush":
11480
11486
  if (!sameBox || scaleX || rotation || skew) PaintImage.repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
11487
+
11488
+ case "brush":
11481
11489
  if (!repeat) data.repeat = "repeat";
11482
11490
  const count = isObject(repeat);
11483
11491
  if (gap || count) data.gap = getGapData(gap, count && repeat, tempImage.width, tempImage.height, box);
@@ -11488,7 +11496,7 @@ var LeaferUI = function(exports) {
11488
11496
  default:
11489
11497
  if (scaleX) PaintImage.fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
11490
11498
  }
11491
- if (!data.transform) {
11499
+ if (!data.transform && mode !== "brush") {
11492
11500
  if (box.x || box.y) translate$1(data.transform = get$3(), box.x, box.y);
11493
11501
  }
11494
11502
  if (scaleX) {
@@ -11604,8 +11612,9 @@ var LeaferUI = function(exports) {
11604
11612
  let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
11605
11613
  if (paint.patternId !== id && !ui.destroyed) {
11606
11614
  if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
11607
- const {image: image, brush: brush, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11608
- let imageMatrix, xGap, yGap, {width: width, height: height} = image;
11615
+ const {image: image, brush: brush, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11616
+ let imageMatrix, xGap, yGap, {width: width, height: height} = image, {opacity: opacity} = paint.originPaint;
11617
+ if (brush || opacity === 1) opacity = undefined;
11609
11618
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
11610
11619
  width *= scaleX;
11611
11620
  height *= scaleY;