@@ -1012,22 +1012,26 @@ public void mouseReleased(final MouseEvent me) {
10121012 @ Override
10131013 public void mouseWheelMoved (final MouseWheelEvent e ) {
10141014 if (!e .isControlDown () || isEventsDisabled () || !tracerPlugin .isUIready ()) {
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.
1015+ // Forward to parent (ImageWindow/StackWindow) for IJ's default zoom/scroll.
1016+ // We consume first to suppress AWT's automatic propagation, which on Windows
1017+ // would deliver the event twice (once via propagation, once via our call).
10191018 // 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
1019+ // NB: Direct method call avoids reentrancy and consumed-event filtering.
1020+ // See https://forum.image.sc/t/119476/5
1021+ e .consume ();
1022+ if (getParent () instanceof MouseWheelListener )
1023+ ((MouseWheelListener ) getParent ()).mouseWheelMoved (e ); // doesn't care about consumed flag
10221024 return ;
10231025 }
10241026 final int state = tracerPlugin .getUIState ();
10251027 final boolean validState = editMode || state == SNTUI .WAITING_TO_START_PATH || state == SNTUI .PARTIAL_PATH ;
10261028 if (!validState ) {
1027- getParent ().dispatchEvent (e );
1029+ e .consume ();
1030+ if (getParent () instanceof MouseWheelListener )
1031+ ((MouseWheelListener ) getParent ()).mouseWheelMoved (e );
10281032 return ;
10291033 }
1030- e .consume (); // prevent ImageCanvas from processing the wheel event (e.g., zoom)
1034+ e .consume (); // prevent IJ from also handling this Ctrl+ wheel event
10311035
10321036 // Seed manualRadius: in edit mode, prefer the node's existing radius
10331037 if (tracerPlugin .manualRadius <= 0 ) {
0 commit comments