mirror of
https://github.com/SimpleMobileTools/Simple-Draw.git
synced 2025-02-17 12:10:47 +01:00
zoom towards the center of the screen
This commit is contained in:
parent
56809552e2
commit
087fd1e2f8
@ -25,8 +25,6 @@ import com.simplemobiletools.draw.pro.models.MyPath
|
|||||||
import com.simplemobiletools.draw.pro.models.PaintOptions
|
import com.simplemobiletools.draw.pro.models.PaintOptions
|
||||||
import java.util.concurrent.ExecutionException
|
import java.util.concurrent.ExecutionException
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.math.max
|
|
||||||
import kotlin.math.min
|
|
||||||
|
|
||||||
class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
|
class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
|
||||||
private val MIN_ERASER_WIDTH = 20f
|
private val MIN_ERASER_WIDTH = 20f
|
||||||
@ -474,10 +472,17 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
|
|||||||
mPath.reset()
|
mPath.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mScaleFactor * detector.scaleFactor !in 0.1f..10.0f) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
mIgnoreTouches = true
|
mIgnoreTouches = true
|
||||||
mWasScalingInGesture = true
|
mWasScalingInGesture = true
|
||||||
mScaleFactor *= detector.scaleFactor
|
mScaleFactor *= detector.scaleFactor
|
||||||
mScaleFactor = max(0.1f, min(mScaleFactor, 10.0f))
|
|
||||||
|
mPosX *= detector.scaleFactor
|
||||||
|
mPosY *= detector.scaleFactor
|
||||||
|
|
||||||
setBrushSize(mCurrBrushSize)
|
setBrushSize(mCurrBrushSize)
|
||||||
invalidate()
|
invalidate()
|
||||||
return true
|
return true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user