[OpenLayers-Users] buttonclick in trunk

Andreas Hocevar ahocevar at opengeo.org
Wed Feb 1 10:06:11 EST 2012


Hi,

the idea of the buttonclick event is to have a global event that can
be used for detecting clicks on buttons. It originated because after
introducing mobile support for OpenLayers, it was no longer possible
to interact with the map while over controls. Which is now back to how
it was in OpenLayers 2.10. The LayerSwitcher could also be changed to
not allow dragging, but some people may want that (Google Maps also
allows you to drag the map while over the layer selector). I agree
that double-clicking on a layer name should not zoom in though.

You are also right that every button should now have the olButton css
class. This will prevent map dragging when mousedown or touchstart
occurred on the button. To fix your problem, you could have a look at
the recent changes to the PanZoomPanel control in master, which has
dragging (the slider) on top of olButton elements.

For the layer switcher double-click issue, please create a ticket.

Andreas.

On Wed, Feb 1, 2012 at 1:41 PM, Slawomir Messner
<slawomir.messner at staff.uni-marburg.de> wrote:
> 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"
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



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


More information about the Users mailing list