[OpenLayers-Users] page resize breaks map?

S2 s2.akira at tin.it
Mon May 30 05:30:05 EDT 2011


calling
map.zoomOut();
map.zoomIn();

fixes the problem.
it's a very ugly hack, but it works...


On 30.05.2011 11.16, S2 wrote:
> tried
>
> map = new OpenLayers.Map (el, {
> controls:[
> new OpenLayers.Control.Navigation(),
> new OpenLayers.Control.PanZoomBar(),
> new OpenLayers.Control.LayerSwitcher(),
> new OpenLayers.Control.Attribution()],
> units: 'km',
> size: new OpenLayers.Size({w: 512, h: 320})
> } );
>
> too, but the map still breaks... :(
>
>
> On 30.05.2011 11.01, S2 wrote:
>> On 30.05.2011 10.45, jrom wrote:
>>> I quickly look at your code.
>>
>> thanks :)
>>
>>
>>> Apparently you do not specify a height/width for your map container.
>>
>> the width/height of the div containing the map is set in custom.css on
>> the .openlayermap class (line 25).
>>
>> .openlayermap {
>> width: 512px;
>> height: 320px;
>> margin-bottom: 10px;
>> }
>>
>> i tried to set it on the div directly with
>>
>> <div class="openlayermap" id="olmapid82" style="width: 512px; height:
>> 320px;">
>>
>> but no difference.
>>
>>
>> thanks,
>> Simon
>>
>>
>>> Perhaps you should try to force these values with something in pixels.
>>> It's a nasty solution but you should give it a try to see if it works
>>>
>>> Jerome
>>>
>>> On Mon, May 30, 2011 at 10:19 AM, S2<s2.akira at tin.it> wrote:
>>>> Hi Jerome,
>>>> thanks for taking the time to answer.
>>>> I tried
>>>>
>>>> line 541 of
>>>> http://s2.31337.it/
>>>> elm.data('olmap').updateSize();
>>>>
>>>> but it seems to have no effect.
>>>>
>>>> On 30.05.2011 9.52, jrom wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Perhaps you should try a map.updateSize() after content gets loaded.
>>>>> It will force a map repaint
>>>>>
>>>>> Jerome
>>>>>
>>>>> On Mon, May 30, 2011 at 9:17 AM, S2<s2.akira at tin.it> wrote:
>>>>>>
>>>>>> hello all!
>>>>>>
>>>>>> on http://s2.31337.it/ i have some openlayers maps. the page uses ∞
>>>>>> scroll,
>>>>>> so that when the user scrolls to the bottom of the page, older
>>>>>> posts are
>>>>>> loaded automatically.
>>>>>> when this happens the map breaks (the pictures in the map get somehow
>>>>>> resized to a wrong size). you can try this yourself simply by
>>>>>> scrolling
>>>>>> to
>>>>>> the bottom of the page, let the js load some more posts, and then
>>>>>> scroll
>>>>>> back up.
>>>>>>
>>>>>> can i somehow force the map to repaint itself? (i could do that
>>>>>> when new
>>>>>> content gets loaded).
>>>>>>
>>>>>> i tested this with ff4 and ie 8.
>>>>>>
>>>>>> thanks.
>>>>>>
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at lists.osgeo.org
>>>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>




More information about the Users mailing list