@leafer-draw/worker 2.3.1 → 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.
@@ -4900,6 +4900,8 @@ const LeafHelper = {
4900
4900
  renderComplex(_leaf, _canvas, _options) {},
4901
4901
  updateComplex(_leaf) {},
4902
4902
  checkComplex(_leaf) {},
4903
+ updateFlowLayout(_leaf) {},
4904
+ updatePositionLayout(_leaf) {},
4903
4905
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4904
4906
  const local = isObject(x) ? Object.assign({}, x) : {
4905
4907
  x: x,
@@ -6205,6 +6207,7 @@ const LeafBounds = {
6205
6207
  },
6206
6208
  __updateLocalBoxBounds() {
6207
6209
  if (this.__hasMotionPath) this.__updateMotionPath();
6210
+ if (this.__hasPosition) LeafHelper.updatePositionLayout(this);
6208
6211
  if (this.__hasAutoLayout) this.__updateAutoLayout();
6209
6212
  toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
6210
6213
  },
@@ -6231,11 +6234,7 @@ const LeafBounds = {
6231
6234
  if (this.isBranch) {
6232
6235
  this.__extraUpdate();
6233
6236
  if (this.__.flow) {
6234
- if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6235
- if (this.__layout.boxChanged) this.__updateFlowLayout();
6236
- updateAllMatrix$2(this);
6237
- updateBounds(this, this);
6238
- if (this.__.__autoSide) this.__updateBoxBounds(true);
6237
+ LeafHelper.updateFlowLayout(this);
6239
6238
  } else {
6240
6239
  updateAllMatrix$2(this);
6241
6240
  updateBounds(this, this);
@@ -7077,7 +7076,7 @@ class LeafLevelList {
7077
7076
  }
7078
7077
  }
7079
7078
 
7080
- const version = "2.3.1";
7079
+ const version = "2.3.2";
7081
7080
 
7082
7081
  if (typeof globalThis !== "undefined") {
7083
7082
  const globalLeafer = globalThis.Leafer || (globalThis.Leafer = {});
@@ -10044,19 +10043,21 @@ function compute(attrName, ui) {
10044
10043
  data.__removePaint(attrName, false);
10045
10044
  data["_" + attrName] = "";
10046
10045
  }
10046
+ recycleMap = undefined;
10047
10047
  }
10048
10048
 
10049
10049
  function getLeafPaint(attrName, paint, ui) {
10050
10050
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
10051
- let leafPaint;
10051
+ let leafPaint, oldPaint;
10052
10052
  const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
10053
10053
  switch (type) {
10054
10054
  case "image":
10055
10055
  case "film":
10056
10056
  case "video":
10057
10057
  if (!paint.url) return undefined;
10058
- leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
10059
- if (type !== "image") PaintImage[type](leafPaint);
10058
+ oldPaint = recycleMap && recycleMap[paint.url];
10059
+ leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, oldPaint);
10060
+ if (type !== "image") PaintImage[type](leafPaint, oldPaint);
10060
10061
  break;
10061
10062
 
10062
10063
  case "linear":
@@ -10114,9 +10115,9 @@ let cache, box = new Bounds;
10114
10115
 
10115
10116
  const {isSame: isSame} = BoundsHelper;
10116
10117
 
10117
- function image(ui, attrName, paint, boxBounds, firstUse) {
10118
+ function image(ui, attrName, paint, boxBounds, oldPaint) {
10118
10119
  let leafPaint, event;
10119
- const image = ImageManager.get(paint, paint.type);
10120
+ const image = ImageManager.get(paint, paint.type), firstUse = !oldPaint;
10120
10121
  if (cache && paint === cache.paint && isSame(boxBounds, cache.boxBounds)) {
10121
10122
  leafPaint = cache.leafPaint;
10122
10123
  } else {
@@ -10542,7 +10543,7 @@ function recycleImage(attrName, data) {
10542
10543
  url = image && image.url;
10543
10544
  if (url) {
10544
10545
  if (!recycleMap) recycleMap = {};
10545
- recycleMap[url] = true;
10546
+ recycleMap[url] = paint;
10546
10547
  ImageManager.recyclePaint(paint);
10547
10548
  if (paint.brush) PaintImage.recycleBrush(paint, ui);
10548
10549
  if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, ui);