maqetta/maqetta — Issue #1742: Canvas and Outline palette: action should apply to item under mouse, not selection
Author: JonFerraiolo
Created: 2012-02-12 17:54:56+00:00
State: open
Labels: Outline View, Priority Low, Visual Editor

@jhpedemonte, @childsb, @peller

In the Files palette, if file2.html is currently selected, but the mouse is over file1.html and you bring up context menu and issue a delete command, we delete file1.html instead of file2.html. That's good. The trick that is employed is to change the selection just before bringing up the context menu. This is accomplished by Explorer.js registering an ```openCallback``` function:

```
Workbench.createPopup({
partID: 'davinci.ui.navigator',
domNode: this.tree.domNode,
openCallback:function (event)
{
// Make sure corresponding node on the Tree is set, as needed for right-mouse clicks (ctrl-click selects just fine)
var w = dijit.getEnclosingWidget(event.target);
if(w && w.item){
var nodes = tree.get("selectedNodes");
if(dojo.indexOf(nodes, w) == -1) {
tree.set("selectedNodes", [w]);
}
}
}
});
```

However, on the canvas or in the Outline palette, if widget A is selected and the mouse if over widget B, and you bring up context menu and issue a delete command, we delete the current selection (i.e., widget A).

If we are lucky, we can use the same approach on the canvas and Outline palette - register an ```openCallback``` function so that we change selection just before bringing up the popup menu.

(Note: I discovered this problem while fooling around with mobile views. The common way to delete a mobile view today is via the context menu in the Outline palette. Because of this bug, to delete a mobile view, a user has to first click on the view to select it, then bring up context menu and issue a "delete" command. When I was fooling around with product, I found myself not wanting to have to first select the view before I could delete it via context menu.)