Search in sources :

Example 1 with PaintPickerController

use of com.fxexperience.javafx.scene.control.paintpicker.PaintPickerController in project fxexperience2 by EricCanull.

the class GradientPickerStop method thumbKeyPressed.

@FXML
void thumbKeyPressed(KeyEvent e) {
    if (e.getCode() == KeyCode.BACK_SPACE || e.getCode() == KeyCode.DELETE) {
        gradientPicker.removeStop(this);
        // Called when removing a gradient stop :
        // - update gradient preview accordingly
        // - update model
        final PaintPickerController paintPicker = gradientPicker.getPaintPickerController();
        final Mode mode = paintPicker.getMode();
        final Paint value = gradientPicker.getValue(mode);
        gradientPicker.updatePreview(value);
        // Update model
        paintPicker.setPaintProperty(value);
        e.consume();
    }
}
Also used : Mode(com.fxexperience.javafx.scene.control.paintpicker.PaintPicker.Mode) PaintPickerController(com.fxexperience.javafx.scene.control.paintpicker.PaintPickerController) Paint(javafx.scene.paint.Paint) FXML(javafx.fxml.FXML)

Example 2 with PaintPickerController

use of com.fxexperience.javafx.scene.control.paintpicker.PaintPickerController in project fxexperience2 by EricCanull.

the class GradientPickerStop method stopAction.

@FXML
void stopAction(ActionEvent event) {
    double val = Double.valueOf(offset_textfield.getText());
    setOffset(val);
    showHUD();
    // Called when moving a gradient stop :
    // - update gradient preview accordingly
    // - update model
    final PaintPickerController paintPicker = gradientPicker.getPaintPickerController();
    final Mode mode = paintPicker.getMode();
    final Paint value = gradientPicker.getValue(mode);
    gradientPicker.updatePreview(value);
    // Update model
    paintPicker.setPaintProperty(value);
}
Also used : Mode(com.fxexperience.javafx.scene.control.paintpicker.PaintPicker.Mode) PaintPickerController(com.fxexperience.javafx.scene.control.paintpicker.PaintPickerController) Paint(javafx.scene.paint.Paint) FXML(javafx.fxml.FXML)

Example 3 with PaintPickerController

use of com.fxexperience.javafx.scene.control.paintpicker.PaintPickerController in project fxexperience2 by EricCanull.

the class GradientPickerStop method thumbMouseDragged.

@FXML
void thumbMouseDragged(MouseEvent event) {
    double dragValue = event.getSceneX() - startDragX;
    double deltaX = origX + dragValue;
    double trackWidth = getParent().getBoundsInLocal().getWidth();
    final Double newX = clamp(edgeMargin, deltaX, (trackWidth - (getWidth() + edgeMargin)));
    setLayoutX(newX);
    // showHUD();
    pixelsToValue();
    // Called when moving a gradient stop :
    // - update gradient preview accordingly
    // - update model
    final PaintPickerController paintPicker = gradientPicker.getPaintPickerController();
    final Mode mode = paintPicker.getMode();
    final Paint value = gradientPicker.getValue(mode);
    gradientPicker.updatePreview(value);
    // Update model
    paintPicker.setPaintProperty(value);
}
Also used : Mode(com.fxexperience.javafx.scene.control.paintpicker.PaintPicker.Mode) PaintPickerController(com.fxexperience.javafx.scene.control.paintpicker.PaintPickerController) Paint(javafx.scene.paint.Paint) FXML(javafx.fxml.FXML)

Example 4 with PaintPickerController

use of com.fxexperience.javafx.scene.control.paintpicker.PaintPickerController in project fxexperience2 by EricCanull.

the class GradientPickerStop method thumbMousePressed.

@FXML
void thumbMousePressed(MouseEvent event) {
    gradientPicker.setSelectedStop(this);
    startDragX = event.getSceneX();
    origX = getLayoutX();
    // make sure this stop is in highest z-order
    toFront();
    // showHUD();
    pixelsToValue();
    // Called when selecting a gradient stop :
    // - update color preview accordingly
    // - do not update the model
    final PaintPickerController paintPicker = gradientPicker.getPaintPickerController();
    final ColorPickerControl colorPicker = paintPicker.getColorPicker();
    colorPicker.updateUI(color);
    stop_button.requestFocus();
}
Also used : ColorPickerControl(com.fxexperience.javafx.scene.control.colorpicker.ColorPickerControl) PaintPickerController(com.fxexperience.javafx.scene.control.paintpicker.PaintPickerController) FXML(javafx.fxml.FXML)

Aggregations

PaintPickerController (com.fxexperience.javafx.scene.control.paintpicker.PaintPickerController)4 FXML (javafx.fxml.FXML)4 Mode (com.fxexperience.javafx.scene.control.paintpicker.PaintPicker.Mode)3 Paint (javafx.scene.paint.Paint)3 ColorPickerControl (com.fxexperience.javafx.scene.control.colorpicker.ColorPickerControl)1