set minimal brush size to 5

This commit is contained in:
tibbi 2022-10-11 12:45:32 +02:00
parent 91431fe649
commit b7f113b449
3 changed files with 3 additions and 2 deletions

View File

@ -644,7 +644,7 @@ class MainActivity : SimpleActivity(), CanvasListener {
private var onStrokeWidthBarChangeListener: SeekBar.OnSeekBarChangeListener = object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
brushSize = progress.toFloat()
brushSize = Math.max(progress.toFloat(), 5f)
updateBrushSize()
}

View File

@ -292,7 +292,7 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
fun setBrushSize(newBrushSize: Float) {
mCurrBrushSize = newBrushSize
mPaintOptions.strokeWidth = resources.getDimension(R.dimen.full_brush_size) * (newBrushSize / mScaleFactor / 100f)
mPaintOptions.strokeWidth = resources.getDimension(R.dimen.full_brush_size) * (mCurrBrushSize / mScaleFactor / 100f)
}
fun setAllowZooming(allowZooming: Boolean) {

View File

@ -107,6 +107,7 @@
android:layout_centerHorizontal="true"
android:layout_marginBottom="12dp"
android:max="100"
android:min="5"
android:padding="@dimen/medium_margin"
android:progress="50" />