make map zoom work while list has focus

This commit is contained in:
rolux 2011-05-24 16:32:03 +02:00
parent 05af51f76b
commit 74802d284a
5 changed files with 19 additions and 3 deletions

View file

@ -89,7 +89,9 @@
focused !== null && Ox.UI.elements[focused].triggerEvent('keys', {
keys: buffer
});
}, 250);
}, 25);
// fixme: used to be 250, but seemed too much.
// if it stays at 25, we may not need a timeout at all
}
}
// clear the reset timeout even if the key didn't go into the buffer

View file

@ -1282,7 +1282,7 @@ Ox.List = function(options, self) {
} else if (key == 'selected') {
Ox.print('setOption selected', value)
setSelected(value);
triggerSelectEvent();
triggerSelectEvent(); // fixme: added to make text list find-as-you-type work, may break other things
} else if (key == 'sort') {
Ox.print('---sort---')
updateSort();

View file

@ -485,12 +485,14 @@ Ox.TextList = function(options, self) {
// fixme: works only if items are an array
var query = data.keys,
sort = self.options.sort[0];
Ox.print('QUERY', query)
Ox.forEach(self.options.items, function(item, i) {
var value = (
sort.map ? sort.map(item[sort.key]) : item[sort.key]
).toLowerCase();
if (Ox.startsWith(value, query)) {
that.$body.options({selected: [item[self.unique]]});
Ox.print('QUERY', query, 'VALUE', value)
return false;
}
});

View file

@ -244,6 +244,18 @@ Ox.ListMap = function(options, self) {
.bindEvent({
'delete': removeItem,
init: initList,
key_0: function() {
self.$map.panToPlace();
},
key_equal: function() {
self.$map.zoom(1);
},
key_minus: function() {
self.$map.zoom(-1);
},
key_shift_0: function() {
self.$map.zoomToPlace();
},
load: function() {
that.triggerEvent('loadlist');
},

View file

@ -1137,7 +1137,7 @@ Ox.Map = function(options, self) {
};
that.zoom = function(value) {
self.map.setZoom(value);
zoom(value);
return that;
};