Skip to content
Snippets Groups Projects
Commit 1a245db4 authored by Alexander Rose's avatar Alexander Rose
Browse files

tweaked bindings formating

parent 6a694f92
No related branches found
No related tags found
No related merge requests found
...@@ -76,29 +76,29 @@ const B = ButtonsType ...@@ -76,29 +76,29 @@ const B = ButtonsType
function formatButtons(buttons?: ButtonsType) { function formatButtons(buttons?: ButtonsType) {
const s: string[] = [] const s: string[] = []
if (buttons === undefined) { if (buttons === undefined) {
s.push('any button') s.push('any mouse button')
} else if (buttons === 0) { } else if (buttons === 0) {
s.push('no button') s.push('mouse hover')
} else { } else {
if (B.has(buttons, B.Flag.Primary)) s.push('left button') if (B.has(buttons, B.Flag.Primary)) s.push('left mouse button')
if (B.has(buttons, B.Flag.Secondary)) s.push('right button') if (B.has(buttons, B.Flag.Secondary)) s.push('right mouse button')
if (B.has(buttons, B.Flag.Auxilary)) s.push('wheel/middle button') if (B.has(buttons, B.Flag.Auxilary)) s.push('wheel/middle mouse button')
if (B.has(buttons, B.Flag.Forth)) s.push('three fingers') if (B.has(buttons, B.Flag.Forth)) s.push('three fingers')
} }
return s.join(' + ') return s.join(' + ')
} }
function formatModifiers(modifiers?: ModifiersKeys) { function formatModifiers(modifiers?: ModifiersKeys, verbose?: boolean) {
const s: string[] = [] const s: string[] = []
if (modifiers) { if (modifiers) {
if (modifiers.alt) s.push('alt') if (modifiers.alt) s.push('alt key')
if (modifiers.control) s.push('control') if (modifiers.control) s.push('control key')
if (modifiers.meta) s.push('meta/command') if (modifiers.meta) s.push('meta/command key')
if (modifiers.shift) s.push('shift') if (modifiers.shift) s.push('shift key')
if (s.length === 0) s.push('no key') if (verbose && s.length === 0) s.push('no key')
} else { } else {
s.push('any key') if (verbose) s.push('any key')
} }
return s.join(' + ') return s.join(' + ')
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment