-
Notifications
You must be signed in to change notification settings - Fork 93
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
Focus map zooming on the cursor #316
Conversation
@@ -1481,6 +1506,31 @@ void Editor::createConnectionItem(MapConnection* connection, bool hide) { | |||
connection_edit_items.append(connection_edit_item); | |||
} | |||
|
|||
// Hides connected map tiles that cannot be seen from the current map (beyond BORDER_DISTANCE). | |||
void Editor::maskNonVisibleConnectionTiles() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain this please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, so to enable this functionality I had to expand the graphicsView
to fill the entire frame, which caused outer parts of connected maps to be displayed (tiles extending further than BORDER_DISTANCE
from the current map). These outer tiles were previously hidden by resizing the graphicsView
. This resize was reseting the scroll bars and preventing the zoom from anchoring on the mouse cursor. So to keep the displayed tiles the same I draw over them with the background color of the graphicsView
, this is the 'mask'.
This one perplexes me, I can't recreate the gray area (and have no idea why it would disappear when switching tabs). Does the gray area come back when switching back to the map tab, or does it stay gone? And do you still get an off-colored area when using other porymap themes? |
It is drawing the widget while the window is disabled so it is using the widget's disabled color palette. The window is disabled when porymap is loading the project in case it encounters an error. In the MainWindow constructor you could probably add |
Closes #256.
Zooming the map will now zoom into the location of the cursor rather than the top left corner. If the cursor is not on the map then the map will zoom into the center.