Incorrect ZApplication.MousePosition in Preview

Found a bug? Post information about it here so we can fix it!

Moderator: Moderators

User avatar
Posts: 770
Joined: Wed May 05, 2010 12:16 pm

Incorrect ZApplication.MousePosition in Preview

Postby Rado1 » Sat Oct 25, 2014 10:25 am

In the latest Beta, if an application has set ViewportRatio to the value other than "Full window", e.g. 16:9, and it is running in the ZGE Preview panel, the ZApplication.MousePosition is not set correctly. The offset of the returned position depends also on the size of the Preview panel.

See the attached testing project: run it in a Preview which is wider than taller and has some black side strips. Put the mouse to the middle of the screen marked with small yellow point. The white rectangle, determining the mouse position should also be in the middle, but it is not. Change the Preview size and observe that the position offset changes. Try to run it with F9 and see that it is correct.

(Fix is quite urgent since I cannot continue with planned game development.)
testing project
(1.27 KiB) Downloaded 93 times

User avatar
Posts: 1648
Joined: Sat Feb 23, 2008 11:15 pm

Postby Kjell » Sat Oct 25, 2014 12:06 pm


Also, even though ViewportWidth / Height display the correct values when viewing the properties of App, when you access them through a ZExpression they contain the ScreenWidth / Height values instead.


User avatar
Site Admin
Posts: 1920
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden

Postby VilleK » Mon Oct 27, 2014 8:28 am

Beta updated. This happened because I earlier tried to fix the issue where Viewport properties were zero during preview.

User avatar
Posts: 770
Joined: Wed May 05, 2010 12:16 pm

Postby Rado1 » Mon Oct 27, 2014 10:33 am

Tested the latest beta and the fix works. Thanks Ville!

Return to “Bug reports”

Who is online

Users browsing this forum: No registered users and 1 guest