editor: smarter shift+drag selection: allow selecting widgets in the area when the event started on the parent container
This commit is contained in:
parent
d402a473c9
commit
7ea95702e8
2 changed files with 18 additions and 6 deletions
|
|
@ -6,7 +6,7 @@
|
|||
- visualizer: remove `bars` and `dots` option
|
||||
- plot: fix `bars` option
|
||||
- project tree: clear filter input when loading a session
|
||||
- server: fix serving files from paths containing accents
|
||||
- server: fix serving files from paths containing accents
|
||||
|
||||
- widgets
|
||||
- image: add pre defined values for `size`, `position` and `repeat` properties
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
- editor
|
||||
- tree: add icons before widget ids depending on the category
|
||||
- tree: activate tab when selecting it in the project tree
|
||||
- smarter shift+drag selection: allow selecting widgets in the area when the event started on the parent container
|
||||
|
||||
- remote control
|
||||
- add `/STATE/SEND` command
|
||||
|
|
|
|||
|
|
@ -202,12 +202,16 @@ class Editor {
|
|||
|
||||
if (e.ctrlKey) {
|
||||
|
||||
// only add siblings to current selection
|
||||
|
||||
for (var i in widgets) {
|
||||
this.select(widgets[i], {multi:true, fromLasso:true, lassoEnd: i == widgets.length - 1})
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// select the largest group of siblings in area
|
||||
|
||||
var groups = {}
|
||||
for (var w of widgets) {
|
||||
var g = w.parent.hash
|
||||
|
|
@ -215,12 +219,19 @@ class Editor {
|
|||
if (!groups[g]) groups[g] = []
|
||||
if (!groups[g].includes(w)) groups[g].push(w)
|
||||
}
|
||||
groups = Object.values(groups).filter(g=>!(g.length === 1 && g[0] === this.selectedWidgets[0]))
|
||||
console.log(groups)
|
||||
var lengths = groups.map(g=>g.length)
|
||||
var winner = groups[lengths.indexOf(Math.max(...lengths))]
|
||||
|
||||
if (winner) this.select(winner)
|
||||
groups = Object.values(groups)
|
||||
|
||||
// if the event started from a container widget (but not in the project tree)
|
||||
// remove groups that are more than one level away from that container
|
||||
if (e.target.tagName !== 'LI' && this.selectedWidgets[0].childrenType !== undefined) {
|
||||
groups = groups.filter(g=>g[0].parent === this.selectedWidgets[0] || g[0].parent === this.selectedWidgets[0].parent)
|
||||
}
|
||||
|
||||
var lengths = groups.map(g=>g.length),
|
||||
selection = groups[lengths.lastIndexOf(Math.max(...lengths))]
|
||||
|
||||
if (selection) this.select(selection)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue