]> git.sesse.net Git - vlc/commitdiff
luahttp: Don't interfere while the user is dragging
authorEdward Wang <edward.c.wang@compdigitec.com>
Thu, 24 May 2012 22:18:02 +0000 (18:18 -0400)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 24 May 2012 22:40:08 +0000 (00:40 +0200)
The updateStatus() function should not interrupt the user and reset his position while he is dragging the volume slider.

Close #6652

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
share/lua/http/js/controlers.js
share/lua/http/js/ui.js

index 2425ffef9595574e00f12bcb37564a6fbbc77030..c80be3862616a8fdf0c03300ce944f00258baec4 100644 (file)
@@ -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())
                 });
index 831f79c37ee1dfbec8993891ed594ad20f0b08ac..3ba9e28f90872d3280b4a58204da732c2a191f04 100644 (file)
@@ -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':