add tooltips to map place info; fix a bug with autocomplete and live updates (fixes #453)

This commit is contained in:
rlx 2012-02-15 16:13:09 +00:00
parent 96db09337c
commit 972808eb17
4 changed files with 19 additions and 16 deletions

View file

@ -438,7 +438,7 @@ Ox.Input = function(options, self) {
}) })
.addClass('OxAutocompleteMenu') .addClass('OxAutocompleteMenu')
.bindEvent({ .bindEvent({
click: clickMenu click: clickMenu,
}); });
return menu; return menu;
} }
@ -643,9 +643,7 @@ Ox.Input = function(options, self) {
self.$input.val(self.options.value); self.$input.val(self.options.value);
cursor(0, self.options.value.length); cursor(0, self.options.value.length);
self.options.changeOnKeypress && that.triggerEvent({ self.options.changeOnKeypress && that.triggerEvent({
change: { change: {value: self.options.value}
value: self.options.value
}
}); });
} }
@ -745,9 +743,7 @@ Ox.Input = function(options, self) {
self.options.autocomplete && autocomplete(oldValue, oldCursor); self.options.autocomplete && autocomplete(oldValue, oldCursor);
self.options.autovalidate && autovalidate(oldValue, oldCursor); self.options.autovalidate && autovalidate(oldValue, oldCursor);
self.options.changeOnKeypress && that.triggerEvent({ self.options.changeOnKeypress && that.triggerEvent({
change: { change: {value: self.options.value}
value: self.options.value
}
}); });
} }
}, 0); }, 0);
@ -773,6 +769,9 @@ Ox.Input = function(options, self) {
self.options.value = data.title self.options.value = data.title
self.$input.val(self.options.value); self.$input.val(self.options.value);
cursor(pos[0], self.options.value.length); cursor(pos[0], self.options.value.length);
self.options.changeOnKeypress && that.triggerEvent({
change: {value: self.options.value}
});
//} //}
} }

View file

@ -897,9 +897,9 @@ Ox.ListMap = function(options, self) {
function removeItem(data) { function removeItem(data) {
var id = data.ids[0]; var id = data.ids[0];
// fixme: events or callback functions?? self.$list.value(id, 'type') && self.$map.removePlace(id);
// FIXME: events or callback functions??
that.triggerEvent('removeplace', {id: id}); that.triggerEvent('removeplace', {id: id});
self.$map.removePlace(id);
} }
function removePlace() { function removePlace() {

View file

@ -415,7 +415,8 @@ Ox.Map = function(options, self) {
flag: Ox.Element() flag: Ox.Element()
.addClass('OxPlaceControl OxPlaceFlag'), .addClass('OxPlaceControl OxPlaceFlag'),
name: Ox.Label({ name: Ox.Label({
textAlign: 'center' textAlign: 'center',
tooltip: 'Click to pan, doubleclick to zoom'
}) })
.addClass('OxPlaceControl OxPlaceName') .addClass('OxPlaceControl OxPlaceName')
.bindEvent({ .bindEvent({
@ -428,6 +429,7 @@ Ox.Map = function(options, self) {
}), }),
deselectButton: Ox.Button({ deselectButton: Ox.Button({
title: 'close', title: 'close',
tooltip: 'Deselect',
type: 'image', type: 'image',
}) })
.addClass('OxPlaceControl OxPlaceDeselectButton') .addClass('OxPlaceControl OxPlaceDeselectButton')
@ -555,10 +557,7 @@ Ox.Map = function(options, self) {
function centerChanged() { function centerChanged() {
var tooltip = $('.OxMapMarkerTooltip'); var tooltip = $('.OxMapMarkerTooltip');
if (tooltip.length) { tooltip.length && Ox.UI.elements[$(tooltip[0]).data('oxid')].hide();
Ox.Log('Map', '??', tooltip[0].className, $(tooltip[0]).data('oxid'));
Ox.UI.elements[$(tooltip[0]).data('oxid')].hide();
}
self.center = self.map.getCenter(); self.center = self.map.getCenter();
self.centerChanged = true; self.centerChanged = true;
} }

View file

@ -624,10 +624,15 @@ Ox.AnnotationFolder = function(options, self) {
}); });
self.options.selected = item.id; self.options.selected = item.id;
self.$annotations.options({selected: self.options.selected}); self.$annotations.options({selected: self.options.selected});
if (self.widget && isDefined(item)) { if (self.widget) {
self.options.type == 'event'
? self.$calendar.options({events: getEvents()})
: self.$map.options({places: getPlaces()});
// if updating has made the item match // if updating has made the item match
// an event or place, then select it // an event or place, then select it
self.$widget.options({selected: item[self.options.type].id}); isDefined(item) && self.$widget.options({
selected: item[self.options.type].id
});
} }
return that; return that;
}; };