(...args: number[])
| 647 | * me.input.bindPointer(me.input.pointer.RIGHT, me.input.KEY.X); |
| 648 | */ |
| 649 | export function bindPointer(...args: number[]): void { |
| 650 | const button = args.length < 2 ? pointer.LEFT : args[0]; |
| 651 | const keyCode = args.length < 2 ? args[0] : args[1]; |
| 652 | |
| 653 | // make sure the mouse is initialized |
| 654 | enablePointerEvent(); |
| 655 | |
| 656 | // throw an exception if no action is defined for the specified keycode |
| 657 | if (!getBindingKey(keyCode)) { |
| 658 | throw new Error(`no action defined for keycode ${keyCode}`); |
| 659 | } |
| 660 | // map the mouse button to the keycode |
| 661 | pointer.bind[button] = keyCode; |
| 662 | } |
| 663 | |
| 664 | /** |
| 665 | * unbind the defined keycode |
nothing calls this directly
no test coverage detected