mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
updated .focused / .selected props, still need to do events...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
bc483edb26
commit
adc25ca1a9
@ -324,27 +324,49 @@ var BaseBrowserPrototype = {
|
|||||||
this.__item_index = value },
|
this.__item_index = value },
|
||||||
|
|
||||||
|
|
||||||
// XXX what should these return??? (item, id, ...)
|
// XXX should this be more pedantic???
|
||||||
__focused: undefined,
|
__focused: undefined,
|
||||||
get focused(){
|
get focused(){
|
||||||
return this.__focused && this.__focused.focused ?
|
return (this.__focused && this.__focused.focused) ?
|
||||||
this.__focused
|
this.__focused
|
||||||
: (this.__focused = this
|
: (this.__focused = this.get('focused')) },
|
||||||
// XXX should we simple bailout when we find an item???
|
// XXX should this trigger focus/blur events???
|
||||||
.filter(function(e){
|
// ...or should this call .focus(..)
|
||||||
return e.focused }).shift()) },
|
|
||||||
set focused(value){
|
set focused(value){
|
||||||
// XXX
|
delete this.get('focused').focused
|
||||||
},
|
this.__focused = value == null ?
|
||||||
|
null
|
||||||
|
: this.get(value,
|
||||||
|
function(e){
|
||||||
|
e.focused = true
|
||||||
|
return e}) },
|
||||||
|
|
||||||
__selected: null,
|
__selected: null,
|
||||||
get selected(){
|
get selected(){
|
||||||
return this.__selected
|
return this.__selected
|
||||||
|| (this.__selected = this
|
|| (this.__selected = this.search('selected')) },
|
||||||
.filter(function(e){
|
// XXX should this trigger select/deselect events???
|
||||||
return e.selected })) },
|
// ...or should this call .select(..)
|
||||||
set selected(value){
|
set selected(value){
|
||||||
// XXX
|
var that = this
|
||||||
|
// deselect...
|
||||||
|
this.__selected = null
|
||||||
|
this.search('selected',
|
||||||
|
function(e){
|
||||||
|
delete e.selected })
|
||||||
|
// select...
|
||||||
|
this.__selected = value == null ?
|
||||||
|
null
|
||||||
|
: (value instanceof Array ?
|
||||||
|
value
|
||||||
|
: [value])
|
||||||
|
.map(function(p){
|
||||||
|
return that.search(p,
|
||||||
|
function(e){
|
||||||
|
e.selected = true
|
||||||
|
return e }) })
|
||||||
|
.flat()
|
||||||
|
.unique()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user