OpenLayers OpenLayers

Changeset 1778

Show
Ignore:
Timestamp:
11/08/06 11:01:39 (2 years ago)
Author:
crschmidt
Message:

A fix for #366 , this prevents bailing out in the case where originPx
can't be determined from the baselayer yet. This is the case in Google,
because Google can't call getLatLonFromPx until after setCenter has been
called, which comes after this. There may be some cases where this isn't
a perfect fix, but we're going to fix this for now, and punt on further
testing until 2.3.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Map.js

    r1721 r1778  
    787787        var newPx = this.getViewPortPxFromLonLat(lonlat); 
    788788 
    789         this.layerContainerDiv.style.left = (originPx.x - newPx.x) + "px"; 
    790         this.layerContainerDiv.style.top  = (originPx.y - newPx.y) + "px"; 
     789        if ((originPx != null) && (newPx != null)) { 
     790            this.layerContainerDiv.style.left = (originPx.x - newPx.x) + "px"; 
     791            this.layerContainerDiv.style.top  = (originPx.y - newPx.y) + "px"; 
     792        } 
    791793    }, 
    792794