1 decade ago
by mimik
where looking through the docs and couldn't find any support for mouse middle button.
e.a clicking the scroll wheel.
Is there any impactJS support for that?
Can do it manually but i want to trigger a button click with it.
function detect_button(e){
e = e || window.event;
if (e.which == 2){
console.log('middlebutton')
}
}
document.onmousedown = detect_button;
1 decade ago
by mimik
And it seams that impact blocks that action anyways
1 decade ago
by lTyl
I'm using a custom-built Input system, but here is how I handle 3 mouse buttons:
window.addEventListener('mousedown', function( event ){
var code;
if (event.button > 0)
code = event.button == 1 ? KEYS["mmiddle"] : KEYS["mright"];
else
code = KEYS['mleft'];
dispatch(event, code);
}, false);
In order to get the same functionality, you'd have to modify your Impact Input class, specifically the keydown function and then check for the key press via event.button:
'mleft': 0,
'mmiddle': 1,
'mright': 2
1 decade ago
by mimik
yeah i ended up adding a ugly switch to test if there was some more mouse keys available.
Basically the same result.
var code = event.type == 'keyup'
? event.keyCode
: (event.button == 2 ? ig.KEY.MOUSE2 : ig.KEY.MOUSE1);
if(event.type != 'keyup'){
if(!event.keyCode){
switch(event.button){
case 0:
code = ig.KEY.MOUSE1;
break;
case 1:
code = ig.KEY.MOUSEMID;
break;
case 2:
code = ig.KEY.MOUSE2;
break;
}
}
}
hacking it up.
possible ie problems but who cares about that browser anyway.
Page 1 of 1
« first
« previous
next ›
last »