Java Code Examples for javafx.scene.input.TouchEvent#TOUCH_MOVED

The following examples show how to use javafx.scene.input.TouchEvent#TOUCH_MOVED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HeatControlSkin.java    From Enzo with Apache License 2.0 6 votes vote down vote up
private void handleTouchEvent(final TouchEvent TOUCH_EVENT) {
    final Object    SRC  = TOUCH_EVENT.getSource();
    final EventType TYPE = TOUCH_EVENT.getEventType();
    if (SRC.equals(targetIndicator)) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getTarget()));
            resizeText();
        } else if (TouchEvent.TOUCH_MOVED == TYPE) {
            touchRotate(TOUCH_EVENT.getTouchPoint().getSceneX() - getSkinnable().getLayoutX(), TOUCH_EVENT.getTouchPoint().getSceneY() - getSkinnable().getLayoutY(),
                        targetIndicatorRotate);
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            getSkinnable().setTarget(Double.parseDouble(value.getText()));
            fadeBack();
        }
    }
}
 
Example 2
Source File: RadialBargraphSkin.java    From Enzo with Apache License 2.0 4 votes vote down vote up
private void handleTouchEvent(final TouchEvent TOUCH_EVENT) {
    final Object    SRC  = TOUCH_EVENT.getSource();
    final EventType TYPE = TOUCH_EVENT.getEventType();
    if (SRC.equals(threshold)) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            unit.setText("Threshold");
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getThreshold()));
            resizeText();
        } else if (TouchEvent.TOUCH_MOVED == TYPE) {
            touchRotate(TOUCH_EVENT.getTouchPoint().getSceneX() - getSkinnable().getLayoutX(), TOUCH_EVENT.getTouchPoint().getSceneY() - getSkinnable().getLayoutY(), thresholdRotate);
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            getSkinnable().setThreshold(Double.parseDouble(value.getText()));
            fadeBackToInteractive();
        }
    } else if (SRC instanceof Marker) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            unit.setText(((Marker) SRC).getText());
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", ((Marker) SRC).getValue()));
            resizeText();
        } else if (TouchEvent.TOUCH_MOVED == TYPE) {
            touchRotate(TOUCH_EVENT.getTouchPoint().getSceneX() - getSkinnable().getLayoutX(), TOUCH_EVENT.getTouchPoint().getSceneY() - getSkinnable().getLayoutY(), getSkinnable().getMarkers().get(SRC));
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            ((Marker) SRC).setValue(Double.parseDouble(value.getText()));
            fadeBackToInteractive();
        }
    } else if (SRC.equals(minMeasuredValue)) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            unit.setText("Min");
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMinMeasuredValue()));
            resizeText();
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            fadeBackToInteractive();
        }
    } else if (SRC.equals(maxMeasuredValue)) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            unit.setText("Max");
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMaxMeasuredValue()));
            resizeText();
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            fadeBackToInteractive();
        }
    }
}
 
Example 3
Source File: GaugeSkin.java    From Enzo with Apache License 2.0 4 votes vote down vote up
private void handleTouchEvent(final TouchEvent TOUCH_EVENT) {
    final Object    SRC  = TOUCH_EVENT.getSource();
    final EventType TYPE = TOUCH_EVENT.getEventType();
    if (SRC.equals(threshold)) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            unit.setText("Threshold");
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getThreshold()));
            resizeText();
        } else if (TouchEvent.TOUCH_MOVED == TYPE) {
            touchRotate(TOUCH_EVENT.getTouchPoint().getSceneX() - getSkinnable().getLayoutX(), TOUCH_EVENT.getTouchPoint().getSceneY() - getSkinnable().getLayoutY(), thresholdRotate);
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            getSkinnable().setThreshold(Double.parseDouble(value.getText()));
            fadeBackToInteractive();
        }
    } else if (SRC instanceof Marker) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            unit.setText(((Marker) SRC).getText());
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", ((Marker) SRC).getValue()));
            resizeText();
        } else if (TouchEvent.TOUCH_MOVED == TYPE) {
            touchRotate(TOUCH_EVENT.getTouchPoint().getSceneX() - getSkinnable().getLayoutX(), TOUCH_EVENT.getTouchPoint().getSceneY() - getSkinnable().getLayoutY(), getSkinnable().getMarkers().get(SRC));
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            ((Marker) SRC).setValue(Double.parseDouble(value.getText()));
            fadeBackToInteractive();
        }
    } else if (SRC.equals(minMeasuredValue)) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            unit.setText("Min");
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMinMeasuredValue()));
            resizeText();
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            fadeBackToInteractive();
        }
    } else if (SRC.equals(maxMeasuredValue)) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            unit.setText("Max");
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMaxMeasuredValue()));
            resizeText();
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            fadeBackToInteractive();
        }
    }
}