Refine interaction options #292

Closed
twpayne opened this Issue Mar 6, 2013 · 7 comments

5 participants

@twpayne

@probins commented:

would be nice to group interactions, so you can do touch:false or keyboard:false

Suggested API:

var map = new ol.Map({
  interactions: ol.interaction.defaults({
    keyboard: false,
    mouseOptions: {
      shiftDragZoom: false
    },
    touch: true,
    touchOptions: {
      pan: true,
      zoom: true,
      rotate: false
    }
  })
  // ...
});

Of course, with sensible defaults for the platform.

@fredj
OpenLayers member

See ol.interaction.defaults function

@probins

can we revive this one? ISTM it will be quite common for people to want to have interactions specifically for mobile/desktop, and maybe even have a build that only includes the appropriate ones, as with ol2. At the moment, all the interactions are true by default and there is no check whether the symbol is even in the build. Also having to set each interaction to true/false separately is a bit cumbersome. I'm thinking though you could quite easily add, for example, a 'touch' option at the top of the defaults function which would set the individual touch interactions to true/false as appropriate. An alternative would be to have separate mobileDefaults and desktopDefaults or something like that.

@twpayne

With #1840, I'm not sure if this still makes sense, given that the event handling across mobile and desktop is now unified with pointer events.

@tsauerwein, what is your view?

@tsauerwein
OpenLayers member

Partly it still makes sense, because there are interactions that still only work for either touch or mouse. For example a touch option could enable pinchRotate and pinchZoom, while desktop or mouse would enable altShiftDragRotate, mouseWheelZoom and shiftDragZoom.

@twpayne

So, am I right in thinking that, given that mouse events will never be triggered on pure touch devices, the advantage of this would be simply to reduce the build size in situations where it is known what sort of device is being used?

@tsauerwein
OpenLayers member

As far as I can see, yes.

@elemoine
OpenLayers member

Closing this for the moment.

@elemoine elemoine closed this Jul 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment