Skip to content

Commit

Permalink
[HTML5] Fix multi-touch input handling.
Browse files Browse the repository at this point in the history
The code to populate the input data for WebAssembly was incorrectly
overriding values when multiple touches were present due to wrong
indexing.
  • Loading branch information
Faless committed Nov 30, 2021
1 parent aa74494 commit 470496d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions platform/javascript/js/libs/library_godot_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,9 @@ const GodotInput = {
for (let i = 0; i < touches.length; i++) {
const touch = touches[i];
const pos = GodotInput.computePosition(touch, rect);
GodotRuntime.setHeapValue(coords + (i * 2), pos[0], 'double');
GodotRuntime.setHeapValue(coords + (i * 2 + 8), pos[1], 'double');
GodotRuntime.setHeapValue(ids + i, touch.identifier, 'i32');
GodotRuntime.setHeapValue(coords + (i * 2) * 8, pos[0], 'double');
GodotRuntime.setHeapValue(coords + (i * 2 + 1) * 8, pos[1], 'double');
GodotRuntime.setHeapValue(ids + i * 4, touch.identifier, 'i32');
}
func(type, touches.length);
if (evt.cancelable) {
Expand Down

0 comments on commit 470496d

Please sign in to comment.