leafer-game 1.6.3 → 1.6.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.
package/dist/web.js CHANGED
@@ -2272,16 +2272,19 @@ var LeaferUI = (function (exports) {
2272
2272
  if (blendMode)
2273
2273
  this.blendMode = 'source-over';
2274
2274
  }
2275
- clearWorld(bounds, ceilPixel) {
2276
- this.setTempBounds(bounds, ceilPixel);
2277
- this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2278
- }
2279
2275
  clipWorld(bounds, ceilPixel) {
2280
2276
  this.beginPath();
2281
2277
  this.setTempBounds(bounds, ceilPixel);
2282
2278
  this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2283
2279
  this.clip();
2284
2280
  }
2281
+ clipUI(ruleData) {
2282
+ ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
2283
+ }
2284
+ clearWorld(bounds, ceilPixel) {
2285
+ this.setTempBounds(bounds, ceilPixel);
2286
+ this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2287
+ }
2285
2288
  clear() {
2286
2289
  const { pixelRatio } = this;
2287
2290
  this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
@@ -5450,7 +5453,7 @@ var LeaferUI = (function (exports) {
5450
5453
  if (this.__worldOpacity) {
5451
5454
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5452
5455
  this.__drawRenderPath(canvas);
5453
- this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
5456
+ canvas.clipUI(this);
5454
5457
  }
5455
5458
  },
5456
5459
  __updateWorldOpacity() {
@@ -6233,7 +6236,7 @@ var LeaferUI = (function (exports) {
6233
6236
  }
6234
6237
  }
6235
6238
 
6236
- const version = "1.6.3";
6239
+ const version = "1.6.4";
6237
6240
 
6238
6241
  const debug$5 = Debug.get('LeaferCanvas');
6239
6242
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7710,7 +7713,7 @@ var LeaferUI = (function (exports) {
7710
7713
  __drawAfterFill(canvas, options) {
7711
7714
  if (this.__.__clipAfterFill) {
7712
7715
  canvas.save();
7713
- this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
7716
+ canvas.clipUI();
7714
7717
  this.__drawContent(canvas, options);
7715
7718
  canvas.restore();
7716
7719
  }
@@ -9195,6 +9198,9 @@ var LeaferUI = (function (exports) {
9195
9198
  __decorate([
9196
9199
  boundsType('show')
9197
9200
  ], exports.Text.prototype, "textOverflow", void 0);
9201
+ __decorate([
9202
+ surfaceType(false)
9203
+ ], exports.Text.prototype, "textEditing", void 0);
9198
9204
  exports.Text = __decorate([
9199
9205
  registerUI()
9200
9206
  ], exports.Text);
@@ -10968,11 +10974,14 @@ var LeaferUI = (function (exports) {
10968
10974
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
10969
10975
  fillText(ui, out);
10970
10976
  out.blendMode = 'normal';
10977
+ copyWorld(canvas, out, ui);
10978
+ out.recycle(ui.__nowWorld);
10979
+ }
10980
+ function copyWorld(canvas, out, ui) {
10971
10981
  if (ui.__worldFlipped || Platform.fullImageShadow)
10972
10982
  canvas.copyWorldByReset(out, ui.__nowWorld);
10973
10983
  else
10974
10984
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
10975
- out.recycle(ui.__nowWorld);
10976
10985
  }
10977
10986
  function drawTextStroke(ui, canvas) {
10978
10987
  let row, data = ui.__.__textDrawData;
@@ -11041,9 +11050,8 @@ var LeaferUI = (function (exports) {
11041
11050
  Paint.strokeArrow(stroke, ui, canvas);
11042
11051
  }
11043
11052
  function drawInside(stroke, ui, canvas) {
11044
- const data = ui.__;
11045
11053
  canvas.save();
11046
- data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
11054
+ canvas.clipUI(ui);
11047
11055
  drawCenter(stroke, 2, ui, canvas);
11048
11056
  canvas.restore();
11049
11057
  }
@@ -11057,12 +11065,9 @@ var LeaferUI = (function (exports) {
11057
11065
  const out = canvas.getSameCanvas(true, true);
11058
11066
  ui.__drawRenderPath(out);
11059
11067
  drawCenter(stroke, 2, ui, out);
11060
- data.windingRule ? out.clip(data.windingRule) : out.clip();
11068
+ out.clipUI(data);
11061
11069
  out.clearWorld(renderBounds);
11062
- if (ui.__worldFlipped || Platform.fullImageShadow)
11063
- canvas.copyWorldByReset(out, ui.__nowWorld);
11064
- else
11065
- canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
11070
+ copyWorld(canvas, out, ui);
11066
11071
  out.recycle(ui.__nowWorld);
11067
11072
  }
11068
11073
  }
@@ -11118,9 +11123,7 @@ var LeaferUI = (function (exports) {
11118
11123
  paints = [paints];
11119
11124
  recycleMap = PaintImage.recycleImage(attrName, data);
11120
11125
  for (let i = 0, len = paints.length, item; i < len; i++) {
11121
- item = getLeafPaint(attrName, paints[i], ui);
11122
- if (item)
11123
- leafPaints.push(item);
11126
+ (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
11124
11127
  }
11125
11128
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
11126
11129
  if (leafPaints.length) {
@@ -11158,8 +11161,8 @@ var LeaferUI = (function (exports) {
11158
11161
  data = PaintGradient.conicGradient(paint, boxBounds);
11159
11162
  break;
11160
11163
  case 'solid':
11161
- const { type, blendMode, color, opacity } = paint;
11162
- data = { type, blendMode, style: ColorConvert.string(color, opacity) };
11164
+ const { type, color, opacity } = paint;
11165
+ data = { type, style: ColorConvert.string(color, opacity) };
11163
11166
  break;
11164
11167
  default:
11165
11168
  if (paint.r !== undefined)
@@ -11536,7 +11539,7 @@ var LeaferUI = (function (exports) {
11536
11539
  }
11537
11540
  function drawImage(ui, canvas, paint, data) {
11538
11541
  canvas.save();
11539
- ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
11542
+ canvas.clipUI(ui);
11540
11543
  if (paint.blendMode)
11541
11544
  canvas.blendMode = paint.blendMode;
11542
11545
  if (data.opacity)
@@ -11701,12 +11704,10 @@ var LeaferUI = (function (exports) {
11701
11704
  }
11702
11705
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
11703
11706
  }
11704
- if (ui.__worldFlipped) {
11707
+ if (ui.__worldFlipped)
11705
11708
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11706
- }
11707
- else {
11709
+ else
11708
11710
  current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
11709
- }
11710
11711
  if (end && index < end)
11711
11712
  other.clearWorld(copyBounds, true);
11712
11713
  });
@@ -11765,12 +11766,10 @@ var LeaferUI = (function (exports) {
11765
11766
  copyBounds = bounds;
11766
11767
  }
11767
11768
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
11768
- if (ui.__worldFlipped) {
11769
+ if (ui.__worldFlipped)
11769
11770
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11770
- }
11771
- else {
11771
+ else
11772
11772
  current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
11773
- }
11774
11773
  if (end && index < end)
11775
11774
  other.clearWorld(copyBounds, true);
11776
11775
  });