Keybinding tweaks

Write all default keybindings as char
Remove some default keybindings
This commit is contained in:
JannisX11 2021-02-20 11:58:53 +01:00
parent 8aa2c5ba26
commit 042e3c7e75
14 changed files with 64 additions and 69 deletions

View File

@ -1196,7 +1196,7 @@ BARS.defineActions(function() {
icon: 'flag',
category: 'animation',
condition: {modes: ['animate']},
keybind: new Keybind({ctrl: true, key: 77}),
keybind: new Keybind({ctrl: true, key: 'm'}),
click: function (event) {
if (!Animation.selected) {
Blockbench.showQuickMessage('message.no_animation_selected')

View File

@ -208,7 +208,7 @@ BARS.defineActions(function() {
category: 'edit',
work_in_dialog: true,
condition: () => Clipbench.getCopyType(1, true),
keybind: new Keybind({key: 67, ctrl: true, shift: null}),
keybind: new Keybind({key: 'c', ctrl: true, shift: null}),
click: function (event) {Clipbench.copy(event)}
})
new Action('cut', {
@ -216,7 +216,7 @@ BARS.defineActions(function() {
category: 'edit',
work_in_dialog: true,
condition: () => Clipbench.getCopyType(1, true),
keybind: new Keybind({key: 88, ctrl: true, shift: null}),
keybind: new Keybind({key: 'x', ctrl: true, shift: null}),
click: function (event) {Clipbench.copy(event, true)}
})
new Action('paste', {
@ -224,7 +224,7 @@ BARS.defineActions(function() {
category: 'edit',
work_in_dialog: true,
condition: () => Clipbench.getCopyType(2, true),
keybind: new Keybind({key: 86, ctrl: true, shift: null}),
keybind: new Keybind({key: 'v', ctrl: true, shift: null}),
click: function (event) {Clipbench.paste(event)}
})
})

View File

@ -1291,7 +1291,7 @@ const BARS = {
toolbar: Blockbench.isMobile ? 'element_position' : 'main_tools',
alt_tool: 'resize_tool',
modes: ['edit', 'display', 'animate'],
keybind: new Keybind({key: 86}),
keybind: new Keybind({key: 'v'}),
})
new Tool('resize_tool', {
icon: 'open_with',
@ -1302,7 +1302,7 @@ const BARS = {
toolbar: Blockbench.isMobile ? 'element_size' : 'main_tools',
alt_tool: 'move_tool',
modes: ['edit', 'display', 'animate'],
keybind: new Keybind({key: 83}),
keybind: new Keybind({key: 's'}),
})
new Tool('rotate_tool', {
icon: 'sync',
@ -1313,7 +1313,7 @@ const BARS = {
toolbar: Blockbench.isMobile ? 'element_rotation' : 'main_tools',
alt_tool: 'pivot_tool',
modes: ['edit', 'display', 'animate'],
keybind: new Keybind({key: 82})
keybind: new Keybind({key: 'r'})
})
new Tool('pivot_tool', {
icon: 'gps_fixed',
@ -1322,7 +1322,7 @@ const BARS = {
toolbar: Blockbench.isMobile ? 'element_origin' : 'main_tools',
alt_tool: 'rotate_tool',
modes: ['edit', 'animate'],
keybind: new Keybind({key: 80}),
keybind: new Keybind({key: 'p'}),
})
new Tool('vertex_snap_tool', {
icon: 'icon-vertexsnap',
@ -1332,7 +1332,7 @@ const BARS = {
selectCubes: true,
cursor: 'copy',
modes: ['edit'],
keybind: new Keybind({key: 88}),
keybind: new Keybind({key: 'x'}),
onCanvasClick(data) {
Vertexsnap.canvasClick(data)
},
@ -1385,7 +1385,6 @@ const BARS = {
new Action('settings_window', {
icon: 'settings',
category: 'blockbench',
keybind: new Keybind({key: 69, ctrl: true}),
click: function () {Settings.open()}
})
new Action('keybindings_window', {
@ -1469,7 +1468,7 @@ const BARS = {
icon: 'content_copy',
category: 'edit',
condition: () => (Animation.selected && Modes.animate) || (Modes.edit && (selected.length || Group.selected)),
keybind: new Keybind({key: 68, ctrl: true}),
keybind: new Keybind({key: 'd', ctrl: true}),
click: function () {
if (Modes.animate) {
if (Animation.selected && Prop.active_panel == 'animations') {
@ -1553,7 +1552,7 @@ const BARS = {
new Action('action_control', {
icon: 'fullscreen',
category: 'blockbench',
keybind: new Keybind({key: 70}),
keybind: new Keybind({key: 'f'}),
click: function () {
ActionControl.select()
}

View File

@ -122,37 +122,38 @@ class Keybind {
return tl('keys.mouse', [key])
}
switch (key) {
case 1: return 'leftclick'; break;
case 2: return 'middleclick'; break;
case 3: return 'rightclick'; break;
case 9: return 'tab'; break;
case 8: return 'backspace'; break;
case 13: return 'enter'; break;
case 27: return 'escape'; break;
case 46: return 'delete'; break;
case 46: return 'caps'; break;
case 16: return 'shift'; break;
case 17: return 'control'; break;
case 18: return 'alt'; break;
case 32: return 'space'; break;
case 93: return 'menu'; break;
case 187: return 'plus'; break;
case 188: return 'comma'; break;
case 190: return 'point'; break;
case 189: return 'minus'; break;
case 191: return 'cross'; break;
case 37: return 'left'; break;
case 38: return 'up'; break;
case 39: return 'right'; break;
case 40: return 'down'; break;
case 33: return 'pageup'; break;
case 34: return 'pagedown'; break;
case 35: return 'end'; break;
case 36: return 'pos1'; break;
case 44: return 'printscreen'; break;
case 19: return 'pause'; break;
case 1001: return 'mousewheel'; break;
default : return String.fromCharCode(key).toLowerCase(); break;
case 1: return 'leftclick';
case 2: return 'middleclick';
case 3: return 'rightclick';
case 9: return 'tab';
case 8: return 'backspace';
case 13: return 'enter';
case 27: return 'escape';
case 46: return 'delete';
case 46: return 'caps';
case 16: return 'shift';
case 17: return 'control';
case 18: return 'alt';
case 32: return 'space';
case 93: return 'menu';
case 37: return 'left';
case 38: return 'up';
case 39: return 'right';
case 40: return 'down';
case 33: return 'pageup';
case 34: return 'pagedown';
case 35: return 'end';
case 36: return 'pos1';
case 44: return 'printscreen';
case 19: return 'pause';
case 1001: return 'mousewheel';
case 187: return '+';
case 188: return ',';
case 190: return '.';
case 189: return '-';
case 191: return '#';
default : return String.fromCharCode(key).toLowerCase();
}
}
hasKey() {

View File

@ -245,7 +245,7 @@ BARS.defineActions(function() {
codec.export_action = new Action('save_project', {
icon: 'save',
category: 'file',
keybind: new Keybind({key: 83, ctrl: true, alt: true}),
keybind: new Keybind({key: 's', ctrl: true, alt: true}),
click: function () {
saveTextures(true)
if (isApp && ModelMeta.save_path) {
@ -259,7 +259,7 @@ BARS.defineActions(function() {
new Action('save_project_as', {
icon: 'save',
category: 'file',
keybind: new Keybind({key: 83, ctrl: true, alt: true, shift: true}),
keybind: new Keybind({key: 's', ctrl: true, alt: true, shift: true}),
click: function () {
saveTextures(true)
codec.export()

View File

@ -475,7 +475,7 @@ BARS.defineActions(function() {
new Action('open_model', {
icon: 'assessment',
category: 'file',
keybind: new Keybind({key: 79, ctrl: true}),
keybind: new Keybind({key: 'o', ctrl: true}),
condition: () => (!EditSession.active || EditSession.hosting),
click: function () {
var startpath;
@ -537,7 +537,7 @@ BARS.defineActions(function() {
new Action('export_over', {
icon: 'save',
category: 'file',
keybind: new Keybind({key: 83, ctrl: true}),
keybind: new Keybind({key: 's', ctrl: true}),
click: function () {
if (isApp) {
saveTextures()

View File

@ -225,13 +225,11 @@ BARS.defineActions(function() {
default_tool: 'move_tool',
category: 'navigate',
condition: () => Format,
keybind: new Keybind({key: 49})
})
new Mode('paint', {
default_tool: 'brush_tool',
category: 'navigate',
condition: () => Format,
keybind: new Keybind({key: 50}),
onSelect: () => {
if (Modes.previous_id == 'animate') {
Animator.preview();
@ -261,7 +259,6 @@ BARS.defineActions(function() {
selectCubes: false,
default_tool: 'move_tool',
category: 'navigate',
keybind: new Keybind({key: 51}),
condition: () => Format.display_mode,
onSelect: () => {
enterDisplaySettings()
@ -274,7 +271,6 @@ BARS.defineActions(function() {
default_tool: 'move_tool',
category: 'navigate',
center_windows: ['preview', 'timeline'],
keybind: new Keybind({key: 52}),
condition: () => Format.animation_mode,
onSelect: () => {
Animator.join()

View File

@ -819,7 +819,7 @@ BARS.defineActions(function() {
id: 'add_cube',
icon: 'add_box',
category: 'edit',
keybind: new Keybind({key: 78, ctrl: true}),
keybind: new Keybind({key: 'n', ctrl: true}),
condition: () => Modes.edit,
click: function () {

View File

@ -487,7 +487,7 @@ BARS.defineActions(function() {
icon: 'create_new_folder',
category: 'edit',
condition: () => Modes.edit,
keybind: new Keybind({key: 71, ctrl: true}),
keybind: new Keybind({key: 'g', ctrl: true}),
click: function () {
Undo.initEdit({outliner: true});
var add_group = Group.selected

View File

@ -815,7 +815,7 @@ BARS.defineActions(function() {
new Action('select_window', {
icon: 'filter_list',
category: 'edit',
keybind: new Keybind({key: 70, ctrl: true}),
keybind: new Keybind({key: 'f', ctrl: true}),
condition: () => Modes.edit || Modes.paivnt,
click: function () {
let color_options = {
@ -889,7 +889,7 @@ BARS.defineActions(function() {
new Action('invert_selection', {
icon: 'swap_vert',
category: 'edit',
keybind: new Keybind({key: 73, ctrl: true}),
keybind: new Keybind({key: 'i', ctrl: true}),
condition: () => Modes.edit || Modes.paint,
click: function () {
elements.forEach(function(s) {
@ -908,7 +908,7 @@ BARS.defineActions(function() {
icon: 'select_all',
category: 'edit',
condition: () => !Modes.display,
keybind: new Keybind({key: 65, ctrl: true}),
keybind: new Keybind({key: 'a', ctrl: true}),
click: function () {selectAll()}
})
})

View File

@ -2054,7 +2054,7 @@ BARS.defineActions(function() {
new Toggle('toggle_wireframe', {
icon: 'border_clear',
category: 'view',
keybind: new Keybind({key: 90}),
keybind: new Keybind({key: 'z'}),
condition: () => Toolbox && Toolbox.selected && Toolbox.selected.allowWireframe,
default: false,
onChange: function (state) {
@ -2071,7 +2071,7 @@ BARS.defineActions(function() {
icon: 'fas.fa-chess-board',
category: 'view',
linked_setting: 'preview_checkerboard',
keybind: new Keybind({key: 84})
keybind: new Keybind({key: 't'})
})
new Toggle('uv_checkerboard', {
icon: 'fas.fa-chess-board',
@ -2096,7 +2096,7 @@ BARS.defineActions(function() {
new Action('screenshot_model', {
icon: 'fa-cubes',
category: 'view',
keybind: new Keybind({key: 80, ctrl: true}),
keybind: new Keybind({key: 'p', ctrl: true}),
click: function () {Preview.selected.screenshot()}
})
new Action('record_model_gif', {
@ -2182,7 +2182,6 @@ BARS.defineActions(function() {
icon: 'center_focus_weak',
category: 'view',
condition: () => !Modes.display,
keybind: new Keybind({key: 191}),
click: function () {
let center = getSelectionCenter();
if (!Format.centered_grid) center.V3_subtract(8, 8, 8)

View File

@ -819,7 +819,7 @@ BARS.defineActions(function() {
paintTool: true,
brushTool: true,
allowWireframe: false,
keybind: new Keybind({key: 66}),
keybind: new Keybind({key: 'b'}),
modes: ['paint'],
onCanvasClick: function(data) {
Painter.startPaintToolCanvas(data, data.event)
@ -862,7 +862,7 @@ BARS.defineActions(function() {
brushTool: true,
allowWireframe: false,
modes: ['paint'],
keybind: new Keybind({key: 69}),
keybind: new Keybind({key: 'e'}),
onCanvasClick: function(data) {
Painter.startPaintToolCanvas(data, data.event)
},
@ -899,7 +899,7 @@ BARS.defineActions(function() {
allowWireframe: false,
modes: ['paint'],
condition: {modes: ['paint']},
keybind: new Keybind({key: 85}),
keybind: new Keybind({key: 'u'}),
onCanvasClick: function(data) {
Painter.startPaintToolCanvas(data, data.event)
},
@ -919,7 +919,7 @@ BARS.defineActions(function() {
allowWireframe: false,
modes: ['paint'],
condition: {modes: ['paint']},
keybind: new Keybind({key: 77})
keybind: new Keybind({key: 'm'})
})
new BarSelect('draw_shape_type', {
@ -978,7 +978,7 @@ BARS.defineActions(function() {
icon: 'grid_on',
category: 'view',
condition: () => Modes.paint,
keybind: new Keybind({key: 71}),
keybind: new Keybind({key: 'g'}),
linked_setting: 'painting_grid'
})

View File

@ -1306,7 +1306,7 @@ BARS.defineActions(function() {
new Action('import_texture', {
icon: 'library_add',
category: 'textures',
keybind: new Keybind({key: 84, ctrl: true}),
keybind: new Keybind({key: 't', ctrl: true}),
click: function () {
var start_path;
if (!isApp) {} else
@ -1341,7 +1341,7 @@ BARS.defineActions(function() {
new Action('create_texture', {
icon: 'icon-create_bitmap',
category: 'textures',
keybind: new Keybind({key: 84, ctrl: true, shift: true}),
keybind: new Keybind({key: 't', ctrl: true, shift: true}),
click: function () {
TextureGenerator.addBitmapDialog()
}

View File

@ -472,7 +472,7 @@ BARS.defineActions(function() {
category: 'edit',
condition: () => (!open_dialog || open_dialog === 'uv_dialog' || open_dialog === 'toolbar_edit'),
work_in_dialog: true,
keybind: new Keybind({key: 90, ctrl: true}),
keybind: new Keybind({key: 'z', ctrl: true}),
click: Undo.undo
})
new Action('redo', {
@ -480,7 +480,7 @@ BARS.defineActions(function() {
category: 'edit',
condition: () => (!open_dialog || open_dialog === 'uv_dialog' || open_dialog === 'toolbar_edit'),
work_in_dialog: true,
keybind: new Keybind({key: 89, ctrl: true}),
keybind: new Keybind({key: 'y', ctrl: true}),
click: Undo.redo
})
})