Skip to content

Commit

Permalink
Merge pull request #278 from lucasnlm/update-strings
Browse files Browse the repository at this point in the history
Unlock camera after touch for a long distance
  • Loading branch information
lucasnlm authored May 12, 2021
2 parents 3524eab + 0155ac2 commit 0da1326
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {

defaultConfig {
// versionCode and versionName must be hardcoded to support F-droid
versionCode 1001051
versionName '10.1.5'
versionCode 1001061
versionName '10.1.6'
minSdkVersion 21
targetSdkVersion 30
multiDexEnabled true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CameraController(
) {
private val velocity: Vector2 = Vector2.Zero.cpy()
private var touch: Vector2? = null
private var unlockTouch = false

private fun limitSpeed(minefieldSize: SizeF) {
val padding = renderSettings.internalPadding
Expand Down Expand Up @@ -60,6 +61,7 @@ class CameraController(
velocity.add(dx * Gdx.graphics.deltaTime, dy * Gdx.graphics.deltaTime)
}
touch = null
unlockTouch = false
}

fun startTouch(x: Float, y: Float) {
Expand All @@ -70,12 +72,13 @@ class CameraController(

fun translate(dx: Float, dy: Float, x: Float, y: Float) {
touch?.let {
if (Vector2(x, y).sub(it.x, it.y).len() > renderSettings.areaSize) {
if (Vector2(x, y).sub(it.x, it.y).len() > renderSettings.areaSize || unlockTouch) {
camera.run {
translate(dx, dy, 0f)
update(true)
Gdx.graphics.requestRendering()
}
unlockTouch = true
}
}
}
Expand Down

0 comments on commit 0da1326

Please sign in to comment.