From 7047e9a8d4d136457f6c5577f9113d6062d127f9 Mon Sep 17 00:00:00 2001 From: arekrataj Date: Thu, 25 Jan 2018 12:29:17 +0100 Subject: [PATCH] Fix for UNDO feature in P_2_3_3_01_TABLET_TOOL The method 'undoDrawItems' (line 201) didn't update the value of 'theUndoIndex' variable. --- .../P_2_3_3_01_TABLET_TOOL.pde | 53 ++----------------- 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/01_P/P_2_3_3_01_TABLET_TOOL/P_2_3_3_01_TABLET_TOOL.pde b/01_P/P_2_3_3_01_TABLET_TOOL/P_2_3_3_01_TABLET_TOOL.pde index abc0e40..b51c55c 100644 --- a/01_P/P_2_3_3_01_TABLET_TOOL/P_2_3_3_01_TABLET_TOOL.pde +++ b/01_P/P_2_3_3_01_TABLET_TOOL/P_2_3_3_01_TABLET_TOOL.pde @@ -168,7 +168,7 @@ void keyReleased() { } if (key == 'z' || key == 'Z') { - undoDrawItems(undoIndex); + undoIndex = undoDrawItems(undoIndex); reDrawAllDrawItems(); } } @@ -198,56 +198,13 @@ void reDrawAllDrawItems() { } } -void undoDrawItems(int theUndoIndex) { +int undoDrawItems(int theUndoIndex) { theUndoIndex -= 1; if (drawItems.size() > 0 && theUndoIndex >= 0) { for (int i = drawItems.size()-1; i > theUndoIndex; i--) { drawItems.remove(i); } } -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + return theUndoIndex; +} \ No newline at end of file