avoid asking save/discard without doing anything

This commit is contained in:
tibbi 2023-01-20 11:43:34 +01:00
parent 304d47a9d0
commit 1698f94288
1 changed files with 7 additions and 1 deletions

View File

@ -445,7 +445,13 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
return mapOf(*pathOps) return mapOf(*pathOps)
} }
fun getDrawingHashCode() = mOperations.hashCode().toLong() + (mBackgroundBitmap?.hashCode()?.toLong() ?: 0L) fun getDrawingHashCode(): Long {
return if (mOperations.isEmpty()) {
0
} else {
mOperations.hashCode().toLong() + (mBackgroundBitmap?.hashCode()?.toLong() ?: 0L)
}
}
private fun MotionEvent?.isTouchSlop(pointerIndex: Int, startX: Float, startY: Float): Boolean { private fun MotionEvent?.isTouchSlop(pointerIndex: Int, startX: Float, startY: Float): Boolean {
return if (this == null || actionMasked != MotionEvent.ACTION_MOVE) { return if (this == null || actionMasked != MotionEvent.ACTION_MOVE) {