diff --git a/source/funkin/editors/ui/UIScrollBar.hx b/source/funkin/editors/ui/UIScrollBar.hx index b94f4cd548..7311578d28 100644 --- a/source/funkin/editors/ui/UIScrollBar.hx +++ b/source/funkin/editors/ui/UIScrollBar.hx @@ -29,6 +29,8 @@ class UIScrollBar extends UISprite { thumbIcon = new FlxSprite(0, 0, Paths.image('editors/ui/scrollbar-icon')); members.push(thumbIcon); + + FlxG.stage.window.onFocusOut.add(onWindowFocusOut); } public var isScrolling:Bool = false; @@ -61,4 +63,15 @@ class UIScrollBar extends UISprite { thumb.framesOffset = lastHoveredThumb ? 9 : 0; } } + + public override function destroy() { + FlxG.stage.window.onFocusOut.remove(onWindowFocusOut); + super.destroy(); + } + + private function onWindowFocusOut():Void { + isScrolling = false; + hovered = false; + thumb.hovered = false; + } } \ No newline at end of file