[OpenLayers-Users] SetCenter

Toby Reinicke ramotswa at gmail.com
Tue Nov 22 10:17:23 EST 2011


Hi Ricardo,

No I think that makes sense. A solution would be to 
A: get the pixel from the new center
B: add maybe 20 (or however much your left panel is big) to the x value so the center is moved further right.
C: then recenter using get lonlatfrompixel.

One big warning about this (and using pixels in general); this will all break when you use a screen with a different resolution. 

Toby

On 22 Nov 2011, at 14:48, Ricardo Bayley <ricardo.bayley at gmail.com> wrote:

> Hi folks,
> 
> I have 2 divs. One is a panel and the other is the map.
> The panel slides to the left of my screen and gets hidden. So the map occupies the entire screen width.
> 
> If both divs are position one next to the other, every time the panel slides (opening & closing) map div gets resized. 
> Since I dont like the effect it causes I made by div panel to lay on top of the map and not next to it. So every time the panel gets hidden or shown, map doesnt change at all.
> 
> This comes with a cost. When I do => map.setCenter(x,y) I would like to have it centered to the "visible center" of the map.
> So when the panel is visible, the center should be shifted to x pixels to the right.
> 
> So basically, what I am  looking for is to shift coords xpixels to the right.
> Ideally it should work to with zoomToExtent.
> 
> Is it confusing ? How should I do this ?
> 
> 
> warm regards.
> 
> 
> Ricardo
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111122/ce41b4c4/attachment.html


More information about the Users mailing list