Skip to content

Commit

Permalink
clanup and support for MAC key bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
drom committed May 9, 2024
1 parent 9de8af2 commit b9bb0b8
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 105 deletions.
1 change: 1 addition & 0 deletions lib/gen-key-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const genKeyHandler = (div, pstate, deso, cm, keyBindo, plugins) => {
);
// const key = modifier + event.key;
const key = modifier + keyName(event);
console.log(key);

if (executeKeyHandler(key, keyBindo, pstate, cm)) {
event.stopPropagation();
Expand Down
12 changes: 11 additions & 1 deletion lib/help-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ const icons = {
])
};

exports.mlPanel = (keyBindo) => {
exports.mlPanel = (keyBindo, version) => {
const ml = ['div',
['div', {class: 'wd-help-panel-row'},
['h3', 'VCDrom v' + version]
],
['div', {class: 'wd-help-panel-row'},
['h3', ['a', {href: './documentation/'}, 'Online Documentation']]
],
['div', {class: 'wd-help-panel-row'},
['h3', 'Keyboard / Mouse shortcuts']
]
Expand Down Expand Up @@ -108,6 +114,10 @@ exports.css = {
height: '100%',
'overflow-y': 'auto'
},
'a:link': { 'font-weight': 'normal', color: '#7bf' },
'a:visited': { color: '#7bf' },
'a:hover': { 'font-weight': 'bold' },
'a:active': { color: '#7bf' },
'.wd-even': {
background: '#ffffff11'
},
Expand Down
36 changes: 17 additions & 19 deletions lib/key-bindo.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ const scroll = {
down: {
desc: 'scroll down',
fn: yScroll(.1)
},
home: {
desc: 'Jump to beginning of time',
fn: pstate => xOffsetUpdate(pstate, pstate.sidebarWidth)
},
end: {
desc: 'Jump to end time',
fn: pstate => xOffsetUpdate(pstate, pstate.width - pstate.xScale * pstate.time)
}
};

Expand All @@ -52,30 +60,20 @@ const editable = {
};

module.exports = {
// Alt + <, >. left / right
'Alt+,': scroll.left, 'Shift+icon:scrollUp': scroll.left,

'Alt+.': scroll.right, 'Shift+icon:scrollDown': scroll.right,

// Alt + [ ] home / end
'Alt+[': {desc: 'Jump to beginning of time', fn: pstate => xOffsetUpdate(pstate, pstate.sidebarWidth)}, // Home

'Alt+]': {desc: 'Jump to end time', fn: pstate => xOffsetUpdate(pstate, pstate.width - pstate.xScale * pstate.time)}, // End
'Alt+,': scroll.left, 'Alt+≤': {fn: scroll.left.fn}, 'Shift+icon:scrollUp': scroll.left,
'Alt+.': scroll.right, 'Alt+≥': {fn: scroll.right.fn}, 'Shift+icon:scrollDown': scroll.right,

// ALT + - +
'Alt+=': pluso, // '+': pluso, '=': pluso,
'Ctrl+icon:scrollUp': pluso,
'Alt+[': scroll.home, 'Alt+"': {fn: scroll.home.fn}, // Home
'Alt+]': scroll.end, 'Alt+‘': {fn: scroll.end.fn}, // End

'Alt+-': minuso, // '-': minuso, '_': minuso,
'Ctrl+icon:scrollDown': minuso,
'Alt+=': pluso, 'Alt+≠': {fn: pluso.fn}, 'Ctrl+icon:scrollUp': pluso, // + =
'Alt+-': minuso, 'Alt+–': {fn: minuso.fn}, 'Ctrl+icon:scrollDown': minuso, // - _

'Alt+0': fullo, // 'Shift+f': fullo, F: fullo, 'Shift+F': fullo,
'Alt+0': fullo, 'Alt+º': {fn: fullo.fn}, // 'Shift+f': fullo, F: fullo, 'Shift+F': fullo,

'Alt+/': editable,
'Alt+/': editable, 'Alt+÷': {fn: editable.fn},

'Shift+?': {
desc: 'Toggle help panel',
fn: helpPanel.toggle},
'Shift+?': {desc: 'Toggle help panel', fn: helpPanel.toggle},
// CAN'T DO: Alt + e, d, f, l

// ArrowUp: scroll.up, 'Shift+ArrowUp': scroll.up,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lib"
],
"scripts": {
"test": "eslint lib",
"test": "eslint lib ; mocha test",
"watch": "watchify ./lib/page-format.js -o docs/page-format.js -v"
},
"repository": {
Expand Down
Binary file removed src/IosevkaDrom-Italic.woff2
Binary file not shown.
Binary file removed src/IosevkaDrom-Oblique.woff2
Binary file not shown.
Binary file removed src/IosevkaDrom-Regular.woff2
Binary file not shown.
67 changes: 0 additions & 67 deletions src/wavehub.css

This file was deleted.

17 changes: 0 additions & 17 deletions src/wavehub.html

This file was deleted.

Binary file removed src/wavehub.ico
Binary file not shown.

0 comments on commit b9bb0b8

Please sign in to comment.