@leafer-draw/worker 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.
@@ -4900,6 +4900,9 @@ const LeafHelper = {
4900
4900
  renderComplex(_leaf, _canvas, _options) {},
4901
4901
  updateComplex(_leaf) {},
4902
4902
  checkComplex(_leaf) {},
4903
+ updateFlowLayout(_leaf) {},
4904
+ listenPositionNode(_leaf) {},
4905
+ updatePositionLayout(_leaf) {},
4903
4906
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4904
4907
  const local = isObject(x) ? Object.assign({}, x) : {
4905
4908
  x: x,
@@ -6158,7 +6161,10 @@ const LeafBounds = {
6158
6161
  layout.resized = "inner";
6159
6162
  }
6160
6163
  if (layout.localBoxChanged) {
6161
- if (this.__local) this.__updateLocalBoxBounds();
6164
+ if (this.__local) {
6165
+ this.__updateLocalBoxBounds();
6166
+ if (data.__usePositionNode) LeafHelper.listenPositionNode(this);
6167
+ }
6162
6168
  layout.localBoxChanged = undefined;
6163
6169
  if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
6164
6170
  if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
@@ -6205,6 +6211,7 @@ const LeafBounds = {
6205
6211
  },
6206
6212
  __updateLocalBoxBounds() {
6207
6213
  if (this.__hasMotionPath) this.__updateMotionPath();
6214
+ if (this.__hasPosition) LeafHelper.updatePositionLayout(this);
6208
6215
  if (this.__hasAutoLayout) this.__updateAutoLayout();
6209
6216
  toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
6210
6217
  },
@@ -6231,11 +6238,7 @@ const LeafBounds = {
6231
6238
  if (this.isBranch) {
6232
6239
  this.__extraUpdate();
6233
6240
  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);
6241
+ LeafHelper.updateFlowLayout(this);
6239
6242
  } else {
6240
6243
  updateAllMatrix$2(this);
6241
6244
  updateBounds(this, this);
@@ -7077,7 +7080,7 @@ class LeafLevelList {
7077
7080
  }
7078
7081
  }
7079
7082
 
7080
- const version = "2.3.1";
7083
+ const version = "2.3.3";
7081
7084
 
7082
7085
  if (typeof globalThis !== "undefined") {
7083
7086
  const globalLeafer = globalThis.Leafer || (globalThis.Leafer = {});
@@ -10044,19 +10047,21 @@ function compute(attrName, ui) {
10044
10047
  data.__removePaint(attrName, false);
10045
10048
  data["_" + attrName] = "";
10046
10049
  }
10050
+ recycleMap = undefined;
10047
10051
  }
10048
10052
 
10049
10053
  function getLeafPaint(attrName, paint, ui) {
10050
10054
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
10051
- let leafPaint;
10055
+ let leafPaint, oldPaint;
10052
10056
  const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
10053
10057
  switch (type) {
10054
10058
  case "image":
10055
10059
  case "film":
10056
10060
  case "video":
10057
10061
  if (!paint.url) return undefined;
10058
- leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
10059
- if (type !== "image") PaintImage[type](leafPaint);
10062
+ oldPaint = recycleMap && recycleMap[paint.url];
10063
+ leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, oldPaint);
10064
+ if (type !== "image") PaintImage[type](leafPaint, oldPaint);
10060
10065
  break;
10061
10066
 
10062
10067
  case "linear":
@@ -10114,9 +10119,9 @@ let cache, box = new Bounds;
10114
10119
 
10115
10120
  const {isSame: isSame} = BoundsHelper;
10116
10121
 
10117
- function image(ui, attrName, paint, boxBounds, firstUse) {
10122
+ function image(ui, attrName, paint, boxBounds, oldPaint) {
10118
10123
  let leafPaint, event;
10119
- const image = ImageManager.get(paint, paint.type);
10124
+ const image = ImageManager.get(paint, paint.type), firstUse = !oldPaint;
10120
10125
  if (cache && paint === cache.paint && isSame(boxBounds, cache.boxBounds)) {
10121
10126
  leafPaint = cache.leafPaint;
10122
10127
  } else {
@@ -10542,7 +10547,7 @@ function recycleImage(attrName, data) {
10542
10547
  url = image && image.url;
10543
10548
  if (url) {
10544
10549
  if (!recycleMap) recycleMap = {};
10545
- recycleMap[url] = true;
10550
+ recycleMap[url] = paint;
10546
10551
  ImageManager.recyclePaint(paint);
10547
10552
  if (paint.brush) PaintImage.recycleBrush(paint, ui);
10548
10553
  if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, ui);