Expand adaptive joystick activation area by fifty percent

This commit is contained in:
MaxsTechReview committed 2026-09-28 14:39:55 -04:00
1 parent e10f5b4430
commit 659ff4817f
2 files changed
+3 -2

No files matched your search

@@ -520,7 +520,7 @@ class OnScreenControls(context: Context, private val pad: PadBridge?, private va
return controls.filter {
val dx = x - it.cx
val dy = y - it.cy
val reach = it.radius * 1.4f
val reach = it.radius * 1.4f * sqrt(1.5f)
it.stick >= 0 && isVisible(it) && it.pressedBy == -1 && dx * dx + dy * dy <= reach * reach
}.minByOrNull {
val dx = x - it.cx
@@ -1,5 +1,6 @@
package com.droiddeck.launcher.input
import kotlin.math.sqrt
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
@@ -120,7 +121,7 @@ class OnScreenControlsTest {
val left = control("ls")
val x = value(left, "cx")
val y = value(left, "cy")
val reach = value(left, "radius") * 1.4f
val reach = value(left, "radius") * 1.4f * sqrt(1.5f)
assertFalse(touch(MotionEvent.ACTION_DOWN, 1 to (x to y - reach - 1f)))
assertTrue(touch(MotionEvent.ACTION_DOWN, 1 to (x to y - reach + 1f)))
assertEquals(y - reach + 1f, value(left, "ay"), 0.001f)