Skip to content

Commit 6bb3878

Browse files
committed
Fix: smooth scrolling was inactive after certain drag operations.
1 parent 3f7e12e commit 6bb3878

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

flatlaf-core/src/main/java/com/formdev/flatlaf/SmoothScrollingHelper.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ public void eventDispatched( AWTEvent event ) {
6060
if( Animator.useAnimation() && FlatSystemProperties.getBoolean( FlatSystemProperties.SMOOTH_SCROLLING, true ) ) {
6161
boolean isHoldingScrollModeBlocked = false;
6262
switch(event.getID()) {
63+
case MouseEvent.MOUSE_MOVED:
64+
case MouseEvent.MOUSE_ENTERED:
65+
case MouseEvent.MOUSE_EXITED:
66+
if(isBlitScrollModeBlocked) {
67+
int modifiersEx = ((MouseEvent)event).getModifiersEx();
68+
if((modifiersEx & (MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON3_DOWN_MASK)) == 0) {
69+
// If the scroll mode was blocked for dragging, let's release if we receive a non-drag-related event (i.e. drag is done).
70+
for( JViewport viewport: viewportSet ) {
71+
setBlitScrollModeBlocked( viewport, false );
72+
setInSmoothScrolling( viewport, false );
73+
}
74+
isBlitScrollModeBlocked = false;
75+
}
76+
}
77+
break;
6378
case MouseEvent.MOUSE_PRESSED:
6479
case MouseEvent.MOUSE_DRAGGED:
6580
isHoldingScrollModeBlocked = true;

0 commit comments

Comments
 (0)