X-Git-Url: https://defiant.homedns.org/gitweb/?p=ros_wild_thumper.git;a=blobdiff_plain;f=www%2Fassets%2Fjavascripts%2Fapplication.js;h=7a87c12532d0fbb8bafc74d1cfa05702f5d29a0c;hp=df4c9ebfefc7ca40845878a06c68b83a65dfa34b;hb=5265263d46b9396252d852a763e68913ad3a913e;hpb=2b77cd47ca07d0e078b3dd27616ab255b7657db1;ds=sidebyside diff --git a/www/assets/javascripts/application.js b/www/assets/javascripts/application.js index df4c9eb..7a87c12 100644 --- a/www/assets/javascripts/application.js +++ b/www/assets/javascripts/application.js @@ -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', {