WIP : Brad_GraphPiece #25

Closed
BrokenBrad wants to merge 13 commits from Brad_GraphPiece into master
Showing only changes of commit bb5e2ff401 - Show all commits

View File

@ -56,17 +56,16 @@ public class Piece extends Application{
//Instantiating RotateTransition class to create the animation (rotation to the left)
RotateTransition rotatelft = new RotateTransition();
//setting attributes for the RotateTransition
rotatelft.setByAngle(-90);
rotatelft.setByAngle(-90);// minus to rotate to the left
rotatelft.autoReverseProperty();
rotatelft.setDuration(Duration.millis(1000));
rotatelft.setNode(piece1);
rotatelft.setAxis(Rotate.Z_AXIS);
/* */
piece1.setOnMousePressed(new EventHandler<MouseEvent>() {
//Mouse events handling
piece1.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
// record a delta distance for the drag and drop operation.
// record a (x,y) distance for the drag and drop operation.
x = piece1.getLayoutX() - mouseEvent.getSceneX();
y = piece1.getLayoutY() - mouseEvent.getSceneY();
piece1.setCursor(Cursor.CLOSED_HAND);
@ -96,9 +95,6 @@ public class Piece extends Application{
scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
@ -115,23 +111,6 @@ public class Piece extends Application{
}
/*public void pressed(MouseEvent event, Polygon piece1) {
piece1.setFill(Color.AZURE);
int x = piece1.getLayoutX() - MouseEvent.getSceneX();
int y = piece1.getLayoutY() - MouseEvent.getSceneY();
piece1.setCursor(Cursor.MOVE);
}
public void dragged(MouseEvent event, Polygon piece1) {
piece1.setLayoutX(event.getSceneX()+ x);
piece1.setLayoutY(event.getSceneY()+ y);
piece1.draw();
}
public void released(MouseEvent event, Polygon piece1) {
piece1.setCursor(Cursor.HAND);
}
*/
public static void main(String[] args) {
launch(args);