[OpenLayers-Users] buggy loadingPanel (vs
Navigation/MouseDefaults) please help!
BrainDrain
paulborodaev at gmail.com
Tue Dec 23 10:01:48 EST 2008
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
>
>
--
View this message in context: http://www.nabble.com/buggy-loadingPanel-%28vs-Navigation-MouseDefaults%29-please-help%21-tp21144457p21145874.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list