@leafer-game/worker 2.1.2 → 2.1.3

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/worker.js CHANGED
@@ -2850,7 +2850,7 @@ var LeaferUI = function(exports) {
2850
2850
  current.length = PathCommandLengthMap[char];
2851
2851
  current.index = 0;
2852
2852
  pushData(data, current.name);
2853
- if (!needConvert && convertCommand[char]) needConvert = true;
2853
+ if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"]; else if (!needConvert && convertCommand[char]) needConvert = true;
2854
2854
  } else {
2855
2855
  if (char === "-" || char === "+") {
2856
2856
  if (lastChar === "e" || lastChar === "E") {
@@ -2882,10 +2882,9 @@ var LeaferUI = function(exports) {
2882
2882
  old[i + 2] += y;
2883
2883
 
2884
2884
  case M$5:
2885
- x = old[i + 1];
2886
- y = old[i + 2];
2887
- if (lastCommand === command) data.push(L$6, x, y); else data.push(M$5, x, y), startX = x,
2888
- startY = y;
2885
+ x = startX = old[i + 1];
2886
+ y = startY = old[i + 2];
2887
+ data.push(M$5, x, y);
2889
2888
  i += 3;
2890
2889
  break;
2891
2890
 
@@ -5689,39 +5688,45 @@ var LeaferUI = function(exports) {
5689
5688
  this.__updateRenderPath();
5690
5689
  this.__updateBoxBounds();
5691
5690
  layout.resized = "inner";
5692
- if (data.__strokeGeometry) data.__strokeGeometry = undefined;
5693
5691
  }
5694
5692
  if (layout.localBoxChanged) {
5695
5693
  if (this.__local) this.__updateLocalBoxBounds();
5696
5694
  layout.localBoxChanged = undefined;
5697
- if (layout.strokeSpread) layout.strokeChanged = true;
5698
- if (layout.renderSpread) layout.renderChanged = true;
5695
+ if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
5696
+ if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
5699
5697
  if (this.parent) this.parent.__layout.boxChange();
5700
5698
  }
5701
5699
  layout.boxChanged = undefined;
5702
5700
  if (layout.strokeChanged) {
5703
- layout.strokeSpread = this.__updateStrokeSpread();
5704
- if (layout.strokeSpread) {
5705
- if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
5706
- this.__updateStrokeBounds();
5701
+ if (layout.strokeChanged === 2) {
5707
5702
  this.__updateLocalStrokeBounds();
5708
5703
  } else {
5709
- layout.spreadStrokeCancel();
5704
+ layout.strokeSpread = this.__updateStrokeSpread();
5705
+ if (layout.strokeSpread) {
5706
+ if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
5707
+ this.__updateStrokeBounds();
5708
+ this.__updateLocalStrokeBounds();
5709
+ } else {
5710
+ layout.spreadStrokeCancel();
5711
+ }
5712
+ layout.resized = "inner";
5713
+ if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
5710
5714
  }
5711
5715
  layout.strokeChanged = undefined;
5712
- if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
5713
5716
  if (this.parent) this.parent.__layout.strokeChange();
5714
- layout.resized = "inner";
5715
- if (data.__strokeGeometry) data.__strokeGeometry = undefined;
5716
5717
  }
5717
5718
  if (layout.renderChanged) {
5718
- layout.renderSpread = this.__updateRenderSpread();
5719
- if (layout.renderSpread) {
5720
- if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
5721
- this.__updateRenderBounds();
5719
+ if (layout.renderChanged === 2) {
5722
5720
  this.__updateLocalRenderBounds();
5723
5721
  } else {
5724
- layout.spreadRenderCancel();
5722
+ layout.renderSpread = this.__updateRenderSpread();
5723
+ if (layout.renderSpread) {
5724
+ if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
5725
+ this.__updateRenderBounds();
5726
+ this.__updateLocalRenderBounds();
5727
+ } else {
5728
+ layout.spreadRenderCancel();
5729
+ }
5725
5730
  }
5726
5731
  layout.renderChanged = undefined;
5727
5732
  if (this.parent) this.parent.__layout.renderChange();
@@ -6668,7 +6673,7 @@ var LeaferUI = function(exports) {
6668
6673
  this.levelMap = null;
6669
6674
  }
6670
6675
  }
6671
- const version = "2.1.2";
6676
+ const version = "2.1.3";
6672
6677
  class LeaferCanvas extends LeaferCanvasBase {
6673
6678
  get allowBackgroundColor() {
6674
6679
  return true;
@@ -11036,7 +11041,7 @@ var LeaferUI = function(exports) {
11036
11041
  needUpdate = false;
11037
11042
  }
11038
11043
  }
11039
- if (paint.mode === "brush") PaintImage.brush(leafPaint);
11044
+ if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
11040
11045
  if (!leafPaint.data) {
11041
11046
  PaintImage.createData(leafPaint, image, paint, boxBounds);
11042
11047
  const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
@@ -11269,8 +11274,12 @@ var LeaferUI = function(exports) {
11269
11274
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
11270
11275
  }
11271
11276
  const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
11272
- const pattern = brush ? imageCanvas : image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
11273
- paint.style = pattern;
11277
+ if (brush) {
11278
+ paint.style = imageCanvas;
11279
+ PaintImage.cacheBrush(paint, ui, canvas, renderOptions);
11280
+ } else {
11281
+ paint.style = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
11282
+ }
11274
11283
  paint.patternId = id;
11275
11284
  }
11276
11285
  }