@leafer-draw/worker 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.
@@ -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);
@@ -6567,6 +6566,7 @@ let Leaf = class Leaf {
6567
6566
  this.__layout.update();
6568
6567
  }
6569
6568
  forceUpdate(typeOrAttrName) {
6569
+ if (this.__hasComplex) LeafHelper.updateComplex(this);
6570
6570
  let quick;
6571
6571
  if (!typeOrAttrName || typeOrAttrName === "bounds") doBoundsType(this), quick = true; else if (typeOrAttrName === "surface") doSurfaceType(this),
6572
6572
  quick = true; else if (typeOrAttrName === "stroke") doStrokeType(this), quick = true;
@@ -7076,7 +7076,7 @@ class LeafLevelList {
7076
7076
  }
7077
7077
  }
7078
7078
 
7079
- const version = "2.3.0";
7079
+ const version = "2.3.2";
7080
7080
 
7081
7081
  if (typeof globalThis !== "undefined") {
7082
7082
  const globalLeafer = globalThis.Leafer || (globalThis.Leafer = {});
@@ -10043,19 +10043,21 @@ function compute(attrName, ui) {
10043
10043
  data.__removePaint(attrName, false);
10044
10044
  data["_" + attrName] = "";
10045
10045
  }
10046
+ recycleMap = undefined;
10046
10047
  }
10047
10048
 
10048
10049
  function getLeafPaint(attrName, paint, ui) {
10049
10050
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
10050
- let leafPaint;
10051
+ let leafPaint, oldPaint;
10051
10052
  const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
10052
10053
  switch (type) {
10053
10054
  case "image":
10054
10055
  case "film":
10055
10056
  case "video":
10056
10057
  if (!paint.url) return undefined;
10057
- leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
10058
- 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);
10059
10061
  break;
10060
10062
 
10061
10063
  case "linear":
@@ -10113,9 +10115,9 @@ let cache, box = new Bounds;
10113
10115
 
10114
10116
  const {isSame: isSame} = BoundsHelper;
10115
10117
 
10116
- function image(ui, attrName, paint, boxBounds, firstUse) {
10118
+ function image(ui, attrName, paint, boxBounds, oldPaint) {
10117
10119
  let leafPaint, event;
10118
- const image = ImageManager.get(paint, paint.type);
10120
+ const image = ImageManager.get(paint, paint.type), firstUse = !oldPaint;
10119
10121
  if (cache && paint === cache.paint && isSame(boxBounds, cache.boxBounds)) {
10120
10122
  leafPaint = cache.leafPaint;
10121
10123
  } else {
@@ -10541,7 +10543,7 @@ function recycleImage(attrName, data) {
10541
10543
  url = image && image.url;
10542
10544
  if (url) {
10543
10545
  if (!recycleMap) recycleMap = {};
10544
- recycleMap[url] = true;
10546
+ recycleMap[url] = paint;
10545
10547
  ImageManager.recyclePaint(paint);
10546
10548
  if (paint.brush) PaintImage.recycleBrush(paint, ui);
10547
10549
  if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, ui);