[OpenLayers-Dev] Control.Panel: main-<div> and handling of mousedown-events

Andreas Hocevar ahocevar at opengeo.org
Tue Nov 30 05:38:00 EST 2010


Hi Marc,

I think your use case is a rather specific one - and achieving the behavior you want is a one-liner. It works even if shortened:

OpenLayers.Event.observe(myPanel.div, "mousedown", OpenLayers.Event.stop);

To me it feels like this is easy enough to do it on the application level. Your patch, without making the behavior configurable, would cause unexpected behavior in controls like PanPanel, where the whole space within the rectangle that holds the control's buttons would not react to mouse interaction any more.

Regards,
Andreas.

On Nov 30, 2010, at 09:49 , Marc Jansen wrote:

> Hi list,
> 
> currently mousedowns/clicks that happen directliy on the <div> of a Control.Panel are not being stopped but are being sent e.g. to the map the panel-divs lies over.
> 
> This might be useful in some setups, in mine it isn't. I was wondering whether we should make it configurable to have the panel <div> stop the mousedown event or whether this even can be considered a bug.
> 
> What do you think?
> 
> I wanted to discuss this first before opening a ticket. The attached patch fixes my personal issue, but stops mousedowns on the Control.Panel-<div> in any case, e.g. it is not configurable via a config-option. It'd be easy to wrap that in a conditional, of course.
> 
> Thanks for any response and regards,
> 
> Marc
> 
> 
> BTW: how would you test (speaking of unit-tests) that the new behaviour does what it is supposed to do? Is there documentation on how to test eventhandling and simulating e.g. clicks? Which testfile can I use to learn from source?
> <panel-div-stop-mousedown-001.patch>_______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Dev mailing list