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', { focused !== null && Ox.UI.elements[focused].triggerEvent('keys', {
keys: buffer 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 // 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') { } else if (key == 'selected') {
Ox.print('setOption selected', value) Ox.print('setOption selected', value)
setSelected(value); setSelected(value);
triggerSelectEvent(); triggerSelectEvent(); // fixme: added to make text list find-as-you-type work, may break other things
} else if (key == 'sort') { } else if (key == 'sort') {
Ox.print('---sort---') Ox.print('---sort---')
updateSort(); updateSort();

View file

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

View file

@ -244,6 +244,18 @@ Ox.ListMap = function(options, self) {
.bindEvent({ .bindEvent({
'delete': removeItem, 'delete': removeItem,
init: initList, 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() { load: function() {
that.triggerEvent('loadlist'); that.triggerEvent('loadlist');
}, },

View file

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