@leafer-draw/miniapp 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/miniapp.cjs +8 -6
- package/dist/miniapp.esm.js +8 -6
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +119 -55
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +7 -7
package/dist/miniapp.module.js
CHANGED
|
@@ -213,6 +213,7 @@ class LeafData {
|
|
|
213
213
|
}
|
|
214
214
|
destroy() {
|
|
215
215
|
this.__input = this.__middle = null;
|
|
216
|
+
if (this.__complexData) this.__complexData.destroy();
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
|
|
@@ -311,6 +312,8 @@ const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumbe
|
|
|
311
312
|
|
|
312
313
|
const {round: round$3, pow: pow$1, max: max$3, floor: floor$2, PI: PI$3} = Math;
|
|
313
314
|
|
|
315
|
+
const tempScaleData$1 = {};
|
|
316
|
+
|
|
314
317
|
const MathHelper = {
|
|
315
318
|
within(value, min, max) {
|
|
316
319
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -354,6 +357,24 @@ const MathHelper = {
|
|
|
354
357
|
} else if (scale) MathHelper.assignScale(scaleData, scale);
|
|
355
358
|
return scaleData;
|
|
356
359
|
},
|
|
360
|
+
getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
|
|
361
|
+
let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
|
|
362
|
+
if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
|
|
363
|
+
if (scaleFixed) {
|
|
364
|
+
if (scaleFixed === true) {
|
|
365
|
+
scaleX = scaleY = unscale ? 1 : 1 / scaleX;
|
|
366
|
+
} else {
|
|
367
|
+
let minScale;
|
|
368
|
+
if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
|
|
369
|
+
if (minScale) {
|
|
370
|
+
if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
tempScaleData$1.scaleX = scaleX;
|
|
375
|
+
tempScaleData$1.scaleY = scaleY;
|
|
376
|
+
return tempScaleData$1;
|
|
377
|
+
},
|
|
357
378
|
assignScale(scaleData, scale) {
|
|
358
379
|
if (isNumber(scale)) {
|
|
359
380
|
scaleData.scaleX = scaleData.scaleY = scale;
|
|
@@ -850,8 +871,8 @@ const PointHelper = {
|
|
|
850
871
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
851
872
|
return points;
|
|
852
873
|
},
|
|
853
|
-
isSame(t, point) {
|
|
854
|
-
return float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
874
|
+
isSame(t, point, quick) {
|
|
875
|
+
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);
|
|
855
876
|
},
|
|
856
877
|
reset(t) {
|
|
857
878
|
P$5.reset(t);
|
|
@@ -926,8 +947,8 @@ class Point {
|
|
|
926
947
|
getAtan2(to) {
|
|
927
948
|
return PointHelper.getAtan2(this, to);
|
|
928
949
|
}
|
|
929
|
-
isSame(point) {
|
|
930
|
-
return PointHelper.isSame(this, point);
|
|
950
|
+
isSame(point, quick) {
|
|
951
|
+
return PointHelper.isSame(this, point, quick);
|
|
931
952
|
}
|
|
932
953
|
reset() {
|
|
933
954
|
PointHelper.reset(this);
|
|
@@ -1183,9 +1204,9 @@ const AroundHelper = {
|
|
|
1183
1204
|
}
|
|
1184
1205
|
if (!onlyBoxSize) to.x += box.x, to.y += box.y;
|
|
1185
1206
|
},
|
|
1186
|
-
getPoint(around, box, to) {
|
|
1207
|
+
getPoint(around, box, to, onlyBoxSize = true) {
|
|
1187
1208
|
if (!to) to = {};
|
|
1188
|
-
AroundHelper.toPoint(around, box, to,
|
|
1209
|
+
AroundHelper.toPoint(around, box, to, onlyBoxSize);
|
|
1189
1210
|
return to;
|
|
1190
1211
|
}
|
|
1191
1212
|
};
|
|
@@ -1452,6 +1473,9 @@ const BoundsHelper = {
|
|
|
1452
1473
|
y: y + height
|
|
1453
1474
|
} ];
|
|
1454
1475
|
},
|
|
1476
|
+
getPoint(t, around, onlyBoxSize = false, to) {
|
|
1477
|
+
return AroundHelper.getPoint(around, t, to, onlyBoxSize);
|
|
1478
|
+
},
|
|
1455
1479
|
hitRadiusPoint(t, point, pointMatrix) {
|
|
1456
1480
|
if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
|
|
1457
1481
|
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);
|
|
@@ -1623,6 +1647,9 @@ class Bounds {
|
|
|
1623
1647
|
getPoints() {
|
|
1624
1648
|
return BoundsHelper.getPoints(this);
|
|
1625
1649
|
}
|
|
1650
|
+
getPoint(around, onlyBoxSize, to) {
|
|
1651
|
+
return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
|
|
1652
|
+
}
|
|
1626
1653
|
hitPoint(point, pointMatrix) {
|
|
1627
1654
|
return BoundsHelper.hitPoint(this, point, pointMatrix);
|
|
1628
1655
|
}
|
|
@@ -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, relative.scrollWorldTransform);
|
|
4897
4931
|
return temp ? matrix : Object.assign({}, matrix);
|
|
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() {
|
|
@@ -7848,7 +7888,9 @@ function effectType(defaultValue) {
|
|
|
7848
7888
|
set(value) {
|
|
7849
7889
|
this.__setAttr(key, value);
|
|
7850
7890
|
if (value) this.__.__useEffect = true;
|
|
7851
|
-
|
|
7891
|
+
const layout = this.__layout;
|
|
7892
|
+
layout.renderChanged || layout.renderChange();
|
|
7893
|
+
layout.surfaceChange();
|
|
7852
7894
|
}
|
|
7853
7895
|
}));
|
|
7854
7896
|
}
|
|
@@ -8062,15 +8104,16 @@ class UIData extends LeafData {
|
|
|
8062
8104
|
this.__needComputePaint = undefined;
|
|
8063
8105
|
}
|
|
8064
8106
|
__getRealStrokeWidth(childStyle) {
|
|
8065
|
-
let {strokeWidth: strokeWidth,
|
|
8107
|
+
let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
|
|
8066
8108
|
if (childStyle) {
|
|
8067
8109
|
if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
|
|
8068
|
-
if (!isUndefined(childStyle.
|
|
8110
|
+
if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
|
|
8069
8111
|
}
|
|
8070
|
-
if (
|
|
8071
|
-
const
|
|
8072
|
-
|
|
8073
|
-
}
|
|
8112
|
+
if (strokeScaleFixed) {
|
|
8113
|
+
const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
|
|
8114
|
+
if (scaleX !== 1) return strokeWidth * scaleX;
|
|
8115
|
+
}
|
|
8116
|
+
return strokeWidth;
|
|
8074
8117
|
}
|
|
8075
8118
|
__setPaint(attrName, value) {
|
|
8076
8119
|
this.__setInput(attrName, value);
|
|
@@ -8152,7 +8195,11 @@ class EllipseData extends UIData {
|
|
|
8152
8195
|
|
|
8153
8196
|
class PolygonData extends LineData {}
|
|
8154
8197
|
|
|
8155
|
-
class StarData extends UIData {
|
|
8198
|
+
class StarData extends UIData {
|
|
8199
|
+
get __boxStroke() {
|
|
8200
|
+
return !this.__pathInputed;
|
|
8201
|
+
}
|
|
8202
|
+
}
|
|
8156
8203
|
|
|
8157
8204
|
class PathData extends UIData {
|
|
8158
8205
|
get __pathInputed() {
|
|
@@ -8256,7 +8303,7 @@ const UIBounds = {
|
|
|
8256
8303
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
8257
8304
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
8258
8305
|
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
8259
|
-
if (!data.__boxStroke) {
|
|
8306
|
+
if (!data.__boxStroke || data.__useArrow) {
|
|
8260
8307
|
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
8261
8308
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
8262
8309
|
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
@@ -8413,6 +8460,12 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8413
8460
|
get isFrame() {
|
|
8414
8461
|
return false;
|
|
8415
8462
|
}
|
|
8463
|
+
set strokeWidthFixed(value) {
|
|
8464
|
+
this.strokeScaleFixed = value;
|
|
8465
|
+
}
|
|
8466
|
+
get strokeWidthFixed() {
|
|
8467
|
+
return this.strokeScaleFixed;
|
|
8468
|
+
}
|
|
8416
8469
|
set scale(value) {
|
|
8417
8470
|
MathHelper.assignScale(this, value);
|
|
8418
8471
|
}
|
|
@@ -8468,6 +8521,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8468
8521
|
getPathString(curve, pathForRender, floatLength) {
|
|
8469
8522
|
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
8470
8523
|
}
|
|
8524
|
+
asPath(curve, pathForRender) {
|
|
8525
|
+
this.path = this.getPath(curve, pathForRender);
|
|
8526
|
+
}
|
|
8471
8527
|
load() {
|
|
8472
8528
|
this.__.__computePaint();
|
|
8473
8529
|
}
|
|
@@ -8477,16 +8533,18 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8477
8533
|
data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
|
|
8478
8534
|
}
|
|
8479
8535
|
}
|
|
8480
|
-
__updateRenderPath() {
|
|
8536
|
+
__updateRenderPath(updateCache) {
|
|
8481
8537
|
const data = this.__;
|
|
8482
8538
|
if (data.path) {
|
|
8483
8539
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8484
|
-
if (data.__useArrow) PathArrow.addArrows(this);
|
|
8540
|
+
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
8485
8541
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8486
8542
|
}
|
|
8487
8543
|
__drawRenderPath(canvas) {
|
|
8544
|
+
const data = this.__;
|
|
8488
8545
|
canvas.beginPath();
|
|
8489
|
-
|
|
8546
|
+
if (data.__useArrow) PathArrow.updateArrow(this);
|
|
8547
|
+
this.__drawPathByData(canvas, data.__pathForRender);
|
|
8490
8548
|
}
|
|
8491
8549
|
__drawPath(canvas) {
|
|
8492
8550
|
canvas.beginPath();
|
|
@@ -8535,6 +8593,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8535
8593
|
static setEditOuter(_toolName) {}
|
|
8536
8594
|
static setEditInner(_editorName) {}
|
|
8537
8595
|
destroy() {
|
|
8596
|
+
this.__.__willDestroy = true;
|
|
8538
8597
|
this.fill = this.stroke = null;
|
|
8539
8598
|
if (this.__animate) this.killAnimate();
|
|
8540
8599
|
super.destroy();
|
|
@@ -8651,7 +8710,7 @@ __decorate([ strokeType("inside") ], UI.prototype, "strokeAlign", void 0);
|
|
|
8651
8710
|
|
|
8652
8711
|
__decorate([ strokeType(1, true) ], UI.prototype, "strokeWidth", void 0);
|
|
8653
8712
|
|
|
8654
|
-
__decorate([ strokeType(false) ], UI.prototype, "
|
|
8713
|
+
__decorate([ strokeType(false) ], UI.prototype, "strokeScaleFixed", void 0);
|
|
8655
8714
|
|
|
8656
8715
|
__decorate([ strokeType("none") ], UI.prototype, "strokeCap", void 0);
|
|
8657
8716
|
|
|
@@ -9152,6 +9211,9 @@ let Box = class Box extends Group {
|
|
|
9152
9211
|
get isBranchLeaf() {
|
|
9153
9212
|
return true;
|
|
9154
9213
|
}
|
|
9214
|
+
get __useSelfBox() {
|
|
9215
|
+
return this.pathInputed;
|
|
9216
|
+
}
|
|
9155
9217
|
constructor(data) {
|
|
9156
9218
|
super(data);
|
|
9157
9219
|
this.__layout.renderChanged || this.__layout.renderChange();
|
|
@@ -9167,7 +9229,7 @@ let Box = class Box extends Group {
|
|
|
9167
9229
|
}
|
|
9168
9230
|
__updateRectBoxBounds() {}
|
|
9169
9231
|
__updateBoxBounds(_secondLayout) {
|
|
9170
|
-
if (this.children.length && !this.
|
|
9232
|
+
if (this.children.length && !this.__useSelfBox) {
|
|
9171
9233
|
const data = this.__;
|
|
9172
9234
|
if (data.__autoSide) {
|
|
9173
9235
|
if (data.__hasSurface) this.__extraUpdate();
|
|
@@ -9283,9 +9345,9 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9283
9345
|
return "Ellipse";
|
|
9284
9346
|
}
|
|
9285
9347
|
__updatePath() {
|
|
9286
|
-
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} =
|
|
9348
|
+
const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
|
|
9287
9349
|
const rx = width / 2, ry = height / 2;
|
|
9288
|
-
const path =
|
|
9350
|
+
const path = data.path = [];
|
|
9289
9351
|
let open;
|
|
9290
9352
|
if (innerRadius) {
|
|
9291
9353
|
if (startAngle || endAngle) {
|
|
@@ -9307,7 +9369,7 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9307
9369
|
}
|
|
9308
9370
|
}
|
|
9309
9371
|
if (!open) closePath$2(path);
|
|
9310
|
-
if (Platform.ellipseToCurve)
|
|
9372
|
+
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
9311
9373
|
}
|
|
9312
9374
|
};
|
|
9313
9375
|
|
|
@@ -9782,8 +9844,8 @@ function fills(fills, ui, canvas, renderOptions) {
|
|
|
9782
9844
|
canvas.save();
|
|
9783
9845
|
if (item.transform) canvas.transform(item.transform);
|
|
9784
9846
|
if (originPaint.scaleFixed) {
|
|
9785
|
-
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
9786
|
-
if (
|
|
9847
|
+
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, originPaint.scaleFixed, false);
|
|
9848
|
+
if (scaleX !== 1) canvas.scale(scaleX, scaleY);
|
|
9787
9849
|
}
|
|
9788
9850
|
if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
|
|
9789
9851
|
fillPathOrText(ui, canvas, renderOptions);
|
|
@@ -10204,6 +10266,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
10204
10266
|
const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
|
|
10205
10267
|
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
10206
10268
|
}
|
|
10269
|
+
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
10207
10270
|
return true;
|
|
10208
10271
|
}
|
|
10209
10272
|
|
|
@@ -10431,7 +10494,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
10431
10494
|
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
10432
10495
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
10433
10496
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
10434
|
-
const {image: image, data: data} = paint, {opacity: opacity
|
|
10497
|
+
const {image: image, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
10435
10498
|
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
10436
10499
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
10437
10500
|
width *= scaleX;
|
|
@@ -10447,7 +10510,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
10447
10510
|
if (transform) copy$1(imageMatrix, transform);
|
|
10448
10511
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10449
10512
|
}
|
|
10450
|
-
const imageCanvas = image.getCanvas(width, height, opacity,
|
|
10513
|
+
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
10451
10514
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
10452
10515
|
paint.style = pattern;
|
|
10453
10516
|
paint.patternId = id;
|
|
@@ -10476,7 +10539,7 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
10476
10539
|
if (drawImage) {
|
|
10477
10540
|
if (data.repeat) {
|
|
10478
10541
|
drawImage = false;
|
|
10479
|
-
} else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp"
|
|
10542
|
+
} else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" || exporting)) {
|
|
10480
10543
|
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
10481
10544
|
}
|
|
10482
10545
|
}
|
|
@@ -10538,6 +10601,7 @@ function recycleImage(attrName, data) {
|
|
|
10538
10601
|
if (!recycleMap) recycleMap = {};
|
|
10539
10602
|
recycleMap[url] = true;
|
|
10540
10603
|
ImageManager.recyclePaint(paint);
|
|
10604
|
+
if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf);
|
|
10541
10605
|
if (image.loading) {
|
|
10542
10606
|
if (!input) {
|
|
10543
10607
|
input = data.__input && data.__input[attrName] || [];
|
|
@@ -11028,7 +11092,7 @@ function createRows(drawData, content, style) {
|
|
|
11028
11092
|
}, row = {
|
|
11029
11093
|
words: []
|
|
11030
11094
|
};
|
|
11031
|
-
|
|
11095
|
+
content = [ ...content ];
|
|
11032
11096
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
11033
11097
|
char = content[i];
|
|
11034
11098
|
if (char === "\n") {
|