Select to view content in your preferred language

"hold" touch gesture stopped working in 2.1 release

987
6
03-17-2011 05:56 AM
IdoFlatow
Emerging Contributor
When working with 2.1rc, I was able to use the "hold" touch gesture to get the GestureType.Hold gesture, but as of version 2.1 release I can't get this gesture.

In 2.1rc I needed to go to the "pen and touch" settings and to turn off the "press and hold" for right-click, otherwise it interfered with the hold gesture and it never fired. I've tried both turning it off and on, but non seems to get the GestureType.Hold fired.

Is there something I need to change in my code for the hold gesture in the release version?
0 Kudos
6 Replies
JenniferNery
Esri Regular Contributor
Are you using WPF?

If yes, you may be seeing the delay that is introduced by Stylus.IsPressAndHoldEnabled. In your map, you can set this property to false. This was the response I got from Mike Taulty http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2010/10/15/touched-part-1-or-only...
0 Kudos
IdoFlatow
Emerging Contributor
Hi,

I am using WPF, but changing this dependency property did not help.

I've canceled press-and-hold in my OS, leaving only press-and-tap, because press-and-hold prevented the hold gesture in 2.1rc. When using the rc version if I press for more than 2 seconds I get the hold gesture in the MapGesture event, but when I replace the rc dlls with the release dlls it stops working and I don't get hold.

All other gestures (drag, pinch, double tap, tap) works fine.

I'm using windows 7 64-bit on a dual-touch machine (acer aspire 1420p) with .net 4 + WPF.

But again - this works with the 2.1rc assemblies and stops working with the 2.1 release
0 Kudos
JenniferNery
Esri Regular Contributor
I just tested this with v2.1 final. Hold gesture is detected without delay when Stylus.IsPressAndHoldEnabled is False. In either case, hold gesture is still raised.

I tested with the WPF sample for http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#DrawGraphics. When you activate draw for polyline/polygon, the magnifier is displayed when a "touch and hold" gesture is raised. This lets you update the vertex position with the help of the magnifier.

The event you need to subscribe to is Map.MapGesture event:
http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Map~MapGes... and these are the GestureTypes: http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.GestureTyp...
0 Kudos
IdoFlatow
Emerging Contributor
Hi,

I still can't get the hold gesture to work in WPF. Here's my code:
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:esriClient="http://schemas.esri.com/arcgis/client/2009"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:bing="clr-namespace:ESRI.ArcGIS.Client.Bing;assembly=ESRI.ArcGIS.Client.Bing"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <sys:String x:Key="BingKey">xxxxx</sys:String>
    </Window.Resources>
    <Grid>
        <esriClient:Map IsLogoVisible="False"
                        VerticalAlignment="Stretch"
                        HorizontalAlignment="Stretch"
                        x:Name="MapControl"
                        MapGesture="MapControl_MapGesture"
                        MaximumResolution="21000"
                        Grid.ColumnSpan="3"
                        Stylus.IsPressAndHoldEnabled="False">
            <bing:TileLayer ID="BingLayer"
                            LayerStyle="Road"
                            Visible="True"
                            ServerType="Production"
                            Token="{StaticResource BingKey}" />          
        </esriClient:Map>
    </Grid>
</Window>

If I run this code with version 2.1.0.427 it works fine, but with version 2.1.0.446 I don't get the hold gesture in the event.
I also noticed that with the new version, the map is very sensitive - if I place my finger on the screen and try to keep my finger steady, every little move causes drag gesture, while in the previous version I had to actually move my finger to get drag gestures. Is there any way to set the sensitivity of the touch in the map control? this also causes double-tap event more hard to perform (in the previous version it responded well, and now with my finger it nearly never works and I have to use the stylus).

I have the feeling that the sensitivity is also the cause of the hold gesture not firing.
0 Kudos
JenniferNery
Esri Regular Contributor
I used your code and v2.1 final assembly (version: 2.1.0.446), with the following code-behind:
void MapControl_MapGesture(object sender, Map.MapGestureEventArgs e)
{
 System.Diagnostics.Debug.WriteLine(e.Gesture);
}


I still am not able to replicate the issue because Hold gesture is still detected and written on my Output window. Maybe someone else in the forum can try it out with their touch device.

So you are saying that swapping out the assemblies to RC does not have the same issue or are you saying it worked before with RC? I'm just wondering because maybe something changed with your hardware lately?
0 Kudos
IdoFlatow
Emerging Contributor
I'm using the same debug code in my app and not getting the hold.

Yes, replacing the release assemblies with the rc makes it output the hold gesture (just remove release dlls and replace with rc).

I think this has something to do with the sensitivity of the touch. I'll try to see if I can change the sensitivity of my touch screen, although it is strange that there is a difference in the sensitivity between the versions (as I wrote before - when simply placing my finger on the screen, every small movement causes drag gesture in the release mode while not causing movement in the RC).

I don't have any other screen to test it currently, maybe I'll have one next week.
0 Kudos