react-hotels-on-map
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -33,2 +33,8 @@ 'use strict'; | ||
function newInfoWindow(hotel) { | ||
var maps = global.window.google.maps; | ||
return new maps.InfoWindow({ content: (0, _hotelInfoHtml2.default)(hotel) }); | ||
} | ||
exports.default = _react2.default.createClass({ | ||
@@ -50,4 +56,12 @@ displayName: 'src', | ||
this.map = new maps.Map(this.getDOMNode(), (0, _defaultMapConfiguration2.default)()); | ||
this.applyClustering(); | ||
}, | ||
applyClustering: function applyClustering() { | ||
var maps = global.window.google.maps; | ||
var markers = this.markers(); | ||
var markers = this.markers(); | ||
if (markers.length === 1) { | ||
maps.event.trigger(markers[0], 'click'); | ||
} | ||
var clusterer = new _MarkerClusterer2.default(this.map, markers, { gridSize: 30 }); | ||
@@ -61,8 +75,6 @@ | ||
return this.props.hotels.map(function (hotel) { | ||
var maps = global.window.google.maps; | ||
var result = (0, _marker2.default)(hotel.geolocation); | ||
var infoWindow = new maps.InfoWindow({ content: (0, _hotelInfoHtml2.default)(hotel) }); | ||
result.addListener('click', function () { | ||
infoWindow.open(_this.map, result); | ||
newInfoWindow(hotel).open(_this.map, result); | ||
}); | ||
@@ -69,0 +81,0 @@ |
{ | ||
"name": "react-hotels-on-map", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Presents a set of hotels as clustered markers on Google Map, each with an info window displaying the hotel summary", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
46414
1176