MouseX & MouseY false values when fscreen on ios

Monkey Targets Forums/HTML5/MouseX & MouseY false values when fscreen on ios

Vignoli(Posted 2015) [#1]
Hi

I'm programming a game, and i've set this in the html code :
var CANVAS_RESIZE_MODE=1;	//0=locked, 1=stretch, 2=resize

var CANVAS_WIDTH=224;
var CANVAS_HEIGHT=288;

window.onload=function( e ){

	var canvas=document.getElementById( "GameCanvas" );
	var splitter=document.getElementById( "Splitter" );
	var console=document.getElementById( "GameConsole" );
	
	var mouseDown=false;
	var startY=0;
	var canvasH=CANVAS_HEIGHT;
	var cmousemove=null;
	var cmouseup=null;
	var cmouseout=null;
	var fscreen=true;


The problem is under ios 8.3, the MouseDown command recognise only a 224x288 surface on the top/left corner of the canvas. Same thing with the TouchDown command.

Any idea ?

EDIT:
Same problem on Android. (not tested under OS X or linux)

EDIT2:
It's a tactile problem.
With the mouse, it works, but with all tactile screen (even windows), it does not works.


Vignoli(Posted 2015) [#2]
This is a link to test...
Arrow keys and mouse works, but not tactile.
Is Monkey not recognising it's own fullscreen ?
http://www.retro-bruno.com/html5/pacman/pacman.html


rIKmAN(Posted 2015) [#3]
Is this running as an app on the device, or running the game through a browser on the device?

Try using autofit?


bitJericho(Posted 2015) [#4]
Well you'll see in the following code in main.js:
	function mouseX( e ){
		var x=e.clientX+document.body.scrollLeft;
		var c=canvas;
		while( c ){
			x-=c.offsetLeft;
			c=c.offsetParent;
		}
		return x*xscale;
	}
	
	function mouseY( e ){
		var y=e.clientY+document.body.scrollTop;
		var c=canvas;
		while( c ){
			y-=c.offsetTop;
			c=c.offsetParent;
		}
		return y*yscale;
	}

	function touchX( touch ){
		var x=touch.pageX;
		var c=canvas;
		while( c ){
			x-=c.offsetLeft;
			c=c.offsetParent;
		}
		return x;
	}			
	
	function touchY( touch ){
		var y=touch.pageY;
		var c=canvas;
		while( c ){
			y-=c.offsetTop;
			c=c.offsetParent;
		}
		return y;
	}
	


It seems like the touch functions aren't taking into account whatever that scale variable is from. I would play around with these and see if that fixes it. If you do spot a problem here, submit it to the bug board. I would look into it further for you but I don't really have anything set up at this moment to debug this.


Vignoli(Posted 2015) [#5]
Thanks.
I've submited it as a bug.


Xaron(Posted 2016) [#6]
Has this been resolved?