leafer-game 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.
package/dist/web.js CHANGED
@@ -4596,6 +4596,9 @@ var LeaferUI = function(exports) {
4596
4596
  renderComplex(_leaf, _canvas, _options) {},
4597
4597
  updateComplex(_leaf) {},
4598
4598
  checkComplex(_leaf) {},
4599
+ updateFlowLayout(_leaf) {},
4600
+ listenPositionNode(_leaf) {},
4601
+ updatePositionLayout(_leaf) {},
4599
4602
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4600
4603
  const local = isObject(x) ? Object.assign({}, x) : {
4601
4604
  x: x,
@@ -5755,7 +5758,10 @@ var LeaferUI = function(exports) {
5755
5758
  layout.resized = "inner";
5756
5759
  }
5757
5760
  if (layout.localBoxChanged) {
5758
- if (this.__local) this.__updateLocalBoxBounds();
5761
+ if (this.__local) {
5762
+ this.__updateLocalBoxBounds();
5763
+ if (data.__usePositionNode) LeafHelper.listenPositionNode(this);
5764
+ }
5759
5765
  layout.localBoxChanged = undefined;
5760
5766
  if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
5761
5767
  if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
@@ -5802,6 +5808,7 @@ var LeaferUI = function(exports) {
5802
5808
  },
5803
5809
  __updateLocalBoxBounds() {
5804
5810
  if (this.__hasMotionPath) this.__updateMotionPath();
5811
+ if (this.__hasPosition) LeafHelper.updatePositionLayout(this);
5805
5812
  if (this.__hasAutoLayout) this.__updateAutoLayout();
5806
5813
  toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
5807
5814
  },
@@ -5828,11 +5835,7 @@ var LeaferUI = function(exports) {
5828
5835
  if (this.isBranch) {
5829
5836
  this.__extraUpdate();
5830
5837
  if (this.__.flow) {
5831
- if (this.__layout.childrenSortChanged) this.__updateSortChildren();
5832
- if (this.__layout.boxChanged) this.__updateFlowLayout();
5833
- updateAllMatrix$3(this);
5834
- updateBounds$1(this, this);
5835
- if (this.__.__autoSide) this.__updateBoxBounds(true);
5838
+ LeafHelper.updateFlowLayout(this);
5836
5839
  } else {
5837
5840
  updateAllMatrix$3(this);
5838
5841
  updateBounds$1(this, this);
@@ -6653,7 +6656,7 @@ var LeaferUI = function(exports) {
6653
6656
  this.levelMap = null;
6654
6657
  }
6655
6658
  }
6656
- const version = "2.3.1";
6659
+ const version = "2.3.3";
6657
6660
  if (typeof globalThis !== "undefined") {
6658
6661
  const globalLeafer = globalThis.Leafer || (globalThis.Leafer = {});
6659
6662
  globalLeafer.version = version;
@@ -11461,18 +11464,20 @@ var LeaferUI = function(exports) {
11461
11464
  data.__removePaint(attrName, false);
11462
11465
  data["_" + attrName] = "";
11463
11466
  }
11467
+ recycleMap = undefined;
11464
11468
  }
11465
11469
  function getLeafPaint(attrName, paint, ui) {
11466
11470
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
11467
- let leafPaint;
11471
+ let leafPaint, oldPaint;
11468
11472
  const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
11469
11473
  switch (type) {
11470
11474
  case "image":
11471
11475
  case "film":
11472
11476
  case "video":
11473
11477
  if (!paint.url) return undefined;
11474
- leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
11475
- if (type !== "image") PaintImage[type](leafPaint);
11478
+ oldPaint = recycleMap && recycleMap[paint.url];
11479
+ leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, oldPaint);
11480
+ if (type !== "image") PaintImage[type](leafPaint, oldPaint);
11476
11481
  break;
11477
11482
 
11478
11483
  case "linear":
@@ -11526,9 +11531,9 @@ var LeaferUI = function(exports) {
11526
11531
  };
11527
11532
  let cache$1, box = new Bounds;
11528
11533
  const {isSame: isSame} = BoundsHelper;
11529
- function image(ui, attrName, paint, boxBounds, firstUse) {
11534
+ function image(ui, attrName, paint, boxBounds, oldPaint) {
11530
11535
  let leafPaint, event;
11531
- const image = ImageManager.get(paint, paint.type);
11536
+ const image = ImageManager.get(paint, paint.type), firstUse = !oldPaint;
11532
11537
  if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
11533
11538
  leafPaint = cache$1.leafPaint;
11534
11539
  } else {
@@ -11924,7 +11929,7 @@ var LeaferUI = function(exports) {
11924
11929
  url = image && image.url;
11925
11930
  if (url) {
11926
11931
  if (!recycleMap) recycleMap = {};
11927
- recycleMap[url] = true;
11932
+ recycleMap[url] = paint;
11928
11933
  ImageManager.recyclePaint(paint);
11929
11934
  if (paint.brush) PaintImage.recycleBrush(paint, ui);
11930
11935
  if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, ui);
@@ -14554,7 +14559,7 @@ var LeaferUI = function(exports) {
14554
14559
  if (!data.total) return {};
14555
14560
  const point = HighCurveHelper.getDistancePoint(data, motionDistance, pathElement.motionPrecision, offsetX);
14556
14561
  const {motionRotation: motionRotation} = this;
14557
- if (isNumber(motionRotation)) point.rotation += motionRotation;
14562
+ if (isNumber(motionRotation)) point.rotation += motionRotation; else if (motionRotation === false) point.rotation = 0;
14558
14563
  if (motionAround && motionAround !== "top-left") {
14559
14564
  AroundHelper.toPoint(motionAround, this.__layout.boxBounds, tempPoint);
14560
14565
  PointHelper.set(tempPoint, point.x - tempPoint.x * this.scaleX, point.y - tempPoint.y * this.scaleY);