-
Notifications
You must be signed in to change notification settings - Fork 378
Open
Description
I ma using Gmap4rails gem to populate rich markers on map.
When I click on marker, It changes map center automatically.
I don't want to change center on marker click.
Following is the code
var RichMarkerBuilder,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
RichMarkerBuilder = (function(superClass) {
extend(RichMarkerBuilder, superClass);
function RichMarkerBuilder() {
return RichMarkerBuilder.__super__.constructor.apply(this, arguments);
}
RichMarkerBuilder.prototype.create_marker = function() {
var options;
options = _.extend(this.marker_options(), this.rich_marker_options());
return this.serviceObject = new RichMarker(options);
};
RichMarkerBuilder.prototype.rich_marker_options = function() {
var marker;
marker = document.createElement("div");
marker.setAttribute('class', 'marker_container '+ this.args.id);
marker.innerHTML = this.args.custom_marker;
return {
content: marker
};
};
return RichMarkerBuilder;
})(Gmaps.Google.Builders.Marker);
this.buildMap = function(markers) {
// var handler;
markers = _.filter(markers, function(marker){
return marker.lat !== undefined;
});
window.handler = Gmaps.build('Google', {
builders: {
Marker: RichMarkerBuilder
}
});
return handler.buildMap({
provider: {fullscreenControl: false , clickableIcons: false },
internal: {
id: 'map'
}
}, function() {
markers = markers.map(function(m) {
marker = handler.addMarker(m);
marker.serviceObject.set('id', m.id); // You can add other attributes using set
return marker;
});
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
// handler.getMap().setZoom(12);
if (window.zoom && window.zoom !== undefined)
{
handler.getMap().setZoom(window.zoom)
}else {handler.getMap().setZoom(12); window.zoom = 12}
if (window.center && window.center !== undefined)
{
// handler.getMap().setCenter(window.center)
}
setTimeout(function(){
bind_map_bounds_change()
},100)
return
});
};
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels