Ticket #3103 (new feature)

Opened 2 years ago

Last modified 2 years ago

Tap property of Click Handler, Control.Navigation center-on-tap

Reported by: crschmidt Owned by:
Priority: major Milestone: 2.13 Release
Component: Control.Navigation Version: 2.10
Keywords: mobile Cc:
State: Needs More Work

Description

In order to support devices which support touch, but do not support touch events, add an property to the Click handler which will automatically be set to true on devices which support this type of interaction.

When this is the case, the Navigation and TouchNavigation control should pan the map to this location.

Attachments

tap-pan.patch Download (10.1 KB) - added by crschmidt 2 years ago.
tap-pan.2.patch Download (10.1 KB) - added by crschmidt 2 years ago.
tap-pan.3.patch Download (10.3 KB) - added by crschmidt 2 years ago.
3103.patch Download (8.7 KB) - added by crschmidt 2 years ago.
openlayers-3103.patch Download (8.8 KB) - added by ahocevar 2 years ago.
applies to current trunk

Change History

Changed 2 years ago by crschmidt

Changed 2 years ago by crschmidt

Patch includes:

  1. Modification to Handler.Click to listen to various move events to heuristically determine whether a device is a tap device
  2. Manual acceptance test for above behavior
  3. Control.Navigation and Control.TouchNavigation now center the map on clicks if tap is true.

Changed 2 years ago by crschmidt

Changed 2 years ago by crschmidt

Changed 2 years ago by crschmidt

  • state set to Review

.3 fixes the acceptance test.

Changed 2 years ago by bartvde

Reviewing this one now.

Changed 2 years ago by crschmidt

  • keywords mobile added

Changed 2 years ago by bartvde

Hey Chris, a few comments but overall this looks good:

  • APIProprety (typo, 2 occurrences in patch)
  • handleClick in Navigation.js: should be this.map instead of map (2 occurrences)
  • TouchNavigation.js: defaultClick: this.map instead of map
  • should the comment on how to disable this behaviour not also make it into TouchNavigation?
  • after tapTolerance there is an extra white line
  • firstMouseOver not documented as a property
  • then unregister to save processing on further mousemoves -> should this not say mouseovers?

One question I have is wrt to the default, should this behaviour not be false by default in Navigation and true by default in TouchNavigation? I am not sure if people would actually be using Navigation instead of TouchNavigation if they want to target mobile development? But this is more of a question than a concern overall.

Changed 2 years ago by crschmidt

I can take care of all the stupid typos :)

Regarding the final question: I am strongly of the belief that we should make the default behavior of all OpenLayers Map to be as supportive of mobile clients as we can. TouchNavigation removes some controls which are not needed by default (like the box handler, which is not needed), but I think that we should always do our best to support mobile browsers in the default environment, so developers hopefully don't even have to think about it in order to support mobile phones.

Changed 2 years ago by crschmidt

Changed 2 years ago by crschmidt

Patch with stupid typos pointed out above fixed.

Changed 2 years ago by ahocevar

applies to current trunk

Changed 2 years ago by ahocevar

  • state changed from Review to Needs More Work

Patch looks good, I only have 2 comments:

  • tap should be an API property in the Click handler
  • tap should not be on by default for the Navigation control, unless there is a better way to avoid desktop browsers from being mistakenly detected as tap devices (happens e.g. when clicking on the map while it still loads)
Note: See TracTickets for help on using tickets.