lint: editor pr #382

This commit is contained in:
jean-emmanuel 2018-10-10 15:31:33 +02:00
parent 340f766243
commit 5621ba3d13

View file

@ -124,25 +124,25 @@ var Editor = class Editor {
if(!this.selectedWidgets || (this.selectedWidgets.length==0)) return
const curWidget = this.selectedWidgets[0]
let toSelect = null;
let toSelect = null
if(e.key == 'ArrowUp' && curWidget.parent!==widgetManager){
toSelect = curWidget.parent
}
else if(e.key == 'ArrowDown' ){
const toSelectList = curWidget.childrenHashes
.map(h=>widgetManager.widgets[h])
.filter(w=>w && w.parent==curWidget)
.map(h=>widgetManager.widgets[h])
.filter(w=>w && w.parent==curWidget)
if(toSelectList && toSelectList.length){
toSelectList.sort((a,b)=>a.container.offsetLeft>b.container.offsetLeft)
toSelect = toSelectList[0]
toSelectList.sort((a,b)=>a.container.offsetLeft>b.container.offsetLeft)
toSelect = toSelectList[0]
}
}
else if((e.key == 'ArrowLeft') || (e.key == 'ArrowRight')){
const toSelectList = curWidget.parent.childrenHashes
.map(h=>widgetManager.widgets[h])
.filter(w=>w && w.parent==curWidget.parent)
.map(h=>widgetManager.widgets[h])
.filter(w=>w && w.parent==curWidget.parent && (!e.shiftKey || !this.selectedWidgets.includes(w)))
if(toSelectList && toSelectList.length){
toSelectList.sort((a,b)=>a.container.offsetLeft>b.container.offsetLeft)
const idx = toSelectList.findIndex(e=>e.hash===curWidget.hash)
@ -154,7 +154,7 @@ var Editor = class Editor {
}
if(toSelect){
this.select(toSelect)
this.select(toSelect, {multi: e.shiftKey})
}
})