Changeset 73ff5ff in guacamole-common-js


Ignore:
Timestamp:
04/09/12 16:57:58 (14 months ago)
Author:
zhangmaike
Branches:
master, guacamole-debian-parent, unstable
Children:
6fe74a6
Parents:
6701f31
git-author:
Michael Jumper <zhangmaike@…> (04/09/12 16:57:58)
git-committer:
Michael Jumper <zhangmaike@…> (04/09/12 16:57:58)
Message:

Fix non-left mouse button clicks (there may not be one touchstart event per touch). Fix setting/resetting of gesture_in_progress flag.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/resources/mouse.js

    ra5b79eb r73ff5ff  
    164164    var last_touch_time = 0; 
    165165    var pixels_moved = 0; 
    166     var touch_distance = 0; 
    167166 
    168167    var touch_buttons = { 
     
    177176    element.addEventListener("touchend", function(e) { 
    178177         
     178        cancelEvent(e); 
     179             
    179180        // If we're handling a gesture AND this is the last touch 
    180181        if (gesture_in_progress && e.touches.length == 0) { 
    181              
    182             cancelEvent(e); 
    183182             
    184183            var time = new Date().getTime(); 
     
    221220                        guac_mouse.onmouseup(guac_mouse.currentState); 
    222221                     
    223                     // Allow mouse events now that touching is over 
     222                    // Gesture now over 
    224223                    gesture_in_progress = false; 
    225              
     224 
    226225                }, guac_mouse.clickTimingThreshold); 
    227226 
    228227            } 
    229228 
     229            // If we're not waiting to see if this is a click, stop gesture 
     230            if (!click_release_timeout) 
     231                gesture_in_progress = false; 
     232 
    230233        } 
    231234 
     
    233236 
    234237    element.addEventListener("touchstart", function(e) { 
     238 
     239        cancelEvent(e); 
    235240 
    236241        // Track number of touches, but no more than three 
    237242        touch_count = Math.min(e.touches.length, 3); 
    238243 
     244        // Clear timeout, if set 
     245        if (click_release_timeout) { 
     246            window.clearTimeout(click_release_timeout); 
     247            click_release_timeout = null; 
     248        } 
     249 
    239250        // Record initial touch location and time for touch movement 
    240251        // and tap gestures 
    241         if (e.touches.length == 1) { 
    242  
    243             cancelEvent(e); 
     252        if (!gesture_in_progress) { 
    244253 
    245254            // Stop mouse events while touching 
    246255            gesture_in_progress = true; 
    247  
    248             // Clear timeout, if set 
    249             if (click_release_timeout) { 
    250                 window.clearTimeout(click_release_timeout); 
    251                 click_release_timeout = null; 
    252             } 
    253256 
    254257            // Record touch location and time 
Note: See TracChangeset for help on using the changeset viewer.