@leafer/core 1.9.3 → 1.9.4
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 +16 -13
- package/lib/core.esm.js +16 -13
- 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.cjs
CHANGED
|
@@ -56,7 +56,7 @@ function isUndefined(value) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
function isNull(value) {
|
|
59
|
-
return value
|
|
59
|
+
return value == null;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function isString(value) {
|
|
@@ -306,6 +306,9 @@ const MathHelper = {
|
|
|
306
306
|
num = round$3(num * a) / a;
|
|
307
307
|
return num === -0 ? 0 : num;
|
|
308
308
|
},
|
|
309
|
+
sign(num) {
|
|
310
|
+
return num < 0 ? -1 : 1;
|
|
311
|
+
},
|
|
309
312
|
getScaleData(scale, size, originSize, scaleData) {
|
|
310
313
|
if (!scaleData) scaleData = {};
|
|
311
314
|
if (size) {
|
|
@@ -4104,7 +4107,7 @@ function createDescriptor(key, defaultValue) {
|
|
|
4104
4107
|
return {
|
|
4105
4108
|
get() {
|
|
4106
4109
|
const v = this[privateKey];
|
|
4107
|
-
return
|
|
4110
|
+
return v == null ? defaultValue : v;
|
|
4108
4111
|
},
|
|
4109
4112
|
set(value) {
|
|
4110
4113
|
this[privateKey] = value;
|
|
@@ -4390,21 +4393,21 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4390
4393
|
};
|
|
4391
4394
|
} else if (typeof defaultValue === "function") {
|
|
4392
4395
|
property.get = function() {
|
|
4393
|
-
|
|
4394
|
-
return v
|
|
4396
|
+
const v = this[computedKey];
|
|
4397
|
+
return v == null ? defaultValue(this.__leaf) : v;
|
|
4395
4398
|
};
|
|
4396
4399
|
} else if (isObject(defaultValue)) {
|
|
4397
4400
|
const isEmpty = isEmptyData(defaultValue);
|
|
4398
4401
|
property.get = function() {
|
|
4399
|
-
|
|
4400
|
-
return v
|
|
4402
|
+
const v = this[computedKey];
|
|
4403
|
+
return v == null ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
|
|
4401
4404
|
};
|
|
4402
4405
|
}
|
|
4403
4406
|
const isBox = target.isBranchLeaf;
|
|
4404
4407
|
if (key === "width") {
|
|
4405
4408
|
property.get = function() {
|
|
4406
4409
|
const v = this[computedKey];
|
|
4407
|
-
if (v
|
|
4410
|
+
if (v == null) {
|
|
4408
4411
|
const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
|
|
4409
4412
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
|
|
4410
4413
|
if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
|
|
@@ -4414,7 +4417,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4414
4417
|
} else if (key === "height") {
|
|
4415
4418
|
property.get = function() {
|
|
4416
4419
|
const v = this[computedKey];
|
|
4417
|
-
if (v
|
|
4420
|
+
if (v == null) {
|
|
4418
4421
|
const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
|
|
4419
4422
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
|
|
4420
4423
|
if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
|
|
@@ -5174,7 +5177,7 @@ class LeafLayout {
|
|
|
5174
5177
|
}
|
|
5175
5178
|
boxChange() {
|
|
5176
5179
|
this.boxChanged = true;
|
|
5177
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5180
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5178
5181
|
this.hitCanvasChanged = true;
|
|
5179
5182
|
}
|
|
5180
5183
|
localBoxChange() {
|
|
@@ -5208,7 +5211,7 @@ class LeafLayout {
|
|
|
5208
5211
|
}
|
|
5209
5212
|
matrixChange() {
|
|
5210
5213
|
this.matrixChanged = true;
|
|
5211
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5214
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5212
5215
|
}
|
|
5213
5216
|
surfaceChange() {
|
|
5214
5217
|
this.surfaceChanged = true;
|
|
@@ -6274,10 +6277,10 @@ exports.Leaf = class Leaf {
|
|
|
6274
6277
|
relative.innerToWorld(world, to, distance);
|
|
6275
6278
|
world = to ? to : world;
|
|
6276
6279
|
}
|
|
6277
|
-
toInnerPoint(this.
|
|
6280
|
+
toInnerPoint(this.scrollWorldTransform, world, to, distance);
|
|
6278
6281
|
}
|
|
6279
6282
|
innerToWorld(inner, to, distance, relative) {
|
|
6280
|
-
toOuterPoint(this.
|
|
6283
|
+
toOuterPoint(this.scrollWorldTransform, inner, to, distance);
|
|
6281
6284
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
6282
6285
|
}
|
|
6283
6286
|
getBoxPoint(world, relative, distance, change) {
|
|
@@ -6741,7 +6744,7 @@ class LeafLevelList {
|
|
|
6741
6744
|
}
|
|
6742
6745
|
}
|
|
6743
6746
|
|
|
6744
|
-
const version = "1.9.
|
|
6747
|
+
const version = "1.9.4";
|
|
6745
6748
|
|
|
6746
6749
|
exports.AlignHelper = AlignHelper;
|
|
6747
6750
|
|
package/lib/core.esm.js
CHANGED
|
@@ -54,7 +54,7 @@ function isUndefined(value) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
function isNull(value) {
|
|
57
|
-
return value
|
|
57
|
+
return value == null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
function isString(value) {
|
|
@@ -304,6 +304,9 @@ const MathHelper = {
|
|
|
304
304
|
num = round$3(num * a) / a;
|
|
305
305
|
return num === -0 ? 0 : num;
|
|
306
306
|
},
|
|
307
|
+
sign(num) {
|
|
308
|
+
return num < 0 ? -1 : 1;
|
|
309
|
+
},
|
|
307
310
|
getScaleData(scale, size, originSize, scaleData) {
|
|
308
311
|
if (!scaleData) scaleData = {};
|
|
309
312
|
if (size) {
|
|
@@ -4102,7 +4105,7 @@ function createDescriptor(key, defaultValue) {
|
|
|
4102
4105
|
return {
|
|
4103
4106
|
get() {
|
|
4104
4107
|
const v = this[privateKey];
|
|
4105
|
-
return
|
|
4108
|
+
return v == null ? defaultValue : v;
|
|
4106
4109
|
},
|
|
4107
4110
|
set(value) {
|
|
4108
4111
|
this[privateKey] = value;
|
|
@@ -4388,21 +4391,21 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4388
4391
|
};
|
|
4389
4392
|
} else if (typeof defaultValue === "function") {
|
|
4390
4393
|
property.get = function() {
|
|
4391
|
-
|
|
4392
|
-
return v
|
|
4394
|
+
const v = this[computedKey];
|
|
4395
|
+
return v == null ? defaultValue(this.__leaf) : v;
|
|
4393
4396
|
};
|
|
4394
4397
|
} else if (isObject(defaultValue)) {
|
|
4395
4398
|
const isEmpty = isEmptyData(defaultValue);
|
|
4396
4399
|
property.get = function() {
|
|
4397
|
-
|
|
4398
|
-
return v
|
|
4400
|
+
const v = this[computedKey];
|
|
4401
|
+
return v == null ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
|
|
4399
4402
|
};
|
|
4400
4403
|
}
|
|
4401
4404
|
const isBox = target.isBranchLeaf;
|
|
4402
4405
|
if (key === "width") {
|
|
4403
4406
|
property.get = function() {
|
|
4404
4407
|
const v = this[computedKey];
|
|
4405
|
-
if (v
|
|
4408
|
+
if (v == null) {
|
|
4406
4409
|
const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
|
|
4407
4410
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
|
|
4408
4411
|
if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
|
|
@@ -4412,7 +4415,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4412
4415
|
} else if (key === "height") {
|
|
4413
4416
|
property.get = function() {
|
|
4414
4417
|
const v = this[computedKey];
|
|
4415
|
-
if (v
|
|
4418
|
+
if (v == null) {
|
|
4416
4419
|
const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
|
|
4417
4420
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
|
|
4418
4421
|
if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
|
|
@@ -5172,7 +5175,7 @@ class LeafLayout {
|
|
|
5172
5175
|
}
|
|
5173
5176
|
boxChange() {
|
|
5174
5177
|
this.boxChanged = true;
|
|
5175
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5178
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5176
5179
|
this.hitCanvasChanged = true;
|
|
5177
5180
|
}
|
|
5178
5181
|
localBoxChange() {
|
|
@@ -5206,7 +5209,7 @@ class LeafLayout {
|
|
|
5206
5209
|
}
|
|
5207
5210
|
matrixChange() {
|
|
5208
5211
|
this.matrixChanged = true;
|
|
5209
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5212
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5210
5213
|
}
|
|
5211
5214
|
surfaceChange() {
|
|
5212
5215
|
this.surfaceChanged = true;
|
|
@@ -6272,10 +6275,10 @@ let Leaf = class Leaf {
|
|
|
6272
6275
|
relative.innerToWorld(world, to, distance);
|
|
6273
6276
|
world = to ? to : world;
|
|
6274
6277
|
}
|
|
6275
|
-
toInnerPoint(this.
|
|
6278
|
+
toInnerPoint(this.scrollWorldTransform, world, to, distance);
|
|
6276
6279
|
}
|
|
6277
6280
|
innerToWorld(inner, to, distance, relative) {
|
|
6278
|
-
toOuterPoint(this.
|
|
6281
|
+
toOuterPoint(this.scrollWorldTransform, inner, to, distance);
|
|
6279
6282
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
6280
6283
|
}
|
|
6281
6284
|
getBoxPoint(world, relative, distance, change) {
|
|
@@ -6739,6 +6742,6 @@ class LeafLevelList {
|
|
|
6739
6742
|
}
|
|
6740
6743
|
}
|
|
6741
6744
|
|
|
6742
|
-
const version = "1.9.
|
|
6745
|
+
const version = "1.9.4";
|
|
6743
6746
|
|
|
6744
6747
|
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, 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, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useModule, version, visibleType };
|