[OpenLayers-Users] buggy loadingPanel (vs Navigation/MouseDefaults) please help!

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Tue Dec 23 10:19:29 EST 2008


Hi,

the div size is this big so that the loading panel can be centered in 
the map.

Can you please post your complete example HTML to reproduce the problem?

As I said mousewheel navigation works for me in the example when the 
loading panel is showing, so I don't get the problem.

Best regards,
Bart

BrainDrain wrote:
> of course I know about this example 
> I think problem is here (loadingPanel):
> maximizeControl: function(evt) {
>         var viewSize = this.map.getSize();
>         var msgW = viewSize.w;
>         var msgH = viewSize.h;
>         this.div.style.width = msgW + "px";//WHY?
>         this.div.style.height = msgH + "px";//WHY?
>         this.div.style.display = "block";		
> 		
>         this.maximized = true;
>     
>         if (evt != null) {
>             OpenLayers.Event.stop(evt);
>         }
>     }
> div size is very large (div catching mouse wheel event addressed to layer's
> divs): it must be equals to size of background img!
> changing background-position (in css) to right top just moves background img
> (I use smaller one then in example, more sexy) to right top corner but div
> size is still big - overlapping map/layer's (tile's) divs
>
> I've change code to
>     minimizeControl: function(evt) {
>         this.div.style.display = "none"; 
>         //this.div.style.width = "0px";
>         //this.div.style.height = "0px";
>         this.maximized = false;
>     
>         if (evt != null) {
>             OpenLayers.Event.stop(evt);
>         }
>     },
>     maximizeControl: function(evt) {
>         //var viewSize = this.map.getSize();
>         //var msgW = viewSize.w;
>         //var msgH = viewSize.h;
>         //this.div.style.width = msgW + "px";
>         //this.div.style.height = msgH + "px";				
>         this.div.style.display = "block";		
> 		
>         this.maximized = true;
>     
>         if (evt != null) {
>             OpenLayers.Event.stop(evt);
>         }
>     },
> + css:
> .olControlLoadingPanel {
>         background-image:url(~/images/default/open-layers/loading.gif);    
> 	background-position:center;
>         background-repeat:no-repeat;    
> 	top: 5px;
>         right: 5px;
> 	width: 16px;
> 	height: 16px;
>     position: absolute;
> }
> and zoom wheel works good during tiles loading
> but I need to make this more correct (div hiding with resetting size)
> so I need to preserve populated from css div size before hiding (minimizing)
> and restore on maximize
> or I need to find a way to auto-size div by img content (without css)
> looking into layerswitcher code we can find this:
>
> maximizeControl: function(e) {
>         //HACK HACK HACK - find a way to auto-size this layerswitcher
>         this.div.style.width = "20em";
>         this.div.style.height = ""; ...
> )))))))))))
>
> Now I'm going to try Sys.UI.DomElement.getBounds function from MS AJAX
> client lib.
>
>
> Bart van den Eijnden wrote:
>   
>> Hi,
>>
>> for me it works in the loadingpanel example:
>>
>> http://dev.openlayers.org/addins/loadingPanel/trunk/examples/loadingpanel.html
>>
>> It could have to do with the sequence in which you add the controls, 
>> take a good look at the example.
>>
>> Best regards,
>> Bart
>>
>> BrainDrain wrote:
>>     
>>> I've found that loadingPanel addon doesn't work properly
>>> When I add some controls (including new OpenLayers.Control.LoadingPanel()
>>> &
>>> new OpenLayers.Control.Navigation({ zoomWheelEnabled: true }) in my map
>>> (I'm
>>> using tiled mapserver layer)
>>> and when tiles loading - mouse wheel doesn't change zoom level in my map
>>> mouse wheel become working only after loading ends
>>> BUT with MouseDefaults control all works perfectly!
>>> After some digging I can see that problem in onWheelEvent (MouseWheel
>>> handler):
>>> var elem = OpenLayers.Event.element(e) - eveluates to {... ,
>>> className="olControlLoadingPanel olControlNoSelect", ...}
>>> and then overLayerDiv evaluates to false - so
>>> this.wheelZoom(e) - is not called at all during loadingPanel is active
>>> (maximized)
>>> What is the best way to fix that?
>>>
>>>
>>>
>>>   
>>>       
>> -- 
>> Bart van den Eijnden
>> OSGIS, Open Source GIS
>> bartvde at osgis.nl
>> http://www.osgis.nl
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>>     
>
>   


-- 
Bart van den Eijnden
OSGIS, Open Source GIS
bartvde at osgis.nl
http://www.osgis.nl




More information about the Users mailing list