[OpenLayers-Users] buttonclick in trunk

Slawomir Messner slawomir.messner at staff.uni-marburg.de
Wed Feb 1 07:41:30 EST 2012


Hi,
on our site www.regionalsprache.de/mapviewer/mapviewer.aspx we use 
draggable controls. This worked quite well before buttonclick was 
introduced. The user clicks the minimize/maximize button and the control 
minimize or maximize, when the user holds the button pressed he can move 
the control around(only the controls open on the left). On my dev 
machine I use the master branch from git and now it's broken.
Clicking works on min/max-buttons but when I drag the map moves with the 
control and now mousebutton events are also passed through controls like 
the layerswitcher in:
  (old)
http://dev.openlayers.org/releases/OpenLayers-2.11/examples/osm-google.html
(new)
http://openlayers.org/dev/examples/osm-google.html
I can start panning over the open layerswitcher or doubleclick and it 
zooms in (some users doubleclick when selecting layers even if single 
click would do).
I don't have a completely working solution, so I would like to know if 
it's a bug or a feature?

What I tried is to stop events on the div of the control (i.e. 
OpenLayers.Event.observe(this.div, "click", 
this.ignoreEventAllowSystem);). I thought this should do it, because the 
drag handles div and the contents div are over the controls div, so the 
mouseevents shouldn't reach the map and all will be like before, as a 
workaround till I include the new buttonclick feature properly. But I 
was wrong.
This works against passing the events through the control to the map. 
But it collides with the dragging of the control. Because then the drag 
starts also when clicking not only mousedown and doesn't stop until I 
click outside the control which is only possible outside of the map(the 
controls follows the mouse).
Also assigning olButton class to the drag handle doesn't work, with or 
without the stopping of the events. Without stopping the events the 
handle behaves strange, sometimes it is in drag mode after a click, 
sometimes a click works and control minmizes or maximizes but on 
mousedown the map is dragging with the control, cause the events not 
stopped. If the behaviour would be predictable like "click on the handle 
to start drag an click again to stop" it would be fine.
I hope someone can give me a hint or some new ideas.
And now some further questions.
What's the idea behind "buttonclick"? Prevent collision with handlers? 
Will there also be a "mousemove" or a "mousebutton" event? Do we have to 
assign all our buttons an olButton css-class?
Regards
Slawomir

-- 
-----------------------------------------------
Slawomir Messner
Forschungszentrum "Deutscher Sprachatlas"



More information about the Users mailing list