diff --git a/google-map-marker.html b/google-map-marker.html index fb789a3..58b0d05 100644 --- a/google-map-marker.html +++ b/google-map-marker.html @@ -306,7 +306,7 @@ }, _clickEventsChanged: function() { - if (this.map) { + if (this.marker) { if (this.clickEvents) { this._forwardEvent('click'); this._forwardEvent('dblclick'); @@ -320,7 +320,7 @@ }, _dragEventsChanged: function() { - if (this.map) { + if (this.marker) { if (this.dragEvents) { this._forwardEvent('drag'); this._forwardEvent('dragend'); @@ -334,7 +334,7 @@ }, _mouseEventsChanged: function() { - if (this.map) { + if (this.marker) { if (this.mouseEvents) { this._forwardEvent('mousedown'); this._forwardEvent('mousemove'); diff --git a/google-map.html b/google-map.html index 833897a..29f401b 100644 --- a/google-map.html +++ b/google-map.html @@ -235,6 +235,15 @@ }, /** + * Bounds of the map + */ + bounds: { + type: Object, + notify: true, + value: null + }, + + /** * A kml file to load. */ kml: { @@ -306,6 +315,15 @@ observer: '_disableStreetViewControlChanged' }, + /** + * If set, removes the map's 'fullscreen' UI controls. + */ + disableFullscreenControl: { + type: Boolean, + value: false, + observer: '_disableFullscreenControlChanged' + }, + /** * If set, the zoom level is set such that all markers (google-map-marker children) are brought into view. */ @@ -499,6 +517,7 @@ disableDefaultUI: this.disableDefaultUi, mapTypeControl: !this.disableDefaultUi && !this.disableMapTypeControl, streetViewControl: !this.disableDefaultUi && !this.disableStreetViewControl, + fullscreenControl: !this.disableDefaultUi && !this.disableFullscreenControl, disableDoubleClickZoom: this.disableZoom, scrollwheel: !this.disableZoom, styles: this.styles, @@ -625,9 +644,30 @@ if (this.fitToMarkers) { // we might not have a center if we are doing fit-to-markers this._fitToMarkersChanged(); } + + this.calcBounds(); + } + }, + + calcBounds: function() { + var bounds = this.map.getBounds(); + if (bounds) { + var ne = bounds.getNorthEast(); + var sw = bounds.getSouthWest(); + this.bounds = { + ne: { + lat: ne.lat(), + lng: ne.lng() + }, + sw: { + lat: sw.lat(), + lng: sw.lng() + } + } } }, + _loadKml: function() { if (this.map && this.kml) { var kmlfile = new google.maps.KmlLayer({ @@ -670,12 +710,14 @@ this.map.panTo(newCenter); } } + this.calcBounds(); } }, _zoomChanged: function() { if (this.map) { this.map.setZoom(Number(this.zoom)); + this.calcBounds(); } }, @@ -768,6 +810,13 @@ this.map.setOptions({streetViewControl: !this.disableStreetViewControl}); }, + _disableFullscreenControlChanged: function() { + if (!this.map) { + return; + } + this.map.setOptions({fullscreenControl: !this.disableFullscreenControl}); + }, + _disableZoomChanged: function() { if (!this.map) { return; @@ -806,6 +855,7 @@ } this.map.setCenter(latLngBounds.getCenter()); + this.calcBounds(); } }, @@ -814,10 +864,12 @@ var center = this.map.getCenter(); this.latitude = center.lat(); this.longitude = center.lng(); + this.calcBounds(); }.bind(this)); google.maps.event.addListener(this.map, 'zoom_changed', function() { this.zoom = this.map.getZoom(); + this.calcBounds(); }.bind(this)); google.maps.event.addListener(this.map, 'maptypeid_changed', function() {