Skip to content
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

Implement margins concept for map canvas #5252

Merged
merged 5 commits into from
May 21, 2024
Merged

Implement margins concept for map canvas #5252

merged 5 commits into from
May 21, 2024

Conversation

nirvn
Copy link
Member

@nirvn nirvn commented May 18, 2024

This PR implements the concept of margins (bottom and right for now) to the map canvas. Those margins allow for us to overlay elements on top of the map canvas and take those margins into account when setting the map extent / center.

Practically speaking, this allows for zooming to feature / point to recenter around the portion of the map that's not covered by overlaid elements.

Needed for the ongoing revamp of information panel -> drawer (see #5251)

Here's a screencast of what it does:

vokoscreenNG-2024-05-20_11-55-05.mp4

Note how the auto re-centering to positioning and destination is contained within the part of the map canvas that's not partially hidden by the information drawer. Big win! This was not needed before as we were shrinking the map canvas to show information below it (booouh;) ).

Margin magic in action, this time with zooming into features:

vokoscreenNG-2024-05-20_13-56-04.mp4

You can see the feature nicely fits within the top-left region that's not obstructed by either the feature form nor the information drawers.

@qfield-fairy
Copy link
Collaborator

qfield-fairy commented May 18, 2024

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/core/featurelistextentcontroller.cpp Show resolved Hide resolved
src/core/qgsquick/qgsquickmapcanvasmap.cpp Show resolved Hide resolved
src/core/qgsquick/qgsquickmapcanvasmap.cpp Show resolved Hide resolved
src/core/qgsquick/qgsquickmapsettings.cpp Show resolved Hide resolved
src/core/qgsquick/qgsquickmapsettings.cpp Show resolved Hide resolved
src/core/qgsquick/qgsquickmapsettings.cpp Show resolved Hide resolved
src/core/qgsquick/qgsquickmapsettings.cpp Show resolved Hide resolved
src/core/utils/featureutils.cpp Show resolved Hide resolved
Copy link
Collaborator

@mohsenD98 mohsenD98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really loved labels and transparent background color.

color: "#ffffff"
radius: 8
}
color: "#bbfafafa"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we use Theme.mainBackgroundColorSemiOpaque as background color?

Result of using Theme.mainBackgroundColorSemiOpaque:

Screenshot from 2024-05-20 17-36-21

Then i think instrutionLabel style should change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mohsenD98 , we have to hard code it for now because the elevation plotting canvas doesn't expose a property to set the label color yet (and therefore the result is bad on dark theme ATM)

src/qml/InformationDrawer.qml Outdated Show resolved Hide resolved
@nirvn nirvn enabled auto-merge May 21, 2024 03:29
@nirvn nirvn disabled auto-merge May 21, 2024 03:53
@nirvn nirvn merged commit ef39edd into master May 21, 2024
21 of 23 checks passed
@nirvn nirvn deleted the canvas_margins branch May 21, 2024 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants