tree: select range of contiguous widgets with shift + click

This commit is contained in:
jean-emmanuel 2021-03-09 08:23:19 +01:00
parent 39c35c5d99
commit d2e5aac72f
2 changed files with 20 additions and 1 deletions

View file

@ -1,5 +1,10 @@
# Changelog
## 1.8.12
- project tree
- select range of contiguous widgets with shift + click
## 1.8.11
- bug fixes

View file

@ -35,6 +35,20 @@ var handleClick = function(event) {
if (event.type !== 'fast-right-click') {
if (editor.inspector.focusedInput) editor.inspector.onChange()
if (
event.target.tagName === 'LI' && // Project tree
event.detail.shiftKey &&
editor.selectedWidgets.length > 0
) {
var siblings = targetWidget.parent.children,
from = siblings.indexOf(editor.selectedWidgets[0]),
to = siblings.indexOf(targetWidget),
range = siblings.slice(Math.min(from, to), Math.max(from, to) + 1)
targetWidget = editor.selectedWidgets.concat(range)
}
editor.select(targetWidget, {multi: event.detail[multiSelectKey]})
}
@ -58,7 +72,7 @@ var handleClick = function(event) {
if (parent !== widgetManager) {
if (event.target.tagName !== 'LI') {
if (event.target.tagName !== 'LI') { // not Project tree
actions.push({
label: icon('project-diagram') + ' ' + locales('editor_show_in_tree'),
action: ()=>{