@leafer/core 2.0.2 → 2.0.3
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 +66 -28
- package/lib/core.esm.js +66 -28
- 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
|
@@ -206,6 +206,7 @@ class LeafData {
|
|
|
206
206
|
}
|
|
207
207
|
destroy() {
|
|
208
208
|
this.__input = this.__middle = null;
|
|
209
|
+
if (this.__complexData) this.__complexData.destroy();
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
212
|
|
|
@@ -304,6 +305,8 @@ const {set: set$1, get: get$1, setTemp: setTemp, toTempAB: toTempAB} = FourNumbe
|
|
|
304
305
|
|
|
305
306
|
const {round: round$3, pow: pow$1, max: max$1, floor: floor$2, PI: PI$1} = Math;
|
|
306
307
|
|
|
308
|
+
const tempScaleData = {};
|
|
309
|
+
|
|
307
310
|
const MathHelper = {
|
|
308
311
|
within(value, min, max) {
|
|
309
312
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -347,6 +350,24 @@ const MathHelper = {
|
|
|
347
350
|
} else if (scale) MathHelper.assignScale(scaleData, scale);
|
|
348
351
|
return scaleData;
|
|
349
352
|
},
|
|
353
|
+
getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
|
|
354
|
+
let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
|
|
355
|
+
if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
356
|
+
if (scaleFixed) {
|
|
357
|
+
if (scaleFixed === true) {
|
|
358
|
+
scaleX = scaleY = unscale ? 1 : 1 / scaleX;
|
|
359
|
+
} else {
|
|
360
|
+
let minScale;
|
|
361
|
+
if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
|
|
362
|
+
if (minScale) {
|
|
363
|
+
if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
tempScaleData.scaleX = scaleX;
|
|
368
|
+
tempScaleData.scaleY = scaleY;
|
|
369
|
+
return tempScaleData;
|
|
370
|
+
},
|
|
350
371
|
assignScale(scaleData, scale) {
|
|
351
372
|
if (isNumber(scale)) {
|
|
352
373
|
scaleData.scaleX = scaleData.scaleY = scale;
|
|
@@ -843,8 +864,8 @@ const PointHelper = {
|
|
|
843
864
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
844
865
|
return points;
|
|
845
866
|
},
|
|
846
|
-
isSame(t, point) {
|
|
847
|
-
return float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
867
|
+
isSame(t, point, quick) {
|
|
868
|
+
return quick ? t.x === point.x && t.y === point.y : float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
848
869
|
},
|
|
849
870
|
reset(t) {
|
|
850
871
|
P$5.reset(t);
|
|
@@ -919,8 +940,8 @@ class Point {
|
|
|
919
940
|
getAtan2(to) {
|
|
920
941
|
return PointHelper.getAtan2(this, to);
|
|
921
942
|
}
|
|
922
|
-
isSame(point) {
|
|
923
|
-
return PointHelper.isSame(this, point);
|
|
943
|
+
isSame(point, quick) {
|
|
944
|
+
return PointHelper.isSame(this, point, quick);
|
|
924
945
|
}
|
|
925
946
|
reset() {
|
|
926
947
|
PointHelper.reset(this);
|
|
@@ -1176,9 +1197,9 @@ const AroundHelper = {
|
|
|
1176
1197
|
}
|
|
1177
1198
|
if (!onlyBoxSize) to.x += box.x, to.y += box.y;
|
|
1178
1199
|
},
|
|
1179
|
-
getPoint(around, box, to) {
|
|
1200
|
+
getPoint(around, box, to, onlyBoxSize = true) {
|
|
1180
1201
|
if (!to) to = {};
|
|
1181
|
-
AroundHelper.toPoint(around, box, to,
|
|
1202
|
+
AroundHelper.toPoint(around, box, to, onlyBoxSize);
|
|
1182
1203
|
return to;
|
|
1183
1204
|
}
|
|
1184
1205
|
};
|
|
@@ -1445,6 +1466,9 @@ const BoundsHelper = {
|
|
|
1445
1466
|
y: y + height
|
|
1446
1467
|
} ];
|
|
1447
1468
|
},
|
|
1469
|
+
getPoint(t, around, onlyBoxSize = false, to) {
|
|
1470
|
+
return AroundHelper.getPoint(around, t, to, onlyBoxSize);
|
|
1471
|
+
},
|
|
1448
1472
|
hitRadiusPoint(t, point, pointMatrix) {
|
|
1449
1473
|
if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
|
|
1450
1474
|
return point.x >= t.x - point.radiusX && point.x <= t.x + t.width + point.radiusX && (point.y >= t.y - point.radiusY && point.y <= t.y + t.height + point.radiusY);
|
|
@@ -1616,6 +1640,9 @@ class Bounds {
|
|
|
1616
1640
|
getPoints() {
|
|
1617
1641
|
return BoundsHelper.getPoints(this);
|
|
1618
1642
|
}
|
|
1643
|
+
getPoint(around, onlyBoxSize, to) {
|
|
1644
|
+
return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
|
|
1645
|
+
}
|
|
1619
1646
|
hitPoint(point, pointMatrix) {
|
|
1620
1647
|
return BoundsHelper.hitPoint(this, point, pointMatrix);
|
|
1621
1648
|
}
|
|
@@ -4095,6 +4122,7 @@ const ImageManager = {
|
|
|
4095
4122
|
return image;
|
|
4096
4123
|
},
|
|
4097
4124
|
recycle(image) {
|
|
4125
|
+
if (image.parent) image = image.parent;
|
|
4098
4126
|
image.use--;
|
|
4099
4127
|
setTimeout(() => {
|
|
4100
4128
|
if (!image.use) {
|
|
@@ -4263,8 +4291,10 @@ class LeaferImage {
|
|
|
4263
4291
|
return undefined;
|
|
4264
4292
|
}
|
|
4265
4293
|
clearLevels(_checkUse) {}
|
|
4294
|
+
destroyFilter() {}
|
|
4266
4295
|
destroy() {
|
|
4267
4296
|
this.clearLevels();
|
|
4297
|
+
this.destroyFilter();
|
|
4268
4298
|
const {view: view} = this;
|
|
4269
4299
|
if (view && view.close) view.close();
|
|
4270
4300
|
this.config = {
|
|
@@ -4461,7 +4491,6 @@ function dimType(defaultValue) {
|
|
|
4461
4491
|
if (this.__setAttr(key, value)) {
|
|
4462
4492
|
const data = this.__;
|
|
4463
4493
|
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4464
|
-
this.__layout.surfaceChange();
|
|
4465
4494
|
}
|
|
4466
4495
|
}
|
|
4467
4496
|
}));
|
|
@@ -4511,7 +4540,6 @@ function sortType(defaultValue) {
|
|
|
4511
4540
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4512
4541
|
set(value) {
|
|
4513
4542
|
if (this.__setAttr(key, value)) {
|
|
4514
|
-
this.__layout.surfaceChange();
|
|
4515
4543
|
this.waitParent(() => {
|
|
4516
4544
|
this.parent.__layout.childrenSortChange();
|
|
4517
4545
|
});
|
|
@@ -4548,7 +4576,6 @@ function hitType(defaultValue) {
|
|
|
4548
4576
|
set(value) {
|
|
4549
4577
|
if (this.__setAttr(key, value)) {
|
|
4550
4578
|
this.__layout.hitCanvasChanged = true;
|
|
4551
|
-
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4552
4579
|
if (this.leafer) this.leafer.updateCursor();
|
|
4553
4580
|
}
|
|
4554
4581
|
}
|
|
@@ -4754,6 +4781,10 @@ const LeafHelper = {
|
|
|
4754
4781
|
if (layout.stateStyleChanged) leaf.updateState();
|
|
4755
4782
|
if (layout.opacityChanged) updateAllWorldOpacity(leaf);
|
|
4756
4783
|
leaf.__updateChange();
|
|
4784
|
+
if (layout.surfaceChanged) {
|
|
4785
|
+
if (leaf.__hasComplex) L.updateComplex(leaf);
|
|
4786
|
+
layout.surfaceChanged = false;
|
|
4787
|
+
}
|
|
4757
4788
|
},
|
|
4758
4789
|
updateAllChange(leaf) {
|
|
4759
4790
|
updateChange(leaf);
|
|
@@ -4778,6 +4809,9 @@ const LeafHelper = {
|
|
|
4778
4809
|
if (!fromWorld) fromWorld = leaf.__nowWorld;
|
|
4779
4810
|
if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4780
4811
|
},
|
|
4812
|
+
renderComplex(_leaf, _canvas, _options) {},
|
|
4813
|
+
updateComplex(_leaf) {},
|
|
4814
|
+
checkComplex(_leaf) {},
|
|
4781
4815
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4782
4816
|
const local = isObject(x) ? Object.assign({}, x) : {
|
|
4783
4817
|
x: x,
|
|
@@ -4889,6 +4923,9 @@ const LeafHelper = {
|
|
|
4889
4923
|
divideParent(matrix, relative.scrollWorldTransform);
|
|
4890
4924
|
return temp ? matrix : Object.assign({}, matrix);
|
|
4891
4925
|
},
|
|
4926
|
+
updateScaleFixedWorld(_t) {},
|
|
4927
|
+
updateOuterBounds(_t) {},
|
|
4928
|
+
cacheId(_t) {},
|
|
4892
4929
|
drop(t, parent, index, resize) {
|
|
4893
4930
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4894
4931
|
parent.add(t, index);
|
|
@@ -4939,7 +4976,8 @@ const LeafBoundsHelper = {
|
|
|
4939
4976
|
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4940
4977
|
},
|
|
4941
4978
|
localRenderBounds(target) {
|
|
4942
|
-
|
|
4979
|
+
const {__: __, __layout: __layout} = target;
|
|
4980
|
+
return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
|
|
4943
4981
|
},
|
|
4944
4982
|
maskLocalBoxBounds(target, index) {
|
|
4945
4983
|
return checkMask(target, index) && target.__localBoxBounds;
|
|
@@ -4948,7 +4986,8 @@ const LeafBoundsHelper = {
|
|
|
4948
4986
|
return checkMask(target, index) && target.__layout.localStrokeBounds;
|
|
4949
4987
|
},
|
|
4950
4988
|
maskLocalRenderBounds(target, index) {
|
|
4951
|
-
|
|
4989
|
+
const {__layout: __layout} = target;
|
|
4990
|
+
return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
|
|
4952
4991
|
},
|
|
4953
4992
|
excludeRenderBounds(child, options) {
|
|
4954
4993
|
if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
|
|
@@ -5468,7 +5507,6 @@ class LeafLayout {
|
|
|
5468
5507
|
}
|
|
5469
5508
|
opacityChange() {
|
|
5470
5509
|
this.opacityChanged = true;
|
|
5471
|
-
this.surfaceChanged || this.surfaceChange();
|
|
5472
5510
|
}
|
|
5473
5511
|
childrenSortChange() {
|
|
5474
5512
|
if (!this.childrenSortChanged) {
|
|
@@ -5961,6 +5999,7 @@ const LeafMatrix = {
|
|
|
5961
5999
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5962
6000
|
multiplyParent$1(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5963
6001
|
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
6002
|
+
if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
|
|
5964
6003
|
},
|
|
5965
6004
|
__updateLocalMatrix() {
|
|
5966
6005
|
if (this.__local) {
|
|
@@ -5994,6 +6033,7 @@ const LeafBounds = {
|
|
|
5994
6033
|
__updateWorldBounds() {
|
|
5995
6034
|
const {__layout: __layout, __world: __world} = this;
|
|
5996
6035
|
toOuterOf$1(__layout.renderBounds, __world, __world);
|
|
6036
|
+
if (this.__hasComplex) LeafHelper.checkComplex(this);
|
|
5997
6037
|
if (__layout.resized) {
|
|
5998
6038
|
if (__layout.resized === "inner") this.__onUpdateSize();
|
|
5999
6039
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -6043,6 +6083,7 @@ const LeafBounds = {
|
|
|
6043
6083
|
layout.renderChanged = undefined;
|
|
6044
6084
|
if (this.parent) this.parent.__layout.renderChange();
|
|
6045
6085
|
}
|
|
6086
|
+
if (layout.outerScale) LeafHelper.updateOuterBounds(this);
|
|
6046
6087
|
layout.resized || (layout.resized = "local");
|
|
6047
6088
|
layout.boundsChanged = undefined;
|
|
6048
6089
|
},
|
|
@@ -6109,7 +6150,7 @@ const LeafRender = {
|
|
|
6109
6150
|
const data = this.__;
|
|
6110
6151
|
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
6111
6152
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
6112
|
-
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
6153
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
6113
6154
|
if (this.__.__single) {
|
|
6114
6155
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6115
6156
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
@@ -6163,7 +6204,7 @@ const BranchRender = {
|
|
|
6163
6204
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6164
6205
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
6165
6206
|
this.__renderBranch(tempCanvas, options);
|
|
6166
|
-
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6207
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6167
6208
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
6168
6209
|
tempCanvas.recycle(nowWorld);
|
|
6169
6210
|
} else {
|
|
@@ -6179,7 +6220,7 @@ const BranchRender = {
|
|
|
6179
6220
|
const {children: children} = this;
|
|
6180
6221
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6181
6222
|
child = children[i];
|
|
6182
|
-
excludeRenderBounds(child, options) || (child.
|
|
6223
|
+
excludeRenderBounds(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
|
|
6183
6224
|
}
|
|
6184
6225
|
}
|
|
6185
6226
|
},
|
|
@@ -6193,8 +6234,6 @@ const BranchRender = {
|
|
|
6193
6234
|
}
|
|
6194
6235
|
};
|
|
6195
6236
|
|
|
6196
|
-
const tempScaleData = {};
|
|
6197
|
-
|
|
6198
6237
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
6199
6238
|
|
|
6200
6239
|
const {stintSet: stintSet} = DataHelper;
|
|
@@ -6205,6 +6244,8 @@ const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
|
6205
6244
|
|
|
6206
6245
|
const {copy: copy, move: move} = PointHelper;
|
|
6207
6246
|
|
|
6247
|
+
const {getScaleFixedData: getScaleFixedData} = MathHelper;
|
|
6248
|
+
|
|
6208
6249
|
const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
|
|
6209
6250
|
|
|
6210
6251
|
exports.Leaf = class Leaf {
|
|
@@ -6363,6 +6404,7 @@ exports.Leaf = class Leaf {
|
|
|
6363
6404
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
6364
6405
|
if (this.animation) this.__runAnimation("in");
|
|
6365
6406
|
if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
6407
|
+
if (leafer.cacheId) LeafHelper.cacheId(this);
|
|
6366
6408
|
} else {
|
|
6367
6409
|
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
6368
6410
|
}
|
|
@@ -6492,13 +6534,8 @@ exports.Leaf = class Leaf {
|
|
|
6492
6534
|
if (scaleX < 0) scaleX = -scaleX;
|
|
6493
6535
|
return scaleX > 1 ? scaleX : 1;
|
|
6494
6536
|
}
|
|
6495
|
-
getRenderScaleData(abs, scaleFixed) {
|
|
6496
|
-
|
|
6497
|
-
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
6498
|
-
if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
|
|
6499
|
-
tempScaleData.scaleX = scaleX;
|
|
6500
|
-
tempScaleData.scaleY = scaleY;
|
|
6501
|
-
return tempScaleData;
|
|
6537
|
+
getRenderScaleData(abs, scaleFixed, unscale = true) {
|
|
6538
|
+
return getScaleFixedData(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
|
|
6502
6539
|
}
|
|
6503
6540
|
getTransform(relative) {
|
|
6504
6541
|
return this.__layout.getTransform(relative || "local");
|
|
@@ -6660,7 +6697,6 @@ exports.Leaf = class Leaf {
|
|
|
6660
6697
|
__drawHitPath(_canvas) {}
|
|
6661
6698
|
__updateHitCanvas() {}
|
|
6662
6699
|
__render(_canvas, _options) {}
|
|
6663
|
-
__renderComplex(_canvas, _options) {}
|
|
6664
6700
|
__drawFast(_canvas, _options) {}
|
|
6665
6701
|
__draw(_canvas, _options, _originCanvas) {}
|
|
6666
6702
|
__clip(_canvas, _options) {}
|
|
@@ -6671,7 +6707,7 @@ exports.Leaf = class Leaf {
|
|
|
6671
6707
|
__drawPath(_canvas) {}
|
|
6672
6708
|
__drawRenderPath(_canvas) {}
|
|
6673
6709
|
__updatePath() {}
|
|
6674
|
-
__updateRenderPath() {}
|
|
6710
|
+
__updateRenderPath(_updateCache) {}
|
|
6675
6711
|
getMotionPathData() {
|
|
6676
6712
|
return Plugin.need("path");
|
|
6677
6713
|
}
|
|
@@ -6745,9 +6781,11 @@ exports.Branch = class Branch extends exports.Leaf {
|
|
|
6745
6781
|
return 0;
|
|
6746
6782
|
}
|
|
6747
6783
|
__updateRenderSpread() {
|
|
6784
|
+
let layout;
|
|
6748
6785
|
const {children: children} = this;
|
|
6749
6786
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6750
|
-
|
|
6787
|
+
layout = children[i].__layout;
|
|
6788
|
+
if (layout.renderSpread || layout.localOuterBounds) return 1;
|
|
6751
6789
|
}
|
|
6752
6790
|
return 0;
|
|
6753
6791
|
}
|
|
@@ -7006,7 +7044,7 @@ class LeafLevelList {
|
|
|
7006
7044
|
}
|
|
7007
7045
|
}
|
|
7008
7046
|
|
|
7009
|
-
const version = "2.0.
|
|
7047
|
+
const version = "2.0.3";
|
|
7010
7048
|
|
|
7011
7049
|
exports.AlignHelper = AlignHelper;
|
|
7012
7050
|
|
package/lib/core.esm.js
CHANGED
|
@@ -204,6 +204,7 @@ class LeafData {
|
|
|
204
204
|
}
|
|
205
205
|
destroy() {
|
|
206
206
|
this.__input = this.__middle = null;
|
|
207
|
+
if (this.__complexData) this.__complexData.destroy();
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
210
|
|
|
@@ -302,6 +303,8 @@ const {set: set$1, get: get$1, setTemp: setTemp, toTempAB: toTempAB} = FourNumbe
|
|
|
302
303
|
|
|
303
304
|
const {round: round$3, pow: pow$1, max: max$1, floor: floor$2, PI: PI$1} = Math;
|
|
304
305
|
|
|
306
|
+
const tempScaleData = {};
|
|
307
|
+
|
|
305
308
|
const MathHelper = {
|
|
306
309
|
within(value, min, max) {
|
|
307
310
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -345,6 +348,24 @@ const MathHelper = {
|
|
|
345
348
|
} else if (scale) MathHelper.assignScale(scaleData, scale);
|
|
346
349
|
return scaleData;
|
|
347
350
|
},
|
|
351
|
+
getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
|
|
352
|
+
let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
|
|
353
|
+
if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
354
|
+
if (scaleFixed) {
|
|
355
|
+
if (scaleFixed === true) {
|
|
356
|
+
scaleX = scaleY = unscale ? 1 : 1 / scaleX;
|
|
357
|
+
} else {
|
|
358
|
+
let minScale;
|
|
359
|
+
if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
|
|
360
|
+
if (minScale) {
|
|
361
|
+
if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
tempScaleData.scaleX = scaleX;
|
|
366
|
+
tempScaleData.scaleY = scaleY;
|
|
367
|
+
return tempScaleData;
|
|
368
|
+
},
|
|
348
369
|
assignScale(scaleData, scale) {
|
|
349
370
|
if (isNumber(scale)) {
|
|
350
371
|
scaleData.scaleX = scaleData.scaleY = scale;
|
|
@@ -841,8 +862,8 @@ const PointHelper = {
|
|
|
841
862
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
842
863
|
return points;
|
|
843
864
|
},
|
|
844
|
-
isSame(t, point) {
|
|
845
|
-
return float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
865
|
+
isSame(t, point, quick) {
|
|
866
|
+
return quick ? t.x === point.x && t.y === point.y : float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
846
867
|
},
|
|
847
868
|
reset(t) {
|
|
848
869
|
P$5.reset(t);
|
|
@@ -917,8 +938,8 @@ class Point {
|
|
|
917
938
|
getAtan2(to) {
|
|
918
939
|
return PointHelper.getAtan2(this, to);
|
|
919
940
|
}
|
|
920
|
-
isSame(point) {
|
|
921
|
-
return PointHelper.isSame(this, point);
|
|
941
|
+
isSame(point, quick) {
|
|
942
|
+
return PointHelper.isSame(this, point, quick);
|
|
922
943
|
}
|
|
923
944
|
reset() {
|
|
924
945
|
PointHelper.reset(this);
|
|
@@ -1174,9 +1195,9 @@ const AroundHelper = {
|
|
|
1174
1195
|
}
|
|
1175
1196
|
if (!onlyBoxSize) to.x += box.x, to.y += box.y;
|
|
1176
1197
|
},
|
|
1177
|
-
getPoint(around, box, to) {
|
|
1198
|
+
getPoint(around, box, to, onlyBoxSize = true) {
|
|
1178
1199
|
if (!to) to = {};
|
|
1179
|
-
AroundHelper.toPoint(around, box, to,
|
|
1200
|
+
AroundHelper.toPoint(around, box, to, onlyBoxSize);
|
|
1180
1201
|
return to;
|
|
1181
1202
|
}
|
|
1182
1203
|
};
|
|
@@ -1443,6 +1464,9 @@ const BoundsHelper = {
|
|
|
1443
1464
|
y: y + height
|
|
1444
1465
|
} ];
|
|
1445
1466
|
},
|
|
1467
|
+
getPoint(t, around, onlyBoxSize = false, to) {
|
|
1468
|
+
return AroundHelper.getPoint(around, t, to, onlyBoxSize);
|
|
1469
|
+
},
|
|
1446
1470
|
hitRadiusPoint(t, point, pointMatrix) {
|
|
1447
1471
|
if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
|
|
1448
1472
|
return point.x >= t.x - point.radiusX && point.x <= t.x + t.width + point.radiusX && (point.y >= t.y - point.radiusY && point.y <= t.y + t.height + point.radiusY);
|
|
@@ -1614,6 +1638,9 @@ class Bounds {
|
|
|
1614
1638
|
getPoints() {
|
|
1615
1639
|
return BoundsHelper.getPoints(this);
|
|
1616
1640
|
}
|
|
1641
|
+
getPoint(around, onlyBoxSize, to) {
|
|
1642
|
+
return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
|
|
1643
|
+
}
|
|
1617
1644
|
hitPoint(point, pointMatrix) {
|
|
1618
1645
|
return BoundsHelper.hitPoint(this, point, pointMatrix);
|
|
1619
1646
|
}
|
|
@@ -4093,6 +4120,7 @@ const ImageManager = {
|
|
|
4093
4120
|
return image;
|
|
4094
4121
|
},
|
|
4095
4122
|
recycle(image) {
|
|
4123
|
+
if (image.parent) image = image.parent;
|
|
4096
4124
|
image.use--;
|
|
4097
4125
|
setTimeout(() => {
|
|
4098
4126
|
if (!image.use) {
|
|
@@ -4261,8 +4289,10 @@ class LeaferImage {
|
|
|
4261
4289
|
return undefined;
|
|
4262
4290
|
}
|
|
4263
4291
|
clearLevels(_checkUse) {}
|
|
4292
|
+
destroyFilter() {}
|
|
4264
4293
|
destroy() {
|
|
4265
4294
|
this.clearLevels();
|
|
4295
|
+
this.destroyFilter();
|
|
4266
4296
|
const {view: view} = this;
|
|
4267
4297
|
if (view && view.close) view.close();
|
|
4268
4298
|
this.config = {
|
|
@@ -4459,7 +4489,6 @@ function dimType(defaultValue) {
|
|
|
4459
4489
|
if (this.__setAttr(key, value)) {
|
|
4460
4490
|
const data = this.__;
|
|
4461
4491
|
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4462
|
-
this.__layout.surfaceChange();
|
|
4463
4492
|
}
|
|
4464
4493
|
}
|
|
4465
4494
|
}));
|
|
@@ -4509,7 +4538,6 @@ function sortType(defaultValue) {
|
|
|
4509
4538
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4510
4539
|
set(value) {
|
|
4511
4540
|
if (this.__setAttr(key, value)) {
|
|
4512
|
-
this.__layout.surfaceChange();
|
|
4513
4541
|
this.waitParent(() => {
|
|
4514
4542
|
this.parent.__layout.childrenSortChange();
|
|
4515
4543
|
});
|
|
@@ -4546,7 +4574,6 @@ function hitType(defaultValue) {
|
|
|
4546
4574
|
set(value) {
|
|
4547
4575
|
if (this.__setAttr(key, value)) {
|
|
4548
4576
|
this.__layout.hitCanvasChanged = true;
|
|
4549
|
-
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4550
4577
|
if (this.leafer) this.leafer.updateCursor();
|
|
4551
4578
|
}
|
|
4552
4579
|
}
|
|
@@ -4752,6 +4779,10 @@ const LeafHelper = {
|
|
|
4752
4779
|
if (layout.stateStyleChanged) leaf.updateState();
|
|
4753
4780
|
if (layout.opacityChanged) updateAllWorldOpacity(leaf);
|
|
4754
4781
|
leaf.__updateChange();
|
|
4782
|
+
if (layout.surfaceChanged) {
|
|
4783
|
+
if (leaf.__hasComplex) L.updateComplex(leaf);
|
|
4784
|
+
layout.surfaceChanged = false;
|
|
4785
|
+
}
|
|
4755
4786
|
},
|
|
4756
4787
|
updateAllChange(leaf) {
|
|
4757
4788
|
updateChange(leaf);
|
|
@@ -4776,6 +4807,9 @@ const LeafHelper = {
|
|
|
4776
4807
|
if (!fromWorld) fromWorld = leaf.__nowWorld;
|
|
4777
4808
|
if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4778
4809
|
},
|
|
4810
|
+
renderComplex(_leaf, _canvas, _options) {},
|
|
4811
|
+
updateComplex(_leaf) {},
|
|
4812
|
+
checkComplex(_leaf) {},
|
|
4779
4813
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4780
4814
|
const local = isObject(x) ? Object.assign({}, x) : {
|
|
4781
4815
|
x: x,
|
|
@@ -4887,6 +4921,9 @@ const LeafHelper = {
|
|
|
4887
4921
|
divideParent(matrix, relative.scrollWorldTransform);
|
|
4888
4922
|
return temp ? matrix : Object.assign({}, matrix);
|
|
4889
4923
|
},
|
|
4924
|
+
updateScaleFixedWorld(_t) {},
|
|
4925
|
+
updateOuterBounds(_t) {},
|
|
4926
|
+
cacheId(_t) {},
|
|
4890
4927
|
drop(t, parent, index, resize) {
|
|
4891
4928
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4892
4929
|
parent.add(t, index);
|
|
@@ -4937,7 +4974,8 @@ const LeafBoundsHelper = {
|
|
|
4937
4974
|
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4938
4975
|
},
|
|
4939
4976
|
localRenderBounds(target) {
|
|
4940
|
-
|
|
4977
|
+
const {__: __, __layout: __layout} = target;
|
|
4978
|
+
return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
|
|
4941
4979
|
},
|
|
4942
4980
|
maskLocalBoxBounds(target, index) {
|
|
4943
4981
|
return checkMask(target, index) && target.__localBoxBounds;
|
|
@@ -4946,7 +4984,8 @@ const LeafBoundsHelper = {
|
|
|
4946
4984
|
return checkMask(target, index) && target.__layout.localStrokeBounds;
|
|
4947
4985
|
},
|
|
4948
4986
|
maskLocalRenderBounds(target, index) {
|
|
4949
|
-
|
|
4987
|
+
const {__layout: __layout} = target;
|
|
4988
|
+
return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
|
|
4950
4989
|
},
|
|
4951
4990
|
excludeRenderBounds(child, options) {
|
|
4952
4991
|
if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
|
|
@@ -5466,7 +5505,6 @@ class LeafLayout {
|
|
|
5466
5505
|
}
|
|
5467
5506
|
opacityChange() {
|
|
5468
5507
|
this.opacityChanged = true;
|
|
5469
|
-
this.surfaceChanged || this.surfaceChange();
|
|
5470
5508
|
}
|
|
5471
5509
|
childrenSortChange() {
|
|
5472
5510
|
if (!this.childrenSortChanged) {
|
|
@@ -5959,6 +5997,7 @@ const LeafMatrix = {
|
|
|
5959
5997
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5960
5998
|
multiplyParent$1(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5961
5999
|
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
6000
|
+
if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
|
|
5962
6001
|
},
|
|
5963
6002
|
__updateLocalMatrix() {
|
|
5964
6003
|
if (this.__local) {
|
|
@@ -5992,6 +6031,7 @@ const LeafBounds = {
|
|
|
5992
6031
|
__updateWorldBounds() {
|
|
5993
6032
|
const {__layout: __layout, __world: __world} = this;
|
|
5994
6033
|
toOuterOf$1(__layout.renderBounds, __world, __world);
|
|
6034
|
+
if (this.__hasComplex) LeafHelper.checkComplex(this);
|
|
5995
6035
|
if (__layout.resized) {
|
|
5996
6036
|
if (__layout.resized === "inner") this.__onUpdateSize();
|
|
5997
6037
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -6041,6 +6081,7 @@ const LeafBounds = {
|
|
|
6041
6081
|
layout.renderChanged = undefined;
|
|
6042
6082
|
if (this.parent) this.parent.__layout.renderChange();
|
|
6043
6083
|
}
|
|
6084
|
+
if (layout.outerScale) LeafHelper.updateOuterBounds(this);
|
|
6044
6085
|
layout.resized || (layout.resized = "local");
|
|
6045
6086
|
layout.boundsChanged = undefined;
|
|
6046
6087
|
},
|
|
@@ -6107,7 +6148,7 @@ const LeafRender = {
|
|
|
6107
6148
|
const data = this.__;
|
|
6108
6149
|
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
6109
6150
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
6110
|
-
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
6151
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
6111
6152
|
if (this.__.__single) {
|
|
6112
6153
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6113
6154
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
@@ -6161,7 +6202,7 @@ const BranchRender = {
|
|
|
6161
6202
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6162
6203
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
6163
6204
|
this.__renderBranch(tempCanvas, options);
|
|
6164
|
-
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6205
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6165
6206
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
6166
6207
|
tempCanvas.recycle(nowWorld);
|
|
6167
6208
|
} else {
|
|
@@ -6177,7 +6218,7 @@ const BranchRender = {
|
|
|
6177
6218
|
const {children: children} = this;
|
|
6178
6219
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6179
6220
|
child = children[i];
|
|
6180
|
-
excludeRenderBounds(child, options) || (child.
|
|
6221
|
+
excludeRenderBounds(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
|
|
6181
6222
|
}
|
|
6182
6223
|
}
|
|
6183
6224
|
},
|
|
@@ -6191,8 +6232,6 @@ const BranchRender = {
|
|
|
6191
6232
|
}
|
|
6192
6233
|
};
|
|
6193
6234
|
|
|
6194
|
-
const tempScaleData = {};
|
|
6195
|
-
|
|
6196
6235
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
6197
6236
|
|
|
6198
6237
|
const {stintSet: stintSet} = DataHelper;
|
|
@@ -6203,6 +6242,8 @@ const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
|
6203
6242
|
|
|
6204
6243
|
const {copy: copy, move: move} = PointHelper;
|
|
6205
6244
|
|
|
6245
|
+
const {getScaleFixedData: getScaleFixedData} = MathHelper;
|
|
6246
|
+
|
|
6206
6247
|
const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
|
|
6207
6248
|
|
|
6208
6249
|
let Leaf = class Leaf {
|
|
@@ -6361,6 +6402,7 @@ let Leaf = class Leaf {
|
|
|
6361
6402
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
6362
6403
|
if (this.animation) this.__runAnimation("in");
|
|
6363
6404
|
if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
6405
|
+
if (leafer.cacheId) LeafHelper.cacheId(this);
|
|
6364
6406
|
} else {
|
|
6365
6407
|
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
6366
6408
|
}
|
|
@@ -6490,13 +6532,8 @@ let Leaf = class Leaf {
|
|
|
6490
6532
|
if (scaleX < 0) scaleX = -scaleX;
|
|
6491
6533
|
return scaleX > 1 ? scaleX : 1;
|
|
6492
6534
|
}
|
|
6493
|
-
getRenderScaleData(abs, scaleFixed) {
|
|
6494
|
-
|
|
6495
|
-
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
6496
|
-
if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
|
|
6497
|
-
tempScaleData.scaleX = scaleX;
|
|
6498
|
-
tempScaleData.scaleY = scaleY;
|
|
6499
|
-
return tempScaleData;
|
|
6535
|
+
getRenderScaleData(abs, scaleFixed, unscale = true) {
|
|
6536
|
+
return getScaleFixedData(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
|
|
6500
6537
|
}
|
|
6501
6538
|
getTransform(relative) {
|
|
6502
6539
|
return this.__layout.getTransform(relative || "local");
|
|
@@ -6658,7 +6695,6 @@ let Leaf = class Leaf {
|
|
|
6658
6695
|
__drawHitPath(_canvas) {}
|
|
6659
6696
|
__updateHitCanvas() {}
|
|
6660
6697
|
__render(_canvas, _options) {}
|
|
6661
|
-
__renderComplex(_canvas, _options) {}
|
|
6662
6698
|
__drawFast(_canvas, _options) {}
|
|
6663
6699
|
__draw(_canvas, _options, _originCanvas) {}
|
|
6664
6700
|
__clip(_canvas, _options) {}
|
|
@@ -6669,7 +6705,7 @@ let Leaf = class Leaf {
|
|
|
6669
6705
|
__drawPath(_canvas) {}
|
|
6670
6706
|
__drawRenderPath(_canvas) {}
|
|
6671
6707
|
__updatePath() {}
|
|
6672
|
-
__updateRenderPath() {}
|
|
6708
|
+
__updateRenderPath(_updateCache) {}
|
|
6673
6709
|
getMotionPathData() {
|
|
6674
6710
|
return Plugin.need("path");
|
|
6675
6711
|
}
|
|
@@ -6743,9 +6779,11 @@ let Branch = class Branch extends Leaf {
|
|
|
6743
6779
|
return 0;
|
|
6744
6780
|
}
|
|
6745
6781
|
__updateRenderSpread() {
|
|
6782
|
+
let layout;
|
|
6746
6783
|
const {children: children} = this;
|
|
6747
6784
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6748
|
-
|
|
6785
|
+
layout = children[i].__layout;
|
|
6786
|
+
if (layout.renderSpread || layout.localOuterBounds) return 1;
|
|
6749
6787
|
}
|
|
6750
6788
|
return 0;
|
|
6751
6789
|
}
|
|
@@ -7004,6 +7042,6 @@ class LeafLevelList {
|
|
|
7004
7042
|
}
|
|
7005
7043
|
}
|
|
7006
7044
|
|
|
7007
|
-
const version = "2.0.
|
|
7045
|
+
const version = "2.0.3";
|
|
7008
7046
|
|
|
7009
7047
|
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, LeaferFilm, LeaferImage, LeaferVideo, 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, UnitConvertHelper, 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 };
|