editor: keyboard shortcut mod + a for selecting all siblings
This commit is contained in:
parent
b43c13079f
commit
61a53c2e14
3 changed files with 22 additions and 7 deletions
|
|
@ -13,6 +13,7 @@
|
|||
- use `backspace` instead of `delete` for deleting widgets on MacOs
|
||||
- added keyboard shortcut `mod + e` for enabling / disabling the editor
|
||||
- added keyboard shortcuts `mod + arrows` for selecting widgets
|
||||
- added keyboard shortcut `mod + a` for selecting a widget's siblings and itself
|
||||
- added multi widget selection with mouse
|
||||
|
||||
## 0.37.4
|
||||
|
|
|
|||
|
|
@ -76,10 +76,11 @@ The following shortcuts are available only when the editor is enabled:
|
|||
| `mod + shift + v` | paste and increment id |
|
||||
| `up, down, left, right` | move selected widgets (1 grid unit, hold `shift` for 5 grid units) |
|
||||
| `alt + [up, down, left, right]` | resize selected widgets (1 grid unit, hold `shift` for 5 grid units) |
|
||||
| `ctrl + up` | select current widget's parent |
|
||||
| `ctrl + down` | select current widget's first child |
|
||||
| `ctrl + right` | select current widget's next sibling |
|
||||
| `ctrl + left` | select current widget's previous sibling |
|
||||
| `mod + a` | select current widget's siblings and itself |
|
||||
| `mod + up` | select current widget's parent |
|
||||
| `mod + down` | select current widget's first child |
|
||||
| `mod + right` | select current widget's next sibling |
|
||||
| `mod + left` | select current widget's previous sibling |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -118,10 +118,23 @@ var Editor = class Editor {
|
|||
|
||||
this.moveWidget(deltaX, deltaY)
|
||||
})
|
||||
|
||||
keyboardJS.bind('mod + a', (e)=>{
|
||||
if (e.target.classList.contains('no-keybinding')) return
|
||||
var curWidget = this.selectedWidgets[0],
|
||||
toSelect
|
||||
if (curWidget.parent !== widgetManager) {
|
||||
toSelect = curWidget.parent.childrenHashes
|
||||
.map(h=>widgetManager.widgets[h])
|
||||
.filter(w=>w && w.parent === curWidget.parent && w !== curWidget)
|
||||
toSelect.unshift(curWidget)
|
||||
}
|
||||
if (toSelect) {
|
||||
this.select(toSelect)
|
||||
}
|
||||
})
|
||||
keyboardJS.bind(['mod + up','mod + down','mod + left' , 'mod + right'], (e)=>{
|
||||
if (e.target.classList.contains('no-keybinding')) return
|
||||
if(!this.selectedWidgets || (this.selectedWidgets.length==0)) return
|
||||
if (!this.selectedWidgets.length) return
|
||||
|
||||
const curWidget = this.selectedWidgets[0]
|
||||
let toSelect = null
|
||||
|
|
@ -153,7 +166,7 @@ var Editor = class Editor {
|
|||
}
|
||||
}
|
||||
|
||||
if(toSelect){
|
||||
if (toSelect) {
|
||||
this.select(toSelect)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue