I want to add SVG-overlays to a leaflet map. I add a SVG-container to the overlay pane where I append my SVGs. This works however my SVG-container keeps scrolling with the map. To display my SVGs properly I want the container to always span over my current view of the map (from the top-left to the bottom-right of my current map view).

How can I reset the origin of the svg-container to the top-left of my current map view?
This is my code snippet, it shows the directive for the SVG-overlay. I am using the leaflet-angular-directive:
angular.module('app')
  .directive('cluster', ['lodash', function() {
    return {
      link: function(scope, element, attrs, leafletController) {
        scope.$watch('cluster', function(newCluster, oldCluster) {
          leafletController.getMap()
            .then(function(map) {
              return scope.render(newCluster, map);
            });
        });
        scope.render = function(cluster, map) {
          var overlayPane = d3.select(map.getPanes().overlayPane);
          var svg = overlayPane.append("svg").attr("class", "leaflet-zoom-hide cluster");
          var g = svg.append("g");
          // append features (circles) to g
          // ...
          map.on("viewreset", update);
          update();
          function update() {
            // update svg
            svg.attr("width", map.getSize().x);
            svg.attr("height", map.getSize().y);
            // update features
            // ...
          }
        };
      }
    };
  }]);
 
                        
This is how I fixed it:
The size of the svg container is the bounds of all circles. You also have to include the radius of your circles as offset since the bounds of a circle depends on its center.