Skip to content

Commit

Permalink
Added a method to clear the currently selected snake from the current…
Browse files Browse the repository at this point in the history
… frame only.
  • Loading branch information
m smith committed Sep 11, 2019
1 parent d1ce747 commit 86ce655
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/main/java/snakeprogram/SnakeFrame.java
Expand Up @@ -243,6 +243,13 @@ private JMenuBar createMenuBar(){
transform_snake.setAccelerator(KeyStroke.getKeyStroke('m'));
snakes.add(transform_snake);

JMenuItem clear_current = new JMenuItem("Clear from Current Frame.");
clear_current.addActionListener(evt->{
snake_model.clearCurrentSnake();
});
clear_current.setAccelerator(KeyStroke.getKeyStroke('c'));
snakes.add(clear_current);

JMenuItem sculpt_snake = new JMenuItem("Sculpt Selected");
sculpt_snake.setActionCommand(SnakeActions.sculpt.name());
sculpt_snake.addActionListener(snake_listener);
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/snakeprogram/SnakeModel.java
Expand Up @@ -934,7 +934,20 @@ public boolean checkForCurrentSnake(){
}

}


/**
* Clears the current snake from the current frame, without deleting the whole snake.
*/
public void clearCurrentSnake(){
if(CurrentSnake != null){
Integer f = getCurrentFrame();
if(CurrentSnake.exists(f)){
CurrentSnake.Coordinates.remove(f);
}
purgeSnakes();
updateImagePanel();
}
}
/**
* Ceases a deform iterations
*/
Expand Down

0 comments on commit 86ce655

Please sign in to comment.