@leafer-game/miniapp 2.3.1 → 2.3.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.
@@ -4901,6 +4901,9 @@ const LeafHelper = {
4901
4901
  renderComplex(_leaf, _canvas, _options) {},
4902
4902
  updateComplex(_leaf) {},
4903
4903
  checkComplex(_leaf) {},
4904
+ updateFlowLayout(_leaf) {},
4905
+ listenPositionNode(_leaf) {},
4906
+ updatePositionLayout(_leaf) {},
4904
4907
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4905
4908
  const local = isObject(x) ? Object.assign({}, x) : {
4906
4909
  x: x,
@@ -6159,7 +6162,10 @@ const LeafBounds = {
6159
6162
  layout.resized = "inner";
6160
6163
  }
6161
6164
  if (layout.localBoxChanged) {
6162
- if (this.__local) this.__updateLocalBoxBounds();
6165
+ if (this.__local) {
6166
+ this.__updateLocalBoxBounds();
6167
+ if (data.__usePositionNode) LeafHelper.listenPositionNode(this);
6168
+ }
6163
6169
  layout.localBoxChanged = undefined;
6164
6170
  if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
6165
6171
  if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
@@ -6206,6 +6212,7 @@ const LeafBounds = {
6206
6212
  },
6207
6213
  __updateLocalBoxBounds() {
6208
6214
  if (this.__hasMotionPath) this.__updateMotionPath();
6215
+ if (this.__hasPosition) LeafHelper.updatePositionLayout(this);
6209
6216
  if (this.__hasAutoLayout) this.__updateAutoLayout();
6210
6217
  toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
6211
6218
  },
@@ -6232,11 +6239,7 @@ const LeafBounds = {
6232
6239
  if (this.isBranch) {
6233
6240
  this.__extraUpdate();
6234
6241
  if (this.__.flow) {
6235
- if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6236
- if (this.__layout.boxChanged) this.__updateFlowLayout();
6237
- updateAllMatrix$3(this);
6238
- updateBounds$1(this, this);
6239
- if (this.__.__autoSide) this.__updateBoxBounds(true);
6242
+ LeafHelper.updateFlowLayout(this);
6240
6243
  } else {
6241
6244
  updateAllMatrix$3(this);
6242
6245
  updateBounds$1(this, this);
@@ -7078,7 +7081,7 @@ class LeafLevelList {
7078
7081
  }
7079
7082
  }
7080
7083
 
7081
- const version = "2.3.1";
7084
+ const version = "2.3.3";
7082
7085
 
7083
7086
  if (typeof globalThis !== "undefined") {
7084
7087
  const globalLeafer = globalThis.Leafer || (globalThis.Leafer = {});
@@ -12065,19 +12068,21 @@ function compute(attrName, ui) {
12065
12068
  data.__removePaint(attrName, false);
12066
12069
  data["_" + attrName] = "";
12067
12070
  }
12071
+ recycleMap = undefined;
12068
12072
  }
12069
12073
 
12070
12074
  function getLeafPaint(attrName, paint, ui) {
12071
12075
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
12072
- let leafPaint;
12076
+ let leafPaint, oldPaint;
12073
12077
  const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
12074
12078
  switch (type) {
12075
12079
  case "image":
12076
12080
  case "film":
12077
12081
  case "video":
12078
12082
  if (!paint.url) return undefined;
12079
- leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
12080
- if (type !== "image") PaintImage[type](leafPaint);
12083
+ oldPaint = recycleMap && recycleMap[paint.url];
12084
+ leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, oldPaint);
12085
+ if (type !== "image") PaintImage[type](leafPaint, oldPaint);
12081
12086
  break;
12082
12087
 
12083
12088
  case "linear":
@@ -12135,9 +12140,9 @@ let cache$1, box = new Bounds;
12135
12140
 
12136
12141
  const {isSame: isSame} = BoundsHelper;
12137
12142
 
12138
- function image(ui, attrName, paint, boxBounds, firstUse) {
12143
+ function image(ui, attrName, paint, boxBounds, oldPaint) {
12139
12144
  let leafPaint, event;
12140
- const image = ImageManager.get(paint, paint.type);
12145
+ const image = ImageManager.get(paint, paint.type), firstUse = !oldPaint;
12141
12146
  if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
12142
12147
  leafPaint = cache$1.leafPaint;
12143
12148
  } else {
@@ -12563,7 +12568,7 @@ function recycleImage(attrName, data) {
12563
12568
  url = image && image.url;
12564
12569
  if (url) {
12565
12570
  if (!recycleMap) recycleMap = {};
12566
- recycleMap[url] = true;
12571
+ recycleMap[url] = paint;
12567
12572
  ImageManager.recyclePaint(paint);
12568
12573
  if (paint.brush) PaintImage.recycleBrush(paint, ui);
12569
12574
  if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, ui);
@@ -15477,7 +15482,7 @@ ui$1.getMotionPoint = function(motionDistance, motionAround, offsetX = 0, offset
15477
15482
  if (!data.total) return {};
15478
15483
  const point = HighCurveHelper.getDistancePoint(data, motionDistance, pathElement.motionPrecision, offsetX);
15479
15484
  const {motionRotation: motionRotation} = this;
15480
- if (isNumber(motionRotation)) point.rotation += motionRotation;
15485
+ if (isNumber(motionRotation)) point.rotation += motionRotation; else if (motionRotation === false) point.rotation = 0;
15481
15486
  if (motionAround && motionAround !== "top-left") {
15482
15487
  AroundHelper.toPoint(motionAround, this.__layout.boxBounds, tempPoint);
15483
15488
  PointHelper.set(tempPoint, point.x - tempPoint.x * this.scaleX, point.y - tempPoint.y * this.scaleY);