use of net.sf.mzmine.chartbasics.gestures.standard.DragGestureHandlerDef in project mzmine2 by mzmine.
the class ChartGestureHandler method initStandardGestures.
/**
* Generates a list of standard chart gesture
*
* @param axisDrag
* @param axisWheel
* @param titleRemover
* @param zoomHistory
* @param axisAutoRange
* @return
*/
public static List<GestureHandlerFactory> initStandardGestures(boolean axisDrag, boolean axisWheel, boolean titleRemover, boolean zoomHistory, boolean axisAutoRange) {
standardGestures = new ArrayList<GestureHandlerFactory>();
if (axisDrag) {
// adds multiple gestures to one domain axis drag handler
// Scroll axis: DRAG mouse over domain axis
// Scroll + auto zoom: SHIFT + DRAG
// Zoom axis centered: CTRL + DRAG
// Zoom + auto zoom range axis: CTRL + SHIFT + DRAG
standardGestures.add(new DragGestureHandlerDef(new DragHandler[] { DragHandler.SCROLL_AXIS, DragHandler.SCROLL_AXIS_AND_AUTO_ZOOM, DragHandler.ZOOM_AXIS_CENTER, DragHandler.ZOOM_AXIS_CENTER, DragHandler.AUTO_ZOOM_OPPOSITE_AXIS }, new Key[] { Key.NONE, Key.SHIFT, Key.CTRL, Key.CTRL_SHIFT, Key.CTRL_SHIFT }, Entity.DOMAIN_AXIS, Button.BUTTON1, null, null));
// Zoom range axis (include zero): DRAG
standardGestures.add(new DragGestureHandlerDef(new DragHandler[] { DragHandler.ZOOM_AXIS_INCLUDE_ZERO }, new Key[] { Key.ALL }, Entity.RANGE_AXIS, Button.BUTTON1, null, null));
}
if (axisWheel) {
// MOUSE WHEEL on domain axis
// Scroll axis: WHEEL over domain axis
// Scroll + auto zoom: SHIFT + WHEEL
// Zoom axis centered: CTRL + WHEEL
// Zoom + auto zoom range axis: CTRL + SHIFT + WHEEL
standardGestures.add(new GestureHandlerDef(Handler.SCROLL_AXIS, Entity.DOMAIN_AXIS, new Event[] { Event.MOUSE_WHEEL }, null, Key.NONE, null));
standardGestures.add(new GestureHandlerDef(Handler.SCROLL_AXIS_AND_AUTO_ZOOM, Entity.DOMAIN_AXIS, new Event[] { Event.MOUSE_WHEEL }, null, Key.SHIFT, null));
standardGestures.add(new GestureHandlerDef(Handler.ZOOM_AXIS_CENTER, Entity.DOMAIN_AXIS, new Event[] { Event.MOUSE_WHEEL }, null, Key.CTRL, null));
standardGestures.add(new GestureHandlerDef(Handler.ZOOM_AXIS_CENTER, Entity.DOMAIN_AXIS, new Event[] { Event.MOUSE_WHEEL }, null, Key.CTRL_SHIFT, null));
standardGestures.add(new GestureHandlerDef(Handler.AUTO_ZOOM_OPPOSITE_AXIS, Entity.DOMAIN_AXIS, new Event[] { Event.MOUSE_WHEEL }, null, Key.CTRL_SHIFT, null));
// Zoom range axis (include zero): MOUSE WHEEL
standardGestures.add(new GestureHandlerDef(Handler.ZOOM_AXIS_INCLUDE_ZERO, Entity.RANGE_AXIS, new Event[] { Event.MOUSE_WHEEL }, null, Key.ALL, null));
}
if (zoomHistory) {
// Previous zoom history: DOUBLE CLICK on plot
// Next zoom history: CTRL + DOUBLE CLICK on plot
standardGestures.add(new GestureHandlerDef(Handler.PREVIOUS_ZOOM_HISTORY, Entity.PLOT, new Event[] { Event.DOUBLE_CLICK }, Button.BUTTON1, Key.NONE, null));
standardGestures.add(new GestureHandlerDef(Handler.NEXT_ZOOM_HISTORY, Entity.PLOT, new Event[] { Event.DOUBLE_CLICK }, Button.BUTTON1, Key.CTRL, null));
}
if (titleRemover) {
// Remove titles, legends: CTRL + CLICK on titles
standardGestures.add(new GestureHandlerDef(Handler.TITLE_REMOVER, Entity.TITLE, new Event[] { Event.CLICK }, Button.BUTTON1, Key.CTRL, null));
}
if (axisAutoRange) {
// Auto zoom axes: DOUBLE CLICK on axis
standardGestures.add(new GestureHandlerDef(Handler.AUTO_ZOOM_AXIS, Entity.DOMAIN_AXIS, new Event[] { Event.DOUBLE_CLICK }, Button.BUTTON1, null, null));
standardGestures.add(new GestureHandlerDef(Handler.AUTO_ZOOM_AXIS, Entity.RANGE_AXIS, new Event[] { Event.DOUBLE_CLICK }, Button.BUTTON1, null, null));
}
return standardGestures;
}
Aggregations