getModifiers extracts a ModifierKey bitmask from a Javascript event object.
(event js.Value)
| 477 | |
| 478 | // getModifiers extracts a ModifierKey bitmask from a Javascript event object. |
| 479 | func getModifiers(event js.Value) ModifierKey { |
| 480 | |
| 481 | shiftKey := event.Get("shiftKey").Bool() |
| 482 | ctrlKey := event.Get("ctrlKey").Bool() |
| 483 | altKey := event.Get("altKey").Bool() |
| 484 | metaKey := event.Get("metaKey").Bool() |
| 485 | var mods ModifierKey |
| 486 | if shiftKey { |
| 487 | mods = mods | ModShift |
| 488 | } |
| 489 | if ctrlKey { |
| 490 | mods = mods | ModControl |
| 491 | } |
| 492 | if altKey { |
| 493 | mods = mods | ModAlt |
| 494 | } |
| 495 | if metaKey { |
| 496 | mods = mods | ModSuper |
| 497 | } |
| 498 | return mods |
| 499 | } |
| 500 | |
| 501 | // Canvas returns the associated WebGL WebGlCanvas. |
| 502 | func (w *WebGlCanvas) Canvas() js.Value { |