@leafer/core 1.4.1 → 1.5.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 +14 -14
- package/lib/core.cjs.map +1 -1
- package/lib/core.esm.js +14 -14
- package/lib/core.esm.js.map +1 -1
- package/lib/core.esm.min.js +1 -1
- package/lib/core.esm.min.js.map +1 -1
- package/lib/core.min.cjs +1 -1
- package/lib/core.min.cjs.map +1 -1
- package/package.json +17 -17
- package/src/index.ts +1 -1
- package/types/index.d.ts +1 -1
package/lib/core.esm.js
CHANGED
|
@@ -3635,7 +3635,12 @@ const Resource = {
|
|
|
3635
3635
|
return R.map[key];
|
|
3636
3636
|
},
|
|
3637
3637
|
remove(key) {
|
|
3638
|
-
|
|
3638
|
+
const r = R.map[key];
|
|
3639
|
+
if (r) {
|
|
3640
|
+
if (r.destroy)
|
|
3641
|
+
r.destroy();
|
|
3642
|
+
delete R.map[key];
|
|
3643
|
+
}
|
|
3639
3644
|
},
|
|
3640
3645
|
loadImage(key, format) {
|
|
3641
3646
|
return new Promise((resolve, reject) => {
|
|
@@ -3661,6 +3666,7 @@ const Resource = {
|
|
|
3661
3666
|
const R = Resource;
|
|
3662
3667
|
|
|
3663
3668
|
const ImageManager = {
|
|
3669
|
+
maxRecycled: 100,
|
|
3664
3670
|
recycledList: [],
|
|
3665
3671
|
patternTasker: new TaskProcessor(),
|
|
3666
3672
|
get(config) {
|
|
@@ -3677,13 +3683,8 @@ const ImageManager = {
|
|
|
3677
3683
|
},
|
|
3678
3684
|
clearRecycled() {
|
|
3679
3685
|
const list = I.recycledList;
|
|
3680
|
-
if (list.length >
|
|
3681
|
-
list.forEach(image =>
|
|
3682
|
-
if (!image.use && image.url) {
|
|
3683
|
-
Resource.remove(image.url);
|
|
3684
|
-
image.destroy();
|
|
3685
|
-
}
|
|
3686
|
-
});
|
|
3686
|
+
if (list.length > I.maxRecycled) {
|
|
3687
|
+
list.forEach(image => (!image.use && image.url) && Resource.remove(image.url));
|
|
3687
3688
|
list.length = 0;
|
|
3688
3689
|
}
|
|
3689
3690
|
},
|
|
@@ -4069,12 +4070,11 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4069
4070
|
if (defaultValue === undefined) {
|
|
4070
4071
|
property.get = function () { return this[computedKey]; };
|
|
4071
4072
|
}
|
|
4072
|
-
else if (typeof defaultValue === '
|
|
4073
|
-
const { clone } = DataHelper;
|
|
4073
|
+
else if (typeof defaultValue === 'function') {
|
|
4074
4074
|
property.get = function () {
|
|
4075
4075
|
let v = this[computedKey];
|
|
4076
4076
|
if (v === undefined)
|
|
4077
|
-
this[computedKey] = v =
|
|
4077
|
+
this[computedKey] = v = defaultValue(this.__leaf);
|
|
4078
4078
|
return v;
|
|
4079
4079
|
};
|
|
4080
4080
|
}
|
|
@@ -5721,10 +5721,10 @@ let Leaf = class Leaf {
|
|
|
5721
5721
|
static changeAttr(attrName, defaultValue, fn) {
|
|
5722
5722
|
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5723
5723
|
}
|
|
5724
|
-
static addAttr(attrName, defaultValue, fn) {
|
|
5724
|
+
static addAttr(attrName, defaultValue, fn, helpValue) {
|
|
5725
5725
|
if (!fn)
|
|
5726
5726
|
fn = boundsType;
|
|
5727
|
-
fn(defaultValue)(this.prototype, attrName);
|
|
5727
|
+
fn(defaultValue, helpValue)(this.prototype, attrName);
|
|
5728
5728
|
}
|
|
5729
5729
|
__emitLifeEvent(type) {
|
|
5730
5730
|
if (this.hasEvent(type))
|
|
@@ -6051,7 +6051,7 @@ class LeafLevelList {
|
|
|
6051
6051
|
}
|
|
6052
6052
|
}
|
|
6053
6053
|
|
|
6054
|
-
const version = "1.
|
|
6054
|
+
const version = "1.5.0";
|
|
6055
6055
|
|
|
6056
6056
|
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, 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, 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, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, useModule, version, visibleType };
|
|
6057
6057
|
//# sourceMappingURL=core.esm.js.map
|