Browse Source

Add explanatory comment for a tricky condition

Jason Grout 8 years ago
parent
commit
89b4f48f73
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/leafletwidget/widget.ts

+ 3 - 0
src/leafletwidget/widget.ts

@@ -137,6 +137,9 @@ class MapWidget extends Widget {
    */
   private _fitLayerBounds() {
     if (this._fitBounds && this._geojsonLayer && this._width && this._height) {
+      // We haven't fitted before, we have layer information, and the
+      // width and height have been updated from their initial falsey values to a
+      // positive size or to -1 (indicating we need to read the size from the DOM).
       this._map.fitBounds(this._geojsonLayer.getBounds());
       this._fitBounds = false;
     }