leafer-game 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.
package/dist/web.js CHANGED
@@ -4596,6 +4596,8 @@ var LeaferUI = function(exports) {
4596
4596
  renderComplex(_leaf, _canvas, _options) {},
4597
4597
  updateComplex(_leaf) {},
4598
4598
  checkComplex(_leaf) {},
4599
+ updateFlowLayout(_leaf) {},
4600
+ updatePositionLayout(_leaf) {},
4599
4601
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4600
4602
  const local = isObject(x) ? Object.assign({}, x) : {
4601
4603
  x: x,
@@ -5802,6 +5804,7 @@ var LeaferUI = function(exports) {
5802
5804
  },
5803
5805
  __updateLocalBoxBounds() {
5804
5806
  if (this.__hasMotionPath) this.__updateMotionPath();
5807
+ if (this.__hasPosition) LeafHelper.updatePositionLayout(this);
5805
5808
  if (this.__hasAutoLayout) this.__updateAutoLayout();
5806
5809
  toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
5807
5810
  },
@@ -5828,11 +5831,7 @@ var LeaferUI = function(exports) {
5828
5831
  if (this.isBranch) {
5829
5832
  this.__extraUpdate();
5830
5833
  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);
5834
+ LeafHelper.updateFlowLayout(this);
5836
5835
  } else {
5837
5836
  updateAllMatrix$3(this);
5838
5837
  updateBounds$1(this, this);
@@ -6153,6 +6152,7 @@ var LeaferUI = function(exports) {
6153
6152
  this.__layout.update();
6154
6153
  }
6155
6154
  forceUpdate(typeOrAttrName) {
6155
+ if (this.__hasComplex) LeafHelper.updateComplex(this);
6156
6156
  let quick;
6157
6157
  if (!typeOrAttrName || typeOrAttrName === "bounds") doBoundsType(this), quick = true; else if (typeOrAttrName === "surface") doSurfaceType(this),
6158
6158
  quick = true; else if (typeOrAttrName === "stroke") doStrokeType(this), quick = true;
@@ -6652,7 +6652,7 @@ var LeaferUI = function(exports) {
6652
6652
  this.levelMap = null;
6653
6653
  }
6654
6654
  }
6655
- const version = "2.3.0";
6655
+ const version = "2.3.2";
6656
6656
  if (typeof globalThis !== "undefined") {
6657
6657
  const globalLeafer = globalThis.Leafer || (globalThis.Leafer = {});
6658
6658
  globalLeafer.version = version;
@@ -11460,18 +11460,20 @@ var LeaferUI = function(exports) {
11460
11460
  data.__removePaint(attrName, false);
11461
11461
  data["_" + attrName] = "";
11462
11462
  }
11463
+ recycleMap = undefined;
11463
11464
  }
11464
11465
  function getLeafPaint(attrName, paint, ui) {
11465
11466
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
11466
- let leafPaint;
11467
+ let leafPaint, oldPaint;
11467
11468
  const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
11468
11469
  switch (type) {
11469
11470
  case "image":
11470
11471
  case "film":
11471
11472
  case "video":
11472
11473
  if (!paint.url) return undefined;
11473
- leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
11474
- if (type !== "image") PaintImage[type](leafPaint);
11474
+ oldPaint = recycleMap && recycleMap[paint.url];
11475
+ leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, oldPaint);
11476
+ if (type !== "image") PaintImage[type](leafPaint, oldPaint);
11475
11477
  break;
11476
11478
 
11477
11479
  case "linear":
@@ -11525,9 +11527,9 @@ var LeaferUI = function(exports) {
11525
11527
  };
11526
11528
  let cache$1, box = new Bounds;
11527
11529
  const {isSame: isSame} = BoundsHelper;
11528
- function image(ui, attrName, paint, boxBounds, firstUse) {
11530
+ function image(ui, attrName, paint, boxBounds, oldPaint) {
11529
11531
  let leafPaint, event;
11530
- const image = ImageManager.get(paint, paint.type);
11532
+ const image = ImageManager.get(paint, paint.type), firstUse = !oldPaint;
11531
11533
  if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
11532
11534
  leafPaint = cache$1.leafPaint;
11533
11535
  } else {
@@ -11923,7 +11925,7 @@ var LeaferUI = function(exports) {
11923
11925
  url = image && image.url;
11924
11926
  if (url) {
11925
11927
  if (!recycleMap) recycleMap = {};
11926
- recycleMap[url] = true;
11928
+ recycleMap[url] = paint;
11927
11929
  ImageManager.recyclePaint(paint);
11928
11930
  if (paint.brush) PaintImage.recycleBrush(paint, ui);
11929
11931
  if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, ui);
@@ -14553,7 +14555,7 @@ var LeaferUI = function(exports) {
14553
14555
  if (!data.total) return {};
14554
14556
  const point = HighCurveHelper.getDistancePoint(data, motionDistance, pathElement.motionPrecision, offsetX);
14555
14557
  const {motionRotation: motionRotation} = this;
14556
- if (isNumber(motionRotation)) point.rotation += motionRotation;
14558
+ if (isNumber(motionRotation)) point.rotation += motionRotation; else if (motionRotation === false) point.rotation = 0;
14557
14559
  if (motionAround && motionAround !== "top-left") {
14558
14560
  AroundHelper.toPoint(motionAround, this.__layout.boxBounds, tempPoint);
14559
14561
  PointHelper.set(tempPoint, point.x - tempPoint.x * this.scaleX, point.y - tempPoint.y * this.scaleY);