Skip to content

Commit

Permalink
Add mouse navigation hotkeys
Browse files Browse the repository at this point in the history
Resolves #492, #382, #242, #180, #85
  • Loading branch information
bastimeyer committed Nov 1, 2018
1 parent bcf1aa9 commit 9979310
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/app/init/instance-initializers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default {

initialize( application ) {
const document = application.lookup( "service:-document" );
const RoutingService = application.lookup( "service:-routing" );
const SettingsService = application.lookup( "service:settings" );
const HotkeyService = application.lookup( "service:hotkey" );
const rootElement = get( application, "rootElement" );
Expand Down Expand Up @@ -43,7 +44,21 @@ export default {
}
});

function history( e, go ) {
e.preventDefault();
e.stopImmediatePropagation();
RoutingService.history( go );
}

$( rootElement )
.on( "mouseup", e => {
if ( e.buttons & 0b01000 ) {
return history( e, -1 );
}
if ( e.buttons & 0b10000 ) {
return history( e, +1 );
}
})
.on( "keyup", e => HotkeyService.trigger( e ) )
.on( "dragstart dragover dragend dragenter dragleave dragexit drag drop", e => {
e.preventDefault();
Expand Down

0 comments on commit 9979310

Please sign in to comment.