de.gsi.chart.plugins.MouseEvents Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chartfx-chart Show documentation
Show all versions of chartfx-chart Show documentation
This charting library ${project.artifactId}- is an extension
in the spirit of Oracle's XYChart and performance/time-proven JDataViewer charting functionalities.
Emphasis was put on plotting performance for both large number of data points and real-time displays,
as well as scientific accuracies leading to error bar/surface plots, and other scientific plotting
features (parameter measurements, fitting, multiple axes, zoom, ...).
package de.gsi.chart.plugins;
import static javafx.scene.input.MouseButton.PRIMARY;
import static javafx.scene.input.MouseButton.SECONDARY;
import javafx.scene.input.MouseEvent;
/**
* Utility methods for operating on {@link MouseEvent}s. (Unfortunately, the
* original by G.Kruk is package scoped)
*
* @author Grzegorz Kruk
* @author braeun
*/
public class MouseEvents {
static boolean isOnlyPrimaryButtonDown(final MouseEvent event) {
return event.getButton() == PRIMARY && !event.isMiddleButtonDown() && !event.isSecondaryButtonDown();
}
static boolean isOnlySecondaryButtonDown(final MouseEvent event) {
return event.getButton() == SECONDARY && !event.isPrimaryButtonDown() && !event.isMiddleButtonDown();
}
static boolean isOnlyMiddleButtonDown(final MouseEvent event) {
return event.isMiddleButtonDown() && !event.isPrimaryButtonDown() && !event.isSecondaryButtonDown();
}
static boolean isOnlyCtrlModifierDown(final MouseEvent event) {
return event.isControlDown() && !event.isAltDown() && !event.isMetaDown() && !event.isShiftDown();
}
static boolean modifierKeysUp(final MouseEvent event) {
return !event.isAltDown() && !event.isControlDown() && !event.isMetaDown() && !event.isShiftDown();
}
}