зеркало из https://github.com/mozilla/gecko-dev.git
Bug 346819: fix the drop/canDrop implementations so that search engine list drag and drop behaves correctly in all cases, r=mconnor
This commit is contained in:
Родитель
1e9d8f5eed
Коммит
468e598194
|
@ -358,25 +358,29 @@ EngineView.prototype = {
|
|||
|
||||
canDrop: function(targetIndex, orientation) {
|
||||
var sourceIndex = this.getSourceIndexFromDrag();
|
||||
return sourceIndex != -1 &&
|
||||
return (sourceIndex != -1 &&
|
||||
sourceIndex != targetIndex &&
|
||||
(orientation == Ci.nsITreeView.DROP_BEFORE ||
|
||||
orientation == Ci.nsITreeView.DROP_AFTER);
|
||||
|
||||
sourceIndex != (targetIndex + orientation));
|
||||
},
|
||||
|
||||
drop: function(newIndex, orientation) {
|
||||
drop: function(dropIndex, orientation) {
|
||||
var sourceIndex = this.getSourceIndexFromDrag();
|
||||
if (sourceIndex != -1) {
|
||||
var sourceEngine = this._engineStore.engines[sourceIndex];
|
||||
|
||||
this._engineStore.moveEngine(sourceEngine, newIndex);
|
||||
if (dropIndex > sourceIndex) {
|
||||
if (orientation == Ci.nsITreeView.DROP_BEFORE)
|
||||
dropIndex--;
|
||||
} else {
|
||||
if (orientation == Ci.nsITreeView.DROP_AFTER)
|
||||
dropIndex++;
|
||||
}
|
||||
|
||||
this._engineStore.moveEngine(sourceEngine, dropIndex);
|
||||
|
||||
// Redraw, and adjust selection
|
||||
this.invalidate();
|
||||
this.selection.clearSelection();
|
||||
this.selection.select(newIndex);
|
||||
}
|
||||
this.selection.select(dropIndex);
|
||||
},
|
||||
|
||||
selection: null,
|
||||
|
|
Загрузка…
Ссылка в новой задаче