From 0ec1d44c9d36200c66d7069995771560359f77fe Mon Sep 17 00:00:00 2001 From: yan-shuifeng Date: Mon, 7 Feb 2022 14:08:10 +0800 Subject: [PATCH] fix the compatible problem of gestureEvent Signed-off-by: yan-shuifeng Change-Id: I2f08450932f7368cbc43f5ca9f36567338c4de1c --- api/@internal/component/ets/gesture.d.ts | 132 ++++++++------------- api/@internal/component/ets/hyperlink.d.ts | 60 ---------- 2 files changed, 49 insertions(+), 143 deletions(-) delete mode 100644 api/@internal/component/ets/hyperlink.d.ts diff --git a/api/@internal/component/ets/gesture.d.ts b/api/@internal/component/ets/gesture.d.ts index 643cc59fee..9de668a018 100644 --- a/api/@internal/component/ets/gesture.d.ts +++ b/api/@internal/component/ets/gesture.d.ts @@ -204,133 +204,91 @@ interface FingerInfo { * @since 7 */ declare type GestureType = - | TapGestureInterface - | LongPressGestureInterface - | PanGestureInterface + | TapGestureInterface + | LongPressGestureInterface + | PanGestureInterface | PinchGestureInterface - | SwipeGestureInterface - | RotationGestureInterface + | SwipeGestureInterface + | RotationGestureInterface | GestureGroupInterface; /** - * Defines the GestureEvent type. + * Defines event info for gesture. * @since 7 */ -declare type GestureEvent = - | TapGestureEvent - | LongPressGestureEvent - | PanGestureEvent - | SwipeGestureEvent - | PinchGestureEvent - | RotationGestureEvent; - -/** - * tap gesture event used in the longpress scenario. - * @since 8 - */ -interface TapGestureEvent extends BaseGestureEvent { - /** - * All finger information. - * @since 8 - */ - fingerList: FingerInfo[]; -} - -/** - * long press gesture event used in the longpress scenario. - * @since 7 - */ -interface LongPressGestureEvent extends BaseGestureEvent { +interface GestureEvent extends BaseEvent { /** * Indicates whether an event is triggered repeatedly. + * Used in LongPressGesture. * @since 7 */ repeat: boolean; /** * All finger information. + * Used in LongPressGesture and TapGesture. * @since 8 */ fingerList: FingerInfo[]; -} -/** - * pan gesture event used in the pan gesture triggering scenario. - */ -interface PanGestureEvent extends BaseGestureEvent { /** * Gesture event offset X. + * The unit is vp. + * Used in PanGesture. * @since 7 */ offsetX: number; /** * Gesture event offset Y. + * The unit is vp. + * Used in PanGesture. * @since 7 */ offsetY: number; -} -/** - * slide gesture event used in the slide gesture triggering scenario. - */ -interface SwipeGestureEvent extends BaseGestureEvent { /** * Gesture event direction angle. - * @since 8 + * The unit is deg. + * Used in RotationGesture and SwipeGesture. + * @since 7 */ angle: number; + /** * Gesture event slide speed. + * The unit is vp. + * Used in SwipeGesture. * @since 8 */ speed: number; -} -/** - * pinch gesture event used for triggering the pinch gesture. - * @since 7 - */ -interface PinchGestureEvent extends BaseGestureEvent { /** * Scaling ratio. + * Used in PinchGesture. * @since 7 */ scale: number; /** - * X-axis coordinate of the kneading center point, in pixels. + * X-axis coordinate of the kneading center point. + * The unit is vp. + * Used in PinchGesture. * @since 7 */ pinchCenterX: number; /** - * Y-axis coordinate of the kneading center point, in pixels. + * Y-axis coordinate of the kneading center point. + * The unit is vp. + * Used in PinchGesture. * @since 7 */ pinchCenterY: number; } /** - * rotation gesture event used for triggering the pinch gesture. - * @since 7 - */ -interface RotationGestureEvent extends BaseGestureEvent { - /** - * Rotation angle. - * @since 7 - */ - angle: number; -} - -/** - * base event for gesture. - * @since 7 - */ -interface BaseGestureEvent extends BaseEvent {} - -/** - * Creating an interface + * Defines TapGesture interface. * @since 7 */ interface TapGestureInterface { @@ -362,7 +320,7 @@ interface TapGestureInterface { } /** - * Creating an interface + * Defines LongPressGesture interface. * @since 7 */ interface LongPressGestureInterface { @@ -391,13 +349,13 @@ interface LongPressGestureInterface { * LongPress gesture recognition success callback. * @since 7 */ - onAction(event: (event?: LongPressGestureEvent) => void): LongPressGestureInterface; + onAction(event: (event?: GestureEvent) => void): LongPressGestureInterface; /** * The LongPress gesture is successfully recognized. When the finger is lifted, the callback is triggered. * @since 7 */ - onActionEnd(event: (event?: LongPressGestureEvent) => void): LongPressGestureInterface; + onActionEnd(event: (event?: GestureEvent) => void): LongPressGestureInterface; /** * The LongPress gesture is successfully recognized and a callback is triggered when the touch cancel event is received. @@ -407,6 +365,7 @@ interface LongPressGestureInterface { } /** + * Defines the PanGesture option. * @since 7 */ declare class PanGestureOption { @@ -436,6 +395,7 @@ declare class PanGestureOption { } /** + * Defines the PanGesture interface. * @since 7 */ interface PanGestureInterface { @@ -449,7 +409,9 @@ interface PanGestureInterface { * Just use for genetate tsbundle * @ignore ide should ignore this arrtibute */ - create(value?: { fingers?: number; direction?: PanDirection; distance?: number } | PanGestureOption): PanGestureInterface; + create( + value?: { fingers?: number; direction?: PanDirection; distance?: number } | PanGestureOption, + ): PanGestureInterface; /** * Just use for genetate tsbundle @@ -461,19 +423,19 @@ interface PanGestureInterface { * Pan gesture recognition success callback. * @since 7 */ - onActionStart(event: (event?: PanGestureEvent) => void): PanGestureInterface; + onActionStart(event: (event?: GestureEvent) => void): PanGestureInterface; /** * Callback when the Pan gesture is moving. * @since 7 */ - onActionUpdate(event: (event?: PanGestureEvent) => void): PanGestureInterface; + onActionUpdate(event: (event?: GestureEvent) => void): PanGestureInterface; /** * The Pan gesture is successfully recognized. When the finger is lifted, the callback is triggered. * @since 7 */ - onActionEnd(event: (event?: PanGestureEvent) => void): PanGestureInterface; + onActionEnd(event: (event?: GestureEvent) => void): PanGestureInterface; /** * The Pan gesture is successfully recognized and a callback is triggered when the touch cancel event is received. @@ -483,6 +445,7 @@ interface PanGestureInterface { } /** + * Defines the SwipeGesture interface. * @since 8 */ interface SwipeGestureInterface { @@ -508,10 +471,11 @@ interface SwipeGestureInterface { * Slide gesture recognition success callback. * @since 8 */ - onAction(event: (event?: SwipeGestureEvent) => void): SwipeGestureInterface; + onAction(event: (event?: GestureEvent) => void): SwipeGestureInterface; } /** + * Defines the PinchGesture interface. * @since 7 */ interface PinchGestureInterface { @@ -537,19 +501,19 @@ interface PinchGestureInterface { * Pan gesture recognition success callback. * @since 7 */ - onActionStart(event: (event?: PinchGestureEvent) => void): PinchGestureInterface; + onActionStart(event: (event?: GestureEvent) => void): PinchGestureInterface; /** * Callback when the Pan gesture is moving. * @since 7 */ - onActionUpdate(event: (event?: PinchGestureEvent) => void): PinchGestureInterface; + onActionUpdate(event: (event?: GestureEvent) => void): PinchGestureInterface; /** * The Pan gesture is successfully recognized. When the finger is lifted, the callback is triggered. * @since 7 */ - onActionEnd(event: (event?: PinchGestureEvent) => void): PinchGestureInterface; + onActionEnd(event: (event?: GestureEvent) => void): PinchGestureInterface; /** * The Pan gesture is successfully recognized and a callback is triggered when the touch cancel event is received. @@ -559,6 +523,7 @@ interface PinchGestureInterface { } /** + * Defines the RotationGesture interface. * @since 7 */ interface RotationGestureInterface { @@ -584,19 +549,19 @@ interface RotationGestureInterface { * Pan gesture recognition success callback. * @since 7 */ - onActionStart(event: (event?: RotationGestureEvent) => void): RotationGestureInterface; + onActionStart(event: (event?: GestureEvent) => void): RotationGestureInterface; /** * Callback when the Pan gesture is moving. * @since 7 */ - onActionUpdate(event: (event?: RotationGestureEvent) => void): RotationGestureInterface; + onActionUpdate(event: (event?: GestureEvent) => void): RotationGestureInterface; /** * The Pan gesture is successfully recognized. When the finger is lifted, the callback is triggered. * @since 7 */ - onActionEnd(event: (event?: RotationGestureEvent) => void): RotationGestureInterface; + onActionEnd(event: (event?: GestureEvent) => void): RotationGestureInterface; /** * The Pan gesture is successfully recognized and a callback is triggered when the touch cancel event is received. @@ -606,6 +571,7 @@ interface RotationGestureInterface { } /** + * Defines the GestureGroup interface. * @since 7 */ interface GestureGroupInterface { diff --git a/api/@internal/component/ets/hyperlink.d.ts b/api/@internal/component/ets/hyperlink.d.ts deleted file mode 100644 index a193f57ba8..0000000000 --- a/api/@internal/component/ets/hyperlink.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @since 7 - */ -interface HyperlinkInterface { - /** - * Return to get Hyperlink. - * address: Web page redirected by the hyperlink component. - * content: Hyperlinks in the hyperlink component display text. - * @since 7 - */ - (address: string | Resource, content?: string | Resource): HyperlinkAttribute; -} - -/** - * inheritance CommonMethod - * @since 7 - */ -declare class HyperlinkAttribute extends CommonMethod { - /** - * Just use for genetate tsbundle - * @ignore ide should ignore this arrtibute - */ - create(address: string | Resource, content?: string | Resource): HyperlinkAttribute; - - /** - * Just use for genetate tsbundle - * @ignore ide should ignore this arrtibute - */ - pop(): HyperlinkAttribute; - - /** - * Just use for genetate tsbundle - * @ignore ide should ignore this arrtibute - */ - debugLine(value: string): HyperlinkAttribute; - - /** - * Set Color - * @since 7 - */ - color(value: ResourceColor): HyperlinkAttribute; -} - -declare const Hyperlink: HyperlinkInterface; -declare const HyperlinkInstance: HyperlinkAttribute; -- Gitee