Browse Source

remove second joystick. gets stuck anyway

main
Hendrik Langer 4 years ago
parent
commit
e1d7ad694a
  1. 15
      raspberry/roberto/views/frontend/templates/gamepad.js
  2. 2
      raspberry/roberto/views/frontend/templates/index.html

15
raspberry/roberto/views/frontend/templates/gamepad.js

@ -109,15 +109,16 @@ var joystick_axes = {
joystick.on('move', function(evt, data) {
joystick_axes.x1 = data.vector.x;
joystick_axes.y1 = -data.vector.y;
joystick_axes.y2 = -data.vector.y;
joystick_axes.moved = true;
});
joystick.on('end', function(evt, data) {
joystick_axes.x1 = 0;
joystick_axes.y1 = 0;
joystick_axes.moved = true;
//evt.target.manager.unbindDocument(true);
});
/*
var joystick2 = nipplejs.create({
zone: document.getElementById('controls_r'),
mode: 'static',
@ -136,8 +137,16 @@ var joystick_axes = {
joystick_axes.x2 = 0;
joystick_axes.y2 = 0;
joystick_axes.moved = true;
//evt.target.manager.unbindDocument(true);
});
*/
/* // fix joysticks get stuck on multitouch (doesn't work)
$(window).on('touchcancel', function(e) {
console.log("touchcancel");
joystick.processOnEnd(e);
joystick2.processOnEnd(e);
});
*/
setInterval(function(){
if (joystick_axes.moved) {
socket.emit('axes', {0: joystick_axes.x1, 1: joystick_axes.y1, 3: joystick_axes.x2, 4: joystick_axes.y2});

2
raspberry/roberto/views/frontend/templates/index.html

@ -272,7 +272,7 @@ function toggleFullScreen() {
var goFS = document.getElementById("goFS");
goFS.addEventListener("click", function() {
toggleFullScreen();
document.getElementById("goFS").style.display = "none";
//document.getElementById("goFS").style.display = "none";
}, false);
var goDebug = document.getElementById("goDebug");

Loading…
Cancel
Save