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

[layer tree] Avoid needless layer tree model computations for scale-based layer visibility #39066

Merged
merged 1 commit into from
Sep 28, 2020

Conversation

nirvn
Copy link
Contributor

@nirvn nirvn commented Sep 28, 2020

Description

This PR optimizes the layer tree model by avoiding needless computations around scale-based layer visibility. Optimizations include:

  • If the map canvas scale hasn't changed, avoid triggering scale-based layer visibility check loop
  • In cases scale has changed, make sure the model only emits dataChanged for layers that go from hidden to visible (or vice versa)
  • Restrict dataChanged roles to only the ones that are impacted by visibility change

With the PR applied, I can't see any freeze when panning on the canvas with the test project in #38978 .

@github-actions github-actions bot added this to the 3.16.0 milestone Sep 28, 2020
Copy link
Member

@m-kuhn m-kuhn left a comment

Choose a reason for hiding this comment

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

Works and code looks good

@nirvn nirvn merged commit 9d105d9 into qgis:master Sep 28, 2020
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

2 participants