make sure Redo is invisible if theres nothing to redo

This commit is contained in:
tibbi 2018-02-12 16:09:07 +01:00
parent 8386dd4286
commit d2b219201a
1 changed files with 5 additions and 0 deletions

View File

@ -84,6 +84,11 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
}
fun redo() {
if (mUndonePaths.keys.isEmpty()) {
mListener?.toggleRedoVisibility(false)
return
}
val lastKey = mUndonePaths.keys.last()
addPath(lastKey, mUndonePaths.values.last())
mUndonePaths.remove(lastKey)