Commit 7f4841ff sorted the bindings so that if the same key was bound more than once, then the newest binding takes priority (sorted last). However, it got the comparison function wrong, which means the result of the sort depended on the algorithm and not on the actual data, so the priority for keys with more than one binding was still arbitraty. Fix the sort function, and finally ensure that later binding acutally override earlier bindings of the same key.
Showing the changes to player/javascript (1 of 1 file). Show all
Unified · Split
| @@ -277,7 +277,7 @@ function dispatch_key_binding(name, state, key_name) { · 276 unmodified lines | |||
| 277 | var binds_tid = 0; // flush timer id. actual id's are always true-thy | 277 | var binds_tid = 0; // flush timer id. actual id's are always true-thy |
| 278 | mp.flush_key_bindings = function flush_key_bindings() { | 278 | mp.flush_key_bindings = function flush_key_bindings() { |
| 279 | function prioritized_inputs(arr) { | 279 | function prioritized_inputs(arr) { |
| 280 | return arr.sort(function(a, b) { return a.id > b.id }) | 280 | return arr.sort(function(a, b) { return a.id - b.id }) |
| 281 | .map(function(bind) { return bind.input }); | 281 | .map(function(bind) { return bind.input }); |
| 282 | } | 282 | } |
| 283 | 283 | ||