[vlc-commits] luahttp: Don't interfere while the user is dragging

Edward Wang git at videolan.org
Fri May 25 00:44:47 CEST 2012


vlc/vlc-2.0 | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu May 24 18:18:02 2012 -0400| [a778891727f1c1e7ebd2aabd2b8a3acd5b3dd02f] | committer: Jean-Baptiste Kempf

luahttp: Don't interfere while the user is dragging

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 at videolan.org>
(cherry picked from commit e91edd90eaf9cd4339b45fd90f8af4fe8a3b31b3)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=a778891727f1c1e7ebd2aabd2b8a3acd5b3dd02f
---

 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 7fe3207..489e4fb 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':



More information about the vlc-commits mailing list