|
@@ -6,6 +6,7 @@ import javafx.beans.value.ChangeListener;
|
|
|
import javafx.beans.value.ObservableValue;
|
|
|
import javafx.event.Event;
|
|
|
import javafx.geometry.Bounds;
|
|
|
+import javafx.geometry.Pos;
|
|
|
import javafx.scene.Group;
|
|
|
import javafx.scene.control.Label;
|
|
|
import javafx.scene.input.*;
|
|
@@ -62,9 +63,31 @@ public class Connectable extends GridPane implements IGUIEventClient,ChangeListe
|
|
|
|
|
|
configure(json);
|
|
|
|
|
|
+ _border = new Circle(0,0, 7);
|
|
|
+ _border.setFill(Color.BLACK);
|
|
|
+ _circle = new Circle(0,0,5);
|
|
|
+ _circle.setFill(Color.WHITE);
|
|
|
+
|
|
|
+ _connection = new StackPane(_border,_circle);
|
|
|
+
|
|
|
+ _connection.setOnMouseClicked(e -> {
|
|
|
+ if (e.getButton() == MouseButton.SECONDARY) {
|
|
|
+ if (!_connected) {
|
|
|
+ optimizable = !optimizable;
|
|
|
+ updateColor();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ layoutXProperty().addListener(this);
|
|
|
+ layoutYProperty().addListener(this);
|
|
|
+
|
|
|
_parent.translateXProperty().addListener(this);
|
|
|
_parent.translateYProperty().addListener(this);
|
|
|
|
|
|
+ _connection.layoutXProperty().addListener(this);
|
|
|
+
|
|
|
_parent.hlayout.translateXProperty().addListener(this);
|
|
|
_parent.hlayout.translateYProperty().addListener(this);
|
|
|
|
|
@@ -86,22 +109,7 @@ public class Connectable extends GridPane implements IGUIEventClient,ChangeListe
|
|
|
_parent.outputs.layoutYProperty().addListener(this);
|
|
|
}
|
|
|
|
|
|
- _border = new Circle(0,0, 7);
|
|
|
- _border.setFill(Color.BLACK);
|
|
|
- _circle = new Circle(0,0,5);
|
|
|
- _circle.setFill(Color.WHITE);
|
|
|
-
|
|
|
- _connection = new StackPane(_border,_circle);
|
|
|
|
|
|
- _connection.setOnMouseClicked(e -> {
|
|
|
- if (e.getButton() == MouseButton.SECONDARY) {
|
|
|
- if (!_connected) {
|
|
|
- optimizable = !optimizable;
|
|
|
- updateColor();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
|
|
|
_connection.addEventHandler(MouseEvent.DRAG_DETECTED, e -> {
|
|
|
Dragboard db = _connection.startDragAndDrop(TransferMode.MOVE);
|
|
@@ -261,7 +269,7 @@ public class Connectable extends GridPane implements IGUIEventClient,ChangeListe
|
|
|
}
|
|
|
Bounds con_bounds = _connection.getLayoutBounds();
|
|
|
x.setValue(dx + _parent.getTranslateX()+ _parent.hlayout.getTranslateX() + _parent.hlayout.getLayoutX() + _parent.vlayout.getTranslateX() + _parent.vlayout.getLayoutX() + _connection.getLayoutX() + con_bounds.getWidth()/2 + getLayoutX());
|
|
|
- y.setValue(dy + _parent.getTranslateY()+ _parent.hlayout.getTranslateY() + _parent.hlayout.getLayoutY()+ _parent.vlayout.getTranslateY() + _parent.vlayout.getLayoutY() + _connection.getLayoutY() + con_bounds.getHeight()/2 + getLayoutX());
|
|
|
+ y.setValue(dy + _parent.getTranslateY()+ _parent.hlayout.getTranslateY() + _parent.hlayout.getLayoutY()+ _parent.vlayout.getTranslateY() + _parent.vlayout.getLayoutY() + _connection.getLayoutY() + con_bounds.getHeight()/2 + getLayoutY());
|
|
|
}
|
|
|
|
|
|
@Override
|