Skip to content

Commit

Permalink
Snaps selected node to the top of the scroll pane
Browse files Browse the repository at this point in the history
  • Loading branch information
darrellcolehill committed Jun 17, 2024
1 parent b129728 commit cdbe4ed
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ class ChapterSelectorPopupSkin(
selectedNode?.let {
val contentBounds = scrollPane.content.layoutBounds
val nodeBounds = selectedNode.boundsInParent
scrollPane.vvalue = nodeBounds.minY / contentBounds.height
val viewportHeight = scrollPane.viewportBounds.height
scrollPane.vvalue = (nodeBounds.minY) / (contentBounds.height - viewportHeight)
}
}

Expand Down

0 comments on commit cdbe4ed

Please sign in to comment.