import QtQuick 2.0 import "../com/neusoft/auto/widgets" MouseArea { property var threshold; signal swipeRight; signal swipeLeft; // signal swipeUp; // signal swipeDown; property int startX; // property int startY; onPressed: { startX = mouse.x; // console.log("[HMISwipeArea][onReleased]-->startX:",startX); // startY = mouse.y; } onReleased: { // var deltax = mouse.x - startX; // var deltay = mouse.y - startY; // if (Math.abs(deltax) > 50 || Math.abs(deltay) > 50) { // if (deltax > 30 && Math.abs(deltay) < 30) { // // swipe right // swipeRight(); // } else if (deltax < -30 && Math.abs(deltay) < 30) { // // swipe left // swipeLeft(); // } else if (Math.abs(deltax) < 30 && deltay > 30) { // // swipe down // swipeDown(); // } else if (Math.abs(deltax) < 30 && deltay < 30) { // // swipe up // swipeUp(); // } // } var deltax = mouse.x - startX; // console.log("[HMISwipeArea][onReleased]-->deltax:",deltax); if (deltax > threshold){ swipeRight(); }else if(deltax < -threshold){ swipeLeft(); } } /*========================================Function Start==============================================*/ function swipePressed(mouse_x){ startX = mouse_x; } function swipeReleased(mouse_x){ var deltax = mouse_x - threshold; if (deltax > 30){ swipeRight(); }else if(deltax < -threshold){ swipeLeft(); } } /*========================================Function End================================================*/ }