MCPcopy Index your code
hub / github.com/processing/processing / fxMouseEvent

Method fxMouseEvent

core/src/processing/javafx/PSurfaceFX.java:826–871  ·  view source on GitHub ↗
(MouseEvent fxEvent)

Source from the content-addressed store, hash-verified

824 }
825
826 protected void fxMouseEvent(MouseEvent fxEvent) {
827 // the 'amount' is the number of button clicks for a click event,
828 // or the number of steps/clicks on the wheel for a mouse wheel event.
829 int count = fxEvent.getClickCount();
830
831 int action = mouseMap.get(fxEvent.getEventType());
832
833 int modifiers = 0;
834 if (fxEvent.isShiftDown()) {
835 modifiers |= processing.event.Event.SHIFT;
836 }
837 if (fxEvent.isControlDown()) {
838 modifiers |= processing.event.Event.CTRL;
839 }
840 if (fxEvent.isMetaDown()) {
841 modifiers |= processing.event.Event.META;
842 }
843 if (fxEvent.isAltDown()) {
844 modifiers |= processing.event.Event.ALT;
845 }
846
847 int button = 0;
848 switch (fxEvent.getButton()) {
849 case PRIMARY:
850 button = PConstants.LEFT;
851 break;
852 case SECONDARY:
853 button = PConstants.RIGHT;
854 break;
855 case MIDDLE:
856 button = PConstants.CENTER;
857 break;
858 case NONE:
859 // not currently handled
860 break;
861 }
862
863 //long when = nativeEvent.getWhen(); // from AWT
864 long when = System.currentTimeMillis();
865 int x = (int) fxEvent.getX(); // getSceneX()?
866 int y = (int) fxEvent.getY();
867
868 sketch.postEvent(new processing.event.MouseEvent(fxEvent, when,
869 action, modifiers,
870 x, y, button, count));
871 }
872
873 // https://docs.oracle.com/javase/8/javafx/api/javafx/scene/input/ScrollEvent.html
874 protected void fxScrollEvent(ScrollEvent fxEvent) {

Callers 1

handleMethod · 0.80

Calls 10

getClickCountMethod · 0.80
isControlDownMethod · 0.80
isMetaDownMethod · 0.80
isAltDownMethod · 0.80
getButtonMethod · 0.80
getXMethod · 0.80
getYMethod · 0.80
postEventMethod · 0.80
getMethod · 0.65
isShiftDownMethod · 0.45

Tested by

no test coverage detected