From 44f7ddc02da31a78f3daceefde0e0820ec2e77dc Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 15 Jul 2016 17:37:37 +0200 Subject: [PATCH] fixes #6 fixes #7 fixes #8 Only long press implemented other elements where already implemented --- UI/Input/Touch/TouchManager.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/UI/Input/Touch/TouchManager.js b/UI/Input/Touch/TouchManager.js index ca147ef..5eb848b 100644 --- a/UI/Input/Touch/TouchManager.js +++ b/UI/Input/Touch/TouchManager.js @@ -83,7 +83,27 @@ jsOMS.preventAll(event); if (elapsedTime > 300 && distY < 3 && distX < 3) { - // todo: handle long press here + let rightClick = document.createEvent('MouseEvents'); + + rightClick.initMouseEvent( + 'click', + true, // canBubble + true, // cancelable + window, // view - set to the window object + 1, // detail - # of mouse clicks + touch.pageX, // screenX - the page X coordinate + touch.pageY, // screenY - the page Y coordinate + touch.pageX, // clientX - the window X coordinate + toch.pageY, // clientY - the window Y coordinate + false, // ctrlKey + false, // altKey + false, // shiftKey + false, // metaKey + 2, // button - 1 = left, 2 = right + null // relatedTarget + ); + + document.dispatchEvent(rightClick); } else if (elapsedTime < 500) { let e = new Event('keyup');