1
0
Fork 0
forked from 0x2620/oxjs

fix find on map

This commit is contained in:
rolux 2011-04-27 09:13:12 +02:00
commit 358ee1bc96
7 changed files with 18 additions and 5 deletions

View file

@ -237,7 +237,7 @@ Ox.ListMap = function(options, self) {
}
function init(places) {
Ox.print('PLACES', places)
//Ox.print('PLACES', places)
self.$map = new Ox.Map({
clickable: true,
editable: true,

View file

@ -1,4 +1,5 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
Ox.Map = function(options, self) {
var self = self || {}
@ -287,7 +288,7 @@ Ox.Map = function(options, self) {
}
});
if (!exists) {
self.resultPlace && self.resultPlace.removeElement();
self.resultPlace && self.resultPlace.remove();
self.resultPlace = place;
place.add();
}
@ -582,9 +583,9 @@ Ox.Map = function(options, self) {
self.places.sort(function(a, b) {
var sort = {
a: a.selected ? Infinity :
(bounds.contains(a.center) ? a.size : -Infinity),
bounds.contains(a.center) ? a.size : -Infinity,
b: b.selected ? Infinity :
(bounds.contains(b.center) ? b.size : -Infinity),
bounds.contains(b.center) ? b.size : -Infinity,
};
return sort.b - sort.a;
}).forEach(function(place, i) {
@ -878,6 +879,8 @@ Ox.Map = function(options, self) {
if (place) {
addPlaceToMap(place);
self.map.fitBounds(place.bounds);
} else {
self.$findInput.addClass('OxError');
}
callback(place);
});

View file

@ -1,4 +1,5 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
Ox.MapPlace = function(options) {
options = Ox.extend({