@tuya-miniapp/smart-ui 2.8.1-beta-13 → 2.8.1-beta-14
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.
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<view
|
|
28
28
|
id="{{curInstanceId}}"
|
|
29
29
|
bind:touchstart="{{computed.onDragStart(curInstanceId)}}"
|
|
30
|
-
catch:touchmove="{{computed.onDrag(curInstanceId)}}"
|
|
30
|
+
catch:touchmove="{{computed.onDrag(curInstanceId, { maxDragHeight, lockMaxDrag })}}"
|
|
31
31
|
bind:touchend="{{computed.onDragEnd(curInstanceId, { maxDragHeight, minDragHeight, windowHeight, midDragHeight, closeDragHeight })}}"
|
|
32
32
|
tick="{{ts}}"
|
|
33
33
|
change:tick="{{computed.init(curInstanceId, currentHeight)}}"
|
|
@@ -58,7 +58,7 @@ function getEndY(params) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
function onDrag(instanceId) {
|
|
61
|
+
function onDrag(instanceId, data) {
|
|
62
62
|
return function (e, ownerInstance) {
|
|
63
63
|
var delta = e.touches[0].pageY - state[instanceId].startY;
|
|
64
64
|
var contentNode = getContentNode(ownerInstance, instanceId);
|
|
@@ -67,6 +67,10 @@ function onDrag(instanceId) {
|
|
|
67
67
|
state[instanceId].delta = delta;
|
|
68
68
|
|
|
69
69
|
var newHeight = originHeight - delta;
|
|
70
|
+
if (data.lockMaxDrag && data.maxDragHeight) {
|
|
71
|
+
newHeight = Math.min(newHeight, data.maxDragHeight);
|
|
72
|
+
}
|
|
73
|
+
|
|
70
74
|
state[instanceId].newHeight = newHeight;
|
|
71
75
|
|
|
72
76
|
contentNode.setStyle({
|
|
@@ -110,7 +114,7 @@ function onDragEnd(instanceId, data) {
|
|
|
110
114
|
closeDragHeight: closeDragHeight,
|
|
111
115
|
});
|
|
112
116
|
var endHeight = endYRes.value;
|
|
113
|
-
var position = endYRes.position
|
|
117
|
+
var position = endYRes.position;
|
|
114
118
|
var contentNode = getContentNode(ownerInstance, instanceId);
|
|
115
119
|
contentNode.setStyle({
|
|
116
120
|
height: endHeight + 'px',
|
|
@@ -120,7 +124,7 @@ function onDragEnd(instanceId, data) {
|
|
|
120
124
|
contentNode.setStyle({
|
|
121
125
|
transition: 'none',
|
|
122
126
|
});
|
|
123
|
-
ownerInstance.triggerEvent('drag-position', position)
|
|
127
|
+
ownerInstance.triggerEvent('drag-position', position);
|
|
124
128
|
}, 300);
|
|
125
129
|
}
|
|
126
130
|
};
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<view
|
|
28
28
|
id="{{curInstanceId}}"
|
|
29
29
|
bind:touchstart="{{computed.onDragStart(curInstanceId)}}"
|
|
30
|
-
catch:touchmove="{{computed.onDrag(curInstanceId)}}"
|
|
30
|
+
catch:touchmove="{{computed.onDrag(curInstanceId, { maxDragHeight, lockMaxDrag })}}"
|
|
31
31
|
bind:touchend="{{computed.onDragEnd(curInstanceId, { maxDragHeight, minDragHeight, windowHeight, midDragHeight, closeDragHeight })}}"
|
|
32
32
|
tick="{{ts}}"
|
|
33
33
|
change:tick="{{computed.init(curInstanceId, currentHeight)}}"
|
|
@@ -58,7 +58,7 @@ function getEndY(params) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
function onDrag(instanceId) {
|
|
61
|
+
function onDrag(instanceId, data) {
|
|
62
62
|
return function (e, ownerInstance) {
|
|
63
63
|
var delta = e.touches[0].pageY - state[instanceId].startY;
|
|
64
64
|
var contentNode = getContentNode(ownerInstance, instanceId);
|
|
@@ -67,6 +67,10 @@ function onDrag(instanceId) {
|
|
|
67
67
|
state[instanceId].delta = delta;
|
|
68
68
|
|
|
69
69
|
var newHeight = originHeight - delta;
|
|
70
|
+
if (data.lockMaxDrag && data.maxDragHeight) {
|
|
71
|
+
newHeight = Math.min(newHeight, data.maxDragHeight);
|
|
72
|
+
}
|
|
73
|
+
|
|
70
74
|
state[instanceId].newHeight = newHeight;
|
|
71
75
|
|
|
72
76
|
contentNode.setStyle({
|
|
@@ -110,7 +114,7 @@ function onDragEnd(instanceId, data) {
|
|
|
110
114
|
closeDragHeight: closeDragHeight,
|
|
111
115
|
});
|
|
112
116
|
var endHeight = endYRes.value;
|
|
113
|
-
var position = endYRes.position
|
|
117
|
+
var position = endYRes.position;
|
|
114
118
|
var contentNode = getContentNode(ownerInstance, instanceId);
|
|
115
119
|
contentNode.setStyle({
|
|
116
120
|
height: endHeight + 'px',
|
|
@@ -120,7 +124,7 @@ function onDragEnd(instanceId, data) {
|
|
|
120
124
|
contentNode.setStyle({
|
|
121
125
|
transition: 'none',
|
|
122
126
|
});
|
|
123
|
-
ownerInstance.triggerEvent('drag-position', position)
|
|
127
|
+
ownerInstance.triggerEvent('drag-position', position);
|
|
124
128
|
}, 300);
|
|
125
129
|
}
|
|
126
130
|
};
|