diff --git a/examples/users.js b/examples/users.js index ed1703c329..59263e0607 100644 --- a/examples/users.js +++ b/examples/users.js @@ -329,7 +329,8 @@ var usersWindow = (function () { lineClicked, userClicked, i, - visibilityChanged; + visibilityChanged, + delta; if (!isVisible) { return; @@ -380,6 +381,20 @@ var usersWindow = (function () { scrollbarBarClickedAt = (event.y - scrollbarBarPosition.y) / scrollbarBarHeight; isMovingScrollbar = true; } + + if (clickedOverlay === scrollbarBackground2D) { + delta = scrollbarBarHeight / (scrollbarBackgroundHeight - scrollbarBarHeight); + + if (event.y < scrollbarBarPosition.y) { + scrollbarValue = Math.max(scrollbarValue - delta, 0.0); + } else { + scrollbarValue = Math.min(scrollbarValue + delta, 1.0); + } + + firstUserToDisplay = Math.floor(scrollbarValue * (linesOfUsers.length - numUsersToDisplay)); + updateOverlayPositions(); + updateUsersDisplay(); + } } function onMouseMoveEvent(event) {