From d43e9546d8ab49a3999833ae3c3a85f66c388ccb Mon Sep 17 00:00:00 2001 From: vakrilov Date: Fri, 15 Jan 2016 18:09:36 +0200 Subject: [PATCH 1/2] Touch gesture implemented --- CrossPlatformModules.csproj | 4 + apps/ui-tests-app/mainPage.ts | 1 + apps/ui-tests-app/pages/touch-event.ts | 30 +++++ apps/ui-tests-app/pages/touch-event.xml | 7 ++ tsconfig.json | 1 + ui/core/view.android.ts | 10 +- ui/gestures/gestures-common.ts | 20 +++- ui/gestures/gestures.android.ts | 114 ++++++++++++++++--- ui/gestures/gestures.d.ts | 96 +++++++++++++++- ui/gestures/gestures.ios.ts | 142 +++++++++++++++++++++++- 10 files changed, 394 insertions(+), 31 deletions(-) create mode 100644 apps/ui-tests-app/pages/touch-event.ts create mode 100644 apps/ui-tests-app/pages/touch-event.xml diff --git a/CrossPlatformModules.csproj b/CrossPlatformModules.csproj index ac544e11a..6a6ffe7f0 100644 --- a/CrossPlatformModules.csproj +++ b/CrossPlatformModules.csproj @@ -229,6 +229,10 @@ Designer + + + Designer + Designer diff --git a/apps/ui-tests-app/mainPage.ts b/apps/ui-tests-app/mainPage.ts index 43d742cf4..db06d6d60 100644 --- a/apps/ui-tests-app/mainPage.ts +++ b/apps/ui-tests-app/mainPage.ts @@ -79,6 +79,7 @@ examples.set("modalview", "modal-view/modal-view"); examples.set("nordic", "nordic/nordic"); examples.set("gestures", "pages/gestures"); +examples.set("touch", "pages/touch-event"); examples.set("handlers", "pages/handlers"); //examples.set("listview_binding", "pages/listview_binding"); examples.set("console", "pages/console"); diff --git a/apps/ui-tests-app/pages/touch-event.ts b/apps/ui-tests-app/pages/touch-event.ts new file mode 100644 index 000000000..9105b0a2b --- /dev/null +++ b/apps/ui-tests-app/pages/touch-event.ts @@ -0,0 +1,30 @@ +import { Page, View, TextView } from "ui"; +import gestures = require("ui/gestures"); + +export function onTouch(args: gestures.TouchGestureEventData) { + var msg = " touch action: " + args.action + + " x: " + Math.round(args.getX()) + " y: " + Math.round(args.getY()) + + " count: " + args.getPointerCount(); + + var p; + msg += " ACTIVE: "; + var pointers = args.getActivePointers(); + for (var index = 0; index < pointers.length; index++) { + p = pointers[index]; + msg += " p" + index + "[" + Math.round(p.getX()) + ", " + Math.round(p.getY()) + "]" + } + + msg += " ALL: "; + pointers = args.getAllPointers(); + for (var index = 0; index < pointers.length; index++) { + p = pointers[index]; + msg += " p" + index + "[" + Math.round(p.getX()) + ", " + Math.round(p.getY()) + "]" + } + + console.log(msg); + (args.view.page.getViewById("output")).text += msg + "\n"; +} + +export function clear(args) { + args.object.page.getViewById("output").text = ""; +} diff --git a/apps/ui-tests-app/pages/touch-event.xml b/apps/ui-tests-app/pages/touch-event.xml new file mode 100644 index 000000000..2d29e7f3d --- /dev/null +++ b/apps/ui-tests-app/pages/touch-event.xml @@ -0,0 +1,7 @@ + + + +