瀏覽代碼

Add explanatory comment for a tricky condition

Jason Grout 8 年之前
父節點
當前提交
89b4f48f73
共有 1 個文件被更改,包括 3 次插入0 次删除
  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;
     }