mirror of
https://github.com/SimpleMobileTools/Simple-Draw.git
synced 2025-06-05 21:59:17 +02:00
simplify eyedropper valid coordinate check
This commit is contained in:
@ -78,7 +78,9 @@ class EyeDropper(private val view: View, private val onColorSelected: ((Int) ->
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun Bitmap.isValidCoordinate(x: Int, y: Int): Boolean {
|
private fun Bitmap.isValidCoordinate(x: Int, y: Int): Boolean {
|
||||||
return x in 1 until width && y in 1 until height
|
val isValidXCoordinate = x >= 1 && x < width
|
||||||
|
val isValidYCoordinate = y >= 1 && y < height
|
||||||
|
return isValidXCoordinate && isValidYCoordinate
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun View.shouldDrawingCacheBeEnabled(): Boolean = (this !is ImageView) && !isDrawingCacheEnabled
|
private fun View.shouldDrawingCacheBeEnabled(): Boolean = (this !is ImageView) && !isDrawingCacheEnabled
|
||||||
|
Reference in New Issue
Block a user