editor: mac: command instead of ctrl for multi select

This commit is contained in:
jean-emmanuel 2018-03-06 00:35:53 +01:00
parent 8eeb585079
commit 56b3e2a427
3 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,10 @@
# Changelog
## 0.26.1
- editor
- mac: use `command` instead of `ctrl` for multi widget selection
## 0.26.0
- bug fixes

View file

@ -13,6 +13,7 @@ Right clicking / long touch on a widget or on a tab will also display a context
- `Edit parent`: select widget's parent for edition
- `Copy`: copy widget's data
- `Cut`: copy widget's data and delete selected widget
- `Wrap in`: wrap the widget in a new container
- `Paste`: paste copied widget in selected container
- `n+1` : increments the id of the copied widget (and all its children) before pasting
- `Clone` : paste the exact same widget
@ -45,7 +46,7 @@ Selected widget can be resized using its south, south-east and east handles. It
## Bulk editing
When holding the `ctrl` key, multiple widgets can be selected for edition:
When holding the `ctrl` key (or `command` on Mac), multiple widgets can be selected for edition:
- they must share the same parent widget
- context-menu actions and properties changes apply to all selected widgets

View file

@ -4,6 +4,9 @@ var {updateWidget, incrementWidget} = require('./data-workers'),
widgetManager = require('../managers/widgets'),
editor = require('./')
var mod = (navigator.platform || '').match('Mac') ? 'metaKey' : 'ctrlKey'
class ContextMenu {
constructor(){
@ -137,14 +140,14 @@ var handleClick = function(event) {
if (event.type !== 'fast-right-click') {
editor.select(widget, {multi: event.detail.ctrlKey})
editor.select(widget, {multi: event.detail[mod]})
}
// right-click menu
if (event.type !== 'fast-right-click') return
if (!event.detail.ctrlKey && editor.selectedWidgets.length <= 1) {
editor.select(widget, {multi: event.detail.ctrlKey})
editor.select(widget, {multi: event.detail[mod]})
}
if (!editor.selectedWidgets.length) return