Skip to content

Commit

Permalink
add color change back to thumbstick
Browse files Browse the repository at this point in the history
  • Loading branch information
Duron27 authored Oct 29, 2024
1 parent a7813cc commit 0fd6765
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions app/src/main/java/org/openmw/EngineActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,30 @@ class EngineActivity : SDLActivity() {
.then(
if (editMode.value) {
Modifier.pointerInput(Unit) {
detectDragGestures { change, dragAmount ->
offsetX.value += dragAmount.x
offsetY.value += dragAmount.y
// Update layout parameters dynamically
layoutParams.leftMargin = offsetX.value.roundToInt()
layoutParams.topMargin = offsetY.value.roundToInt()
this@apply.layoutParams = layoutParams

// Log the updated margins
Log.d("Thumbstick", "Left Margin: ${layoutParams.leftMargin}, Top Margin: ${layoutParams.topMargin}")
}
detectDragGestures(
onDragStart = {
isThumbDragging = true
},
onDrag = { change, dragAmount ->
offsetX.value += dragAmount.x
offsetY.value += dragAmount.y
// Update layout parameters dynamically
layoutParams.leftMargin = offsetX.value.roundToInt()
layoutParams.topMargin = offsetY.value.roundToInt()
this@apply.layoutParams = layoutParams
},
onDragEnd = {
isThumbDragging = false

},
onDragCancel = {
isThumbDragging = false
}
)
}
} else Modifier
)
} else Modifier
)

) {
ResizableDraggableThumbstick(
context = this@EngineActivity,
Expand Down

0 comments on commit 0fd6765

Please sign in to comment.