Skip to content

Commit 84b1f9b

Browse files
committed
Fix #271
1 parent d63b3e3 commit 84b1f9b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎src/main/java/sc/fiji/snt/InteractiveTracerCanvas.java‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,8 +1012,13 @@ public void mouseReleased(final MouseEvent me) {
10121012
@Override
10131013
public void mouseWheelMoved(final MouseWheelEvent e) {
10141014
if (!e.isControlDown() || isEventsDisabled() || !tracerPlugin.isUIready()) {
1015-
// Do not consume: re-dispatch to ImageWindow so IJ's zoom/scroll still works
1016-
getParent().dispatchEvent(e);
1015+
// We need to dispatch the even so that IJ's zoom/scroll still works. It seems
1016+
// that on M Windows, AWT propagates MouseWheelEvents up the component hierarchy
1017+
// *and* honors our explicit re-dispatch, causing double-scroll. Consuming first
1018+
// suppresses the propagation; the manual dispatchEvent() below delivers it once.
1019+
// See https://github.com/morphonets/SNT/issues/271
1020+
e.consume(); // stop propagation on Windows
1021+
getParent().dispatchEvent(e); // re-dispatch exactly once to ImageWindow
10171022
return;
10181023
}
10191024
final int state = tracerPlugin.getUIState();

0 commit comments

Comments
 (0)