Skip to content

Commit

Permalink
Fix screen range for very short entries
Browse files Browse the repository at this point in the history
  • Loading branch information
sdercolin committed Jan 30, 2024
1 parent be164f4 commit 6032800
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ class ScreenRangeHelper {

fun get(canvasLength: Float, scrollState: ScrollState): FloatRange? {
if (canvasLength != this.canvasLength) {
if (scrollState.value to scrollState.maxValue == valuePair) {
// scroll state is not up-to-date, return previous value
if (scrollState.value to scrollState.maxValue == valuePair && valuePair != 0 to 0) {
// if valuePair is 0 to 0, it means the data is too short to enable scrolling,
// so it never changes.
// in other cases, when it's not changing, it means scrollState has not been updated.
return getRange(this.canvasLength, scrollState.value, scrollState.maxValue)
}
this.canvasLength = canvasLength
Expand Down

0 comments on commit 6032800

Please sign in to comment.