Compose-Drawing-App
Compose-Drawing-App copied to clipboard
Changing stroke width also changes all older eraser paths
While drawing paths in Canvas, when eraseMode is true, it should also use property.strokeWidth (and others) but NOT currentPathProperty.* Simple bug and simple fix ;)
Sure, i will add update it with this fix. I will probably rewrite drawing app from scratch when i have time with some Event logic to capture, time, properties and action to save them to database for persistence and undo/redo logic.
Either way, thank you for this, it does the job for me now. Hopefully, you find the time to build it more robust and customizable. I will also try to find the time to do it myself meanwhile...
Hello, @ugre and @SmartToolFactory i faced same issue, did you find the solution for this one?
I find the solution. Just change "currentPathProperty" to "property" at 218, 219 and 220th lines in DrawingApp.kt
paths.forEach {
val path = it.first
val property = it.second
if (!property.eraseMode) {
drawPath(
color = property.color,
path = path,
style = Stroke(
width = property.strokeWidth,
cap = property.strokeCap,
join = property.strokeJoin
)
)
} else {
// Source
drawPath(
color = Color.Transparent,
path = path,
style = Stroke(
width = **property**.strokeWidth, // <---
cap = **property**.strokeCap, // <---
join = **property**.strokeJoin // <---
),
blendMode = BlendMode.Clear
)
}
}