HTML5 full screen scale buggy (mojo 1, Monkey 85e)

Monkey Forums/Monkey Bug Reports/HTML5 full screen scale buggy (mojo 1, Monkey 85e)

Xaron(Posted 2016) [#1]
Dear all,

I've created a small test example. Basically it draws a circle where the touch down event is recognized:



The MonkeyGame.html is mainly the original one, beside fscreen set to true and a different canvas size:


Running example:
http://www.leidel.net/dl/test/MonkeyGame.html

Everything IS fine for desktop browsers. But start this example on a mobile browser. You will see that the circle is NOT anymore below the finger touch the more the finger reaches the right border!


Xaron(Posted 2016) [#2]
Fix:
https://github.com/blitz-research/monkey/blob/develop/targets/html5/modules/native/html5game.js#L410

In html5game.js replace:
	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;
	}


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


MANY thanks go to kog who fixed this for me! :D


marksibly(Posted 2016) [#3]
V86e including this fix is now up.

Thanks kog!