From f91bd0553009fc1fab28de9f35c480efeb871269 Mon Sep 17 00:00:00 2001 From: JiHyung Lee Date: Mon, 25 Feb 2019 14:34:04 +0900 Subject: [PATCH] Fix problem that invalid scrollbar height when content height is close to view height. cf. https://github.com/DominikSerafin/vuebar/issues/11#issuecomment-466542096 --- vuebar.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vuebar.js b/vuebar.js index ed0d00c..1186a26 100644 --- a/vuebar.js +++ b/vuebar.js @@ -184,10 +184,11 @@ if (state.visibleArea >= 1) { state.barHeight = 0; } else { - state.barHeight = Math.min( - state.el2.clientHeight / 2, - Math.max(state.el2.clientHeight * state.visibleArea, state.config.barMinHeight) - ); + state.barHeight = state.el2.clientHeight * state.visibleArea; + + if (state.barHeight < state.config.barMinHeight) { + state.barHeight = state.config.barMinHeight; + } } }