[OpenLayers-Dev] click & pinch overhaul

Tim Schaub tschaub at opengeo.org
Tue Mar 8 01:49:51 EST 2011


With the change in #3133, the pixel tolerance for both "click" and 
"double-click" on touch devices is configurable.

The double-click tolerance defaults to 10 pixels.  So, if you do a 
single touch tap twice and the second tap is more than 10 pixels from 
the first, this won't be considered a double click.  If you're trying to 
double click and finding it doesn't work, we may need to bump up the 
default here.

The single-click tolerance (pixelTolerance) is also now respected in 
touch environments.  By default, if a touch start and end are separated 
by more than 2 pixels, this is not considered a click.  If the 
multi-touch click to zoom out is not working regularly enough, we may 
need to increase this default.

Mouse wheel scrolling doesn't do anything if you only use the 
TouchNavigation control.  The regular Navigation control zooms in/out 
with the mouse wheel, but the mobile-specific TouchNavigation control 
doesn't listen to mouse wheel events.  The mobile.html example below (on 
trunk and in my sandox) uses the TouchNavigation control, so it 
shouldn't be expected to zoom in/out with mouse wheeling.

These examples (using the regular Navigation control) should work 
equally well with mouse wheel zooming:

http://openlayers.org/dev/examples/controls.html
http://dev.openlayers.org/sandbox/tschaub/click/examples/controls.html

Thanks for the feedback.
Tim


On 3/7/11 8:58 AM, Steven M. Ottens wrote:
> Hi Tim,
>
> Thanks for the update, comments inline.
>
> On 3/7/2011 4:56 PM, Tim Schaub wrote:
>> Hey-
>>
>> There are a number of issues with how the click and pinch handlers
>> work together. After adding pinch zoom, we lost the multi-touch click
>> to zoom out. In addition, the pinch handler was overly cautious about
>> stopping event propagation because the click handler wasn't
>> particularly good at distinguishing clicks from pinches. I've
>> overhauled the click handler to better distinguish clicks from pinches
>> and resolved a number of issues that came up along the way.
>
> There is no scroll-wheel support anymore, is this intentional. I know
> that's not a touch device, but still it would be nice so you could use
> the same client on all your platforms.
>>
>> http://trac.osgeo.org/openlayers/ticket/3133
>>
>> Andreas had reviewed this patch in a previous state, but there were
>> still some unhandled errors getting through, so I continued to modify it.
>>
>> I'd appreciate it if people could test the changes on real devices
>> (I've only tested on emulators). To best test the changes, it is
>> important to have an error console enabled.
>
> I tested the url below with an iPad with iOS 4.2.1 and its Safari browser.
>
>> You should see double-click (zoom in), multi-touch click (zoom out),
>> and pinch (zoom/drag) working in this sandbox example (on multi-touch
>> devices):
>
> Pinch zoom works fast and without problems. Pinch-zoom-dragging (moving
> your two fingers over the device) is working as well correctly and
> doesn't produce the drag-error mentioned below. Multi-touch click works
> almost always, very rarely it gets mistaken for a pinch-gesture.
> Double-click fails about 20%-60% of the time, without error. I tested it
> with a colleague and we think the problem is that it is hard to tap
> twice on exactly the same spot. As such a large 'buffer' area for the
> second tap would be advisable.
>> http://dev.openlayers.org/sandbox/tschaub/click/examples/mobile.html
>>
>> You should also see no unhandled errors. However, there are currently
>> unhandled errors when dragging on the trunk (after r11635). I'll
>> update the sandbox when this is addressed.
> I run in this error, while dragging. It didn't seem to impact
> performance or functionality. I take is the same as mentioned below:
> JavaScript Error on Line 195 in Drag.js
> TypeError: Result of expression'evt' [null] is not an object
>> http://trac.osgeo.org/openlayers/ticket/2936#comment:17
>
> I hope this helps a bit. In general I'm happy with the performance of
> the client on the iPad, apart from the double-tap issue it is a pleasure
> to use.
>
> Regards,
> Steven
>
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.


More information about the Dev mailing list