[vlc-devel] [PATCH] luahttp: Don't interfere while the user is dragging
Edward Wang
edward.c.wang at compdigitec.com
Fri May 25 00:18:02 CEST 2012
The updateStatus() function should not interrupt the user and reset his position while he is dragging the volume slider.
Close #6652
---
If possible, a backport to vlc-2.0 is also appreciated.
share/lua/http/js/controlers.js | 9 ++++++---
share/lua/http/js/ui.js | 7 +++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/share/lua/http/js/controlers.js b/share/lua/http/js/controlers.js
index 2425ffe..c80be38 100644
--- a/share/lua/http/js/controlers.js
+++ b/share/lua/http/js/controlers.js
@@ -21,9 +21,12 @@ function updateStatus() {
value: toFloat($('position', data).text()) * 100
});
$('#currentVolume').append(Math.round($('volume', data).text() / 2.56) + '%');
- $('#volumeSlider').slider({
- value: ($('volume', data).text() / 5.12)
- });
+ /* Don't interfere with the user's action */
+ if (!$('#volumeSlider').data('clicked')) {
+ $('#volumeSlider').slider({
+ value: ($('volume', data).text() / 5.12)
+ });
+ }
$('#rateSlider').slider({
value: ($('rate', data).text())
});
diff --git a/share/lua/http/js/ui.js b/share/lua/http/js/ui.js
index 831f79c..3ba9e28 100644
--- a/share/lua/http/js/ui.js
+++ b/share/lua/http/js/ui.js
@@ -24,14 +24,21 @@ $(function () {
value: 50,
min: 0,
max: 100,
+ start: function (event, ui) {
+ $("#volumeSlider").data( 'clicked', true );
+ },
stop: function (event, ui) {
$("#currentVolume").empty().append(ui.value * 2 + "%");
sendCommand({
'command': 'volume',
'val': Math.round(ui.value * 5.12)
})
+ $("#volumeSlider").data( 'clicked', false );
}
});
+ /* To ensure that updateStatus() doesn't interfere while use is
+ * sliding on the control. */
+ $("#volumeSlider").data( 'clicked', false );
$('#buttonStop').click(function () {
switch (current_que) {
case 'main':
--
1.7.5.4
More information about the vlc-devel
mailing list