This is doumented and has been part of the table in lua, but until now not in the JS object. Fixes #13448
Showing the changes to player/javascript (1 of 1 file). Show all
Unified · Split
| @@ -246,10 +246,10 @@ mp.get_osd_margins = function get_osd_margins() { · 245 unmodified lines | |||
| 246 | // {cb: fn, forced: bool, maybe input: str, repeatable: bool, complex: bool} | 246 | // {cb: fn, forced: bool, maybe input: str, repeatable: bool, complex: bool} |
| 247 | var binds = new_cache(); | 247 | var binds = new_cache(); |
| 248 | 248 | ||
| 249 | function dispatch_key_binding(name, state, key_name) { | 249 | function dispatch_key_binding(name, state, key_name, key_text) { |
| 250 | var cb = binds[name] ? binds[name].cb : false; | 250 | var cb = binds[name] ? binds[name].cb : false; |
| 251 | if (cb) // "script-binding [<script_name>/]<name>" command was invoked | 251 | if (cb) // "script-binding [<script_name>/]<name>" command was invoked |
| 252 | cb(state, key_name); | 252 | cb(state, key_name, key_text); |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | var binds_tid = 0; // flush timer id. actual id's are always true-thy | 255 | var binds_tid = 0; // flush timer id. actual id's are always true-thy |
| @@ -307,11 +307,12 @@ function add_binding(forced, key, name, fn, opts) { · 51 unmodified lines | |||
| 307 | fn({event: "press", is_mouse: false}); | 307 | fn({event: "press", is_mouse: false}); |
| 308 | }); | 308 | }); |
| 309 | var KEY_STATES = { u: "up", d: "down", r: "repeat", p: "press" }; | 309 | var KEY_STATES = { u: "up", d: "down", r: "repeat", p: "press" }; |
| 310 | key_data.cb = function key_cb(state, key_name) { | 310 | key_data.cb = function key_cb(state, key_name, key_text) { |
| 311 | fn({ | 311 | fn({ |
| 312 | event: KEY_STATES[state[0]] || "unknown", | 312 | event: KEY_STATES[state[0]] || "unknown", |
| 313 | is_mouse: state[1] == "m", | 313 | is_mouse: state[1] == "m", |
| 314 | key_name: key_name || undefined | 314 | key_name: key_name || undefined, |
| 315 | key_text: key_text || undefined | ||
| 315 | }); | 316 | }); |
| 316 | } | 317 | } |
| 317 | } else { | 318 | } else { |