fix: #5343 陶瓦联机界面账号快速切换列表右侧滚动条错位以及列表莫名抽搐 #6109
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the AccountListPopupMenu to reset the vertical scroll position of the account list whenever the list is invalidated. A review comment correctly identified that using Double.MIN_VALUE to reset the scroll position is semantically incorrect, as it represents the smallest positive non-zero value rather than zero, and suggested using 0.0 for better clarity and correctness.
| box.add(item); | ||
| } | ||
|
|
||
| Platform.runLater(() -> box.setVvalue(Double.MIN_VALUE)); |
There was a problem hiding this comment.
Using Double.MIN_VALUE to reset the scroll position is semantically incorrect. In Java, Double.MIN_VALUE is the smallest positive non-zero value (-Double.MAX_VALUE). For a ScrollPane's vvalue, the valid range is typically 0.0 to 1.0. While Double.MIN_VALUE is effectively 0.0 due to precision, it is clearer and more idiomatic to use 0.0 or box.getVmin().
| Platform.runLater(() -> box.setVvalue(Double.MIN_VALUE)); | |
| Platform.runLater(() -> box.setVvalue(0.0)); |
fixes #5343