Browse files

Merge branch 'master' of github.com:clientside/amplesdk

  • Loading branch information...
2 parents 7eec7e2 + cc06dc9 commit de6a30dc616a1fb7d79861fc44a189e2e88fb70e @ilinsky ilinsky committed Oct 8, 2012
Showing with 20 additions and 12 deletions.
  1. +7 −3 ample/languages/xul/elements/listbox.js
  2. +13 −9 ample/languages/xul/elements/listitem.js
View
10 ample/languages/xul/elements/listbox.js
@@ -28,7 +28,7 @@ cXULElement_listbox.handlers = {
// Key: Up
var nIndex = this.selectedItems[this.selectedItems.length-1].$getContainer().rowIndex;
if (nIndex > 0) {
- if (oEvent.shiftKey) {
+ if (oEvent.shiftKey && this.getAttribute("seltype") !== "single") {
// Jump over the only selected item
if (this.selectedItems.length > 1)
if (this.currentItem.$getContainer().rowIndex > this.selectedItems[0].$getContainer().rowIndex)
@@ -37,7 +37,9 @@ cXULElement_listbox.handlers = {
this.toggleItemSelection(this.items[nIndex-1]);
}
else
+ {
this.selectItem(this.items[nIndex-1]);
+ }
// Scroll to item if not visible
this.scrollToIndex(nIndex-1);
@@ -51,7 +53,7 @@ cXULElement_listbox.handlers = {
// Key: Down
var nIndex = this.selectedItems[this.selectedItems.length-1].$getContainer().rowIndex;
if (nIndex < this.items.length-1) {
- if (oEvent.shiftKey) {
+ if (oEvent.shiftKey && this.getAttribute("seltype") !== "single") {
// Jump over the only selected item
if (this.selectedItems.length > 1)
if (this.currentItem.$getContainer().rowIndex < this.selectedItems[0].$getContainer().rowIndex)
@@ -74,7 +76,9 @@ cXULElement_listbox.handlers = {
"DOMAttrModified": function(oEvent) {
if (oEvent.target == this)
if (oEvent.attrName == "seltype") {
- // TODO
+ if (this.selectedItems.length) {
+ this.selectItem(this.selectedItems[0]);
+ }
}
},
"DOMNodeInserted": function(oEvent) {
View
22 ample/languages/xul/elements/listitem.js
@@ -24,16 +24,20 @@ cXULElement_listitem.handlers = {
if (oEvent.button == 2 && oView.selectedItems.$indexOf(this) !=-1)
return;
- if (oEvent.shiftKey) {
- if (oView.currentItem)
- oView.selectItemRange(this, oView.currentItem);
- }
- else
- {
- if (oEvent.ctrlKey)
- oView.toggleItemSelection(this);
+ if (oView.getAttribute("seltype") == "single") {
+ oView.selectItem(this);
+ } else {
+ if (oEvent.shiftKey) {
+ if (oView.currentItem)
+ oView.selectItemRange(this, oView.currentItem);
+ }
else
- oView.selectItem(this);
+ {
+ if (oEvent.ctrlKey)
+ oView.toggleItemSelection(this);
+ else
+ oView.selectItem(this);
+ }
}
},
"DOMNodeInserted": function(oEvent) {

0 comments on commit de6a30d

Please sign in to comment.