@leafer-ui/miniapp 1.0.10 → 1.1.0
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 +12 -0
- package/dist/miniapp.esm.js +12 -0
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.module.js +46 -38
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +10 -10
package/dist/miniapp.module.js
CHANGED
|
@@ -108,7 +108,7 @@ const MathHelper = {
|
|
|
108
108
|
return rotation - oldRotation;
|
|
109
109
|
},
|
|
110
110
|
float(num, maxLength) {
|
|
111
|
-
const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
|
|
111
|
+
const a = maxLength !== undefined ? pow$1(10, maxLength) : 1000000000000;
|
|
112
112
|
num = round(num * a) / a;
|
|
113
113
|
return num === -0 ? 0 : num;
|
|
114
114
|
},
|
|
@@ -4165,20 +4165,17 @@ const LeafHelper = {
|
|
|
4165
4165
|
}
|
|
4166
4166
|
return true;
|
|
4167
4167
|
},
|
|
4168
|
-
moveWorld(t, x, y = 0, isInnerPoint) {
|
|
4168
|
+
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4169
4169
|
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
4170
4170
|
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
|
|
4171
|
-
L.moveLocal(t, local.x, local.y);
|
|
4171
|
+
L.moveLocal(t, local.x, local.y, transition);
|
|
4172
4172
|
},
|
|
4173
|
-
moveLocal(t, x, y = 0) {
|
|
4174
|
-
if (typeof x === 'object')
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
t.x += x;
|
|
4180
|
-
t.y += y;
|
|
4181
|
-
}
|
|
4173
|
+
moveLocal(t, x, y = 0, transition) {
|
|
4174
|
+
if (typeof x === 'object')
|
|
4175
|
+
y = x.y, x = x.x;
|
|
4176
|
+
x += t.x;
|
|
4177
|
+
y += t.y;
|
|
4178
|
+
transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
|
|
4182
4179
|
},
|
|
4183
4180
|
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
4184
4181
|
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
@@ -5558,11 +5555,11 @@ let Leaf = class Leaf {
|
|
|
5558
5555
|
transform(matrix, resize) {
|
|
5559
5556
|
transform(this, matrix, resize);
|
|
5560
5557
|
}
|
|
5561
|
-
move(x, y) {
|
|
5562
|
-
moveLocal(this, x, y);
|
|
5558
|
+
move(x, y, transition) {
|
|
5559
|
+
moveLocal(this, x, y, transition);
|
|
5563
5560
|
}
|
|
5564
|
-
moveInner(x, y) {
|
|
5565
|
-
moveWorld(this, x, y, true);
|
|
5561
|
+
moveInner(x, y, transition) {
|
|
5562
|
+
moveWorld(this, x, y, true, transition);
|
|
5566
5563
|
}
|
|
5567
5564
|
scaleOf(origin, scaleX, scaleY, resize) {
|
|
5568
5565
|
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
|
|
@@ -5576,8 +5573,8 @@ let Leaf = class Leaf {
|
|
|
5576
5573
|
transformWorld(worldTransform, resize) {
|
|
5577
5574
|
transformWorld(this, worldTransform, resize);
|
|
5578
5575
|
}
|
|
5579
|
-
moveWorld(x, y) {
|
|
5580
|
-
moveWorld(this, x, y);
|
|
5576
|
+
moveWorld(x, y, transition) {
|
|
5577
|
+
moveWorld(this, x, y, false, transition);
|
|
5581
5578
|
}
|
|
5582
5579
|
scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
|
|
5583
5580
|
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
|
|
@@ -5975,7 +5972,7 @@ class LeafLevelList {
|
|
|
5975
5972
|
}
|
|
5976
5973
|
}
|
|
5977
5974
|
|
|
5978
|
-
const version = "1.0
|
|
5975
|
+
const version = "1.1.0";
|
|
5979
5976
|
|
|
5980
5977
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5981
5978
|
get allowBackgroundColor() { return false; }
|
|
@@ -7545,11 +7542,15 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7545
7542
|
super(data);
|
|
7546
7543
|
}
|
|
7547
7544
|
reset(_data) { }
|
|
7548
|
-
set(data,
|
|
7549
|
-
if (
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7545
|
+
set(data, transition) {
|
|
7546
|
+
if (transition) {
|
|
7547
|
+
if (transition === 'temp') {
|
|
7548
|
+
this.lockNormalStyle = true;
|
|
7549
|
+
Object.assign(this, data);
|
|
7550
|
+
this.lockNormalStyle = false;
|
|
7551
|
+
}
|
|
7552
|
+
else
|
|
7553
|
+
this.animate(data, transition);
|
|
7553
7554
|
}
|
|
7554
7555
|
else
|
|
7555
7556
|
Object.assign(this, data);
|
|
@@ -7859,17 +7860,17 @@ let Group = class Group extends UI {
|
|
|
7859
7860
|
if (!this.children)
|
|
7860
7861
|
this.children = [];
|
|
7861
7862
|
}
|
|
7862
|
-
set(data,
|
|
7863
|
+
set(data, transition) {
|
|
7863
7864
|
if (data.children) {
|
|
7864
7865
|
const { children } = data;
|
|
7865
7866
|
delete data.children;
|
|
7866
7867
|
this.children ? this.clear() : this.__setBranch();
|
|
7867
|
-
super.set(data,
|
|
7868
|
+
super.set(data, transition);
|
|
7868
7869
|
children.forEach(child => this.add(child));
|
|
7869
7870
|
data.children = children;
|
|
7870
7871
|
}
|
|
7871
7872
|
else
|
|
7872
|
-
super.set(data,
|
|
7873
|
+
super.set(data, transition);
|
|
7873
7874
|
}
|
|
7874
7875
|
toJSON(options) {
|
|
7875
7876
|
const data = super.toJSON(options);
|
|
@@ -7982,8 +7983,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7982
7983
|
}
|
|
7983
7984
|
onInit() { }
|
|
7984
7985
|
initType(_type) { }
|
|
7985
|
-
set(data) {
|
|
7986
|
-
this.waitInit(() => { super.set(data); });
|
|
7986
|
+
set(data, transition) {
|
|
7987
|
+
this.waitInit(() => { super.set(data, transition); });
|
|
7987
7988
|
}
|
|
7988
7989
|
start() {
|
|
7989
7990
|
clearTimeout(this.__startTimer);
|
|
@@ -9172,10 +9173,8 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9172
9173
|
this.data = data;
|
|
9173
9174
|
}
|
|
9174
9175
|
static getValidMove(leaf, start, total) {
|
|
9175
|
-
const { draggable, dragBounds
|
|
9176
|
-
|
|
9177
|
-
move.x += start.x - x;
|
|
9178
|
-
move.y += start.y - y;
|
|
9176
|
+
const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
|
|
9177
|
+
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9179
9178
|
if (dragBounds)
|
|
9180
9179
|
this.getMoveInDragBounds(leaf.__local, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9181
9180
|
if (draggable === 'x')
|
|
@@ -9185,8 +9184,7 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9185
9184
|
return move;
|
|
9186
9185
|
}
|
|
9187
9186
|
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9188
|
-
const x = childBox.x + move.x, y = childBox.y + move.y;
|
|
9189
|
-
const right = x + childBox.width, bottom = y + childBox.height;
|
|
9187
|
+
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9190
9188
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9191
9189
|
if (!change)
|
|
9192
9190
|
move = Object.assign({}, move);
|
|
@@ -9238,9 +9236,7 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9238
9236
|
return this.getLocalMove(relative, true);
|
|
9239
9237
|
}
|
|
9240
9238
|
getPageBounds() {
|
|
9241
|
-
const total = this.getPageTotal();
|
|
9242
|
-
const start = this.getPagePoint();
|
|
9243
|
-
const bounds = {};
|
|
9239
|
+
const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
|
|
9244
9240
|
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9245
9241
|
BoundsHelper.unsign(bounds);
|
|
9246
9242
|
return bounds;
|
|
@@ -10733,6 +10729,8 @@ function stroke(stroke, ui, canvas) {
|
|
|
10733
10729
|
case 'center':
|
|
10734
10730
|
canvas.setStroke(stroke, __strokeWidth, options);
|
|
10735
10731
|
canvas.stroke();
|
|
10732
|
+
if (options.__useArrow)
|
|
10733
|
+
strokeArrow(ui, canvas);
|
|
10736
10734
|
break;
|
|
10737
10735
|
case 'inside':
|
|
10738
10736
|
canvas.save();
|
|
@@ -10770,6 +10768,8 @@ function strokes(strokes, ui, canvas) {
|
|
|
10770
10768
|
case 'center':
|
|
10771
10769
|
canvas.setStroke(undefined, __strokeWidth, options);
|
|
10772
10770
|
drawStrokesStyle(strokes, false, ui, canvas);
|
|
10771
|
+
if (options.__useArrow)
|
|
10772
|
+
strokeArrow(ui, canvas);
|
|
10773
10773
|
break;
|
|
10774
10774
|
case 'inside':
|
|
10775
10775
|
canvas.save();
|
|
@@ -10795,6 +10795,14 @@ function strokes(strokes, ui, canvas) {
|
|
|
10795
10795
|
}
|
|
10796
10796
|
}
|
|
10797
10797
|
}
|
|
10798
|
+
function strokeArrow(ui, canvas) {
|
|
10799
|
+
if (ui.__.dashPattern) {
|
|
10800
|
+
canvas.beginPath();
|
|
10801
|
+
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
10802
|
+
canvas.dashPattern = null;
|
|
10803
|
+
canvas.stroke();
|
|
10804
|
+
}
|
|
10805
|
+
}
|
|
10798
10806
|
|
|
10799
10807
|
const { getSpread, getOuterOf, getByMove, getIntersectData } = BoundsHelper;
|
|
10800
10808
|
function shape(ui, current, options) {
|