Open bebaek opened 3 years ago
There are semantic issues with multiple selection and dragging in a Tree editor: if the selected items come from multiple branches of the tree, how should they be treated for a drag/drop action? Do you try to preserve what tree structure you can, or do you treat them as a list with no structure?
As a result, for simplicity, the TreeEditor currently only supports single drag and drop.
Similarly, if you have multiple items selected and they provide different context menus, which one should be used?
If there is visual confusion, the editor should perhaps change the selection before starting a drag or displaying a context menu?
I see this may not be simple. I thought what desktop file editors do can be the reasonable defaults from a user's perspective. For example, my expectation would be preserving selected tree structure for a drag and drop. But there can be other tree structures for which this is not quite desirable. (For example, node types may need to be tied to the depth.)
If we can't decide what should be the default behavior, how about making the editor extensible by allowing a custom multi-selection handler for drag-and-drop and context menu?
If all nodes in the selection are of the same TreeNode type, could this be implemented? The downstream use case has a generic LeafNode
that is essentially meant to be a node for general objects in the application. It would be nice (and has been requested) that these be drag and droppable in a group rather than 1 at a time.
If all the selected objects are of the same node type, then there is only one context menu to chose from, likewise all the nodes should be allowed to be dragged to the same parts of the tree structure.
if the selected items come from multiple branches of the tree, how should they be treated for a drag/drop action? Do you try to preserve what tree structure you can, or do you treat them as a list with no structure?
I'd say treat them as a list with no structure, but that is just my intuition of what would be expected behavior.
Although selecting multiple nodes is supported, it has no effect on dragging. The default context menu actions also ignores the multiple selection unlike a common expectation.
For now, the app could have a custom context menu to handle the multi-selection properly, but there is nothing the app can do about dragging.