avoid piece to be placed when right clicking

This commit is contained in:
Debucquoy Anthony 2023-05-11 11:56:00 +02:00
parent cb54e753d7
commit 201eb3ec10
Signed by: tonitch
GPG Key ID: A78D6421F083D42E

View File

@ -54,6 +54,8 @@ public class GameUI extends Group{
_piece.setLayoutY(event.getSceneY() - piece_pos_click.y); _piece.setLayoutY(event.getSceneY() - piece_pos_click.y);
}); });
_piece.setOnMouseReleased(event -> { _piece.setOnMouseReleased(event -> {
if(event.getButton() != MouseButton.PRIMARY)
return;
if(event.getSceneX() > grid.getLayoutX() && event.getSceneX() < grid.getLayoutX() + grid.boundary_size.x if(event.getSceneX() > grid.getLayoutX() && event.getSceneX() < grid.getLayoutX() + grid.boundary_size.x
&& event.getSceneY() > grid.getLayoutY() && event.getSceneY() < grid.getLayoutY() + grid.boundary_size.y ) && event.getSceneY() > grid.getLayoutY() && event.getSceneY() < grid.getLayoutY() + grid.boundary_size.y )
{ {