Problem on resize map

2,223 views
Skip to first unread message

Walter Lorenzetti

unread,
Feb 16, 2013, 5:55:24 AM2/16/13
to leafl...@googlegroups.com
Hi,

I'm a problem on Leaflet + Jquery UI Layout plugin. I put my map on the center panel, but on resize of that, for open or close of east or west panel, my resize not work. At the moment I use this way.

On resize center panel uiᅵ event I do that:
Before I change dimension of my map container

var div = $(L.getContainer());
ᅵᅵᅵ ᅵᅵᅵ if (div.length > 0)
ᅵᅵᅵ ᅵᅵᅵ ᅵᅵᅵ $(div[0]).width("100%").height($(".ui-layout-center").height()+"px");

After i try to redraw my map

L.setView( this.myMap.getCenter(), this.myMap.getZoom(), true);

but this not work because, if I get the map size with L.getSize() method, I can see
before and after resize event the same size

Before Point(1918, 828)
After Point(1918, 828)

So someone can help me

Thanks in advance
W
-- 

Walter Lorenzetti phD
email: loren...@gis3w.it
skype: aiki74
Cell: (+39) 347-6597931  Tel+Fax: (+39) 0588 85021
Viale Giuseppe Verdi n. 24, 51016
Montecatini Terme,Pistoia
P.IVA 01686280478
Italy

Michael Savarese

unread,
Feb 17, 2013, 12:25:19 AM2/17/13
to leafl...@googlegroups.com
Try this,  map.invalidateSize(true)

If that doesn't work, it may be because the center panel doesn't have a literally defined size. It takes up space left available by other panels. I had same issues using Dojo with OpenLayers. Try wrapping 'map' div with another div which has defined size in the center panel.

Hope some of that helps,

Michael

Walter Lorenzetti

unread,
Feb 17, 2013, 4:55:23 AM2/17/13
to leafl...@googlegroups.com
Hi Michael,

great! It Works!

Thanks a lot
W
Il 17/02/2013 06:25, Michael Savarese ha scritto:
Try this,��map.invalidateSize(true);�

If that�doesn't�work, it may be�because�the center panel�doesn't�have a literally defined size. It takes up space left available by other panels. I had same issues using Dojo with OpenLayers. Try wrapping 'map' div with another div which has defined size in the center panel.
--
�
---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
�
�
Reply all
Reply to author
Forward
0 new messages