changeset 931b112528c2 in sao:6.0 details: https://hg.tryton.org/sao?cmd=changeset&node=931b112528c2 description: Use metaKey in addition to CtrlKey for click event
On MacOS CtrlKey is used to simulate a right-click. issue11420 review407311002 (grafted from 33bfd6702029e1d3f7556ac730d707aa8d2052ec) diffstat: src/view/form.js | 2 +- src/view/list_form.js | 2 +- src/view/tree.js | 6 +++--- src/window.js | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diffs (93 lines): diff -r 94e99e005130 -r 931b112528c2 src/view/form.js --- a/src/view/form.js Fri May 06 23:30:10 2022 +0200 +++ b/src/view/form.js Mon Apr 25 18:08:58 2022 +0200 @@ -2554,7 +2554,7 @@ if (this.has_target(value)) { var m2o_id = this.id_from_value(record.field_get(this.field_name)); - if (evt && evt.ctrlKey) { + if (evt && (evt.ctrlKey || evt.metaKey)) { var params = {}; params.model = this.get_model(); params.res_id = m2o_id; diff -r 94e99e005130 -r 931b112528c2 src/view/list_form.js --- a/src/view/list_form.js Fri May 06 23:30:10 2022 +0200 +++ b/src/view/list_form.js Mon Apr 25 18:08:58 2022 +0200 @@ -132,7 +132,7 @@ } this.select_records(i, view_form_idx); } else { - if (!event_.ctrlKey) { + if (!(event_.ctrlKey || event_.metaKey)) { this.select_records(null, null); } this.record = view_form.record; diff -r 94e99e005130 -r 931b112528c2 src/view/tree.js --- a/src/view/tree.js Fri May 06 23:30:10 2022 +0200 +++ b/src/view/tree.js Mon Apr 25 18:08:58 2022 +0200 @@ -424,7 +424,7 @@ var parent_row = null; var dest_position; - if (evt.ctrlKey && this.children_field) { + if ((evt.ctrlKey || evt.metaKey) && this.children_field) { parent_row = this._find_row(row.el.prev()); dest_position = (parent_row || this).rows.length; } else { @@ -1614,7 +1614,7 @@ current_record = this.tree.screen.current_record; this.tree.select_records(current_record, this.record); } else { - if (!event_.ctrlKey || + if (!(event_.ctrlKey || event_.metaKey) || this.tree.selection_mode == Sao.common.SELECTION_SINGLE) { this.tree.select_records(null, null); @@ -1801,7 +1801,7 @@ Sao.View.Tree.RowEditable._super.select_row.call(this, event_); - if (!event_.shiftKey && !event_.ctrlKey) { + if (!event_.shiftKey && !(event_.ctrlKey || event_.metaKey)) { this.tree.edit_row(this); } }, diff -r 94e99e005130 -r 931b112528c2 src/window.js --- a/src/window.js Fri May 06 23:30:10 2022 +0200 +++ b/src/window.js Mon Apr 25 18:08:58 2022 +0200 @@ -1255,7 +1255,7 @@ }).text(el_field.attr('name')).prepend( Sao.common.ICONFACTORY.get_icon_img('tryton-drag') ).click(function(e) { - if (e.ctrlKey) { + if (e.ctrlKey || e.metaKey) { node.toggleClass('bg-primary'); } else { jQuery(e.target).addClass('bg-primary') @@ -1279,7 +1279,7 @@ 'field': parent_node[field].field, 'name': parent_node[field].name }).text(name).click(function(e) { - if(e.ctrlKey) { + if (e.ctrlKey || e.metaKey) { node.toggleClass('bg-primary'); } else { this.fields_all.find('li').removeClass('bg-primary'); @@ -1635,7 +1635,7 @@ var node = jQuery('<li/>', { 'path': path }).text(parent_node[name].string).click(function(e) { - if(e.ctrlKey) { + if (e.ctrlKey || e.metaKey) { node.toggleClass('bg-primary'); } else { this.fields_all.find('li') @@ -1884,7 +1884,7 @@ 'path': name, 'class': 'draggable-handle', }).text(long_string).click(function(e) { - if(e.ctrlKey) { + if (e.ctrlKey || e.metaKey) { node.toggleClass('bg-primary'); } else { jQuery(e.target).addClass('bg-primary')