leafer-ui 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.
@@ -2269,16 +2269,19 @@ class LeaferCanvasBase extends Canvas$1 {
2269
2269
  if (blendMode)
2270
2270
  this.blendMode = 'source-over';
2271
2271
  }
2272
- clearWorld(bounds, ceilPixel) {
2273
- this.setTempBounds(bounds, ceilPixel);
2274
- this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2275
- }
2276
2272
  clipWorld(bounds, ceilPixel) {
2277
2273
  this.beginPath();
2278
2274
  this.setTempBounds(bounds, ceilPixel);
2279
2275
  this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2280
2276
  this.clip();
2281
2277
  }
2278
+ clipUI(ruleData) {
2279
+ ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
2280
+ }
2281
+ clearWorld(bounds, ceilPixel) {
2282
+ this.setTempBounds(bounds, ceilPixel);
2283
+ this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2284
+ }
2282
2285
  clear() {
2283
2286
  const { pixelRatio } = this;
2284
2287
  this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
@@ -5447,7 +5450,7 @@ const LeafRender = {
5447
5450
  if (this.__worldOpacity) {
5448
5451
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5449
5452
  this.__drawRenderPath(canvas);
5450
- this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
5453
+ canvas.clipUI(this);
5451
5454
  }
5452
5455
  },
5453
5456
  __updateWorldOpacity() {
@@ -6230,7 +6233,7 @@ class LeafLevelList {
6230
6233
  }
6231
6234
  }
6232
6235
 
6233
- const version = "1.6.3";
6236
+ const version = "1.6.4";
6234
6237
 
6235
6238
  const debug$5 = Debug.get('LeaferCanvas');
6236
6239
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7707,7 +7710,7 @@ const UIRender = {
7707
7710
  __drawAfterFill(canvas, options) {
7708
7711
  if (this.__.__clipAfterFill) {
7709
7712
  canvas.save();
7710
- this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
7713
+ canvas.clipUI();
7711
7714
  this.__drawContent(canvas, options);
7712
7715
  canvas.restore();
7713
7716
  }
@@ -9192,6 +9195,9 @@ __decorate([
9192
9195
  __decorate([
9193
9196
  boundsType('show')
9194
9197
  ], Text.prototype, "textOverflow", void 0);
9198
+ __decorate([
9199
+ surfaceType(false)
9200
+ ], Text.prototype, "textEditing", void 0);
9195
9201
  Text = __decorate([
9196
9202
  registerUI()
9197
9203
  ], Text);
@@ -10965,11 +10971,14 @@ function drawAlign(stroke, align, ui, canvas) {
10965
10971
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
10966
10972
  fillText(ui, out);
10967
10973
  out.blendMode = 'normal';
10974
+ copyWorld(canvas, out, ui);
10975
+ out.recycle(ui.__nowWorld);
10976
+ }
10977
+ function copyWorld(canvas, out, ui) {
10968
10978
  if (ui.__worldFlipped || Platform.fullImageShadow)
10969
10979
  canvas.copyWorldByReset(out, ui.__nowWorld);
10970
10980
  else
10971
10981
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
10972
- out.recycle(ui.__nowWorld);
10973
10982
  }
10974
10983
  function drawTextStroke(ui, canvas) {
10975
10984
  let row, data = ui.__.__textDrawData;
@@ -11038,9 +11047,8 @@ function drawCenter(stroke, strokeWidthScale, ui, canvas) {
11038
11047
  Paint.strokeArrow(stroke, ui, canvas);
11039
11048
  }
11040
11049
  function drawInside(stroke, ui, canvas) {
11041
- const data = ui.__;
11042
11050
  canvas.save();
11043
- data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
11051
+ canvas.clipUI(ui);
11044
11052
  drawCenter(stroke, 2, ui, canvas);
11045
11053
  canvas.restore();
11046
11054
  }
@@ -11054,12 +11062,9 @@ function drawOutside(stroke, ui, canvas) {
11054
11062
  const out = canvas.getSameCanvas(true, true);
11055
11063
  ui.__drawRenderPath(out);
11056
11064
  drawCenter(stroke, 2, ui, out);
11057
- data.windingRule ? out.clip(data.windingRule) : out.clip();
11065
+ out.clipUI(data);
11058
11066
  out.clearWorld(renderBounds);
11059
- if (ui.__worldFlipped || Platform.fullImageShadow)
11060
- canvas.copyWorldByReset(out, ui.__nowWorld);
11061
- else
11062
- canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
11067
+ copyWorld(canvas, out, ui);
11063
11068
  out.recycle(ui.__nowWorld);
11064
11069
  }
11065
11070
  }
@@ -11115,9 +11120,7 @@ function compute(attrName, ui) {
11115
11120
  paints = [paints];
11116
11121
  recycleMap = PaintImage.recycleImage(attrName, data);
11117
11122
  for (let i = 0, len = paints.length, item; i < len; i++) {
11118
- item = getLeafPaint(attrName, paints[i], ui);
11119
- if (item)
11120
- leafPaints.push(item);
11123
+ (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
11121
11124
  }
11122
11125
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
11123
11126
  if (leafPaints.length) {
@@ -11155,8 +11158,8 @@ function getLeafPaint(attrName, paint, ui) {
11155
11158
  data = PaintGradient.conicGradient(paint, boxBounds);
11156
11159
  break;
11157
11160
  case 'solid':
11158
- const { type, blendMode, color, opacity } = paint;
11159
- data = { type, blendMode, style: ColorConvert.string(color, opacity) };
11161
+ const { type, color, opacity } = paint;
11162
+ data = { type, style: ColorConvert.string(color, opacity) };
11160
11163
  break;
11161
11164
  default:
11162
11165
  if (paint.r !== undefined)
@@ -11533,7 +11536,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
11533
11536
  }
11534
11537
  function drawImage(ui, canvas, paint, data) {
11535
11538
  canvas.save();
11536
- ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
11539
+ canvas.clipUI(ui);
11537
11540
  if (paint.blendMode)
11538
11541
  canvas.blendMode = paint.blendMode;
11539
11542
  if (data.opacity)
@@ -11698,12 +11701,10 @@ function shadow(ui, current, shape) {
11698
11701
  }
11699
11702
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
11700
11703
  }
11701
- if (ui.__worldFlipped) {
11704
+ if (ui.__worldFlipped)
11702
11705
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11703
- }
11704
- else {
11706
+ else
11705
11707
  current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
11706
- }
11707
11708
  if (end && index < end)
11708
11709
  other.clearWorld(copyBounds, true);
11709
11710
  });
@@ -11762,12 +11763,10 @@ function innerShadow(ui, current, shape) {
11762
11763
  copyBounds = bounds;
11763
11764
  }
11764
11765
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
11765
- if (ui.__worldFlipped) {
11766
+ if (ui.__worldFlipped)
11766
11767
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11767
- }
11768
- else {
11768
+ else
11769
11769
  current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
11770
- }
11771
11770
  if (end && index < end)
11772
11771
  other.clearWorld(copyBounds, true);
11773
11772
  });