-
-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating object position incorrect when map is smaller than screen #135
Comments
Actually, there is one thing that I wanted to change in a previous patch, on how we draw non-floating objects, and that will help to make with this. Right now in the main loop we parse the object list, and if the object is non –floating object, we translate the canvas. So : before the main loop translate the canvas, and then translate back if it’s floating object. First it will be better in terms of performances (because of the ratio between floating and non-floating objects), but then when initially translating the canvas, we can then add the corresponding offset if the level is smaller. |
…e of floating object (see ticket #135)
@parasyte (note the above change does not change anything for this, it's just a small optimization) |
@obiot
It looks like the HUD_Item drawing position worked great (didn't try clicks on it), but drawing position for floating SpriteObject did not work without the map position offset, and the click location did not work without the patch in dispatchMouseEvent. I can maybe do a more minimal example later if necessary, but the demo (which source I've linked to) can be tried here: http://coffee.kodewerx.org/ You will need to select one of the six colored squares with at least three devices or browser tabs simultaneously to get to the point with the panel (the object with the issue); it's supposed to be attached to the right side of the screen, no matter how large the screen is. |
Ooh ok I got it now :) For the HUD I think that following the recent changes, it’s working because of a wrong implementation now (it should not remove the map offset), see here : And when dealing with floating object, the engine should then as well take this in account when translating back (+viewportPos – mapOffset): |
Cool, cool. We also need to verify the click region works correctly with the map position offset. |
@parasyte Could you give it a try ? ( I will let it open until we both "approve" the fix) |
Interesting! Now that the drawing position has been fixed, the patch to input.js is no longer necessary, so that single change should be reverted and everything just works. With that, it passes my tests, too. |
you mean this fix is not required ? hmm... either I misunderstood you, or I need more testing on my side,but with with the current code base (no further change) and my basic tests I have both floating and non floating object being draw correctly, and clickable with the mouse. |
ah ah, my bad, wrong testing on my side ... :( I confirm that the patch to input is not required anymore ! I commit the change and close both tickets :) |
Hooray! 👯 |
👍 |
Discovered this bug during the game jam this weekend: With a map smaller than the screen, floating objects will not be drawn at screen coordinates, and the rectangle for clicks also has an improper offset. Related to #33 and #119.
The text was updated successfully, but these errors were encountered: