I think `$scope.layerHovered` could be removed as it's only assigned and used in this function.