[OpenLayers-Users] Help: Wrong coordinates after map position changed

Christopher Schmidt crschmidt at metacarta.com
Thu Mar 20 08:58:27 EDT 2008


On Thu, Mar 20, 2008 at 05:19:15AM -0700, kgm wrote:
> 
> Hello,
> 
> I have a map where the user can add or edit features. 
> It is possible, that the map container changes its position in the Layout. 
> 
> After this has happened I have the following problem:
> The mouseclick is registered at the position where the map was before being
> moved, so if I add a Feature at some position, it is not added where I click
> but moved by the offset of which the map was moved.
> What can I do about this? 


updateSize: "This function should be called by any external code which
dynamically changes the size of the map div (because mozilla wont let us
catch the “onresize” for an element)"

--
http://dev.openlayers.org/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.updateSize

Call updateSize. It'll reset all the offsets and get things back in
working order (hopefully).

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list