leafer-ui 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.
@@ -3048,7 +3048,7 @@ const PathConvert = {
3048
3048
  current.length = PathCommandLengthMap[char];
3049
3049
  current.index = 0;
3050
3050
  pushData(data, current.name);
3051
- if (!needConvert && convertCommand[char]) needConvert = true;
3051
+ if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"]; else if (!needConvert && convertCommand[char]) needConvert = true;
3052
3052
  } else {
3053
3053
  if (char === "-" || char === "+") {
3054
3054
  if (lastChar === "e" || lastChar === "E") {
@@ -3080,10 +3080,9 @@ const PathConvert = {
3080
3080
  old[i + 2] += y;
3081
3081
 
3082
3082
  case M$4:
3083
- x = old[i + 1];
3084
- y = old[i + 2];
3085
- if (lastCommand === command) data.push(L$5, x, y); else data.push(M$4, x, y), startX = x,
3086
- startY = y;
3083
+ x = startX = old[i + 1];
3084
+ y = startY = old[i + 2];
3085
+ data.push(M$4, x, y);
3087
3086
  i += 3;
3088
3087
  break;
3089
3088
 
@@ -6084,39 +6083,45 @@ const LeafBounds = {
6084
6083
  this.__updateRenderPath();
6085
6084
  this.__updateBoxBounds();
6086
6085
  layout.resized = "inner";
6087
- if (data.__strokeGeometry) data.__strokeGeometry = undefined;
6088
6086
  }
6089
6087
  if (layout.localBoxChanged) {
6090
6088
  if (this.__local) this.__updateLocalBoxBounds();
6091
6089
  layout.localBoxChanged = undefined;
6092
- if (layout.strokeSpread) layout.strokeChanged = true;
6093
- if (layout.renderSpread) layout.renderChanged = true;
6090
+ if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
6091
+ if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
6094
6092
  if (this.parent) this.parent.__layout.boxChange();
6095
6093
  }
6096
6094
  layout.boxChanged = undefined;
6097
6095
  if (layout.strokeChanged) {
6098
- layout.strokeSpread = this.__updateStrokeSpread();
6099
- if (layout.strokeSpread) {
6100
- if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
6101
- this.__updateStrokeBounds();
6096
+ if (layout.strokeChanged === 2) {
6102
6097
  this.__updateLocalStrokeBounds();
6103
6098
  } else {
6104
- layout.spreadStrokeCancel();
6099
+ layout.strokeSpread = this.__updateStrokeSpread();
6100
+ if (layout.strokeSpread) {
6101
+ if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
6102
+ this.__updateStrokeBounds();
6103
+ this.__updateLocalStrokeBounds();
6104
+ } else {
6105
+ layout.spreadStrokeCancel();
6106
+ }
6107
+ layout.resized = "inner";
6108
+ if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
6105
6109
  }
6106
6110
  layout.strokeChanged = undefined;
6107
- if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
6108
6111
  if (this.parent) this.parent.__layout.strokeChange();
6109
- layout.resized = "inner";
6110
- if (data.__strokeGeometry) data.__strokeGeometry = undefined;
6111
6112
  }
6112
6113
  if (layout.renderChanged) {
6113
- layout.renderSpread = this.__updateRenderSpread();
6114
- if (layout.renderSpread) {
6115
- if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
6116
- this.__updateRenderBounds();
6114
+ if (layout.renderChanged === 2) {
6117
6115
  this.__updateLocalRenderBounds();
6118
6116
  } else {
6119
- layout.spreadRenderCancel();
6117
+ layout.renderSpread = this.__updateRenderSpread();
6118
+ if (layout.renderSpread) {
6119
+ if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
6120
+ this.__updateRenderBounds();
6121
+ this.__updateLocalRenderBounds();
6122
+ } else {
6123
+ layout.spreadRenderCancel();
6124
+ }
6120
6125
  }
6121
6126
  layout.renderChanged = undefined;
6122
6127
  if (this.parent) this.parent.__layout.renderChange();
@@ -7084,7 +7089,7 @@ class LeafLevelList {
7084
7089
  }
7085
7090
  }
7086
7091
 
7087
- const version = "2.1.2";
7092
+ const version = "2.1.3";
7088
7093
 
7089
7094
  const debug$5 = Debug.get("LeaferCanvas");
7090
7095
 
@@ -12411,7 +12416,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
12411
12416
  needUpdate = false;
12412
12417
  }
12413
12418
  }
12414
- if (paint.mode === "brush") PaintImage.brush(leafPaint);
12419
+ if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
12415
12420
  if (!leafPaint.data) {
12416
12421
  PaintImage.createData(leafPaint, image, paint, boxBounds);
12417
12422
  const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
@@ -12668,8 +12673,12 @@ function createPattern(paint, ui, canvas, renderOptions) {
12668
12673
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
12669
12674
  }
12670
12675
  const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
12671
- const pattern = brush ? imageCanvas : image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
12672
- paint.style = pattern;
12676
+ if (brush) {
12677
+ paint.style = imageCanvas;
12678
+ PaintImage.cacheBrush(paint, ui, canvas, renderOptions);
12679
+ } else {
12680
+ paint.style = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
12681
+ }
12673
12682
  paint.patternId = id;
12674
12683
  }
12675
12684
  }