explicitly bind key events to prevent defaults

This commit is contained in:
j 2014-09-25 13:32:04 +02:00
parent b5bc56d075
commit b309f9d33f
2 changed files with 33 additions and 16 deletions

View file

@ -704,6 +704,11 @@ oml.ui.infoView = function(identifyData) {
}
}
});
that.bindEvent({
mousedown: function() {
that.gainFocus();
}
})
return that;

View file

@ -501,15 +501,16 @@ oml.ui.mainMenu = function() {
that[data.value ? 'enableItem' : 'disableItem']('showinfo');
},
});
Ox.Event.bind('key', function(data, event, element) {
var key = event.replace(/^key\./, '');
if (key == 'backtick') {
Ox.Event.bind({
key_backtick: function() {
changeFocus(1);
} else if (key == 'control_comma') {
},
key_control_comma: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({page: 'preferences'});
}
} else if (key == 'control_f') {
},
key_control_f: function() {
if (!oml.hasDialogOrScreen()) {
if (ui._findState.key != 'advanced') {
setTimeout(function() {
@ -519,38 +520,49 @@ oml.ui.mainMenu = function() {
oml.$ui.filterDialog = oml.ui.filterDialog().open();
}
}
} else if (key == 'control_m') {
},
key_control_m: function() {
if (!oml.hasDialogOrScreen() && !that.isSelected()) {
that.options('menus')[0].element.trigger('click');
}
} else if (key == 'control_shift_f') {
},
key_control_shift_f: function() {
Ox.print('FIXME: NOT IMPLEMENTED')
} else if (key == 'control_shift_w') {
},
key_control_shift_w: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({
find: oml.config.user.ui.find,
item: ''
});
}
} else if (key == 'control_shift_z') {
},
key_control_shift_z: function() {
oml.redoHistory();
} else if (key == 'control_slash') {
},
key_control_slash: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({page: 'help'});
}
} else if (key == 'control_w') {
},
key_control_w: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({item: ''});
}
} else if (key == 'control_z') {
},
key_control_z: function() {
oml.undoHistory();
} else if (key == 'shift_b') {
},
key_shift_b: function() {
ui.item && oml.UI.set({showBrowser: !ui.showBrowser});
} else if (key == 'shift_f') {
},
key_shift_f: function() {
!ui.item && oml.UI.set({showFilters: !ui.showFilters});
} else if (key == 'shift_i') {
},
key_shift_i: function() {
ui.showSidebar && oml.UI.set({showInfo: !ui.showInfo});
} else if (key == 'shift_s') {
},
key_shift_s: function() {
oml.UI.set({showSidebar: !ui.showSidebar});
}
});