@leafer-game/miniapp 2.3.0 → 2.3.2

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,8 @@ const LeafHelper = {
4901
4901
  renderComplex(_leaf, _canvas, _options) {},
4902
4902
  updateComplex(_leaf) {},
4903
4903
  checkComplex(_leaf) {},
4904
+ updateFlowLayout(_leaf) {},
4905
+ updatePositionLayout(_leaf) {},
4904
4906
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4905
4907
  const local = isObject(x) ? Object.assign({}, x) : {
4906
4908
  x: x,
@@ -6206,6 +6208,7 @@ const LeafBounds = {
6206
6208
  },
6207
6209
  __updateLocalBoxBounds() {
6208
6210
  if (this.__hasMotionPath) this.__updateMotionPath();
6211
+ if (this.__hasPosition) LeafHelper.updatePositionLayout(this);
6209
6212
  if (this.__hasAutoLayout) this.__updateAutoLayout();
6210
6213
  toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
6211
6214
  },
@@ -6232,11 +6235,7 @@ const LeafBounds = {
6232
6235
  if (this.isBranch) {
6233
6236
  this.__extraUpdate();
6234
6237
  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);
6238
+ LeafHelper.updateFlowLayout(this);
6240
6239
  } else {
6241
6240
  updateAllMatrix$3(this);
6242
6241
  updateBounds$1(this, this);
@@ -6568,6 +6567,7 @@ let Leaf = class Leaf {
6568
6567
  this.__layout.update();
6569
6568
  }
6570
6569
  forceUpdate(typeOrAttrName) {
6570
+ if (this.__hasComplex) LeafHelper.updateComplex(this);
6571
6571
  let quick;
6572
6572
  if (!typeOrAttrName || typeOrAttrName === "bounds") doBoundsType(this), quick = true; else if (typeOrAttrName === "surface") doSurfaceType(this),
6573
6573
  quick = true; else if (typeOrAttrName === "stroke") doStrokeType(this), quick = true;
@@ -7077,7 +7077,7 @@ class LeafLevelList {
7077
7077
  }
7078
7078
  }
7079
7079
 
7080
- const version = "2.3.0";
7080
+ const version = "2.3.2";
7081
7081
 
7082
7082
  if (typeof globalThis !== "undefined") {
7083
7083
  const globalLeafer = globalThis.Leafer || (globalThis.Leafer = {});
@@ -12064,19 +12064,21 @@ function compute(attrName, ui) {
12064
12064
  data.__removePaint(attrName, false);
12065
12065
  data["_" + attrName] = "";
12066
12066
  }
12067
+ recycleMap = undefined;
12067
12068
  }
12068
12069
 
12069
12070
  function getLeafPaint(attrName, paint, ui) {
12070
12071
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
12071
- let leafPaint;
12072
+ let leafPaint, oldPaint;
12072
12073
  const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
12073
12074
  switch (type) {
12074
12075
  case "image":
12075
12076
  case "film":
12076
12077
  case "video":
12077
12078
  if (!paint.url) return undefined;
12078
- leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
12079
- if (type !== "image") PaintImage[type](leafPaint);
12079
+ oldPaint = recycleMap && recycleMap[paint.url];
12080
+ leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, oldPaint);
12081
+ if (type !== "image") PaintImage[type](leafPaint, oldPaint);
12080
12082
  break;
12081
12083
 
12082
12084
  case "linear":
@@ -12134,9 +12136,9 @@ let cache$1, box = new Bounds;
12134
12136
 
12135
12137
  const {isSame: isSame} = BoundsHelper;
12136
12138
 
12137
- function image(ui, attrName, paint, boxBounds, firstUse) {
12139
+ function image(ui, attrName, paint, boxBounds, oldPaint) {
12138
12140
  let leafPaint, event;
12139
- const image = ImageManager.get(paint, paint.type);
12141
+ const image = ImageManager.get(paint, paint.type), firstUse = !oldPaint;
12140
12142
  if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
12141
12143
  leafPaint = cache$1.leafPaint;
12142
12144
  } else {
@@ -12562,7 +12564,7 @@ function recycleImage(attrName, data) {
12562
12564
  url = image && image.url;
12563
12565
  if (url) {
12564
12566
  if (!recycleMap) recycleMap = {};
12565
- recycleMap[url] = true;
12567
+ recycleMap[url] = paint;
12566
12568
  ImageManager.recyclePaint(paint);
12567
12569
  if (paint.brush) PaintImage.recycleBrush(paint, ui);
12568
12570
  if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, ui);
@@ -15476,7 +15478,7 @@ ui$1.getMotionPoint = function(motionDistance, motionAround, offsetX = 0, offset
15476
15478
  if (!data.total) return {};
15477
15479
  const point = HighCurveHelper.getDistancePoint(data, motionDistance, pathElement.motionPrecision, offsetX);
15478
15480
  const {motionRotation: motionRotation} = this;
15479
- if (isNumber(motionRotation)) point.rotation += motionRotation;
15481
+ if (isNumber(motionRotation)) point.rotation += motionRotation; else if (motionRotation === false) point.rotation = 0;
15480
15482
  if (motionAround && motionAround !== "top-left") {
15481
15483
  AroundHelper.toPoint(motionAround, this.__layout.boxBounds, tempPoint);
15482
15484
  PointHelper.set(tempPoint, point.x - tempPoint.x * this.scaleX, point.y - tempPoint.y * this.scaleY);