Skip to content

Commit

Permalink
Added contradiction check to mouse event
Browse files Browse the repository at this point in the history
Removed previous changes from TreeView

Added board modifiability update to TreeController for each mouse press on the proof tree: modifiability is determined by whether or not the current selected node is part of a contradiction branch
  • Loading branch information
Chase-Grajeda committed Oct 10, 2023
1 parent d8c6a21 commit 6740d5e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 1 addition & 0 deletions src/main/java/edu/rpi/legup/controller/TreeController.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void mouseReleased(MouseEvent e) {
Puzzle puzzle = getInstance().getPuzzleModule();
TreeViewSelection selection = treeView.getSelection();
if (treeElementView != null) {
treeElementView.getTreeElement().getBoard().setModifiable(!treeElementView.getTreeElement().isContradictoryBranch());
if (e.isShiftDown()) {
selection.addToSelection(treeElementView);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,6 @@ public void onTreeSelectionChanged(TreeViewSelection selection) {
this.selection.getSelectedViews().forEach(v -> v.setSelected(false));
selection.getSelectedViews().forEach(v -> v.setSelected(true));
this.selection = selection;
// When selected node is on a contradictory branch, disable board modifiability
if(selection.getFirstSelection().getTreeElement().isContradictoryBranch()) {
GameBoardFacade.getInstance().getBoard().setModifiable(false);
}
else GameBoardFacade.getInstance().getBoard().setModifiable(true);
repaint();
}

Expand Down

1 comment on commit 6740d5e

@Chase-Grajeda
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Progress towards #624

Please sign in to comment.