@leafer/core 1.9.3 → 1.9.5
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 +48 -36
- package/lib/core.esm.js +47 -37
- 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) {
|
|
@@ -138,6 +138,9 @@ class LeafData {
|
|
|
138
138
|
const {path: path} = this;
|
|
139
139
|
return path && path.length === 6 && path[0] === 1;
|
|
140
140
|
}
|
|
141
|
+
get __usePathBox() {
|
|
142
|
+
return this.__pathInputed;
|
|
143
|
+
}
|
|
141
144
|
get __blendMode() {
|
|
142
145
|
if (this.eraser && this.eraser !== "path") return "destination-out";
|
|
143
146
|
const {blendMode: blendMode} = this;
|
|
@@ -306,6 +309,9 @@ const MathHelper = {
|
|
|
306
309
|
num = round$3(num * a) / a;
|
|
307
310
|
return num === -0 ? 0 : num;
|
|
308
311
|
},
|
|
312
|
+
sign(num) {
|
|
313
|
+
return num < 0 ? -1 : 1;
|
|
314
|
+
},
|
|
309
315
|
getScaleData(scale, size, originSize, scaleData) {
|
|
310
316
|
if (!scaleData) scaleData = {};
|
|
311
317
|
if (size) {
|
|
@@ -2220,15 +2226,15 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2220
2226
|
DataHelper.copyAttrs(s, size, canvasSizeAttrs);
|
|
2221
2227
|
canvasSizeAttrs.forEach(key => s[key] || (s[key] = 1));
|
|
2222
2228
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2223
|
-
|
|
2224
|
-
this.updateViewSize();
|
|
2225
|
-
this.smooth = this.config.smooth;
|
|
2226
|
-
}
|
|
2229
|
+
this.updateViewSize();
|
|
2227
2230
|
this.updateClientBounds();
|
|
2228
|
-
if (this.context
|
|
2229
|
-
this.
|
|
2230
|
-
this.
|
|
2231
|
-
|
|
2231
|
+
if (this.context) {
|
|
2232
|
+
this.smooth = this.config.smooth;
|
|
2233
|
+
if (!this.unreal && takeCanvas) {
|
|
2234
|
+
this.clearWorld(takeCanvas.bounds);
|
|
2235
|
+
this.copyWorld(takeCanvas);
|
|
2236
|
+
takeCanvas.recycle();
|
|
2237
|
+
}
|
|
2232
2238
|
}
|
|
2233
2239
|
}
|
|
2234
2240
|
updateViewSize() {}
|
|
@@ -2542,7 +2548,7 @@ const RectHelper = {
|
|
|
2542
2548
|
}
|
|
2543
2549
|
};
|
|
2544
2550
|
|
|
2545
|
-
const {sin: sin$1, cos: cos$1, atan2: atan2$1, ceil: ceil, abs: abs$1, PI: PI, sqrt: sqrt$1, pow: pow} = Math;
|
|
2551
|
+
const {sin: sin$1, cos: cos$1, hypot: hypot, atan2: atan2$1, ceil: ceil, abs: abs$1, PI: PI, sqrt: sqrt$1, pow: pow} = Math;
|
|
2546
2552
|
|
|
2547
2553
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2548
2554
|
|
|
@@ -2613,9 +2619,11 @@ const BezierHelper = {
|
|
|
2613
2619
|
const CBy = toY - y1;
|
|
2614
2620
|
let startRadian = atan2$1(BAy, BAx);
|
|
2615
2621
|
let endRadian = atan2$1(CBy, CBx);
|
|
2622
|
+
const lenBA = hypot(BAx, BAy);
|
|
2623
|
+
const lenCB = hypot(CBx, CBy);
|
|
2616
2624
|
let totalRadian = endRadian - startRadian;
|
|
2617
2625
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2618
|
-
if (
|
|
2626
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$1(totalRadian - PI) < 1e-12) {
|
|
2619
2627
|
if (data) data.push(L$6, x1, y1);
|
|
2620
2628
|
if (setPointBounds) {
|
|
2621
2629
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
@@ -3207,11 +3215,7 @@ class PathCreator {
|
|
|
3207
3215
|
this.set(path);
|
|
3208
3216
|
}
|
|
3209
3217
|
set(path) {
|
|
3210
|
-
|
|
3211
|
-
this.__path = isString(path) ? PathHelper.parse(path) : path;
|
|
3212
|
-
} else {
|
|
3213
|
-
this.__path = [];
|
|
3214
|
-
}
|
|
3218
|
+
this.__path = path ? isString(path) ? PathHelper.parse(path) : path : [];
|
|
3215
3219
|
return this;
|
|
3216
3220
|
}
|
|
3217
3221
|
beginPath() {
|
|
@@ -3581,14 +3585,18 @@ const PathCorner = {
|
|
|
3581
3585
|
}
|
|
3582
3586
|
};
|
|
3583
3587
|
|
|
3584
|
-
|
|
3588
|
+
function path(path) {
|
|
3589
|
+
return new PathCreator(path);
|
|
3590
|
+
}
|
|
3591
|
+
|
|
3592
|
+
const pen = path();
|
|
3593
|
+
|
|
3594
|
+
PathHelper.creator = path();
|
|
3585
3595
|
|
|
3586
3596
|
PathHelper.parse = PathConvert.parse;
|
|
3587
3597
|
|
|
3588
3598
|
PathHelper.convertToCanvasData = PathConvert.toCanvasData;
|
|
3589
3599
|
|
|
3590
|
-
const pen = new PathCreator;
|
|
3591
|
-
|
|
3592
3600
|
const {drawRoundRect: drawRoundRect} = RectHelper;
|
|
3593
3601
|
|
|
3594
3602
|
function roundRect(drawer) {
|
|
@@ -3953,7 +3961,7 @@ const ImageManager = {
|
|
|
3953
3961
|
return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
|
|
3954
3962
|
},
|
|
3955
3963
|
isFormat(format, config) {
|
|
3956
|
-
if (config.format
|
|
3964
|
+
if (config.format) return config.format === format;
|
|
3957
3965
|
const {url: url} = config;
|
|
3958
3966
|
if (url.startsWith("data:")) {
|
|
3959
3967
|
if (url.startsWith("data:" + FileHelper.mineType(format))) return true;
|
|
@@ -4047,7 +4055,7 @@ class LeaferImage {
|
|
|
4047
4055
|
getFull(_filters) {
|
|
4048
4056
|
return this.view;
|
|
4049
4057
|
}
|
|
4050
|
-
getCanvas(width, height, opacity, _filters, xGap, yGap) {
|
|
4058
|
+
getCanvas(width, height, opacity, _filters, xGap, yGap, smooth) {
|
|
4051
4059
|
width || (width = this.width);
|
|
4052
4060
|
height || (height = this.height);
|
|
4053
4061
|
if (this.cache) {
|
|
@@ -4063,6 +4071,7 @@ class LeaferImage {
|
|
|
4063
4071
|
const canvas = Platform.origin.createCanvas(max(floor(width + (xGap || 0)), 1), max(floor(height + (yGap || 0)), 1));
|
|
4064
4072
|
const ctx = canvas.getContext("2d");
|
|
4065
4073
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4074
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
4066
4075
|
ctx.drawImage(this.view, 0, 0, width, height);
|
|
4067
4076
|
this.cache = this.use > 1 ? {
|
|
4068
4077
|
data: canvas,
|
|
@@ -4104,7 +4113,7 @@ function createDescriptor(key, defaultValue) {
|
|
|
4104
4113
|
return {
|
|
4105
4114
|
get() {
|
|
4106
4115
|
const v = this[privateKey];
|
|
4107
|
-
return
|
|
4116
|
+
return v == null ? defaultValue : v;
|
|
4108
4117
|
},
|
|
4109
4118
|
set(value) {
|
|
4110
4119
|
this[privateKey] = value;
|
|
@@ -4390,21 +4399,21 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4390
4399
|
};
|
|
4391
4400
|
} else if (typeof defaultValue === "function") {
|
|
4392
4401
|
property.get = function() {
|
|
4393
|
-
|
|
4394
|
-
return v
|
|
4402
|
+
const v = this[computedKey];
|
|
4403
|
+
return v == null ? defaultValue(this.__leaf) : v;
|
|
4395
4404
|
};
|
|
4396
4405
|
} else if (isObject(defaultValue)) {
|
|
4397
4406
|
const isEmpty = isEmptyData(defaultValue);
|
|
4398
4407
|
property.get = function() {
|
|
4399
|
-
|
|
4400
|
-
return v
|
|
4408
|
+
const v = this[computedKey];
|
|
4409
|
+
return v == null ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
|
|
4401
4410
|
};
|
|
4402
4411
|
}
|
|
4403
4412
|
const isBox = target.isBranchLeaf;
|
|
4404
4413
|
if (key === "width") {
|
|
4405
4414
|
property.get = function() {
|
|
4406
4415
|
const v = this[computedKey];
|
|
4407
|
-
if (v
|
|
4416
|
+
if (v == null) {
|
|
4408
4417
|
const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
|
|
4409
4418
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
|
|
4410
4419
|
if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
|
|
@@ -4414,7 +4423,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4414
4423
|
} else if (key === "height") {
|
|
4415
4424
|
property.get = function() {
|
|
4416
4425
|
const v = this[computedKey];
|
|
4417
|
-
if (v
|
|
4426
|
+
if (v == null) {
|
|
4418
4427
|
const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
|
|
4419
4428
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
|
|
4420
4429
|
if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
|
|
@@ -4714,8 +4723,9 @@ const L = LeafHelper;
|
|
|
4714
4723
|
|
|
4715
4724
|
const {updateAllMatrix: updateAllMatrix$1, updateMatrix: updateMatrix$1, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange, updateChange: updateChange} = L;
|
|
4716
4725
|
|
|
4717
|
-
function getTempLocal(t,
|
|
4718
|
-
|
|
4726
|
+
function getTempLocal(t, worldPoint) {
|
|
4727
|
+
t.updateLayout();
|
|
4728
|
+
return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
|
|
4719
4729
|
}
|
|
4720
4730
|
|
|
4721
4731
|
const LeafBoundsHelper = {
|
|
@@ -5174,7 +5184,7 @@ class LeafLayout {
|
|
|
5174
5184
|
}
|
|
5175
5185
|
boxChange() {
|
|
5176
5186
|
this.boxChanged = true;
|
|
5177
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5187
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5178
5188
|
this.hitCanvasChanged = true;
|
|
5179
5189
|
}
|
|
5180
5190
|
localBoxChange() {
|
|
@@ -5208,7 +5218,7 @@ class LeafLayout {
|
|
|
5208
5218
|
}
|
|
5209
5219
|
matrixChange() {
|
|
5210
5220
|
this.matrixChanged = true;
|
|
5211
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5221
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5212
5222
|
}
|
|
5213
5223
|
surfaceChange() {
|
|
5214
5224
|
this.surfaceChanged = true;
|
|
@@ -5805,7 +5815,7 @@ const LeafBounds = {
|
|
|
5805
5815
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5806
5816
|
const b = this.__layout.boxBounds;
|
|
5807
5817
|
const data = this.__;
|
|
5808
|
-
if (data.
|
|
5818
|
+
if (data.__usePathBox) {
|
|
5809
5819
|
toBounds(data.path, b);
|
|
5810
5820
|
} else {
|
|
5811
5821
|
b.x = 0;
|
|
@@ -6274,10 +6284,10 @@ exports.Leaf = class Leaf {
|
|
|
6274
6284
|
relative.innerToWorld(world, to, distance);
|
|
6275
6285
|
world = to ? to : world;
|
|
6276
6286
|
}
|
|
6277
|
-
toInnerPoint(this.
|
|
6287
|
+
toInnerPoint(this.scrollWorldTransform, world, to, distance);
|
|
6278
6288
|
}
|
|
6279
6289
|
innerToWorld(inner, to, distance, relative) {
|
|
6280
|
-
toOuterPoint(this.
|
|
6290
|
+
toOuterPoint(this.scrollWorldTransform, inner, to, distance);
|
|
6281
6291
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
6282
6292
|
}
|
|
6283
6293
|
getBoxPoint(world, relative, distance, change) {
|
|
@@ -6741,7 +6751,7 @@ class LeafLevelList {
|
|
|
6741
6751
|
}
|
|
6742
6752
|
}
|
|
6743
6753
|
|
|
6744
|
-
const version = "1.9.
|
|
6754
|
+
const version = "1.9.5";
|
|
6745
6755
|
|
|
6746
6756
|
exports.AlignHelper = AlignHelper;
|
|
6747
6757
|
|
|
@@ -6963,6 +6973,8 @@ exports.naturalBoundsType = naturalBoundsType;
|
|
|
6963
6973
|
|
|
6964
6974
|
exports.opacityType = opacityType;
|
|
6965
6975
|
|
|
6976
|
+
exports.path = path;
|
|
6977
|
+
|
|
6966
6978
|
exports.pathInputType = pathInputType;
|
|
6967
6979
|
|
|
6968
6980
|
exports.pathType = pathType;
|
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) {
|
|
@@ -136,6 +136,9 @@ class LeafData {
|
|
|
136
136
|
const {path: path} = this;
|
|
137
137
|
return path && path.length === 6 && path[0] === 1;
|
|
138
138
|
}
|
|
139
|
+
get __usePathBox() {
|
|
140
|
+
return this.__pathInputed;
|
|
141
|
+
}
|
|
139
142
|
get __blendMode() {
|
|
140
143
|
if (this.eraser && this.eraser !== "path") return "destination-out";
|
|
141
144
|
const {blendMode: blendMode} = this;
|
|
@@ -304,6 +307,9 @@ const MathHelper = {
|
|
|
304
307
|
num = round$3(num * a) / a;
|
|
305
308
|
return num === -0 ? 0 : num;
|
|
306
309
|
},
|
|
310
|
+
sign(num) {
|
|
311
|
+
return num < 0 ? -1 : 1;
|
|
312
|
+
},
|
|
307
313
|
getScaleData(scale, size, originSize, scaleData) {
|
|
308
314
|
if (!scaleData) scaleData = {};
|
|
309
315
|
if (size) {
|
|
@@ -2218,15 +2224,15 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2218
2224
|
DataHelper.copyAttrs(s, size, canvasSizeAttrs);
|
|
2219
2225
|
canvasSizeAttrs.forEach(key => s[key] || (s[key] = 1));
|
|
2220
2226
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2221
|
-
|
|
2222
|
-
this.updateViewSize();
|
|
2223
|
-
this.smooth = this.config.smooth;
|
|
2224
|
-
}
|
|
2227
|
+
this.updateViewSize();
|
|
2225
2228
|
this.updateClientBounds();
|
|
2226
|
-
if (this.context
|
|
2227
|
-
this.
|
|
2228
|
-
this.
|
|
2229
|
-
|
|
2229
|
+
if (this.context) {
|
|
2230
|
+
this.smooth = this.config.smooth;
|
|
2231
|
+
if (!this.unreal && takeCanvas) {
|
|
2232
|
+
this.clearWorld(takeCanvas.bounds);
|
|
2233
|
+
this.copyWorld(takeCanvas);
|
|
2234
|
+
takeCanvas.recycle();
|
|
2235
|
+
}
|
|
2230
2236
|
}
|
|
2231
2237
|
}
|
|
2232
2238
|
updateViewSize() {}
|
|
@@ -2540,7 +2546,7 @@ const RectHelper = {
|
|
|
2540
2546
|
}
|
|
2541
2547
|
};
|
|
2542
2548
|
|
|
2543
|
-
const {sin: sin$1, cos: cos$1, atan2: atan2$1, ceil: ceil, abs: abs$1, PI: PI, sqrt: sqrt$1, pow: pow} = Math;
|
|
2549
|
+
const {sin: sin$1, cos: cos$1, hypot: hypot, atan2: atan2$1, ceil: ceil, abs: abs$1, PI: PI, sqrt: sqrt$1, pow: pow} = Math;
|
|
2544
2550
|
|
|
2545
2551
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2546
2552
|
|
|
@@ -2611,9 +2617,11 @@ const BezierHelper = {
|
|
|
2611
2617
|
const CBy = toY - y1;
|
|
2612
2618
|
let startRadian = atan2$1(BAy, BAx);
|
|
2613
2619
|
let endRadian = atan2$1(CBy, CBx);
|
|
2620
|
+
const lenBA = hypot(BAx, BAy);
|
|
2621
|
+
const lenCB = hypot(CBx, CBy);
|
|
2614
2622
|
let totalRadian = endRadian - startRadian;
|
|
2615
2623
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2616
|
-
if (
|
|
2624
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$1(totalRadian - PI) < 1e-12) {
|
|
2617
2625
|
if (data) data.push(L$6, x1, y1);
|
|
2618
2626
|
if (setPointBounds) {
|
|
2619
2627
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
@@ -3205,11 +3213,7 @@ class PathCreator {
|
|
|
3205
3213
|
this.set(path);
|
|
3206
3214
|
}
|
|
3207
3215
|
set(path) {
|
|
3208
|
-
|
|
3209
|
-
this.__path = isString(path) ? PathHelper.parse(path) : path;
|
|
3210
|
-
} else {
|
|
3211
|
-
this.__path = [];
|
|
3212
|
-
}
|
|
3216
|
+
this.__path = path ? isString(path) ? PathHelper.parse(path) : path : [];
|
|
3213
3217
|
return this;
|
|
3214
3218
|
}
|
|
3215
3219
|
beginPath() {
|
|
@@ -3579,14 +3583,18 @@ const PathCorner = {
|
|
|
3579
3583
|
}
|
|
3580
3584
|
};
|
|
3581
3585
|
|
|
3582
|
-
|
|
3586
|
+
function path(path) {
|
|
3587
|
+
return new PathCreator(path);
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
const pen = path();
|
|
3591
|
+
|
|
3592
|
+
PathHelper.creator = path();
|
|
3583
3593
|
|
|
3584
3594
|
PathHelper.parse = PathConvert.parse;
|
|
3585
3595
|
|
|
3586
3596
|
PathHelper.convertToCanvasData = PathConvert.toCanvasData;
|
|
3587
3597
|
|
|
3588
|
-
const pen = new PathCreator;
|
|
3589
|
-
|
|
3590
3598
|
const {drawRoundRect: drawRoundRect} = RectHelper;
|
|
3591
3599
|
|
|
3592
3600
|
function roundRect(drawer) {
|
|
@@ -3951,7 +3959,7 @@ const ImageManager = {
|
|
|
3951
3959
|
return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
|
|
3952
3960
|
},
|
|
3953
3961
|
isFormat(format, config) {
|
|
3954
|
-
if (config.format
|
|
3962
|
+
if (config.format) return config.format === format;
|
|
3955
3963
|
const {url: url} = config;
|
|
3956
3964
|
if (url.startsWith("data:")) {
|
|
3957
3965
|
if (url.startsWith("data:" + FileHelper.mineType(format))) return true;
|
|
@@ -4045,7 +4053,7 @@ class LeaferImage {
|
|
|
4045
4053
|
getFull(_filters) {
|
|
4046
4054
|
return this.view;
|
|
4047
4055
|
}
|
|
4048
|
-
getCanvas(width, height, opacity, _filters, xGap, yGap) {
|
|
4056
|
+
getCanvas(width, height, opacity, _filters, xGap, yGap, smooth) {
|
|
4049
4057
|
width || (width = this.width);
|
|
4050
4058
|
height || (height = this.height);
|
|
4051
4059
|
if (this.cache) {
|
|
@@ -4061,6 +4069,7 @@ class LeaferImage {
|
|
|
4061
4069
|
const canvas = Platform.origin.createCanvas(max(floor(width + (xGap || 0)), 1), max(floor(height + (yGap || 0)), 1));
|
|
4062
4070
|
const ctx = canvas.getContext("2d");
|
|
4063
4071
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4072
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
4064
4073
|
ctx.drawImage(this.view, 0, 0, width, height);
|
|
4065
4074
|
this.cache = this.use > 1 ? {
|
|
4066
4075
|
data: canvas,
|
|
@@ -4102,7 +4111,7 @@ function createDescriptor(key, defaultValue) {
|
|
|
4102
4111
|
return {
|
|
4103
4112
|
get() {
|
|
4104
4113
|
const v = this[privateKey];
|
|
4105
|
-
return
|
|
4114
|
+
return v == null ? defaultValue : v;
|
|
4106
4115
|
},
|
|
4107
4116
|
set(value) {
|
|
4108
4117
|
this[privateKey] = value;
|
|
@@ -4388,21 +4397,21 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4388
4397
|
};
|
|
4389
4398
|
} else if (typeof defaultValue === "function") {
|
|
4390
4399
|
property.get = function() {
|
|
4391
|
-
|
|
4392
|
-
return v
|
|
4400
|
+
const v = this[computedKey];
|
|
4401
|
+
return v == null ? defaultValue(this.__leaf) : v;
|
|
4393
4402
|
};
|
|
4394
4403
|
} else if (isObject(defaultValue)) {
|
|
4395
4404
|
const isEmpty = isEmptyData(defaultValue);
|
|
4396
4405
|
property.get = function() {
|
|
4397
|
-
|
|
4398
|
-
return v
|
|
4406
|
+
const v = this[computedKey];
|
|
4407
|
+
return v == null ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
|
|
4399
4408
|
};
|
|
4400
4409
|
}
|
|
4401
4410
|
const isBox = target.isBranchLeaf;
|
|
4402
4411
|
if (key === "width") {
|
|
4403
4412
|
property.get = function() {
|
|
4404
4413
|
const v = this[computedKey];
|
|
4405
|
-
if (v
|
|
4414
|
+
if (v == null) {
|
|
4406
4415
|
const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
|
|
4407
4416
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
|
|
4408
4417
|
if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
|
|
@@ -4412,7 +4421,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4412
4421
|
} else if (key === "height") {
|
|
4413
4422
|
property.get = function() {
|
|
4414
4423
|
const v = this[computedKey];
|
|
4415
|
-
if (v
|
|
4424
|
+
if (v == null) {
|
|
4416
4425
|
const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
|
|
4417
4426
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
|
|
4418
4427
|
if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
|
|
@@ -4712,8 +4721,9 @@ const L = LeafHelper;
|
|
|
4712
4721
|
|
|
4713
4722
|
const {updateAllMatrix: updateAllMatrix$1, updateMatrix: updateMatrix$1, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange, updateChange: updateChange} = L;
|
|
4714
4723
|
|
|
4715
|
-
function getTempLocal(t,
|
|
4716
|
-
|
|
4724
|
+
function getTempLocal(t, worldPoint) {
|
|
4725
|
+
t.updateLayout();
|
|
4726
|
+
return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
|
|
4717
4727
|
}
|
|
4718
4728
|
|
|
4719
4729
|
const LeafBoundsHelper = {
|
|
@@ -5172,7 +5182,7 @@ class LeafLayout {
|
|
|
5172
5182
|
}
|
|
5173
5183
|
boxChange() {
|
|
5174
5184
|
this.boxChanged = true;
|
|
5175
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5185
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5176
5186
|
this.hitCanvasChanged = true;
|
|
5177
5187
|
}
|
|
5178
5188
|
localBoxChange() {
|
|
@@ -5206,7 +5216,7 @@ class LeafLayout {
|
|
|
5206
5216
|
}
|
|
5207
5217
|
matrixChange() {
|
|
5208
5218
|
this.matrixChanged = true;
|
|
5209
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5219
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5210
5220
|
}
|
|
5211
5221
|
surfaceChange() {
|
|
5212
5222
|
this.surfaceChanged = true;
|
|
@@ -5803,7 +5813,7 @@ const LeafBounds = {
|
|
|
5803
5813
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5804
5814
|
const b = this.__layout.boxBounds;
|
|
5805
5815
|
const data = this.__;
|
|
5806
|
-
if (data.
|
|
5816
|
+
if (data.__usePathBox) {
|
|
5807
5817
|
toBounds(data.path, b);
|
|
5808
5818
|
} else {
|
|
5809
5819
|
b.x = 0;
|
|
@@ -6272,10 +6282,10 @@ let Leaf = class Leaf {
|
|
|
6272
6282
|
relative.innerToWorld(world, to, distance);
|
|
6273
6283
|
world = to ? to : world;
|
|
6274
6284
|
}
|
|
6275
|
-
toInnerPoint(this.
|
|
6285
|
+
toInnerPoint(this.scrollWorldTransform, world, to, distance);
|
|
6276
6286
|
}
|
|
6277
6287
|
innerToWorld(inner, to, distance, relative) {
|
|
6278
|
-
toOuterPoint(this.
|
|
6288
|
+
toOuterPoint(this.scrollWorldTransform, inner, to, distance);
|
|
6279
6289
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
6280
6290
|
}
|
|
6281
6291
|
getBoxPoint(world, relative, distance, change) {
|
|
@@ -6739,6 +6749,6 @@ class LeafLevelList {
|
|
|
6739
6749
|
}
|
|
6740
6750
|
}
|
|
6741
6751
|
|
|
6742
|
-
const version = "1.9.
|
|
6752
|
+
const version = "1.9.5";
|
|
6743
6753
|
|
|
6744
|
-
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 };
|
|
6754
|
+
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, 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 };
|