incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Git at Apache <>
Subject incubator-cordova-wp7 pull request: Minor improvement for CB-953 mouse even...
Date Thu, 28 Jun 2012 14:08:30 GMT
GitHub user sgrebnov opened a pull request:

    Minor improvement for CB-953 mouse events fired twice

    Reviewed Jesse’s implementation – looks great. But there is a case where we still
get click event fired twice – explained below with the fix. 
    For situations where we have only little mouse move IE still generates own mouse events
– pls take a look on this demo video
. So we both generates the events. The workaround is to add the following. This means that
if we already handled mouse move then prevent IE to generate own events.
            void Border_Tap(object sender, GestureEventArgs e)
                // prevents generating duplicated mouse events
                // firstMouseMove == FALSE means we already handled this situation and generated
mouse events
                e.Handled = ! this.firstMouseMove;
    But I found out that when you press something your clicks are not ideal so in many cases
there is still move event fired with 1-5px  delta.  In such cases we generate our own events
and prevents native so sometimes we encounter with our previous problem when text field is
not focused. The workaround for this problem is to add small delta threshold to consider move
as a real move. This guaranties that for some “not ideal” user touches which have some
delta (so generate move event) we still use browser generated native events instead of our
custom.  It seems to work very well.
                if (firstMouseMove)
                    // even for simple tap there are situations where ui control generates
move with some little delta value
                    // we should avoid such situations allowing to browser control generate
native js mousedown/up/click events
                    if (Math.Abs(pos.X - mouseDownPos.X) + Math.Abs(pos.Y - mouseDownPos.Y)
<= MouseMoveDeltaThreshold)
    Final version in action

You can merge this pull request into a Git repository by running:

    $ git pull master

Alternatively you can review and apply these changes as the patch at:

commit f8d313d09f84b373198b83abc5b930b88516ad36
Author: Sergei Grebnov <>
Date:   2012-06-28T07:07:00-07:00

    Minor improvement for CB-953 mouse events fired twice


View raw message