Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Jack9

Put your pointer somewhere in the middle, over the canvas. Reload the application. Click. Your ig.input.mouse.x and ig.input.mouse.y will incorrectly read 0,0

Change small change to keydown in Input.js is all that's needed.
	keydown: function( event ) {
		if( event.target.type == 'text' ) { return; }
		
		var code = event.type == 'keydown' 
			? event.keyCode 
			: (event.button == 2 ? ig.KEY.MOUSE2 : ig.KEY.MOUSE1);

        if( event.type == 'touchstart' || event.type == 'mousedown') { // FIXED
			this.mousemove( event );
		}

		var action = this.bindings[code];
		if( action ) {
			this.actions[action] = true;
			if( !this.locks[action] ) {
				this.presses[action] = true;
				this.locks[action] = true;
			}
			event.stopPropagation();
			event.preventDefault();
		}
	},

1 decade ago by Jack9

Might want to add a couple others. mouseup/touchstop too. This is in case you mousedown, reload and mouseup. You'll get a bad coordinate there too (untested)

1 decade ago by dominic

Thank you! I'll look into it.
Page 1 of 1
« first « previous next › last »