From f34752a034c7bf9060c7a286975df51f4e1a1e04 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 1 Jun 2012 13:48:20 -0700 Subject: Map fixes --- node_modules/montage-google/map.reel/map.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'node_modules') diff --git a/node_modules/montage-google/map.reel/map.js b/node_modules/montage-google/map.reel/map.js index 879a80d4..4e3a6d70 100644 --- a/node_modules/montage-google/map.reel/map.js +++ b/node_modules/montage-google/map.reel/map.js @@ -21,10 +21,10 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ value: function() { var self = this; - this._latLng = this.defaultLatLng; window.initialize = function initialize() { self._mapLoaded = true; self._geoCoder = new google.maps.Geocoder(); + self.center = self._center; self.needsDraw = true; }; } @@ -115,7 +115,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ set: function(value) { if(value) { this._category = value; - if (this._mapLoaded && this.latLng) { + if (this._map && this.latLng) { this._getPlaces(this._category); this.needsDraw = true; } @@ -139,7 +139,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ zoomValue: { - value: 8 + value: 13 }, __places: {value: null}, @@ -249,9 +249,17 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ draw: { enumerable: false, value: function () { - if(this._mapLoaded) { - var latLng = this.latLng || this.defaultLatLng; + var latLng = this.latLng; + + if (!latLng) { + if (this._center) { + return; + } else { + latLng = this.defaultLatLng; + } + } + if(!this._map) { var map; var myOptions = { @@ -266,7 +274,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ } var map = this._map; - map.setZoom(10); + //map.setZoom(10); var latLng = new window.google.maps.LatLng(latLng.lat, latLng.lng); map.setCenter(latLng); var marker = new google.maps.Marker({ @@ -276,7 +284,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ var places = this._places; if(places && places.length > 0) { - map.setZoom(13); + //map.setZoom(13); this._removeAllMarkers(); for (var i = 0; i < places.length; i++) { this._createMarker(places[i]); -- cgit v1.2.3