leafer-game 2.1.1 → 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/web.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") {
@@ -2872,7 +2872,7 @@ var LeaferUI = function(exports) {
2872
2872
  return needConvert ? PathConvert.toCanvasData(data, curveMode) : data;
2873
2873
  },
2874
2874
  toCanvasData(old, curveMode) {
2875
- let x = 0, y = 0, x1 = 0, y1 = 0, i = 0, len = old.length, controlX, controlY, command, lastCommand, smooth;
2875
+ let x = 0, y = 0, x1 = 0, y1 = 0, startX = 0, startY = 0, i = 0, len = old.length, controlX, controlY, command, lastCommand, smooth;
2876
2876
  const data = [];
2877
2877
  while (i < len) {
2878
2878
  command = old[i];
@@ -2882,9 +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
- data.push(lastCommand === command ? L$6 : M$5, x, y);
2885
+ x = startX = old[i + 1];
2886
+ y = startY = old[i + 2];
2887
+ data.push(M$5, x, y);
2888
2888
  i += 3;
2889
2889
  break;
2890
2890
 
@@ -2999,6 +2999,8 @@ var LeaferUI = function(exports) {
2999
2999
  case z:
3000
3000
  case Z$5:
3001
3001
  data.push(Z$5);
3002
+ x = startX;
3003
+ y = startY;
3002
3004
  i++;
3003
3005
  break;
3004
3006
 
@@ -5686,39 +5688,45 @@ var LeaferUI = function(exports) {
5686
5688
  this.__updateRenderPath();
5687
5689
  this.__updateBoxBounds();
5688
5690
  layout.resized = "inner";
5689
- if (data.__strokeGeometry) data.__strokeGeometry = undefined;
5690
5691
  }
5691
5692
  if (layout.localBoxChanged) {
5692
5693
  if (this.__local) this.__updateLocalBoxBounds();
5693
5694
  layout.localBoxChanged = undefined;
5694
- if (layout.strokeSpread) layout.strokeChanged = true;
5695
- 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;
5696
5697
  if (this.parent) this.parent.__layout.boxChange();
5697
5698
  }
5698
5699
  layout.boxChanged = undefined;
5699
5700
  if (layout.strokeChanged) {
5700
- layout.strokeSpread = this.__updateStrokeSpread();
5701
- if (layout.strokeSpread) {
5702
- if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
5703
- this.__updateStrokeBounds();
5701
+ if (layout.strokeChanged === 2) {
5704
5702
  this.__updateLocalStrokeBounds();
5705
5703
  } else {
5706
- 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;
5707
5714
  }
5708
5715
  layout.strokeChanged = undefined;
5709
- if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
5710
5716
  if (this.parent) this.parent.__layout.strokeChange();
5711
- layout.resized = "inner";
5712
- if (data.__strokeGeometry) data.__strokeGeometry = undefined;
5713
5717
  }
5714
5718
  if (layout.renderChanged) {
5715
- layout.renderSpread = this.__updateRenderSpread();
5716
- if (layout.renderSpread) {
5717
- if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
5718
- this.__updateRenderBounds();
5719
+ if (layout.renderChanged === 2) {
5719
5720
  this.__updateLocalRenderBounds();
5720
5721
  } else {
5721
- 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
+ }
5722
5730
  }
5723
5731
  layout.renderChanged = undefined;
5724
5732
  if (this.parent) this.parent.__layout.renderChange();
@@ -6665,7 +6673,7 @@ var LeaferUI = function(exports) {
6665
6673
  this.levelMap = null;
6666
6674
  }
6667
6675
  }
6668
- const version = "2.1.1";
6676
+ const version = "2.1.3";
6669
6677
  const debug$5 = Debug.get("LeaferCanvas");
6670
6678
  class LeaferCanvas extends LeaferCanvasBase {
6671
6679
  set zIndex(zIndex) {
@@ -9253,7 +9261,6 @@ var LeaferUI = function(exports) {
9253
9261
  const {fontSize: fontSize, italic: italic, padding: padding, __autoWidth: autoWidth, __autoHeight: autoHeight} = data;
9254
9262
  this.__updateTextDrawData();
9255
9263
  const {bounds: contentBounds} = data.__textDrawData;
9256
- console.log(contentBounds);
9257
9264
  const b = layout.boxBounds;
9258
9265
  layout.contentBounds = contentBounds;
9259
9266
  if (data.__lineHeight < fontSize) layout.renderChanged = true;
@@ -11557,7 +11564,7 @@ var LeaferUI = function(exports) {
11557
11564
  needUpdate = false;
11558
11565
  }
11559
11566
  }
11560
- if (paint.mode === "brush") PaintImage.brush(leafPaint);
11567
+ if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
11561
11568
  if (!leafPaint.data) {
11562
11569
  PaintImage.createData(leafPaint, image, paint, boxBounds);
11563
11570
  const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
@@ -11790,8 +11797,12 @@ var LeaferUI = function(exports) {
11790
11797
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
11791
11798
  }
11792
11799
  const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
11793
- const pattern = brush ? imageCanvas : image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
11794
- paint.style = pattern;
11800
+ if (brush) {
11801
+ paint.style = imageCanvas;
11802
+ PaintImage.cacheBrush(paint, ui, canvas, renderOptions);
11803
+ } else {
11804
+ paint.style = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
11805
+ }
11795
11806
  paint.patternId = id;
11796
11807
  }
11797
11808
  }