Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAINTROID-498 Line Color Changing #1167

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class DefaultCommandManager(
notifyCommandExecuted()
}

private fun handleUndo(command: Command) {
private fun handleUndo(command: Command, ignoreColorCommand: Boolean = false) {
var success = true
var layerCount = layerModel.layerCount
val currentCommandName = command.javaClass.simpleName
Expand Down Expand Up @@ -153,9 +153,13 @@ class DefaultCommandManager(

val iterator = undoCommandList.descendingIterator()
while (iterator.hasNext()) {
var nextCommand = iterator.next()
if (nextCommand is ColorChangedCommand && ignoreColorCommand) {
continue
}
val currentLayer = layerModel.currentLayer
canvas.setBitmap(currentLayer?.bitmap)
iterator.next().run(canvas, layerModel)
nextCommand.run(canvas, layerModel)
}

if (!currentCommandName.matches(mergeLayerCommandRegex)) {
Expand Down Expand Up @@ -231,7 +235,7 @@ class DefaultCommandManager(
if (undoCommandList.isNotEmpty() && undoCommandList.first != null) {
val command = undoCommandList.pop()
redoCommandList.addFirst(command)
handleUndo(command)
handleUndo(command, true)
}
return colorCommandList
}
Expand Down