Skip to content

Commit

Permalink
[Inspector V2] Prevent inspector tree scroll from bouncing (#8367)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliette authored Sep 30, 2024
1 parent 89e6c7e commit b4f50fb
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -990,9 +990,14 @@ class _InspectorTreeState extends State<InspectorTree>
safeViewportHeight,
);

// Decide to scroll based on whether the middle of the center-left half of
// the row is visible. See https://github.com/flutter/devtools/pull/8367.
final centerLeftHalf = Offset(
(rect.centerLeft.dx + rect.center.dx) / 2,
rect.center.dy,
);
final isRectInViewPort =
viewPortInScrollControllerSpace.contains(rect.topLeft) &&
viewPortInScrollControllerSpace.contains(rect.bottomRight);
viewPortInScrollControllerSpace.contains(centerLeftHalf);
if (isRectInViewPort) {
// The rect is already in view, don't scroll
return;
Expand Down

0 comments on commit b4f50fb

Please sign in to comment.