-
Notifications
You must be signed in to change notification settings - Fork 312
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
An issue where map is not displayed properly on other surfaces #287
Comments
I've managed to get the map to display fully in the larger surface by passing a third argument to the map object which stores a rectangle object, and doing a search and replace for all instances of using core.width and core.height, and using the rectangle's width and height instead. This does not affect the scaling of the map object, however. I'd recommend committing a third argument that stores either the rectangle data (as I've hacked together), or the target surface area, and making the map utilize its scaleX and scaleY values to make the map object that much more modular and versatile (as far as I can see, even if you were to set core.scale, only a scale of "2" seems to scale it, unless I'm mistaken). |
I'm working on a Wii U game at the moment that leverages enchantJS and specifically the Map, as it provides the best performance on the system for my needs. However, this issue is impacting my release and I'd like to work on fixing it, but could use some direction before digging through the Map code. Essentially, when the scene is scaled, I'd like the Map to scale accordingly, like Sprites, Labels, and other enchant objects behavior (which seems to be the nature of the reported issue above). Does anyone have a good starting point to jump in here? |
So, last night I dug into this and made modifications to the redraw function to respect the scale value of either the map or its parentNode (with the map's scale value taking precedence). Based on my personal use case, it's working as intended now; however, I have no idea if my solution is appropriate to commit as I'm not really sure if the approach aligns with the rest of the project, nor do I know if it behaves appropriately in all use cases. Any suggestions on next steps? I'd love to help out any fellow enchant users who are experiencing the same problem, but I definitely need the guidance of the official team before I do anything. |
Because the map object uses the game's core as a reference for width and height, it creates display problems for surfaces larger than the game's core. This causes odd scaling behaviour, where the map's display will not be scaled, but the dimensions of the tiles will be (so at 3x scale, a collision tile that was at (32,32) will collide at (96,96) appropriately). As far as I can see, the map object is the only object that does not behave appropriately to scaling.
The text was updated successfully, but these errors were encountered: