angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

add css class for marker

Open ignatov-dmitry opened this issue 7 years ago • 7 comments

Hi! I need will add css class for marker. How do it? I mean agm-marker-cluster.

ignatov-dmitry avatar Dec 07 '18 13:12 ignatov-dmitry

if the developers can't help me, then i offering my solution. I moved from folder "node_modules" to folder "app" in my project "/@agm/js-marker-clusterer and /js-marker-clusterer", after rewrite dependencies in head module import { AgmJsMarkerClustererModule } from './_modules/@agm/js-marker-clusterer';

next in file 'js-marker-clustere/src/markerclusterer.js' changed method ClusterIcon.prototype.onAdd `ClusterIcon.prototype.onAdd = function() { this.div_ = document.createElement('DIV'); this.div_.className='cluster' if (this.visible_) { var pos = this.getPosFromLatLng_(this.center_); this.div_.style.cssText = this.createCss(pos); this.div_.innerHTML = this.sums_.text; this.div_.className='cluster-visible'; }

var panes = this.getPanes(); panes.overlayMouseTarget.appendChild(this.div_);

var that = this; google.maps.event.addDomListener(this.div_, 'click', function() { that.triggerClusterClick(); }); };`

ignatov-dmitry avatar Dec 11 '18 13:12 ignatov-dmitry

Yeah, I think there is no simply way to select the marker of the map in CSS. I've tried with this selector .gm-style img {} but this applies the CSS rules to all the images that appear in the map (so also the map itself!). Maybe use this CSS selector .gm-style > div > div > div > div > img {} can be a simple (but unsafe) workaround. However I think this is a big lack in an awesome repository, and should be fixed even only adding some CSS classes to the main elements of the map component.

gbertoncelli avatar Jan 30 '19 14:01 gbertoncelli

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 30 '19 16:04 stale[bot]

why would you want to style markers? Google Maps doesn't usually expect you to mess with their styles directly.

ghost avatar Jun 04 '19 06:06 ghost

Well just some simple coloring and minor styles should be easily possible through a class.

azerafati avatar Jan 07 '20 13:01 azerafati

Don't know if it would because I am not sure they are added as html, but if they are, you can look for the markers and try to see their class. Why involve AGM into it?

ghost avatar Jan 08 '20 16:01 ghost

by [iconUrl] you can add a image but it is not responsive is there a way to make it responsive as this ".gm-style img{} "is not directly accessible

ajinkyasarnaik avatar Mar 24 '20 11:03 ajinkyasarnaik