-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A behaviour to scroll through time-points in bdv with mouse-wheel.
Not binded by default. We have to make special behaviour for it, because the behaviour mechanism for mouse-wheel is implemented in a special behaviour hierarchy.
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/java/org/mastodon/views/bdv/BigDataViewerBehavioursMamut.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.mastodon.views.bdv; | ||
|
||
import org.mastodon.ui.keymap.KeyConfigContexts; | ||
import org.mastodon.ui.keymap.KeyConfigScopes; | ||
import org.mastodon.views.bdv.overlay.OverlayEdge; | ||
import org.mastodon.views.bdv.overlay.OverlayVertex; | ||
import org.scijava.plugin.Plugin; | ||
import org.scijava.ui.behaviour.ScrollBehaviour; | ||
import org.scijava.ui.behaviour.io.gui.CommandDescriptionProvider; | ||
import org.scijava.ui.behaviour.io.gui.CommandDescriptions; | ||
import org.scijava.ui.behaviour.util.Behaviours; | ||
|
||
import bdv.viewer.ViewerPanel; | ||
|
||
public class BigDataViewerBehavioursMamut | ||
{ | ||
|
||
public static final String SCROLL_TIMEPOINTS = "scroll timepoint"; | ||
|
||
private static final String[] SCROLL_TIMEPOINTS_KEYS = new String[] { "not mapped" }; | ||
|
||
public static < V extends OverlayVertex< V, E >, E extends OverlayEdge< E, V > > void install( | ||
final Behaviours behaviours, | ||
final BigDataViewerMamut bdv ) | ||
{ | ||
behaviours.behaviour( new ScrollTimePointsBehaviour( bdv.getViewer() ), SCROLL_TIMEPOINTS, SCROLL_TIMEPOINTS_KEYS ); | ||
} | ||
|
||
/* | ||
* Command descriptions for all provided commands | ||
*/ | ||
@Plugin( type = CommandDescriptionProvider.class ) | ||
public static class Descriptions extends CommandDescriptionProvider | ||
{ | ||
public Descriptions() | ||
{ | ||
super( KeyConfigScopes.MASTODON, KeyConfigContexts.BIGDATAVIEWER ); | ||
} | ||
|
||
@Override | ||
public void getCommandDescriptions( final CommandDescriptions descriptions ) | ||
{ | ||
descriptions.add( SCROLL_TIMEPOINTS, SCROLL_TIMEPOINTS_KEYS, "Use mouse-wheel to scroll through time-points." ); | ||
} | ||
} | ||
|
||
private static class ScrollTimePointsBehaviour implements ScrollBehaviour | ||
{ | ||
|
||
private final ViewerPanel viewer; | ||
|
||
public ScrollTimePointsBehaviour( final ViewerPanel viewerPanel ) | ||
{ | ||
this.viewer = viewerPanel; | ||
} | ||
|
||
@Override | ||
public void scroll( final double wheelRotation, final boolean isHorizontal, final int x, final int y ) | ||
{ | ||
if ( wheelRotation > 0 ) | ||
viewer.nextTimePoint(); | ||
else | ||
viewer.previousTimePoint(); | ||
} | ||
|
||
} | ||
|
||
} |