1
0
Fork 0
forked from 0x2620/oxjs

make find work in listcalendar; fill first page in static text lists with few items; listen to width/height changes in listmap and listcalendar; fix a bug where maps would load without zoombar

This commit is contained in:
rlx 2011-10-11 09:09:20 +00:00
commit 9fb30bf1af
5 changed files with 55 additions and 34 deletions

View file

@ -743,14 +743,12 @@ Ox.Map = function(options, self) {
Ox.print('init', mapBounds.getSouthWest(), mapBounds.getNorthEast(), mapBounds.getCenter())
updateFormElements();
self.elevationService = new google.maps.ElevationService();
self.geocoder = new google.maps.Geocoder();
self.maxZoomService = new google.maps.MaxZoomService();
self.center = mapBounds ? mapBounds.getCenter() : new google.maps.LatLng(0, 0);
self.zoom = 1; // fixme: should depend on height
self.zoom = self.minZoom;
that.map = self.map = new google.maps.Map(self.$map.$element[0], {
center: self.center,
disableDefaultUI: true,
@ -772,12 +770,14 @@ Ox.Map = function(options, self) {
selectPlace(self.options.selected, true);
} else {
mapBounds && self.map.fitBounds(mapBounds);
///*
if (self.map.getZoom() < self.minZoom) {
self.map.setZoom(self.minZoom);
}
//*/
}
updateFormElements();
// fixme: this is just guessing
// setTimeout(updateFormElements, 2500);
self.places = [];
if (!self.isAsync) {
@ -1239,7 +1239,12 @@ Ox.Map = function(options, self) {
function updateFormElements() {
var width = that.width();
self.$zoomInput && constructZoomInput();
if (self.options.zoombar) {
getMaxZoom(function(zoom) {
self.maxZoom = zoom;
constructZoomInput();
});
}
if (self.options.statusbar) {
self.$placeNameInput.options({
width: Math.floor((width - 132) / 2)
@ -1275,9 +1280,9 @@ Ox.Map = function(options, self) {
}
self.setOption = function(key, value) {
/*if (key == 'height' || key == 'width') {
resizeMap();
} else */if (key == 'places') {
if (key == 'height' || key == 'width') {
that.resizeMap();
} else if (key == 'places') {
//fixme: should zoom to new bounds
zoom(0);
} else if (key == 'selected') {
@ -1385,7 +1390,6 @@ Ox.Map = function(options, self) {
self.options.width = that.$element.width();
self.mapHeight = getMapHeight();
self.minZoom = getMinZoom();
Ox.print('map w/h', self.options.width, self.options.height)
self.$map.css({
height: self.mapHeight + 'px',
width: self.options.width + 'px'