Several fixes related to resizing maps - #4609
Open
bjorn wants to merge 3 commits into
Open
Conversation
The offset of image layers was adjusted by the pixel offset, but image layers are positioned in screen coordinates relative to the map's bounding rect. Image layers are now moved by the shift of the bounding rect, which is the same offset already used to adjust the map's position in a world.
The resize drag of the World Tool was snapped to the tile size and then converted to whole rows and columns, but a row of a hexagonal or staggered map adds less than a tile on screen. This skipped a row every few rows. The drag now snaps directly to the on-screen size of one column or row, unless snapping to the world grid is enabled.
The rectangle and resize handles around the hovered map only followed the tool's own resizes and world changes. Undoing or redoing a resize left them stale until the next mouse event. The tool now connects to the target map's mapResized signal. The target is held in a QPointer, since it can be a document other than the current one and may be closed while targeted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three fixes related to resizing maps, both through the Resize Map dialog and with the World Tool:
Image layers ended up at the wrong position after a map resize on non-orthogonal maps. Their offset was adjusted by the pixel offset, but image layers are positioned in screen coordinates relative to the map's bounding rect. They are now moved by the shift of that bounding rect, which is the same offset already used to adjust the map's world position.
Resizing hexagonal and staggered maps with the World Tool skipped rows. The drag was snapped to the tile size and then converted to whole rows and columns, but a row of such a map adds less than a tile on screen, so a row was skipped every few rows. The drag now snaps directly to the on-screen size of one column or row, unless snapping to the world grid is enabled.
The World Tool selection rectangle went stale when the target map was resized by undo or redo. The rectangle and handles only followed the tool's own resizes and world changes, so undoing a resize left them in place until the next mouse event. The tool now follows the target map's resize signal. The target is also held in a
QPointer, since it can be a neighbouring map that is closed while targeted.