Skip to content

Commit

Permalink
Fix redo logic
Browse files Browse the repository at this point in the history
  • Loading branch information
VardanTitan authored and burhanrashid52 committed Feb 28, 2024
1 parent 685c82b commit 8648773
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ class DrawingView @JvmOverloads constructor(
}
viewChangeListener?.apply {
onStopDrawing()
if(redoShapes.isNotEmpty()) {
redoShapes.clear()
}
onViewAdd(this@DrawingView)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ internal class GraphicManager(
mPhotoEditorView.addView(view, params)
mViewState.addAddedView(view)

if(mViewState.redoViewsCount > 0) {
mViewState.clearRedoViews()
}

onPhotoEditorListener?.onAddViewListener(
graphic.viewType,
mViewState.addedViewsCount
Expand Down Expand Up @@ -75,7 +79,8 @@ internal class GraphicManager(
mViewState.redoViewsCount - 1
)
if (redoView is DrawingView) {
return redoView.redo() && (mViewState.redoViewsCount != 0)
val result = redoView.redo()
return result || (mViewState.redoViewsCount != 0)
} else {
mViewState.popRedoView()
mPhotoEditorView.addView(redoView)
Expand Down

0 comments on commit 8648773

Please sign in to comment.