Skip to content

Excessive debug log messages on changes to $scope.markers #829

@MattSidor

Description

@MattSidor

When the user hovers over a marker, I am changing the marker size and anchor:

    function growMarker(markerName) {
        //double marker icon size and slightly adjust anchor so it stays centered
        $scope.markers[markerName].icon.iconSize = [24,24];
        $scope.markers[markerName].icon.iconAnchor = [11,11];
    }
    function shrinkMarker(markerName) {
        //restore marker icon to original settings
        $scope.markers[markerName].icon.iconSize = [17,17];
        $scope.markers[markerName].icon.iconAnchor = [8,8];
    }

    $scope.$on('leafletDirectiveMarker.mouseover', function (event, args){
        growMarker(args.modelName);
    });
    $scope.$on('leafletDirectiveMarker.mouseout', function (event, args){
        shrinkMarker(args.modelName);
    });

Since a recent update to angular-leaflet-directive, each time a marker's iconSize and iconAnchor properties are changed, my console log gets filled with a debug log message for each and every marker on the map, regardless of whether that specific marker was changed:

[AngularJS - Leaflet] [marker] is already rendered, marker: king
angular.js:12314 
[AngularJS - Leaflet] [marker] is already rendered, marker: mathsci
angular.js:12314 
[AngularJS - Leaflet] [marker] is already rendered, marker: art
angular.js:12314 
[AngularJS - Leaflet] [marker] is already rendered, marker: pes
angular.js:12314 

...etc. I have about 20 markers, so I get 20 errors when I mouseover and 20 errors when I mouseout.

To fix this for now, I've turned off Angular debug logging in my application's configuration (it is turned on by default):

angular.module(ApplicationConfiguration.applicationModuleName).config(['$logProvider',
    function($logProvider) {
        $logProvider.debugEnabled(false);
    }
]);

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions