@leafer/miniapp 2.1.7 → 2.1.8
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.module.js +53 -34
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +25 -25
package/dist/miniapp.module.js
CHANGED
|
@@ -913,12 +913,12 @@ class Point {
|
|
|
913
913
|
PointHelper.scaleOf(this, origin, scaleX, scaleY);
|
|
914
914
|
return this;
|
|
915
915
|
}
|
|
916
|
-
rotate(rotation, origin) {
|
|
917
|
-
PointHelper.rotate(this, rotation, origin);
|
|
916
|
+
rotate(rotation, origin, radiusX, radiusY) {
|
|
917
|
+
PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
|
|
918
918
|
return this;
|
|
919
919
|
}
|
|
920
|
-
rotateOf(origin, rotation) {
|
|
921
|
-
PointHelper.rotate(this, rotation, origin);
|
|
920
|
+
rotateOf(origin, rotation, radiusX, radiusY) {
|
|
921
|
+
PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
|
|
922
922
|
return this;
|
|
923
923
|
}
|
|
924
924
|
getRotation(origin, to, toOrigin) {
|
|
@@ -941,11 +941,11 @@ class Point {
|
|
|
941
941
|
getDistancePoint(to, distance, changeTo, fromTo) {
|
|
942
942
|
return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo, fromTo));
|
|
943
943
|
}
|
|
944
|
-
getAngle(to) {
|
|
945
|
-
return PointHelper.getAngle(this, to);
|
|
944
|
+
getAngle(to, radiusX, radiusY) {
|
|
945
|
+
return PointHelper.getAngle(this, to, radiusX, radiusY);
|
|
946
946
|
}
|
|
947
|
-
getAtan2(to) {
|
|
948
|
-
return PointHelper.getAtan2(this, to);
|
|
947
|
+
getAtan2(to, radiusX, radiusY) {
|
|
948
|
+
return PointHelper.getAtan2(this, to, radiusX, radiusY);
|
|
949
949
|
}
|
|
950
950
|
isSame(point, quick) {
|
|
951
951
|
return PointHelper.isSame(this, point, quick);
|
|
@@ -4586,7 +4586,9 @@ function sortType(defaultValue) {
|
|
|
4586
4586
|
set(value) {
|
|
4587
4587
|
if (this.__setAttr(key, value)) {
|
|
4588
4588
|
this.waitParent(() => {
|
|
4589
|
-
this
|
|
4589
|
+
const {parent: parent} = this;
|
|
4590
|
+
parent.__layout.childrenSortChange();
|
|
4591
|
+
if (parent.__.flow) parent.__layout.boxChange();
|
|
4590
4592
|
});
|
|
4591
4593
|
}
|
|
4592
4594
|
}
|
|
@@ -4988,7 +4990,7 @@ const LeafHelper = {
|
|
|
4988
4990
|
p = p.parent;
|
|
4989
4991
|
}
|
|
4990
4992
|
},
|
|
4991
|
-
animateMove(t, move, speed = .3) {
|
|
4993
|
+
animateMove(t, move, speed = .3, onAnimate) {
|
|
4992
4994
|
if (!move.x && !move.y) return;
|
|
4993
4995
|
if (Math.abs(move.x) < 1 && Math.abs(move.y) < 1) {
|
|
4994
4996
|
t.move(move);
|
|
@@ -4996,8 +4998,9 @@ const LeafHelper = {
|
|
|
4996
4998
|
const x = move.x * speed, y = move.y * speed;
|
|
4997
4999
|
move.x -= x, move.y -= y;
|
|
4998
5000
|
t.move(x, y);
|
|
4999
|
-
Platform.requestRender(() => L$5.animateMove(t, move, speed));
|
|
5001
|
+
Platform.requestRender(() => L$5.animateMove(t, move, speed, onAnimate));
|
|
5000
5002
|
}
|
|
5003
|
+
onAnimate && onAnimate();
|
|
5001
5004
|
}
|
|
5002
5005
|
};
|
|
5003
5006
|
|
|
@@ -6169,6 +6172,7 @@ const LeafBounds = {
|
|
|
6169
6172
|
if (this.isBranch) {
|
|
6170
6173
|
this.__extraUpdate();
|
|
6171
6174
|
if (this.__.flow) {
|
|
6175
|
+
if (this.__layout.childrenSortChanged) this.__updateSortChildren();
|
|
6172
6176
|
if (this.__layout.boxChanged) this.__updateFlowLayout();
|
|
6173
6177
|
updateAllMatrix$3(this);
|
|
6174
6178
|
updateBounds$2(this, this);
|
|
@@ -6240,11 +6244,7 @@ const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper, {hasSize:
|
|
|
6240
6244
|
|
|
6241
6245
|
const BranchRender = {
|
|
6242
6246
|
__updateChange() {
|
|
6243
|
-
|
|
6244
|
-
if (layout.childrenSortChanged) {
|
|
6245
|
-
this.__updateSortChildren();
|
|
6246
|
-
layout.childrenSortChanged = false;
|
|
6247
|
-
}
|
|
6247
|
+
if (this.__layout.childrenSortChanged) this.__updateSortChildren();
|
|
6248
6248
|
this.__.__checkSingle();
|
|
6249
6249
|
},
|
|
6250
6250
|
__render(canvas, options) {
|
|
@@ -6748,6 +6748,7 @@ let Branch = class Branch extends Leaf {
|
|
|
6748
6748
|
children.sort(sort);
|
|
6749
6749
|
this.__layout.affectChildrenSort = affectSort;
|
|
6750
6750
|
}
|
|
6751
|
+
this.__layout.childrenSortChanged = false;
|
|
6751
6752
|
}
|
|
6752
6753
|
add(child, index) {
|
|
6753
6754
|
if (child === this || child.destroyed) return debug$8.warn("add self or destroyed");
|
|
@@ -6983,7 +6984,7 @@ class LeafLevelList {
|
|
|
6983
6984
|
}
|
|
6984
6985
|
}
|
|
6985
6986
|
|
|
6986
|
-
const version = "2.1.
|
|
6987
|
+
const version = "2.1.8";
|
|
6987
6988
|
|
|
6988
6989
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6989
6990
|
get allowBackgroundColor() {
|
|
@@ -9513,7 +9514,10 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9513
9514
|
ellipse$1(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
|
|
9514
9515
|
} else {
|
|
9515
9516
|
if (hasAngle) {
|
|
9516
|
-
if (!closedAngle)
|
|
9517
|
+
if (!closedAngle) {
|
|
9518
|
+
if (!closed) open = true;
|
|
9519
|
+
if (!open) moveTo$3(path, rx, ry);
|
|
9520
|
+
}
|
|
9517
9521
|
ellipse$1(path, rx, ry, rx, ry, 0, startAngle, endAngle);
|
|
9518
9522
|
} else {
|
|
9519
9523
|
ellipse$1(path, rx, ry, rx, ry);
|
|
@@ -10191,8 +10195,8 @@ const DragBoundsHelper = {
|
|
|
10191
10195
|
if (!change) scale = Object.assign({}, scale);
|
|
10192
10196
|
tempDragBounds.set(dragBounds);
|
|
10193
10197
|
tempContent.set(content).scaleOf(origin, scale.x, scale.y);
|
|
10194
|
-
const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
|
|
10195
|
-
const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
|
|
10198
|
+
const originLeftScale = float$3((origin.x - content.x) / content.width), originRightScale = float$3(1 - originLeftScale);
|
|
10199
|
+
const originTopScale = float$3((origin.y - content.y) / content.height), originBottomScale = float$3(1 - originTopScale);
|
|
10196
10200
|
let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
|
|
10197
10201
|
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
10198
10202
|
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
@@ -10203,7 +10207,13 @@ const DragBoundsHelper = {
|
|
|
10203
10207
|
correctScaleX *= max$3(aScale, bScale);
|
|
10204
10208
|
} else {
|
|
10205
10209
|
if (scale.x < 0) {
|
|
10206
|
-
if (float$3(minX(content) - minX(dragBounds)) <= 0 || float$3(maxX(dragBounds) - maxX(content)) <= 0)
|
|
10210
|
+
if (float$3(minX(content) - minX(dragBounds), 2) <= 0 || float$3(maxX(dragBounds) - maxX(content), 2) <= 0) {
|
|
10211
|
+
tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
10212
|
+
if (tempContent.width > 1) {
|
|
10213
|
+
correctScaleX *= 1 / tempContent.width;
|
|
10214
|
+
tempContent.width = 1;
|
|
10215
|
+
}
|
|
10216
|
+
}
|
|
10207
10217
|
tempContent.unsign();
|
|
10208
10218
|
}
|
|
10209
10219
|
aSize = float$3(tempDragBounds.minX - tempContent.minX);
|
|
@@ -10226,7 +10236,13 @@ const DragBoundsHelper = {
|
|
|
10226
10236
|
}
|
|
10227
10237
|
} else {
|
|
10228
10238
|
if (scale.y < 0) {
|
|
10229
|
-
if (float$3(minY(content) - minY(dragBounds)) <= 0 || float$3(maxY(dragBounds) - maxY(content)) <= 0)
|
|
10239
|
+
if (float$3(minY(content) - minY(dragBounds), 2) <= 0 || float$3(maxY(dragBounds) - maxY(content), 2) <= 0) {
|
|
10240
|
+
tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
10241
|
+
if (tempContent.height > 1) {
|
|
10242
|
+
correctScaleY *= 1 / tempContent.height;
|
|
10243
|
+
tempContent.height = 1;
|
|
10244
|
+
}
|
|
10245
|
+
}
|
|
10230
10246
|
tempContent.unsign();
|
|
10231
10247
|
}
|
|
10232
10248
|
aSize = float$3(tempDragBounds.minY - tempContent.minY);
|
|
@@ -10357,6 +10373,8 @@ DragEvent.ENTER = "drag.enter";
|
|
|
10357
10373
|
|
|
10358
10374
|
DragEvent.LEAVE = "drag.leave";
|
|
10359
10375
|
|
|
10376
|
+
DragEvent.ANIMATE = "drag.animate";
|
|
10377
|
+
|
|
10360
10378
|
DragEvent = __decorate([ registerUIEvent() ], DragEvent);
|
|
10361
10379
|
|
|
10362
10380
|
const MyDragEvent = DragEvent;
|
|
@@ -10611,7 +10629,7 @@ class Dragger {
|
|
|
10611
10629
|
x: totalX,
|
|
10612
10630
|
y: totalY
|
|
10613
10631
|
}, checkLimitMove || axisDrag);
|
|
10614
|
-
if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
|
|
10632
|
+
if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3, () => leaf.emit(DragEvent.ANIMATE)); else leaf.move(move);
|
|
10615
10633
|
}
|
|
10616
10634
|
});
|
|
10617
10635
|
}
|
|
@@ -14833,10 +14851,11 @@ const registerInnerEditor = registerEditTool;
|
|
|
14833
14851
|
|
|
14834
14852
|
const EditToolCreator = {
|
|
14835
14853
|
list: {},
|
|
14836
|
-
register(EditTool) {
|
|
14854
|
+
register(EditTool, name) {
|
|
14837
14855
|
const {tag: tag} = EditTool.prototype;
|
|
14838
|
-
|
|
14839
|
-
list$1[
|
|
14856
|
+
name || (name = tag);
|
|
14857
|
+
list$1[name] && debug$2.repeat(name);
|
|
14858
|
+
list$1[name] = EditTool;
|
|
14840
14859
|
},
|
|
14841
14860
|
get(tag, editor) {
|
|
14842
14861
|
return new list$1[tag](editor);
|
|
@@ -15651,8 +15670,8 @@ class InnerEditor {
|
|
|
15651
15670
|
}
|
|
15652
15671
|
|
|
15653
15672
|
let EditTool = class EditTool extends InnerEditor {
|
|
15654
|
-
static registerEditTool() {
|
|
15655
|
-
EditToolCreator.register(this);
|
|
15673
|
+
static registerEditTool(name) {
|
|
15674
|
+
EditToolCreator.register(this, name);
|
|
15656
15675
|
}
|
|
15657
15676
|
get tag() {
|
|
15658
15677
|
return "EditTool";
|
|
@@ -16018,14 +16037,14 @@ leaf.__scaleResize = function(scaleX, scaleY) {
|
|
|
16018
16037
|
scaleResize(this, scaleX, scaleY);
|
|
16019
16038
|
};
|
|
16020
16039
|
|
|
16021
|
-
leaf.resizeWidth = function(width) {
|
|
16022
|
-
const scale = width / this.getBounds("box",
|
|
16023
|
-
this.scaleOf(
|
|
16040
|
+
leaf.resizeWidth = function(width, relative = "inner") {
|
|
16041
|
+
const scale = width / this.getBounds("box", relative).width || 1;
|
|
16042
|
+
this.scaleOf("top-left", scale, this.__.lockRatio ? scale : 1, true);
|
|
16024
16043
|
};
|
|
16025
16044
|
|
|
16026
|
-
leaf.resizeHeight = function(height) {
|
|
16027
|
-
const scale = height / this.getBounds("box",
|
|
16028
|
-
this.scaleOf(
|
|
16045
|
+
leaf.resizeHeight = function(height, relative = "inner") {
|
|
16046
|
+
const scale = height / this.getBounds("box", relative).height || 1;
|
|
16047
|
+
this.scaleOf("top-left", this.__.lockRatio ? scale : 1, scale, true);
|
|
16029
16048
|
};
|
|
16030
16049
|
|
|
16031
16050
|
Text.prototype.__scaleResize = function(scaleX, scaleY) {
|