Skip to content

Commit 087fd1e

Browse files
zoom towards the center of the screen
1 parent 5680955 commit 087fd1e

File tree

1 file changed

+8
-3
lines changed
  • app/src/main/kotlin/com/simplemobiletools/draw/pro/views

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import com.simplemobiletools.draw.pro.models.MyPath
2525
import com.simplemobiletools.draw.pro.models.PaintOptions
2626
import java.util.concurrent.ExecutionException
2727
import kotlin.math.abs
28-
import kotlin.math.max
29-
import kotlin.math.min
3028

3129
class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
3230
private val MIN_ERASER_WIDTH = 20f
@@ -474,10 +472,17 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
474472
mPath.reset()
475473
}
476474

475+
if (mScaleFactor * detector.scaleFactor !in 0.1f..10.0f) {
476+
return true
477+
}
478+
477479
mIgnoreTouches = true
478480
mWasScalingInGesture = true
479481
mScaleFactor *= detector.scaleFactor
480-
mScaleFactor = max(0.1f, min(mScaleFactor, 10.0f))
482+
483+
mPosX *= detector.scaleFactor
484+
mPosY *= detector.scaleFactor
485+
481486
setBrushSize(mCurrBrushSize)
482487
invalidate()
483488
return true

0 commit comments

Comments
 (0)