pub enum Location {
Standard = 0,
Left = 1,
Right = 2,
Numpad = 3,
}
Expand description
The location attribute contains an indication of the physical location of the key on the device.
Certain keys on the keyboard can have the same value, but are in different locations. For instance, the Shift key can be on the left or right side of the keyboard, or the number keys can be above the letters or on the numpad. This enum allows differentiating them.
See also MDN’s documentation.
Variants§
Standard = 0
The key is in its “normal” location on the keyboard.
The key activation MUST NOT be distinguished as the left or right
version of the key, and (other than the NumLock
key) did not
originate from the numeric keypad (or did not originate with a
virtual key corresponding to the numeric keypad).
This variant is the default, and is also used when the location of the key cannot be identified.
§Example
The 1 key above the Q key on a QWERTY keyboard will use this location.
For image attribution, see the ATTRIBUTION.md file.
Left = 1
The key activated originated from the left key location (when there is more than one possible location for this key).
§Example
The left Shift key below the Caps Lock key on a QWERTY keyboard will use this location.
For image attribution, see the ATTRIBUTION.md file.
Right = 2
The key activation originated from the right key location (when there is more than one possible location for this key).
§Example
The right Shift key below the Enter key on a QWERTY keyboard will use this location.
For image attribution, see the ATTRIBUTION.md file.
Numpad = 3
The key activation originated on the numeric keypad or with a virtual
key corresponding to the numeric keypad (when there is more than one
possible location for this key). Note that the NumLock
key should
always be encoded with a location of Location::Standard
.
§Example
The 1 key on the numpad will use this location.
For image attribution, see the ATTRIBUTION.md file.