]> defiant.homedns.org Git - ros_wild_thumper.git/blobdiff - www/assets/javascripts/application.js
Merge branch 'master' of ssh://vontaene/home/erik_alt/git/ros_wild_thumper
[ros_wild_thumper.git] / www / assets / javascripts / application.js
index a7b478517788dee56d68033f3d03647ea96af4e3..7a87c12532d0fbb8bafc74d1cfa05702f5d29a0c 100644 (file)
@@ -4,7 +4,7 @@ function init() {
        var isDragging = false;
 
        function connect() {
-               ros.connect('ws://wildthumper:9090');
+               ros.connect('ws://'+robothostname+':9090');
        }
 
        ros.on('connection', function() {
@@ -189,12 +189,12 @@ function init() {
                                Y = e.pageY;
                        }
                        // relative click position
-                       var Xrel = X - this.offsetLeft - $(this).width()/2; 
-                       var Yrel = Y - this.offsetTop - $(this).height()/2; 
+                       var Xrel = X - this.getBoundingClientRect().left - $(this).width()/2;
+                       var Yrel = Y - this.getBoundingClientRect().top - $(this).height()/2;
                        // scale to -1..+1
                        var trans = -Yrel / ($(this).height()/2);
                        var rot = -Xrel / ($(this).width()/2);
-                       setSpeed(trans, rot*3);
+                       setSpeed(trans*$("#scale_trans").val(), rot*$("#scale_rot").val());
                }
        });
 
@@ -238,6 +238,8 @@ function init() {
                // reload
                $("img").attr("src", $("img").attr("src"))
        });
+
+       $("input[type='number']").spinner();
 }
 
 Vue.component('input-value', {