6 Replies Latest reply on Oct 17, 2011 5:45 AM by Sara Ashington

    Getting custom linear gestures to work

      I am able to enable the predefined gestures and even a custom hold, but for the life of me I cannot get a custom linear gesture to work. I think it may be the startX, startY, endX, endY coordinates but anything I try does not seem to work.

       

      function enableGesture()
      {
      
      
      //register for event
      gesture.detected = 'onGesture(%json)';
      
      
       // Register for a Swipe left-right
      gesture.type = 'linear';
      gesture.preset = 'left-right';
      gesture.create();
      
      
      gesture.type = 'linear';
      gesture.preset = 'top-bottom';
      gesture.create();
      
      
      gesture.type = 'linear';
      gesture.id = 'swipe-top';
      gesture.startX = 300;
      gesture.starty = 60;
      gesture.endX = 60;
      gesture.endY = 60;
      
      
      gesture.create();
      
      
      gesture.type='hold';
      gesture.centerX=60;
      gesture.centerY=60;
      gesture.id="press";
      gesture.create();
      
      
      document.getElementById('gLog').innerHTML = "Gesture Enabled";
      
      
      }
      
      
      function onGesture(gObj)
      {
          document.getElementById('gLog').innerHTML += "<BR/>" + gObj.id;
      
      
      }
      
      

       

      In the code above I am expecting a swipe from the right to the left at the top portion of the screen (which is 480x640). All events work except the swipe-top. What am I doing wrong? I am using build 1.0.0.10