Module: deluge
Branch: master
Commit: 43fb99865189cbab169916d8147e8b74c01be5c2

Author: Damien Churchill <[email protected]>
Date:   Thu Jul  1 14:08:20 2010 +0100

fix select 'upwards'

---

 .../ext-extensions/tree/MultiSelectionModelFix.js  |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/deluge/ui/web/js/ext-extensions/tree/MultiSelectionModelFix.js 
b/deluge/ui/web/js/ext-extensions/tree/MultiSelectionModelFix.js
index 866e686..d699cce 100644
--- a/deluge/ui/web/js/ext-extensions/tree/MultiSelectionModelFix.js
+++ b/deluge/ui/web/js/ext-extensions/tree/MultiSelectionModelFix.js
@@ -45,16 +45,24 @@ Ext.override(Ext.tree.MultiSelectionModel, {
                        if (this.lastSelNode.parentNode.id != parentNode.id) 
return;
 
                        // Get the node indexes
-                       var ni = parentNode.indexOf(node),
+                       var fi = parentNode.indexOf(node),
                                li = parentNode.indexOf(this.lastSelNode);
 
+                       // Swap the values if required
+                       if (fi > li) {
+                               fi = fi + li, li = fi - li, fi = fi - li;
+                       }
+
                        // Select all the nodes
                        parentNode.eachChild(function(n) {
                                var i = parentNode.indexOf(n);
-                               if (li < i && i <= ni) {
+                               if (fi < i && i < li) {
                                        this.select(n, e, true);
                                }
                        }, this);
+
+                       // Select the clicked node
+                       this.select(node, e, true);
                } else {
                        this.select(node, e, e.ctrlKey);
                }

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to