Skip to content

Commit 5c137e8

Browse files
committed
set a minimal eraser width
1 parent 1149834 commit 5c137e8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • app/src/main/kotlin/com/simplemobiletools/draw

app/src/main/kotlin/com/simplemobiletools/draw/MyCanvas.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import java.util.*
1717
import java.util.concurrent.ExecutionException
1818

1919
class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
20+
private val MIN_ERASER_WIDTH = 20f
21+
2022
var mPaths = LinkedHashMap<MyPath, PaintOptions>()
2123
var mBackgroundBitmap: Bitmap? = null
2224
private var mPaint = Paint()
@@ -178,6 +180,9 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
178180
mPaint.color = paintOptions.color
179181

180182
mPaint.strokeWidth = paintOptions.strokeWidth
183+
if (paintOptions.isEraser && mPaint.strokeWidth < MIN_ERASER_WIDTH) {
184+
mPaint.strokeWidth = MIN_ERASER_WIDTH
185+
}
181186
}
182187

183188
fun clearCanvas() {

0 commit comments

Comments
 (0)