Angular -google-maps stickers

so I created an angular application with the angular -google-maps library, which includes the markerswithlabels directory and the labels overlap the icons, so you can see a different label on top of another icon with a label. Now I don’t want this label and icon to hide behind it, so it displays only one text,

I created a code handle to show what I mean: here I set the label:

options: { 
      labelContent : dist + '<br />Overlapse',
      labelAnchor: "16 33",
      labelClass: 'labelClass',
      labelStyle: {opacity: 0.75},
      labelInBackground: true
    }, 

And this tells the marker directories to custom markers with labels:

<google-map ng-if="showloadedmap" center="map.center" draggable="true" maxZoom="map.maxZoom"
        minZoom="map.minZoom"  zoom="map.zoom" options="map.options" events="map.events">
      <markers models="map.markers" 
        doCluster="true" 
        coords="'self'"  
        icon="'icon'" 
        click="'onclicked'" 
                    options="'options'"
                    idkey='id' 
        clusterOptions='map.clusterOptions'
        isLabel='true'>     
      </markers>

    </google-map>

Here is an example codepen

+4
source share
1 answer

:

   //1x1 img which is overlapsed by label
   var iconimg = {
        url: 'img/markers/'+value[8], // url
        scaledSize: new google.maps.Size(1, 1), // size
    };
    //icon as background image 
    var newstyle = {
        'background-image':'url("img/markers/'+value[8]+'")',
        'background-size': '36.5px 61px',
        'background-position': 'top left',
        'background-repeat': 'no-repeat'
    }


$scope.map.markers.push({
    id: value[3],
    latitude: angular.fromJson(value[1]),
    longitude: angular.fromJson(value[2]),
    icon: iconimg,
    title : value[0],
    options: {
        labelContent : dist + '<br />'+$filter('date')(date,'d-M'),
        labelAnchor: "36 61",
        labelClass: 'labelClass',
        labelStyle: newstyle,
        labelInBackground: false
    }
 });

label css

.labelClass {
    padding-top:29px;
    padding-left:2px;
    color:#000; 
    font-family: 'open_sansregular';
    height:61px; 
    width:37px;
    font-size:9px;
    line-height: 12px;
} 
+9

All Articles