Use Bitmap cache for smoother panning #15811
Open
+80
−4
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.
Purpose
Building on the logic in #15764, I propose we use the same mechanism that triggers when the number of nodes on canvas is higher than a certain threshold and replace the all node views with rendered bitmaps. Luckily WPF already has an existing mechanism that we can use called
BitmapCache
. Based on the current zoom, we can vary the resolution of the images and create a pseudo LOD system that switches between a low, medium, high and native scale. I spent a lot of time trying out different scaling options and different ways to trigger the cache and I think that the selected settings strike a good balance between UX and performance.Here's a preview of the changes below. On the left is the proposed behavior and on the right, the current:
![DynamoSandbox_rjHFbME1GB](https://private-user-images.githubusercontent.com/7148394/410546849-6b33a75f-f807-47a6-b5a8-9ee7acc981ba.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODczNzYsIm5iZiI6MTczOTM4NzA3NiwicGF0aCI6Ii83MTQ4Mzk0LzQxMDU0Njg0OS02YjMzYTc1Zi1mODA3LTQ3YTYtYjVhOC05ZWU3YWNjOTgxYmEuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTJUMTkwNDM2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTdhNmQyYTY1NDQ3Y2Y4MWRiYWJjOTk5NjhhNjI3MWYwMzQ4YWQzNWYwOTM1YTc2YjhiYjRhM2I5MDUyODBmNSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.ELCGU3aikSFxDqkjuEPVbzomkWUsFnGLvTKFaP-bBIg)
Declarations
Check these if you believe they are true
*.resx
filesRelease Notes
(FILL ME IN) Brief description of the fix / enhancement. Use N/A to indicate that the changes in this pull request do not apply to Release Notes. Mandatory section
Reviewers
(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)
(FILL ME IN, optional) Any additional notes to reviewers or testers.
FYIs
(FILL ME IN, Optional) Names of anyone else you wish to be notified of