mirror of
https://github.com/scratchfoundation/scratch-flash.git
synced 2024-12-04 21:21:06 -05:00
Merge pull request #194 from nathan/list-tabbing
Fixed tabbing between list cells
This commit is contained in:
commit
f889a7fceb
2 changed files with 8 additions and 3 deletions
|
@ -67,4 +67,9 @@ public class ListCell extends Sprite {
|
||||||
addChild(tf);
|
addChild(tf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function select():void {
|
||||||
|
stage.focus = tf;
|
||||||
|
tf.setSelection(0, tf.getLineLength(0));
|
||||||
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -523,14 +523,14 @@ public class ListWatcher extends Sprite {
|
||||||
if (cell.tf == cellContents) {
|
if (cell.tf == cellContents) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (contents.length < 2) return; // only one cell, and it's already selected
|
if (contents.length < 2) return; // only one cell, and it's already selected
|
||||||
if ((i + 1) < visibleCells.length) {
|
if (i + 1 < visibleCells.length) {
|
||||||
stage.focus = visibleCells[i + 1];
|
visibleCells[i + 1].select();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
var selectIndex:int = (firstVisibleIndex + i + 1) % contents.length;
|
var selectIndex:int = (firstVisibleIndex + i + 1) % contents.length;
|
||||||
scrollToIndex(selectIndex);
|
scrollToIndex(selectIndex);
|
||||||
var j:int = firstVisibleIndex - selectIndex;
|
var j:int = firstVisibleIndex - selectIndex;
|
||||||
if ((j >= 0) && (j < visibleCells.length)) stage.focus = visibleCells[j];
|
if (j >= 0 && j < visibleCells.length) visibleCells[j].select();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue