Skip to content

Commit

Permalink
Fix tile action handler
Browse files Browse the repository at this point in the history
  • Loading branch information
prmr committed Feb 20, 2019
1 parent 8f373f9 commit 4fedd51
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/ca/mcgill/cs/swevo/minesweeper/Minesweeper.java
Expand Up @@ -168,16 +168,17 @@ private Button createHiddenTile(Position pPosition)
{
button.setText("!");
}
button.setOnAction(e->
{
aMinefield.reveal(pPosition); refresh();
});
button.setOnMouseClicked( e->
{
if( e.getButton() == MouseButton.SECONDARY )
{
aMinefield.toggleMark(pPosition);
}
else
{
aMinefield.toggleMark(pPosition); refresh();
aMinefield.reveal(pPosition);
}
refresh();
});
return button;
}
Expand Down

0 comments on commit 4fedd51

Please sign in to comment.