editor: enable lasso when mod is pressed
This commit is contained in:
parent
da18760626
commit
0cce15c46c
1 changed files with 11 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ var {widgets} = require('../widgets/'),
|
|||
widgetManager = require('../managers/widgets'),
|
||||
{deepCopy} = require('../utils'),
|
||||
macOs = (navigator.platform || '').match('Mac'),
|
||||
modKey = macOs ? 'metaKey' : 'ctrlKey',
|
||||
modKey = macOs ? 'command' : 'ctrl',
|
||||
sessionManager
|
||||
|
||||
const HISTORY_SIZE = 50
|
||||
|
|
@ -43,6 +43,7 @@ var Editor = class Editor {
|
|||
this.defaults[k] = widgets[k].defaults()
|
||||
}
|
||||
|
||||
this.selecting = false
|
||||
this.selectedWidgets = []
|
||||
|
||||
this.clipboard = null
|
||||
|
|
@ -89,6 +90,12 @@ var Editor = class Editor {
|
|||
if (e.target.classList.contains('no-keybinding')) return
|
||||
this.pasteWidget(this.mousePosition.x, this.mousePosition.y, true)
|
||||
})
|
||||
keyboardJS.bind(modKey, (e)=>{
|
||||
if (e.target.classList.contains('no-keybinding')) return
|
||||
$('#container').selectable('enable')
|
||||
}, (e)=>{
|
||||
if (!this.selecting) $('#container').selectable('disable')
|
||||
})
|
||||
keyboardJS.bind(macOs ? 'backspace' : 'delete', (e)=>{
|
||||
if (e.target.classList.contains('no-keybinding')) return
|
||||
this.deleteWidget()
|
||||
|
|
@ -259,6 +266,7 @@ var Editor = class Editor {
|
|||
disabled: true,
|
||||
start: (e)=>{
|
||||
tmpSelection = []
|
||||
this.selecting = true
|
||||
},
|
||||
selected: (ev, ui)=>{
|
||||
var widget = widgetManager.getWidgetByElement(ui.selected)
|
||||
|
|
@ -269,6 +277,8 @@ var Editor = class Editor {
|
|||
this.select(tmpSelection[i], {multi:true, fromLasso:true})
|
||||
}
|
||||
this.select(this.selectedWidgets)
|
||||
this.selecting = false
|
||||
$('#container').selectable('disable')
|
||||
}
|
||||
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue