@leafer-ui/worker 2.0.2 → 2.0.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/dist/worker.cjs +9 -7
- package/dist/worker.esm.js +9 -7
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +127 -56
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +129 -57
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/worker.module.js
CHANGED
|
@@ -252,6 +252,7 @@ class LeafData {
|
|
|
252
252
|
}
|
|
253
253
|
destroy() {
|
|
254
254
|
this.__input = this.__middle = null;
|
|
255
|
+
if (this.__complexData) this.__complexData.destroy();
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
|
|
@@ -350,6 +351,8 @@ const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumbe
|
|
|
350
351
|
|
|
351
352
|
const {round: round$3, pow: pow$1, max: max$4, floor: floor$2, PI: PI$3} = Math;
|
|
352
353
|
|
|
354
|
+
const tempScaleData$1 = {};
|
|
355
|
+
|
|
353
356
|
const MathHelper = {
|
|
354
357
|
within(value, min, max) {
|
|
355
358
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -393,6 +396,24 @@ const MathHelper = {
|
|
|
393
396
|
} else if (scale) MathHelper.assignScale(scaleData, scale);
|
|
394
397
|
return scaleData;
|
|
395
398
|
},
|
|
399
|
+
getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
|
|
400
|
+
let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
|
|
401
|
+
if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
402
|
+
if (scaleFixed) {
|
|
403
|
+
if (scaleFixed === true) {
|
|
404
|
+
scaleX = scaleY = unscale ? 1 : 1 / scaleX;
|
|
405
|
+
} else {
|
|
406
|
+
let minScale;
|
|
407
|
+
if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
|
|
408
|
+
if (minScale) {
|
|
409
|
+
if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
tempScaleData$1.scaleX = scaleX;
|
|
414
|
+
tempScaleData$1.scaleY = scaleY;
|
|
415
|
+
return tempScaleData$1;
|
|
416
|
+
},
|
|
396
417
|
assignScale(scaleData, scale) {
|
|
397
418
|
if (isNumber(scale)) {
|
|
398
419
|
scaleData.scaleX = scaleData.scaleY = scale;
|
|
@@ -889,8 +910,8 @@ const PointHelper = {
|
|
|
889
910
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
890
911
|
return points;
|
|
891
912
|
},
|
|
892
|
-
isSame(t, point) {
|
|
893
|
-
return float$2(t.x) === float$2(point.x) && float$2(t.y) === float$2(point.y);
|
|
913
|
+
isSame(t, point, quick) {
|
|
914
|
+
return quick ? t.x === point.x && t.y === point.y : float$2(t.x) === float$2(point.x) && float$2(t.y) === float$2(point.y);
|
|
894
915
|
},
|
|
895
916
|
reset(t) {
|
|
896
917
|
P$5.reset(t);
|
|
@@ -965,8 +986,8 @@ class Point {
|
|
|
965
986
|
getAtan2(to) {
|
|
966
987
|
return PointHelper.getAtan2(this, to);
|
|
967
988
|
}
|
|
968
|
-
isSame(point) {
|
|
969
|
-
return PointHelper.isSame(this, point);
|
|
989
|
+
isSame(point, quick) {
|
|
990
|
+
return PointHelper.isSame(this, point, quick);
|
|
970
991
|
}
|
|
971
992
|
reset() {
|
|
972
993
|
PointHelper.reset(this);
|
|
@@ -1222,9 +1243,9 @@ const AroundHelper = {
|
|
|
1222
1243
|
}
|
|
1223
1244
|
if (!onlyBoxSize) to.x += box.x, to.y += box.y;
|
|
1224
1245
|
},
|
|
1225
|
-
getPoint(around, box, to) {
|
|
1246
|
+
getPoint(around, box, to, onlyBoxSize = true) {
|
|
1226
1247
|
if (!to) to = {};
|
|
1227
|
-
AroundHelper.toPoint(around, box, to,
|
|
1248
|
+
AroundHelper.toPoint(around, box, to, onlyBoxSize);
|
|
1228
1249
|
return to;
|
|
1229
1250
|
}
|
|
1230
1251
|
};
|
|
@@ -1491,6 +1512,9 @@ const BoundsHelper = {
|
|
|
1491
1512
|
y: y + height
|
|
1492
1513
|
} ];
|
|
1493
1514
|
},
|
|
1515
|
+
getPoint(t, around, onlyBoxSize = false, to) {
|
|
1516
|
+
return AroundHelper.getPoint(around, t, to, onlyBoxSize);
|
|
1517
|
+
},
|
|
1494
1518
|
hitRadiusPoint(t, point, pointMatrix) {
|
|
1495
1519
|
if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
|
|
1496
1520
|
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);
|
|
@@ -1662,6 +1686,9 @@ class Bounds {
|
|
|
1662
1686
|
getPoints() {
|
|
1663
1687
|
return BoundsHelper.getPoints(this);
|
|
1664
1688
|
}
|
|
1689
|
+
getPoint(around, onlyBoxSize, to) {
|
|
1690
|
+
return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
|
|
1691
|
+
}
|
|
1665
1692
|
hitPoint(point, pointMatrix) {
|
|
1666
1693
|
return BoundsHelper.hitPoint(this, point, pointMatrix);
|
|
1667
1694
|
}
|
|
@@ -4102,6 +4129,7 @@ const ImageManager = {
|
|
|
4102
4129
|
return image;
|
|
4103
4130
|
},
|
|
4104
4131
|
recycle(image) {
|
|
4132
|
+
if (image.parent) image = image.parent;
|
|
4105
4133
|
image.use--;
|
|
4106
4134
|
setTimeout(() => {
|
|
4107
4135
|
if (!image.use) {
|
|
@@ -4270,8 +4298,10 @@ class LeaferImage {
|
|
|
4270
4298
|
return undefined;
|
|
4271
4299
|
}
|
|
4272
4300
|
clearLevels(_checkUse) {}
|
|
4301
|
+
destroyFilter() {}
|
|
4273
4302
|
destroy() {
|
|
4274
4303
|
this.clearLevels();
|
|
4304
|
+
this.destroyFilter();
|
|
4275
4305
|
const {view: view} = this;
|
|
4276
4306
|
if (view && view.close) view.close();
|
|
4277
4307
|
this.config = {
|
|
@@ -4468,7 +4498,6 @@ function dimType(defaultValue) {
|
|
|
4468
4498
|
if (this.__setAttr(key, value)) {
|
|
4469
4499
|
const data = this.__;
|
|
4470
4500
|
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4471
|
-
this.__layout.surfaceChange();
|
|
4472
4501
|
}
|
|
4473
4502
|
}
|
|
4474
4503
|
}));
|
|
@@ -4518,7 +4547,6 @@ function sortType(defaultValue) {
|
|
|
4518
4547
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4519
4548
|
set(value) {
|
|
4520
4549
|
if (this.__setAttr(key, value)) {
|
|
4521
|
-
this.__layout.surfaceChange();
|
|
4522
4550
|
this.waitParent(() => {
|
|
4523
4551
|
this.parent.__layout.childrenSortChange();
|
|
4524
4552
|
});
|
|
@@ -4555,7 +4583,6 @@ function hitType(defaultValue) {
|
|
|
4555
4583
|
set(value) {
|
|
4556
4584
|
if (this.__setAttr(key, value)) {
|
|
4557
4585
|
this.__layout.hitCanvasChanged = true;
|
|
4558
|
-
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4559
4586
|
if (this.leafer) this.leafer.updateCursor();
|
|
4560
4587
|
}
|
|
4561
4588
|
}
|
|
@@ -4761,6 +4788,10 @@ const LeafHelper = {
|
|
|
4761
4788
|
if (layout.stateStyleChanged) leaf.updateState();
|
|
4762
4789
|
if (layout.opacityChanged) updateAllWorldOpacity(leaf);
|
|
4763
4790
|
leaf.__updateChange();
|
|
4791
|
+
if (layout.surfaceChanged) {
|
|
4792
|
+
if (leaf.__hasComplex) L.updateComplex(leaf);
|
|
4793
|
+
layout.surfaceChanged = false;
|
|
4794
|
+
}
|
|
4764
4795
|
},
|
|
4765
4796
|
updateAllChange(leaf) {
|
|
4766
4797
|
updateChange$1(leaf);
|
|
@@ -4785,6 +4816,9 @@ const LeafHelper = {
|
|
|
4785
4816
|
if (!fromWorld) fromWorld = leaf.__nowWorld;
|
|
4786
4817
|
if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4787
4818
|
},
|
|
4819
|
+
renderComplex(_leaf, _canvas, _options) {},
|
|
4820
|
+
updateComplex(_leaf) {},
|
|
4821
|
+
checkComplex(_leaf) {},
|
|
4788
4822
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4789
4823
|
const local = isObject(x) ? Object.assign({}, x) : {
|
|
4790
4824
|
x: x,
|
|
@@ -4896,6 +4930,9 @@ const LeafHelper = {
|
|
|
4896
4930
|
divideParent(matrix$1, relative.scrollWorldTransform);
|
|
4897
4931
|
return temp ? matrix$1 : Object.assign({}, matrix$1);
|
|
4898
4932
|
},
|
|
4933
|
+
updateScaleFixedWorld(_t) {},
|
|
4934
|
+
updateOuterBounds(_t) {},
|
|
4935
|
+
cacheId(_t) {},
|
|
4899
4936
|
drop(t, parent, index, resize) {
|
|
4900
4937
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4901
4938
|
parent.add(t, index);
|
|
@@ -4946,7 +4983,8 @@ const LeafBoundsHelper = {
|
|
|
4946
4983
|
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4947
4984
|
},
|
|
4948
4985
|
localRenderBounds(target) {
|
|
4949
|
-
|
|
4986
|
+
const {__: __, __layout: __layout} = target;
|
|
4987
|
+
return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
|
|
4950
4988
|
},
|
|
4951
4989
|
maskLocalBoxBounds(target, index) {
|
|
4952
4990
|
return checkMask(target, index) && target.__localBoxBounds;
|
|
@@ -4955,7 +4993,8 @@ const LeafBoundsHelper = {
|
|
|
4955
4993
|
return checkMask(target, index) && target.__layout.localStrokeBounds;
|
|
4956
4994
|
},
|
|
4957
4995
|
maskLocalRenderBounds(target, index) {
|
|
4958
|
-
|
|
4996
|
+
const {__layout: __layout} = target;
|
|
4997
|
+
return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
|
|
4959
4998
|
},
|
|
4960
4999
|
excludeRenderBounds(child, options) {
|
|
4961
5000
|
if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
|
|
@@ -5475,7 +5514,6 @@ class LeafLayout {
|
|
|
5475
5514
|
}
|
|
5476
5515
|
opacityChange() {
|
|
5477
5516
|
this.opacityChanged = true;
|
|
5478
|
-
this.surfaceChanged || this.surfaceChange();
|
|
5479
5517
|
}
|
|
5480
5518
|
childrenSortChange() {
|
|
5481
5519
|
if (!this.childrenSortChanged) {
|
|
@@ -5582,7 +5620,7 @@ class BoundsEvent extends Event {
|
|
|
5582
5620
|
}
|
|
5583
5621
|
}
|
|
5584
5622
|
static emitWorld(leaf) {
|
|
5585
|
-
if (leaf.leaferIsReady) leaf.emit(WORLD,
|
|
5623
|
+
if (leaf.leaferIsReady) leaf.emit(WORLD, leaf);
|
|
5586
5624
|
}
|
|
5587
5625
|
}
|
|
5588
5626
|
|
|
@@ -5968,6 +6006,7 @@ const LeafMatrix = {
|
|
|
5968
6006
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
5969
6007
|
multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
|
|
5970
6008
|
if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
|
|
6009
|
+
if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
|
|
5971
6010
|
},
|
|
5972
6011
|
__updateLocalMatrix() {
|
|
5973
6012
|
if (this.__local) {
|
|
@@ -6001,6 +6040,7 @@ const LeafBounds = {
|
|
|
6001
6040
|
__updateWorldBounds() {
|
|
6002
6041
|
const {__layout: __layout, __world: __world} = this;
|
|
6003
6042
|
toOuterOf$2(__layout.renderBounds, __world, __world);
|
|
6043
|
+
if (this.__hasComplex) LeafHelper.checkComplex(this);
|
|
6004
6044
|
if (__layout.resized) {
|
|
6005
6045
|
if (__layout.resized === "inner") this.__onUpdateSize();
|
|
6006
6046
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -6050,6 +6090,7 @@ const LeafBounds = {
|
|
|
6050
6090
|
layout.renderChanged = undefined;
|
|
6051
6091
|
if (this.parent) this.parent.__layout.renderChange();
|
|
6052
6092
|
}
|
|
6093
|
+
if (layout.outerScale) LeafHelper.updateOuterBounds(this);
|
|
6053
6094
|
layout.resized || (layout.resized = "local");
|
|
6054
6095
|
layout.boundsChanged = undefined;
|
|
6055
6096
|
},
|
|
@@ -6116,7 +6157,7 @@ const LeafRender = {
|
|
|
6116
6157
|
const data = this.__;
|
|
6117
6158
|
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
6118
6159
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
6119
|
-
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
6160
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
6120
6161
|
if (this.__.__single) {
|
|
6121
6162
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6122
6163
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
@@ -6170,7 +6211,7 @@ const BranchRender = {
|
|
|
6170
6211
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
6171
6212
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
6172
6213
|
this.__renderBranch(tempCanvas, options);
|
|
6173
|
-
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6214
|
+
canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
6174
6215
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
6175
6216
|
tempCanvas.recycle(nowWorld);
|
|
6176
6217
|
} else {
|
|
@@ -6186,7 +6227,7 @@ const BranchRender = {
|
|
|
6186
6227
|
const {children: children} = this;
|
|
6187
6228
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6188
6229
|
child = children[i];
|
|
6189
|
-
excludeRenderBounds$1(child, options) || (child.
|
|
6230
|
+
excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
|
|
6190
6231
|
}
|
|
6191
6232
|
}
|
|
6192
6233
|
},
|
|
@@ -6200,8 +6241,6 @@ const BranchRender = {
|
|
|
6200
6241
|
}
|
|
6201
6242
|
};
|
|
6202
6243
|
|
|
6203
|
-
const tempScaleData$1 = {};
|
|
6204
|
-
|
|
6205
6244
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
6206
6245
|
|
|
6207
6246
|
const {stintSet: stintSet$4} = DataHelper;
|
|
@@ -6212,6 +6251,8 @@ const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
|
6212
6251
|
|
|
6213
6252
|
const {copy: copy$2, move: move$2} = PointHelper;
|
|
6214
6253
|
|
|
6254
|
+
const {getScaleFixedData: getScaleFixedData} = MathHelper;
|
|
6255
|
+
|
|
6215
6256
|
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;
|
|
6216
6257
|
|
|
6217
6258
|
let Leaf = class Leaf {
|
|
@@ -6370,6 +6411,7 @@ let Leaf = class Leaf {
|
|
|
6370
6411
|
this.__level = this.parent ? this.parent.__level + 1 : 1;
|
|
6371
6412
|
if (this.animation) this.__runAnimation("in");
|
|
6372
6413
|
if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
|
|
6414
|
+
if (leafer.cacheId) LeafHelper.cacheId(this);
|
|
6373
6415
|
} else {
|
|
6374
6416
|
this.__emitLifeEvent(ChildEvent.UNMOUNTED);
|
|
6375
6417
|
}
|
|
@@ -6499,13 +6541,8 @@ let Leaf = class Leaf {
|
|
|
6499
6541
|
if (scaleX < 0) scaleX = -scaleX;
|
|
6500
6542
|
return scaleX > 1 ? scaleX : 1;
|
|
6501
6543
|
}
|
|
6502
|
-
getRenderScaleData(abs, scaleFixed) {
|
|
6503
|
-
|
|
6504
|
-
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
6505
|
-
if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
|
|
6506
|
-
tempScaleData$1.scaleX = scaleX;
|
|
6507
|
-
tempScaleData$1.scaleY = scaleY;
|
|
6508
|
-
return tempScaleData$1;
|
|
6544
|
+
getRenderScaleData(abs, scaleFixed, unscale = true) {
|
|
6545
|
+
return getScaleFixedData(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
|
|
6509
6546
|
}
|
|
6510
6547
|
getTransform(relative) {
|
|
6511
6548
|
return this.__layout.getTransform(relative || "local");
|
|
@@ -6544,14 +6581,16 @@ let Leaf = class Leaf {
|
|
|
6544
6581
|
relative.innerToWorld(world, to, distance);
|
|
6545
6582
|
world = to ? to : world;
|
|
6546
6583
|
}
|
|
6547
|
-
toInnerPoint(this.
|
|
6584
|
+
toInnerPoint(this.worldTransform, world, to, distance);
|
|
6548
6585
|
}
|
|
6549
6586
|
innerToWorld(inner, to, distance, relative) {
|
|
6550
|
-
toOuterPoint(this.
|
|
6587
|
+
toOuterPoint(this.worldTransform, inner, to, distance);
|
|
6551
6588
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
6552
6589
|
}
|
|
6553
6590
|
getBoxPoint(world, relative, distance, change) {
|
|
6554
|
-
|
|
6591
|
+
const inner = this.getInnerPoint(world, relative, distance, change);
|
|
6592
|
+
if (distance) return inner;
|
|
6593
|
+
return this.getBoxPointByInner(inner, null, null, true);
|
|
6555
6594
|
}
|
|
6556
6595
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
6557
6596
|
const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
|
|
@@ -6667,7 +6706,6 @@ let Leaf = class Leaf {
|
|
|
6667
6706
|
__drawHitPath(_canvas) {}
|
|
6668
6707
|
__updateHitCanvas() {}
|
|
6669
6708
|
__render(_canvas, _options) {}
|
|
6670
|
-
__renderComplex(_canvas, _options) {}
|
|
6671
6709
|
__drawFast(_canvas, _options) {}
|
|
6672
6710
|
__draw(_canvas, _options, _originCanvas) {}
|
|
6673
6711
|
__clip(_canvas, _options) {}
|
|
@@ -6678,7 +6716,7 @@ let Leaf = class Leaf {
|
|
|
6678
6716
|
__drawPath(_canvas) {}
|
|
6679
6717
|
__drawRenderPath(_canvas) {}
|
|
6680
6718
|
__updatePath() {}
|
|
6681
|
-
__updateRenderPath() {}
|
|
6719
|
+
__updateRenderPath(_updateCache) {}
|
|
6682
6720
|
getMotionPathData() {
|
|
6683
6721
|
return Plugin.need("path");
|
|
6684
6722
|
}
|
|
@@ -6752,9 +6790,11 @@ let Branch = class Branch extends Leaf {
|
|
|
6752
6790
|
return 0;
|
|
6753
6791
|
}
|
|
6754
6792
|
__updateRenderSpread() {
|
|
6793
|
+
let layout;
|
|
6755
6794
|
const {children: children} = this;
|
|
6756
6795
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6757
|
-
|
|
6796
|
+
layout = children[i].__layout;
|
|
6797
|
+
if (layout.renderSpread || layout.localOuterBounds) return 1;
|
|
6758
6798
|
}
|
|
6759
6799
|
return 0;
|
|
6760
6800
|
}
|
|
@@ -7013,7 +7053,7 @@ class LeafLevelList {
|
|
|
7013
7053
|
}
|
|
7014
7054
|
}
|
|
7015
7055
|
|
|
7016
|
-
const version = "2.0.
|
|
7056
|
+
const version = "2.0.4";
|
|
7017
7057
|
|
|
7018
7058
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7019
7059
|
get allowBackgroundColor() {
|
|
@@ -7852,7 +7892,7 @@ class Selector {
|
|
|
7852
7892
|
this.config = {};
|
|
7853
7893
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
7854
7894
|
this.picker = new Picker(this.target = target, this);
|
|
7855
|
-
this.finder = Creator.finder && Creator.finder();
|
|
7895
|
+
this.finder = Creator.finder && Creator.finder(target, this.config);
|
|
7856
7896
|
}
|
|
7857
7897
|
getByPoint(hitPoint, hitRadius, options) {
|
|
7858
7898
|
const {target: target, picker: picker} = this;
|
|
@@ -7894,7 +7934,9 @@ function effectType(defaultValue) {
|
|
|
7894
7934
|
set(value) {
|
|
7895
7935
|
this.__setAttr(key, value);
|
|
7896
7936
|
if (value) this.__.__useEffect = true;
|
|
7897
|
-
|
|
7937
|
+
const layout = this.__layout;
|
|
7938
|
+
layout.renderChanged || layout.renderChange();
|
|
7939
|
+
layout.surfaceChange();
|
|
7898
7940
|
}
|
|
7899
7941
|
}));
|
|
7900
7942
|
}
|
|
@@ -8108,15 +8150,16 @@ class UIData extends LeafData {
|
|
|
8108
8150
|
this.__needComputePaint = undefined;
|
|
8109
8151
|
}
|
|
8110
8152
|
__getRealStrokeWidth(childStyle) {
|
|
8111
|
-
let {strokeWidth: strokeWidth,
|
|
8153
|
+
let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
|
|
8112
8154
|
if (childStyle) {
|
|
8113
8155
|
if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
|
|
8114
|
-
if (!isUndefined(childStyle.
|
|
8156
|
+
if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
|
|
8157
|
+
}
|
|
8158
|
+
if (strokeScaleFixed) {
|
|
8159
|
+
const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
|
|
8160
|
+
if (scaleX !== 1) return strokeWidth * scaleX;
|
|
8115
8161
|
}
|
|
8116
|
-
|
|
8117
|
-
const scale = this.__leaf.getClampRenderScale();
|
|
8118
|
-
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
8119
|
-
} else return strokeWidth;
|
|
8162
|
+
return strokeWidth;
|
|
8120
8163
|
}
|
|
8121
8164
|
__setPaint(attrName, value) {
|
|
8122
8165
|
this.__setInput(attrName, value);
|
|
@@ -8198,7 +8241,11 @@ class EllipseData extends UIData {
|
|
|
8198
8241
|
|
|
8199
8242
|
class PolygonData extends LineData {}
|
|
8200
8243
|
|
|
8201
|
-
class StarData extends UIData {
|
|
8244
|
+
class StarData extends UIData {
|
|
8245
|
+
get __boxStroke() {
|
|
8246
|
+
return !this.__pathInputed;
|
|
8247
|
+
}
|
|
8248
|
+
}
|
|
8202
8249
|
|
|
8203
8250
|
class PathData extends UIData {
|
|
8204
8251
|
get __pathInputed() {
|
|
@@ -8302,7 +8349,7 @@ const UIBounds = {
|
|
|
8302
8349
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
8303
8350
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
8304
8351
|
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
8305
|
-
if (!data.__boxStroke) {
|
|
8352
|
+
if (!data.__boxStroke || data.__useArrow) {
|
|
8306
8353
|
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
8307
8354
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
8308
8355
|
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
@@ -8459,6 +8506,12 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8459
8506
|
get isFrame() {
|
|
8460
8507
|
return false;
|
|
8461
8508
|
}
|
|
8509
|
+
set strokeWidthFixed(value) {
|
|
8510
|
+
this.strokeScaleFixed = value;
|
|
8511
|
+
}
|
|
8512
|
+
get strokeWidthFixed() {
|
|
8513
|
+
return this.strokeScaleFixed;
|
|
8514
|
+
}
|
|
8462
8515
|
set scale(value) {
|
|
8463
8516
|
MathHelper.assignScale(this, value);
|
|
8464
8517
|
}
|
|
@@ -8514,6 +8567,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8514
8567
|
getPathString(curve, pathForRender, floatLength) {
|
|
8515
8568
|
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
8516
8569
|
}
|
|
8570
|
+
asPath(curve, pathForRender) {
|
|
8571
|
+
this.path = this.getPath(curve, pathForRender);
|
|
8572
|
+
}
|
|
8517
8573
|
load() {
|
|
8518
8574
|
this.__.__computePaint();
|
|
8519
8575
|
}
|
|
@@ -8523,16 +8579,18 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8523
8579
|
data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
|
|
8524
8580
|
}
|
|
8525
8581
|
}
|
|
8526
|
-
__updateRenderPath() {
|
|
8582
|
+
__updateRenderPath(updateCache) {
|
|
8527
8583
|
const data = this.__;
|
|
8528
8584
|
if (data.path) {
|
|
8529
8585
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8530
|
-
if (data.__useArrow) PathArrow.addArrows(this);
|
|
8586
|
+
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
8531
8587
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8532
8588
|
}
|
|
8533
8589
|
__drawRenderPath(canvas) {
|
|
8590
|
+
const data = this.__;
|
|
8534
8591
|
canvas.beginPath();
|
|
8535
|
-
|
|
8592
|
+
if (data.__useArrow) PathArrow.updateArrow(this);
|
|
8593
|
+
this.__drawPathByData(canvas, data.__pathForRender);
|
|
8536
8594
|
}
|
|
8537
8595
|
__drawPath(canvas) {
|
|
8538
8596
|
canvas.beginPath();
|
|
@@ -8581,6 +8639,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8581
8639
|
static setEditOuter(_toolName) {}
|
|
8582
8640
|
static setEditInner(_editorName) {}
|
|
8583
8641
|
destroy() {
|
|
8642
|
+
this.__.__willDestroy = true;
|
|
8584
8643
|
this.fill = this.stroke = null;
|
|
8585
8644
|
if (this.__animate) this.killAnimate();
|
|
8586
8645
|
super.destroy();
|
|
@@ -8697,7 +8756,7 @@ __decorate([ strokeType("inside") ], UI.prototype, "strokeAlign", void 0);
|
|
|
8697
8756
|
|
|
8698
8757
|
__decorate([ strokeType(1, true) ], UI.prototype, "strokeWidth", void 0);
|
|
8699
8758
|
|
|
8700
|
-
__decorate([ strokeType(false) ], UI.prototype, "
|
|
8759
|
+
__decorate([ strokeType(false) ], UI.prototype, "strokeScaleFixed", void 0);
|
|
8701
8760
|
|
|
8702
8761
|
__decorate([ strokeType("none") ], UI.prototype, "strokeCap", void 0);
|
|
8703
8762
|
|
|
@@ -9198,6 +9257,9 @@ let Box = class Box extends Group {
|
|
|
9198
9257
|
get isBranchLeaf() {
|
|
9199
9258
|
return true;
|
|
9200
9259
|
}
|
|
9260
|
+
get __useSelfBox() {
|
|
9261
|
+
return this.pathInputed;
|
|
9262
|
+
}
|
|
9201
9263
|
constructor(data) {
|
|
9202
9264
|
super(data);
|
|
9203
9265
|
this.__layout.renderChanged || this.__layout.renderChange();
|
|
@@ -9213,7 +9275,7 @@ let Box = class Box extends Group {
|
|
|
9213
9275
|
}
|
|
9214
9276
|
__updateRectBoxBounds() {}
|
|
9215
9277
|
__updateBoxBounds(_secondLayout) {
|
|
9216
|
-
if (this.children.length && !this.
|
|
9278
|
+
if (this.children.length && !this.__useSelfBox) {
|
|
9217
9279
|
const data = this.__;
|
|
9218
9280
|
if (data.__autoSide) {
|
|
9219
9281
|
if (data.__hasSurface) this.__extraUpdate();
|
|
@@ -9329,9 +9391,9 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9329
9391
|
return "Ellipse";
|
|
9330
9392
|
}
|
|
9331
9393
|
__updatePath() {
|
|
9332
|
-
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} =
|
|
9394
|
+
const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
|
|
9333
9395
|
const rx = width / 2, ry = height / 2;
|
|
9334
|
-
const path =
|
|
9396
|
+
const path = data.path = [];
|
|
9335
9397
|
let open;
|
|
9336
9398
|
if (innerRadius) {
|
|
9337
9399
|
if (startAngle || endAngle) {
|
|
@@ -9353,7 +9415,7 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9353
9415
|
}
|
|
9354
9416
|
}
|
|
9355
9417
|
if (!open) closePath$2(path);
|
|
9356
|
-
if (Platform.ellipseToCurve)
|
|
9418
|
+
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
9357
9419
|
}
|
|
9358
9420
|
};
|
|
9359
9421
|
|
|
@@ -9893,7 +9955,7 @@ let App = class App extends Leafer {
|
|
|
9893
9955
|
if (this.viewReady) this.renderer.update();
|
|
9894
9956
|
}
|
|
9895
9957
|
__render(canvas, options) {
|
|
9896
|
-
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
|
|
9958
|
+
if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds, undefined, undefined, true));
|
|
9897
9959
|
}
|
|
9898
9960
|
__onResize(event) {
|
|
9899
9961
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -10945,6 +11007,14 @@ class InteractionBase {
|
|
|
10945
11007
|
stopDragAnimate() {
|
|
10946
11008
|
this.dragger.stopAnimate();
|
|
10947
11009
|
}
|
|
11010
|
+
replaceDownTarget(target) {
|
|
11011
|
+
const {downData: downData} = this;
|
|
11012
|
+
if (downData && target) {
|
|
11013
|
+
const {path: path} = downData;
|
|
11014
|
+
path.remove(path.list[0]);
|
|
11015
|
+
path.addAt(target, 0);
|
|
11016
|
+
}
|
|
11017
|
+
}
|
|
10948
11018
|
updateDownData(data, options, merge) {
|
|
10949
11019
|
const {downData: downData} = this;
|
|
10950
11020
|
if (!data && downData) data = downData;
|
|
@@ -11336,8 +11406,8 @@ function fills(fills, ui, canvas, renderOptions) {
|
|
|
11336
11406
|
canvas.save();
|
|
11337
11407
|
if (item.transform) canvas.transform(item.transform);
|
|
11338
11408
|
if (originPaint.scaleFixed) {
|
|
11339
|
-
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
11340
|
-
if (
|
|
11409
|
+
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, originPaint.scaleFixed, false);
|
|
11410
|
+
if (scaleX !== 1) canvas.scale(scaleX, scaleY);
|
|
11341
11411
|
}
|
|
11342
11412
|
if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
|
|
11343
11413
|
fillPathOrText(ui, canvas, renderOptions);
|
|
@@ -11758,6 +11828,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
11758
11828
|
const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
|
|
11759
11829
|
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
11760
11830
|
}
|
|
11831
|
+
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
11761
11832
|
return true;
|
|
11762
11833
|
}
|
|
11763
11834
|
|
|
@@ -11985,7 +12056,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
11985
12056
|
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
11986
12057
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
11987
12058
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
11988
|
-
const {image: image, data: data} = paint, {opacity: opacity
|
|
12059
|
+
const {image: image, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
11989
12060
|
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
11990
12061
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
11991
12062
|
width *= scaleX;
|
|
@@ -12001,7 +12072,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
12001
12072
|
if (transform) copy$1(imageMatrix, transform);
|
|
12002
12073
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
12003
12074
|
}
|
|
12004
|
-
const imageCanvas = image.getCanvas(width, height, opacity,
|
|
12075
|
+
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
12005
12076
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
12006
12077
|
paint.style = pattern;
|
|
12007
12078
|
paint.patternId = id;
|
|
@@ -12030,7 +12101,7 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
12030
12101
|
if (drawImage) {
|
|
12031
12102
|
if (data.repeat) {
|
|
12032
12103
|
drawImage = false;
|
|
12033
|
-
} else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp"
|
|
12104
|
+
} else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" || exporting)) {
|
|
12034
12105
|
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
12035
12106
|
}
|
|
12036
12107
|
}
|
|
@@ -12092,6 +12163,7 @@ function recycleImage(attrName, data) {
|
|
|
12092
12163
|
if (!recycleMap) recycleMap = {};
|
|
12093
12164
|
recycleMap[url] = true;
|
|
12094
12165
|
ImageManager.recyclePaint(paint);
|
|
12166
|
+
if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf);
|
|
12095
12167
|
if (image.loading) {
|
|
12096
12168
|
if (!input) {
|
|
12097
12169
|
input = data.__input && data.__input[attrName] || [];
|
|
@@ -12582,7 +12654,7 @@ function createRows(drawData, content, style) {
|
|
|
12582
12654
|
}, row = {
|
|
12583
12655
|
words: []
|
|
12584
12656
|
};
|
|
12585
|
-
|
|
12657
|
+
content = [ ...content ];
|
|
12586
12658
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
12587
12659
|
char = content[i];
|
|
12588
12660
|
if (char === "\n") {
|