@leafer/core 1.11.2 → 1.12.0

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/lib/core.cjs CHANGED
@@ -4049,16 +4049,27 @@ const ImageManager = {
4049
4049
  recycle(image) {
4050
4050
  image.use--;
4051
4051
  setTimeout(() => {
4052
- if (!image.use) I.recycledList.push(image);
4052
+ if (!image.use) {
4053
+ if (Platform.image.isLarge(image)) {
4054
+ if (image.url) Resource.remove(image.url);
4055
+ } else {
4056
+ image.clearLevels();
4057
+ I.recycledList.push(image);
4058
+ }
4059
+ }
4053
4060
  });
4054
4061
  },
4055
- clearRecycled() {
4062
+ recyclePaint(paint) {
4063
+ I.recycle(paint.image);
4064
+ },
4065
+ clearRecycled(force) {
4056
4066
  const list = I.recycledList;
4057
- if (list.length > I.maxRecycled) {
4058
- list.forEach(image => !image.use && image.url && Resource.remove(image.url));
4067
+ if (list.length > I.maxRecycled || force) {
4068
+ list.forEach(image => (!image.use || force) && image.url && Resource.remove(image.url));
4059
4069
  list.length = 0;
4060
4070
  }
4061
4071
  },
4072
+ clearLevels() {},
4062
4073
  hasAlphaPixel(config) {
4063
4074
  return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
4064
4075
  },
@@ -4073,7 +4084,7 @@ const ImageManager = {
4073
4084
  return false;
4074
4085
  },
4075
4086
  destroy() {
4076
- I.recycledList = [];
4087
+ this.clearRecycled(true);
4077
4088
  }
4078
4089
  };
4079
4090
 
@@ -4176,11 +4187,15 @@ class LeaferImage {
4176
4187
  Platform.image.setPatternTransform(pattern, transform, paint);
4177
4188
  return pattern;
4178
4189
  }
4190
+ clearLevels(_checkUse) {}
4179
4191
  destroy() {
4192
+ this.clearLevels();
4193
+ const {view: view} = this;
4194
+ if (view && view.close) view.close();
4180
4195
  this.config = {
4181
4196
  url: ""
4182
4197
  };
4183
- this.cache = null;
4198
+ this.cache = this.view = null;
4184
4199
  this.waitComplete.length = 0;
4185
4200
  }
4186
4201
  }
@@ -5959,6 +5974,7 @@ const LeafBounds = {
5959
5974
  const LeafRender = {
5960
5975
  __render(canvas, options) {
5961
5976
  if (options.shape) return this.__renderShape(canvas, options);
5977
+ if (options.cellList && !options.cellList.has(this)) return;
5962
5978
  if (this.__worldOpacity) {
5963
5979
  const data = this.__;
5964
5980
  if (data.bright && !options.topRendering) return options.topList.add(this);
@@ -6857,7 +6873,7 @@ class LeafLevelList {
6857
6873
  }
6858
6874
  }
6859
6875
 
6860
- const version = "1.11.2";
6876
+ const version = "1.12.0";
6861
6877
 
6862
6878
  exports.AlignHelper = AlignHelper;
6863
6879
 
package/lib/core.esm.js CHANGED
@@ -4047,16 +4047,27 @@ const ImageManager = {
4047
4047
  recycle(image) {
4048
4048
  image.use--;
4049
4049
  setTimeout(() => {
4050
- if (!image.use) I.recycledList.push(image);
4050
+ if (!image.use) {
4051
+ if (Platform.image.isLarge(image)) {
4052
+ if (image.url) Resource.remove(image.url);
4053
+ } else {
4054
+ image.clearLevels();
4055
+ I.recycledList.push(image);
4056
+ }
4057
+ }
4051
4058
  });
4052
4059
  },
4053
- clearRecycled() {
4060
+ recyclePaint(paint) {
4061
+ I.recycle(paint.image);
4062
+ },
4063
+ clearRecycled(force) {
4054
4064
  const list = I.recycledList;
4055
- if (list.length > I.maxRecycled) {
4056
- list.forEach(image => !image.use && image.url && Resource.remove(image.url));
4065
+ if (list.length > I.maxRecycled || force) {
4066
+ list.forEach(image => (!image.use || force) && image.url && Resource.remove(image.url));
4057
4067
  list.length = 0;
4058
4068
  }
4059
4069
  },
4070
+ clearLevels() {},
4060
4071
  hasAlphaPixel(config) {
4061
4072
  return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
4062
4073
  },
@@ -4071,7 +4082,7 @@ const ImageManager = {
4071
4082
  return false;
4072
4083
  },
4073
4084
  destroy() {
4074
- I.recycledList = [];
4085
+ this.clearRecycled(true);
4075
4086
  }
4076
4087
  };
4077
4088
 
@@ -4174,11 +4185,15 @@ class LeaferImage {
4174
4185
  Platform.image.setPatternTransform(pattern, transform, paint);
4175
4186
  return pattern;
4176
4187
  }
4188
+ clearLevels(_checkUse) {}
4177
4189
  destroy() {
4190
+ this.clearLevels();
4191
+ const {view: view} = this;
4192
+ if (view && view.close) view.close();
4178
4193
  this.config = {
4179
4194
  url: ""
4180
4195
  };
4181
- this.cache = null;
4196
+ this.cache = this.view = null;
4182
4197
  this.waitComplete.length = 0;
4183
4198
  }
4184
4199
  }
@@ -5957,6 +5972,7 @@ const LeafBounds = {
5957
5972
  const LeafRender = {
5958
5973
  __render(canvas, options) {
5959
5974
  if (options.shape) return this.__renderShape(canvas, options);
5975
+ if (options.cellList && !options.cellList.has(this)) return;
5960
5976
  if (this.__worldOpacity) {
5961
5977
  const data = this.__;
5962
5978
  if (data.bright && !options.topRendering) return options.topList.add(this);
@@ -6855,6 +6871,6 @@ class LeafLevelList {
6855
6871
  }
6856
6872
  }
6857
6873
 
6858
- const version = "1.11.2";
6874
+ const version = "1.12.0";
6859
6875
 
6860
6876
  export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, FourNumberHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Resource, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useModule, version, visibleType };