dylanfprice/angular-gm

Do center and bounds of the map correlate?

Closed this issue · 1 comments

I think it seems not actually.

in the source code,

  if (hasCenter) {
    scope.$watch('gmCenter', function (newValue, oldValue) {
      var changed = (newValue !== oldValue);
      if (changed && !controller.dragging) {
        var latLng = newValue;
        if (latLng)
          controller.center = latLng;
      }
    }, true);
  }

and here,

  if (hasBounds) {
    scope.$watch('gmBounds', function(newValue, oldValue) {
      var changed = (newValue !== oldValue);
      if (changed && !controller.dragging) {
        var bounds = newValue;
        if (bounds)
          controller.bounds = bounds; 
      }
    });
  }

Both of $watch expression doesn't update the other side simultaneously. But it is quite natural that if one of them changes, the other also does.

What do you think?

Sorry. They do. After set center from my controller, AngularGM updates controller's center. Then it calls updateScope which handles other properties as well.