Skip to content

Commit

Permalink
Allow using an alternative way to sample touch coordinates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Swordfish90 committed Dec 20, 2022
1 parent a55a369 commit aed3bc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ class RadialGamePad @JvmOverloads constructor(
}

private fun extractFingersPositions(event: MotionEvent): Sequence<TouchUtils.FingerPosition> {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
return if (gamePadConfig.preferScreenTouchCoordinates && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
getLocationOnScreen(positionOnScreen)
TouchUtils.extractRawFingersPositions(event, positionOnScreen[0], positionOnScreen[1])
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ import com.swordfish.radialgamepad.library.haptics.HapticConfig
* @property secondaryDials List of configurations for the surrounding secondary dials
* @property haptic Choose which effects will be performed
* @property theme RadialGamePadTheme for the whole view
* @property preferScreenTouchCoordinates Use an alternative sampling methods for touch coordinates
*/
data class RadialGamePadConfig(
val sockets: Int,
val primaryDial: PrimaryDialConfig,
val secondaryDials: List<SecondaryDialConfig>,
val haptic: HapticConfig = HapticConfig.PRESS,
val theme: RadialGamePadTheme = RadialGamePadTheme()
val theme: RadialGamePadTheme = RadialGamePadTheme(),
val preferScreenTouchCoordinates: Boolean = false
)

0 comments on commit aed3bc7

Please sign in to comment.