[BUG] Touch position returns Infinity in HTML5 when window tag is deleted or set to 0 in project.xml

Maybe I’m missing something or maybe this is a bug.

I’m adding the event like this:

Lib.current.stage.addEventListener(TouchEvent.TOUCH_MOVE,  onTouchMove);

Then I get the position of the touch like this:

	private function onTouchMove(e:TouchEvent):Void 
	    var mousePos:Point = new Point(e.stageX, e.stageY);

When I run in HTML5 using an Ipad I see that e.stageX and e.stageY are “Infinite”.
What is wrong here?


I’ve found where is the bug:

singmajesty recommended to set the window width and height to 0 in the project.xml (or delete the whole window tag), then handle resizing inside the code to avoid a blurring issue when resizing, this works for the blur problem but breaks touch interaction, the position of the touch seems to be divided by the window size of the project.xml and a division by 0 as all we know it’s an error.

This is the original post about the resizing blur issue:

singmajesty if you are there please can you fix this? or give some feedback, this is very important for me.
Deleting the entire window tag didn’t fix the issue, so right now I have to choose between broken touch or bluring without being able to control resizing.

Here you have a test project:

And a uploaded link ready to open with a mobile device to see the issue:

Bug report:


I think this will fix it :smile:

It also needed this compile fix

Fixed! Thanks singmajesty!

1 Like