@leafer/worker 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
  class LeaferCanvas extends LeaferCanvasBase {
6236
6239
  get allowBackgroundColor() { return true; }
@@ -7526,7 +7529,7 @@ const UIRender = {
7526
7529
  __drawAfterFill(canvas, options) {
7527
7530
  if (this.__.__clipAfterFill) {
7528
7531
  canvas.save();
7529
- this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
7532
+ canvas.clipUI();
7530
7533
  this.__drawContent(canvas, options);
7531
7534
  canvas.restore();
7532
7535
  }
@@ -9011,6 +9014,9 @@ __decorate([
9011
9014
  __decorate([
9012
9015
  boundsType('show')
9013
9016
  ], Text.prototype, "textOverflow", void 0);
9017
+ __decorate([
9018
+ surfaceType(false)
9019
+ ], Text.prototype, "textEditing", void 0);
9014
9020
  Text = __decorate([
9015
9021
  registerUI()
9016
9022
  ], Text);
@@ -10475,11 +10481,14 @@ function drawAlign(stroke, align, ui, canvas) {
10475
10481
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
10476
10482
  fillText(ui, out);
10477
10483
  out.blendMode = 'normal';
10484
+ copyWorld(canvas, out, ui);
10485
+ out.recycle(ui.__nowWorld);
10486
+ }
10487
+ function copyWorld(canvas, out, ui) {
10478
10488
  if (ui.__worldFlipped || Platform.fullImageShadow)
10479
10489
  canvas.copyWorldByReset(out, ui.__nowWorld);
10480
10490
  else
10481
10491
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
10482
- out.recycle(ui.__nowWorld);
10483
10492
  }
10484
10493
  function drawTextStroke(ui, canvas) {
10485
10494
  let row, data = ui.__.__textDrawData;
@@ -10548,9 +10557,8 @@ function drawCenter(stroke, strokeWidthScale, ui, canvas) {
10548
10557
  Paint.strokeArrow(stroke, ui, canvas);
10549
10558
  }
10550
10559
  function drawInside(stroke, ui, canvas) {
10551
- const data = ui.__;
10552
10560
  canvas.save();
10553
- data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
10561
+ canvas.clipUI(ui);
10554
10562
  drawCenter(stroke, 2, ui, canvas);
10555
10563
  canvas.restore();
10556
10564
  }
@@ -10564,12 +10572,9 @@ function drawOutside(stroke, ui, canvas) {
10564
10572
  const out = canvas.getSameCanvas(true, true);
10565
10573
  ui.__drawRenderPath(out);
10566
10574
  drawCenter(stroke, 2, ui, out);
10567
- data.windingRule ? out.clip(data.windingRule) : out.clip();
10575
+ out.clipUI(data);
10568
10576
  out.clearWorld(renderBounds);
10569
- if (ui.__worldFlipped || Platform.fullImageShadow)
10570
- canvas.copyWorldByReset(out, ui.__nowWorld);
10571
- else
10572
- canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
10577
+ copyWorld(canvas, out, ui);
10573
10578
  out.recycle(ui.__nowWorld);
10574
10579
  }
10575
10580
  }
@@ -10625,9 +10630,7 @@ function compute(attrName, ui) {
10625
10630
  paints = [paints];
10626
10631
  recycleMap = PaintImage.recycleImage(attrName, data);
10627
10632
  for (let i = 0, len = paints.length, item; i < len; i++) {
10628
- item = getLeafPaint(attrName, paints[i], ui);
10629
- if (item)
10630
- leafPaints.push(item);
10633
+ (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
10631
10634
  }
10632
10635
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
10633
10636
  if (leafPaints.length) {
@@ -10665,8 +10668,8 @@ function getLeafPaint(attrName, paint, ui) {
10665
10668
  data = PaintGradient.conicGradient(paint, boxBounds);
10666
10669
  break;
10667
10670
  case 'solid':
10668
- const { type, blendMode, color, opacity } = paint;
10669
- data = { type, blendMode, style: ColorConvert.string(color, opacity) };
10671
+ const { type, color, opacity } = paint;
10672
+ data = { type, style: ColorConvert.string(color, opacity) };
10670
10673
  break;
10671
10674
  default:
10672
10675
  if (paint.r !== undefined)
@@ -11043,7 +11046,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
11043
11046
  }
11044
11047
  function drawImage(ui, canvas, paint, data) {
11045
11048
  canvas.save();
11046
- ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
11049
+ canvas.clipUI(ui);
11047
11050
  if (paint.blendMode)
11048
11051
  canvas.blendMode = paint.blendMode;
11049
11052
  if (data.opacity)
@@ -11208,12 +11211,10 @@ function shadow$1(ui, current, shape) {
11208
11211
  }
11209
11212
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
11210
11213
  }
11211
- if (ui.__worldFlipped) {
11214
+ if (ui.__worldFlipped)
11212
11215
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11213
- }
11214
- else {
11216
+ else
11215
11217
  current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
11216
- }
11217
11218
  if (end && index < end)
11218
11219
  other.clearWorld(copyBounds, true);
11219
11220
  });
@@ -11272,12 +11273,10 @@ function innerShadow(ui, current, shape) {
11272
11273
  copyBounds = bounds;
11273
11274
  }
11274
11275
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
11275
- if (ui.__worldFlipped) {
11276
+ if (ui.__worldFlipped)
11276
11277
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11277
- }
11278
- else {
11278
+ else
11279
11279
  current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
11280
- }
11281
11280
  if (end && index < end)
11282
11281
  other.clearWorld(copyBounds, true);
11283
11282
  });
@@ -14430,7 +14429,6 @@ TextEditor = __decorate([
14430
14429
  ], TextEditor);
14431
14430
 
14432
14431
  Plugin.add('text-editor', 'editor');
14433
- Text.addAttr('textEditing', false, surfaceType);
14434
14432
 
14435
14433
  function addViewport(leafer, mergeConfig, custom) {
14436
14434
  addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);