Skip to content

Commit 6ca2a45

Browse files
authored
Fix jumps in scale and rotation when pinching
When pressing with two fingers at once and pinching, an old coordinate contained in the curr_state dictionary gets added to the base_state dictionary, which causes unintended jumps in both scale and rotation. By clearing base_state the script functions as intended.
1 parent 57f8628 commit 6ca2a45

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

mobile/multitouch_cubes/GestureArea.gd

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,8 @@ func _gui_input(event):
7878
if not event.pressed and base_state.has(event.index):
7979
# Some known touching finger released.
8080

81-
# Remove released finger from the base state.
82-
base_state.erase(event.index)
83-
# Reset the base state to the now only toyching finger.
84-
base_state = {
85-
curr_state.keys()[0]: curr_state.values()[0],
86-
}
81+
# Clear the base state
82+
base_state.clear()
8783

8884
elif event is InputEventScreenDrag:
8985
if curr_state.has(event.index):

0 commit comments

Comments
 (0)