Skip to content

Commit

Permalink
PAINTROID-396 Multiline tool with movable intermediate points
Browse files Browse the repository at this point in the history
CR
  • Loading branch information
Lenkomotive committed Sep 20, 2023
1 parent d572eb6 commit 65df9cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,8 @@ open class MainActivityPresenter(
idlingResource.increment()
if (view.isKeyboardShown) {
view.hideKeyboard()
} else if (toolController.currentTool is DynamicLineTool) {
commandManager.undo()
} else {
if (commandManager.isLastColorCommandOnTop() || commandManager.getColorCommandCount() == 0) {
toolController.currentTool?.changePaintColor(Color.BLACK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.graphics.Color
import android.graphics.Paint
import android.graphics.PointF
import android.view.View
import androidx.annotation.ColorInt
import androidx.test.espresso.idling.CountingIdlingResource
import org.catrobat.paintroid.command.CommandManager
import org.catrobat.paintroid.command.implementation.DynamicPathCommand
Expand Down Expand Up @@ -142,7 +143,7 @@ class DynamicLineTool(
}

fun setToolPaint(command: DynamicPathCommand) {
super.changePaintColor(command.paint.color)
super.changePaintColor(command.paint.color, false)
super.changePaintStrokeCap(command.paint.strokeCap)
super.changePaintStrokeWidth(command.paint.strokeWidth.toInt())
}
Expand Down Expand Up @@ -324,8 +325,8 @@ class DynamicLineTool(
}
}

override fun changePaintColor(color: Int) {
super.changePaintColor(color)
override fun changePaintColor(@ColorInt color: Int, invalidate: Boolean) {
super.changePaintColor(color, false)
if (vertexStack.isEmpty()) return
vertexStack.last.ingoingPathCommand?.setPaintColor(toolPaint.color)
commandManager.executeAllCommands()
Expand Down

0 comments on commit 65df9cd

Please sign in to comment.