From d85f77402c94d67fcb421183bbafd85caf556c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Thu, 23 Sep 2021 15:42:06 +0800 Subject: [PATCH] abstract parameter as event --- doric-js/index.d.ts | 20 ++++++++++++++++---- doric-js/lib/src/widget/gesture.d.ts | 20 ++++++++++++++++---- doric-js/src/widget/gesture.ts | 8 ++++---- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/doric-js/index.d.ts b/doric-js/index.d.ts index 929e273a..ea771766 100644 --- a/doric-js/index.d.ts +++ b/doric-js/index.d.ts @@ -1011,25 +1011,37 @@ declare module 'doric/lib/src/widget/gesture' { * @param x: the value of event occurs on the x-axis * @param y: the value of event occurs on the y-axis */ - onTouchDown?: (x: number, y: number) => void; + onTouchDown?: (event: { + x: number; + y: number; + }) => void; /** * Called when the finger moving on the screen * @param x: the value of event occurs on the x-axis * @param y: the value of event occurs on the y-axis */ - onTouchMove?: (x: number, y: number) => void; + onTouchMove?: (event: { + x: number; + y: number; + }) => void; /** * Called when the finger touch up off from the screen * @param x: the value of event occurs on the x-axis * @param y: the value of event occurs on the y-axis */ - onTouchUp?: (x: number, y: number) => void; + onTouchUp?: (event: { + x: number; + y: number; + }) => void; /** * Called when the finger leave from screen * @param x: the value of event occurs on the x-axis * @param y: the value of event occurs on the y-axis */ - onTouchCancel?: (x: number, y: number) => void; + onTouchCancel?: (event: { + x: number; + y: number; + }) => void; } export function gestureContainer(views: View | View[], config?: Partial): GestureContainer; } diff --git a/doric-js/lib/src/widget/gesture.d.ts b/doric-js/lib/src/widget/gesture.d.ts index dbd0a0fd..ab046c04 100644 --- a/doric-js/lib/src/widget/gesture.d.ts +++ b/doric-js/lib/src/widget/gesture.d.ts @@ -36,24 +36,36 @@ export declare class GestureContainer extends Stack { * @param x: the value of event occurs on the x-axis * @param y: the value of event occurs on the y-axis */ - onTouchDown?: (x: number, y: number) => void; + onTouchDown?: (event: { + x: number; + y: number; + }) => void; /** * Called when the finger moving on the screen * @param x: the value of event occurs on the x-axis * @param y: the value of event occurs on the y-axis */ - onTouchMove?: (x: number, y: number) => void; + onTouchMove?: (event: { + x: number; + y: number; + }) => void; /** * Called when the finger touch up off from the screen * @param x: the value of event occurs on the x-axis * @param y: the value of event occurs on the y-axis */ - onTouchUp?: (x: number, y: number) => void; + onTouchUp?: (event: { + x: number; + y: number; + }) => void; /** * Called when the finger leave from screen * @param x: the value of event occurs on the x-axis * @param y: the value of event occurs on the y-axis */ - onTouchCancel?: (x: number, y: number) => void; + onTouchCancel?: (event: { + x: number; + y: number; + }) => void; } export declare function gestureContainer(views: View | View[], config?: Partial): GestureContainer; diff --git a/doric-js/src/widget/gesture.ts b/doric-js/src/widget/gesture.ts index ee2ea9a3..1af8710c 100644 --- a/doric-js/src/widget/gesture.ts +++ b/doric-js/src/widget/gesture.ts @@ -66,7 +66,7 @@ export class GestureContainer extends Stack { * @param y: the value of event occurs on the y-axis */ @Property - onTouchDown?: (x: number, y: number) => void + onTouchDown?: (event: { x: number, y: number }) => void /** * Called when the finger moving on the screen @@ -74,7 +74,7 @@ export class GestureContainer extends Stack { * @param y: the value of event occurs on the y-axis */ @Property - onTouchMove?: (x: number, y: number) => void + onTouchMove?: (event: { x: number, y: number }) => void /** * Called when the finger touch up off from the screen @@ -82,7 +82,7 @@ export class GestureContainer extends Stack { * @param y: the value of event occurs on the y-axis */ @Property - onTouchUp?: (x: number, y: number) => void + onTouchUp?: (event: { x: number, y: number }) => void /** * Called when the finger leave from screen @@ -90,7 +90,7 @@ export class GestureContainer extends Stack { * @param y: the value of event occurs on the y-axis */ @Property - onTouchCancel?: (x: number, y: number) => void + onTouchCancel?: (event: { x: number, y: number }) => void } export function gestureContainer(views: View | View[], config?: Partial) {