Repository navigation
Fix inspector Auto Scroll #4283
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
Changes from all commits
a5f7819
19c25bb
757f30c
bf0aac4
d48dedd
ff17103
1da6cb0
426dfa2
ce7f6e6
8fed737
9f75df0
2c9d305
1c25830
9d6882f
e695203
4100faa
b235b87
3fe63cd
d31a088
c4d9831
be5847c
58744db
8ca00a0
dde8264
db4c6f4
147d2d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -704,33 +704,8 @@ class InspectorController extends DisposableController | |
| if (node == null) { | ||
| return; | ||
| } | ||
| final List<InspectorTreeNode> targets = [node]; | ||
|
|
||
| // Backtrack to the the first non-property parent so that all properties | ||
| // for the node are visible if one property is animated to. This is helpful | ||
| // as typically users want to view the properties of a node as a chunk. | ||
| while (node!.parent != null && node.diagnostic?.isProperty == true) { | ||
| node = node.parent; | ||
| } | ||
| // Make sure we scroll so that immediate un-expanded children | ||
| // are also in view. There is no risk in including these children as | ||
| // the amount of space they take up is bounded. This also ensures that if | ||
| // a node is selected, its properties will also be selected as by | ||
| // convention properties are the first children of a node and properties | ||
| // typically do not have children and are never expanded by default. | ||
| for (InspectorTreeNode child in node.children) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this logic removed? If the problem is it does bad things with too many properties, we can tweak the logic to only require some small number of children.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While updating the scrolling code, I ended up changing the behaviour so that scrolling always snaps the focused item to the top left of the viewport. So adding any children to the bounding box doesn't change the result of the scrolling. I am also changing the behaviour, so that we don't distinguish between properties and their parents. The reason for this is that sometimes I would be scrolling the properties with my arrow keys and the focus would go off the screen but the scroll would not update since the parent would be on the screen. I figured that simplifying the whole process to "Just make sure whatever I'm focused on is visible" would help make the experience more consistent.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scrolling to the top left corner of the screen will be jarring for cases like going through a list of search results.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We chatted about this during a 1:1 and decided together that scrolling to the center of the screen is a happy medium we can agree on. |
||
| final RemoteDiagnosticsNode? diagnosticsNode = child.diagnostic; | ||
| targets.add(child); | ||
| if (!child.isLeaf && child.isExpanded) { | ||
| // Stop if we get to expanded children as they might be too large | ||
| // to try to scroll into view. | ||
| break; | ||
| } | ||
| if (diagnosticsNode != null && !diagnosticsNode.isProperty) { | ||
| break; | ||
| } | ||
| } | ||
| inspectorTree.animateToTargets(targets); | ||
| inspectorTree.animateToTargets([node]); | ||
| } | ||
|
|
||
| void setSelectedNode(InspectorTreeNode? newSelection) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.