leafer-game 2.0.0 → 2.0.1

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
@@ -1650,7 +1650,7 @@ var LeaferUI = function(exports) {
1650
1650
  resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
1651
1651
  const realWidth = max$3(floor$1(width + (xGap || 0)), 1), realHeight = max$3(floor$1(height + (yGap || 0)), 1);
1652
1652
  let interlaceX, interlaceY, interlaceOffset;
1653
- if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, (interlaceX = interlace.type === "x") ? width : height))) interlaceX || (interlaceY = true);
1653
+ if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
1654
1654
  const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
1655
1655
  const ctx = canvas.getContext("2d");
1656
1656
  if (opacity) ctx.globalAlpha = opacity;
@@ -3114,10 +3114,10 @@ var LeaferUI = function(exports) {
3114
3114
  data.push(O$2, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
3115
3115
  }
3116
3116
  },
3117
- arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
3117
+ arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
3118
3118
  if (!isUndefined(lastX)) {
3119
- const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
3120
- radius = min$1(radius, min$1(d / 2, d / 2 * abs$4(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3119
+ const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
3120
+ radius = min$1(radius, min$1(r, r * abs$4(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3121
3121
  }
3122
3122
  data.push(U$2, x1, y1, x2, y2, radius);
3123
3123
  },
@@ -3442,7 +3442,7 @@ var LeaferUI = function(exports) {
3442
3442
  let command, lastCommand, commandLen;
3443
3443
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3444
3444
  if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
3445
- const len = data.length;
3445
+ const len = data.length, three = len === 9;
3446
3446
  const smooth = [];
3447
3447
  while (i < len) {
3448
3448
  command = data[i];
@@ -3454,7 +3454,7 @@ var LeaferUI = function(exports) {
3454
3454
  if (data[i] === L$2) {
3455
3455
  secondX = data[i + 1];
3456
3456
  secondY = data[i + 2];
3457
- smooth.push(M$1, getCenterX(startX, secondX), getCenterY(startY, secondY));
3457
+ three ? smooth.push(M$1, startX, startY) : smooth.push(M$1, getCenterX(startX, secondX), getCenterY(startY, secondY));
3458
3458
  } else {
3459
3459
  smooth.push(M$1, startX, startY);
3460
3460
  }
@@ -3466,11 +3466,11 @@ var LeaferUI = function(exports) {
3466
3466
  i += 3;
3467
3467
  switch (data[i]) {
3468
3468
  case L$2:
3469
- arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
3469
+ arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
3470
3470
  break;
3471
3471
 
3472
3472
  case Z$1:
3473
- arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
3473
+ arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
3474
3474
  break;
3475
3475
 
3476
3476
  default:
@@ -3482,7 +3482,7 @@ var LeaferUI = function(exports) {
3482
3482
 
3483
3483
  case Z$1:
3484
3484
  if (lastCommand !== Z$1) {
3485
- arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3485
+ arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
3486
3486
  smooth.push(Z$1);
3487
3487
  }
3488
3488
  i += 1;
@@ -6567,7 +6567,7 @@ var LeaferUI = function(exports) {
6567
6567
  this.levelMap = null;
6568
6568
  }
6569
6569
  }
6570
- const version = "2.0.0";
6570
+ const version = "2.0.1";
6571
6571
  const debug$5 = Debug.get("LeaferCanvas");
6572
6572
  class LeaferCanvas extends LeaferCanvasBase {
6573
6573
  set zIndex(zIndex) {
@@ -7720,16 +7720,16 @@ var LeaferUI = function(exports) {
7720
7720
  return t.fill || t.stroke;
7721
7721
  }
7722
7722
  get __autoWidth() {
7723
- return !this._width;
7723
+ return this._width == null;
7724
7724
  }
7725
7725
  get __autoHeight() {
7726
- return !this._height;
7726
+ return this._height == null;
7727
7727
  }
7728
7728
  get __autoSide() {
7729
- return !this._width || !this._height;
7729
+ return this._width == null || this._height == null;
7730
7730
  }
7731
7731
  get __autoSize() {
7732
- return !this._width && !this._height;
7732
+ return this._width == null && this._height == null;
7733
7733
  }
7734
7734
  setVisible(value) {
7735
7735
  this._visible = value;
@@ -12295,7 +12295,7 @@ var LeaferUI = function(exports) {
12295
12295
  let {x: x, y: y, width: width, height: height} = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
12296
12296
  let starY = __baseLine;
12297
12297
  if (__clipText && realHeight > height) {
12298
- realHeight = Math.max(height, __lineHeight);
12298
+ realHeight = Math.max(style.__autoHeight ? realHeight : height, __lineHeight);
12299
12299
  if (countRows > 1) drawData.overflow = countRows;
12300
12300
  } else if (height || autoSizeAlign) {
12301
12301
  switch (verticalAlign) {
@@ -12351,10 +12351,10 @@ var LeaferUI = function(exports) {
12351
12351
  bounds.height = realHeight;
12352
12352
  }
12353
12353
  function clipText(drawData, style, x, width) {
12354
- if (!width) return;
12355
12354
  const {rows: rows, overflow: overflow} = drawData;
12356
12355
  let {textOverflow: textOverflow} = style;
12357
- rows.splice(overflow);
12356
+ if (overflow) rows.splice(overflow);
12357
+ if (!width) return;
12358
12358
  if (textOverflow && textOverflow !== "show") {
12359
12359
  if (textOverflow === "hide") textOverflow = ""; else if (textOverflow === "ellipsis") textOverflow = "...";
12360
12360
  let char, charRight;