1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

[HTML5] Fix multi-touch input handling.

The code to populate the input data for WebAssembly was incorrectly
overriding values when multiple touches were present due to wrong
indexing.

(cherry picked from commit 470496d8d4)
This commit is contained in:
Fabio Alessandrelli
2021-11-29 21:44:58 +01:00
committed by Rémi Verschelde
parent 86190dd909
commit 53ce3f64ad

View File

@@ -424,9 +424,9 @@ const GodotInput = {
for (let i = 0; i < touches.length; i++) { for (let i = 0; i < touches.length; i++) {
const touch = touches[i]; const touch = touches[i];
const pos = GodotInput.computePosition(touch, rect); const pos = GodotInput.computePosition(touch, rect);
GodotRuntime.setHeapValue(coords + (i * 2), pos[0], 'double'); GodotRuntime.setHeapValue(coords + (i * 2) * 8, pos[0], 'double');
GodotRuntime.setHeapValue(coords + (i * 2 + 8), pos[1], 'double'); GodotRuntime.setHeapValue(coords + (i * 2 + 1) * 8, pos[1], 'double');
GodotRuntime.setHeapValue(ids + i, touch.identifier, 'i32'); GodotRuntime.setHeapValue(ids + i * 4, touch.identifier, 'i32');
} }
func(type, touches.length); func(type, touches.length);
if (evt.cancelable) { if (evt.cancelable) {