已合并
GestureCollectInterceptJs #31640
GestureCollectInterceptJs #31640
已合并
yuanlin创建于 3月30日
6 个文件变更+257-1
@@ -13778,6 +13778,22 @@ declare type OnNeedSoftkeyboardCallback = () => boolean;
13778 */13778 */
13779declare type TouchTestDoneCallback = (event: BaseGestureEvent, recognizers: Array<GestureRecognizer>) => void;13779declare type TouchTestDoneCallback = (event: BaseGestureEvent, recognizers: Array<GestureRecognizer>) => void;
13780 13780 
13781+/**
13782+ * Defines the callback type used in onGestureCollectIntercept.
13783+ *
13784+ * @typedef { function } GestureCollectInterceptCallback
13785+ * @param { Array<GestureRecognizer> } recognizers - the gesture recognizers of the component on the response chain.
13786+ * @param { Array<TouchRecognizer> } [touchRecognizers] - the touch recognizers of the component on the response chain.
13787+ * @returns { GestureCollectIntervention } the gesture intervention.
13788+ * @syscap SystemCapability.ArkUI.ArkUI.Full
13789+ * @stagemodelonly
13790+ * @crossplatform
13791+ * @atomicservice
13792+ * @since 26.0.0 dynamic
13793+ */
13794+declare type GestureCollectInterceptCallback = (recognizers: Array<GestureRecognizer>,
13795+ touchRecognizers?: Array<TouchRecognizer>) => GestureCollectIntervention;
13796+ 
13781/**13797/**
13782 * Defines the PixelMap type object for ui component.13798 * Defines the PixelMap type object for ui component.
13783 *13799 *
@@ -29695,6 +29711,20 @@ declare class CommonMethod<T> {
29695 */29711 */
29696 onTouchTestDone(callback: TouchTestDoneCallback): T;29712 onTouchTestDone(callback: TouchTestDoneCallback): T;
29697 29713 
29714+ /**
29715+ * When the events and gestures on this node and higher-priority nodes have been collected, the callback is executed.
29716+ * This callback is used to intervene in the event and gesture collection results.
29717+ *
29718+ * @param { GestureCollectInterceptCallback } callback - A callback instance used when the component does a touch test.
29719+ * @returns { T }
29720+ * @syscap SystemCapability.ArkUI.ArkUI.Full
29721+ * @stagemodelonly
29722+ * @crossplatform
29723+ * @atomicservice
29724+ * @since 26.0.0 dynamic
29725+ */
29726+ onGestureCollectIntercept(callback: GestureCollectInterceptCallback): T;
29727+ 
29698 /**29728 /**
29699 * Enables the component as a drag-and-drop target with spring loading functionality.29729 * Enables the component as a drag-and-drop target with spring loading functionality.
29700 *29730 *
@@ -11867,6 +11867,81 @@ declare enum InputEventInterceptAction {
11867 COMPETITION = 1,11867 COMPETITION = 1,
11868 }11868 }
11869 11869 
11870+/**
11871+ * Define the gesture and events collection intervention operations.
11872+ *
11873+ * @enum {number}
11874+ * @syscap SystemCapability.ArkUI.ArkUI.Full
11875+ * @stagemodelonly
11876+ * @crossplatform
11877+ * @atomicservice
11878+ * @since 26.0.0 dynamic
11879+ */
11880+declare enum GestureCollectIntervention {
11881+ /**
11882+ * Continue the normal collection process. No intervention will be applied.
11883+ *
11884+ * @syscap SystemCapability.ArkUI.ArkUI.Full
11885+ * @stagemodelonly
11886+ * @crossplatform
11887+ * @atomicservice
11888+ * @since 26.0.0 dynamic
11889+ */
11890+ CONTINUE = 0,
11891+ 
11892+ /**
11893+ * Discard all pending lower-priority gestures and events.
11894+ * This includes gestures from left sibling nodes and ancestor nodes (parent and above).
11895+ * Only the already collected gestures from the current node and higher-priority nodes will be retained.
11896+ *
11897+ * @syscap SystemCapability.ArkUI.ArkUI.Full
11898+ * @stagemodelonly
11899+ * @crossplatform
11900+ * @atomicservice
11901+ * @since 26.0.0 dynamic
11902+ */
11903+ DISCARD_LOWER = 1,
11904+ 
11905+ /**
11906+ * Discard already collected higher-priority gestures and events.
11907+ * This removes gestures from right sibling nodes that have been collected.
11908+ * The collection will continue with lower-priority gestures (left siblings and ancestors).
11909+ *
11910+ * @syscap SystemCapability.ArkUI.ArkUI.Full
11911+ * @stagemodelonly
11912+ * @crossplatform
11913+ * @atomicservice
11914+ * @since 26.0.0 dynamic
11915+ */
11916+ DISCARD_HIGHER = 2,
11917+ 
11918+ /**
11919+ * Discard gestures and events from the current node itself.
11920+ * The current node's gestures and events will be excluded from the gesture tree.
11921+ * Gestures from sibling nodes (both left and right) and ancestor nodes will still be collected.
11922+ *
11923+ * @syscap SystemCapability.ArkUI.ArkUI.Full
11924+ * @stagemodelonly
11925+ * @crossplatform
11926+ * @atomicservice
11927+ * @since 26.0.0 dynamic
11928+ */
11929+ DISCARD_SELF = 3,
11930+ 
11931+ /**
11932+ * Discard gestures and events from left sibling nodes that are pending collection.
11933+ * Gestures and events from the current node and already collected right sibling nodes will be retained.
11934+ * The collection will continue with ancestor nodes.
11935+ *
11936+ * @syscap SystemCapability.ArkUI.ArkUI.Full
11937+ * @stagemodelonly
11938+ * @crossplatform
11939+ * @atomicservice
11940+ * @since 26.0.0 dynamic
11941+ */
11942+ DISCARD_LOWER_PRIORITY_SIBLINGS = 4,
11943+}
11944+ 
11870/**11945/**
11871 * Define the type of raw input event.11946 * Define the type of raw input event.
11872 *11947 *
@@ -4515,6 +4515,17 @@ declare class EventTargetInfo {
4515 * @since 12 dynamic4515 * @since 12 dynamic
4516 */4516 */
4517 getId(): string;4517 getId(): string;
4518+ /**
4519+ * Returns the component's unique id.
4520+ *
4521+ * @returns { number } - the unique id of the component
4522+ * @syscap SystemCapability.ArkUI.ArkUI.Full
4523+ * @stagemodelonly
4524+ * @crossplatform
4525+ * @atomicservice
4526+ * @since 26.0.0 dynamic
4527+ */
4528+ getUniqueId(): number;
4518}4529}
4519 4530 
4520/**4531/**
@@ -4545,6 +4556,18 @@ declare class TouchRecognizer {
4545 * @since 20 dynamic4556 * @since 20 dynamic
4546 */4557 */
4547 cancelTouch(): void;4558 cancelTouch(): void;
4559+ /**
4560+ * Check whether the current gesture binding node is a descendant of the passed-in component.
4561+ *
4562+ * @param { number } uniqueId - the unique id of the component.
4563+ * @returns { boolean } - the query result.
4564+ * @syscap SystemCapability.ArkUI.ArkUI.Full
4565+ * @stagemodelonly
4566+ * @crossplatform
4567+ * @atomicservice
4568+ * @since 26.0.0 dynamic
4569+ */
4570+ isHostBelongsTo(uniqueId: number): boolean;
4548}4571}
4549 4572 
4550/**4573/**
@@ -4670,6 +4693,18 @@ declare class GestureRecognizer {
4670 * @since 20 dynamic4693 * @since 20 dynamic
4671 */4694 */
4672 preventBegin(): void;4695 preventBegin(): void;
4696+ /**
4697+ * Check whether the current gesture binding node is a descendant of the passed-in component.
4698+ *
4699+ * @param { number } uniqueId - the unique id of the component.
4700+ * @returns { boolean } - the query result.
4701+ * @syscap SystemCapability.ArkUI.ArkUI.Full
4702+ * @stagemodelonly
4703+ * @crossplatform
4704+ * @atomicservice
4705+ * @since 26.0.0 dynamic
4706+ */
4707+ isHostBelongsTo(uniqueId: number): boolean;
4673}4708}
4674 4709 
4675/**4710/**
@@ -42,7 +42,7 @@ import { ButtonType, ButtonStyleMode, ButtonRole } from "./button";
42import { Area, ResourceColor, Dimension, ResourceStr, Font, Length, EdgeColors, LocalizedEdgeColors, BorderRadiuses, EdgeWidths, LocalizedEdgeWidths, SizeOptions, Bias, EdgeStyles, Position, LocalizedBorderRadiuses, Margin, ChainWeightOptions, Padding, LocalizedPadding, LocalizedMargin, BorderOptions, OutlineOptions, EdgeOutlineStyles, EdgeOutlineWidths, OutlineRadiuses, Edges, LocalizedEdges, LocalizedPosition, AccessibilityOptions, ConstraintSizeOptions, EdgeWidth, DirectionalEdgesT, VoidCallback, ColorMetrics, AccessibilityActionOptions, ScrollBarMargin } from "./units";42import { Area, ResourceColor, Dimension, ResourceStr, Font, Length, EdgeColors, LocalizedEdgeColors, BorderRadiuses, EdgeWidths, LocalizedEdgeWidths, SizeOptions, Bias, EdgeStyles, Position, LocalizedBorderRadiuses, Margin, ChainWeightOptions, Padding, LocalizedPadding, LocalizedMargin, BorderOptions, OutlineOptions, EdgeOutlineStyles, EdgeOutlineWidths, OutlineRadiuses, Edges, LocalizedEdges, LocalizedPosition, AccessibilityOptions, ConstraintSizeOptions, EdgeWidth, DirectionalEdgesT, VoidCallback, ColorMetrics, AccessibilityActionOptions, ScrollBarMargin } from "./units";
43import { BaseGestureEvent, GestureRecognizer, TouchRecognizer, GestureJudgeResult, GestureType, GestureMask, GestureHandler, GesturePriority, GestureInfo } from "./gesture";43import { BaseGestureEvent, GestureRecognizer, TouchRecognizer, GestureJudgeResult, GestureType, GestureMask, GestureHandler, GesturePriority, GestureInfo } from "./gesture";
44import { ScrollState } from "./list";44import { ScrollState } from "./list";
45-import { AccessibilityHoverType, Curve, PlayMode, SharedTransitionEffectType, KeySource, BorderStyle, HorizontalAlign, LocalizedAlignment, RenderStrategy, VerticalAlign, MouseButton, MouseAction, FontWeight, TouchType, FontStyle, Color, ColoringStrategy, Placement, ArrowPointPosition, ClickEffectLevel, NestedScrollMode, HitTestMode, Alignment, ImageRepeat, ImageSize, HoverEffect, Visibility, ItemAlign, Direction, Axis, GradientDirection, FunctionKey, ModifierKey, ObscuredReasons, RenderFit, LineCapStyle, LineJoinStyle, PixelRoundCalcPolicy, TextDecorationType, TextDecorationStyle, KeyType, ResponseType, BarState, EdgeEffect, ScrollSource, InteractionHand, AxisAction, AxisType, AxisModel, CrownAction, FocusDrawLevel, CrownSensitivity, IlluminatedType, ResponseRegionSupportedTool, TipsAnchorType, InputEventInterceptAction } from "./enums";45+import { AccessibilityHoverType, GestureCollectIntervention, Curve, PlayMode, SharedTransitionEffectType, KeySource, BorderStyle, HorizontalAlign, LocalizedAlignment, RenderStrategy, VerticalAlign, MouseButton, MouseAction, FontWeight, TouchType, FontStyle, Color, ColoringStrategy, Placement, ArrowPointPosition, ClickEffectLevel, NestedScrollMode, HitTestMode, Alignment, ImageRepeat, ImageSize, HoverEffect, Visibility, ItemAlign, Direction, Axis, GradientDirection, FunctionKey, ModifierKey, ObscuredReasons, RenderFit, LineCapStyle, LineJoinStyle, PixelRoundCalcPolicy, TextDecorationType, TextDecorationStyle, KeyType, ResponseType, BarState, EdgeEffect, ScrollSource, InteractionHand, AxisAction, AxisType, AxisModel, CrownAction, FocusDrawLevel, CrownSensitivity, IlluminatedType, ResponseRegionSupportedTool, TipsAnchorType, InputEventInterceptAction } from "./enums";
46import { TextRange } from "./textCommon";46import { TextRange } from "./textCommon";
47import { StyledString } from "./styledString";47import { StyledString } from "./styledString";
48import { CustomBuilder, WrappedBuilder, CustomBuilderT } from './builder';48import { CustomBuilder, WrappedBuilder, CustomBuilderT } from './builder';
@@ -5077,6 +5077,19 @@ export type TransitionFinishCallback = (transitionIn: boolean) => void;
5077 * @since 23 static5077 * @since 23 static
5078 */5078 */
5079export type TouchTestDoneCallback = (event: BaseGestureEvent, recognizers: Array<GestureRecognizer>) => void;5079export type TouchTestDoneCallback = (event: BaseGestureEvent, recognizers: Array<GestureRecognizer>) => void;
5080+/**
5081+ * Defines the callback type used in onGestureCollectIntercept.
5082+ *
5083+ * @typedef { function } GestureCollectInterceptCallback
5084+ * @param { Array<GestureRecognizer> } recognizers - the gesture recognizers of the component on the response chain.
5085+ * @param { Array<TouchRecognizer> } [touchRecognizers] - the touch recognizers of the component on the response chain.
5086+ * @returns { GestureCollectIntervention } the gesture intervention.
5087+ * @syscap SystemCapability.ArkUI.ArkUI.Full
5088+ * @stagemodelonly
5089+ * @since 26.0.0 static
5090+ */
5091+export type GestureCollectInterceptCallback = (recognizers: Array<GestureRecognizer>,
5092+ touchRecognizers?: Array<TouchRecognizer>) => GestureCollectIntervention;
5080/**5093/**
5081 * Defines the callback type used in onNeedSoftkeyboard.5094 * Defines the callback type used in onNeedSoftkeyboard.
5082 * Called when component is focused, the return value indicates whether keyboard is needed.5095 * Called when component is focused, the return value indicates whether keyboard is needed.
@@ -11993,6 +12006,17 @@ export declare interface CommonMethod {
11993 * @since 23 static12006 * @since 23 static
11994 */12007 */
11995 default onTouchTestDone(callback: TouchTestDoneCallback | undefined): this;12008 default onTouchTestDone(callback: TouchTestDoneCallback | undefined): this;
12009+ /**
12010+ * When the events and gestures on this node and higher-priority nodes have been collected, the callback is executed.
12011+ * This callback is used to intervene in the event and gesture collection results.
12012+ *
12013+ * @param { GestureCollectInterceptCallback } callback - A callback instance used when the component does a touch test.
12014+ * @returns { this }
12015+ * @syscap SystemCapability.ArkUI.ArkUI.Full
12016+ * @stagemodelonly
12017+ * @since 26.0.0 static
12018+ */
12019+ default onGestureCollectIntercept(callback: GestureCollectInterceptCallback): this;
11996 /**12020 /**
11997 * Set system-styled materials for the component. Different materials have different effects, which can influence12021 * Set system-styled materials for the component. Different materials have different effects, which can influence
11998 * the backgroundColor, border, shadow, and other visual attributes of the component.12022 * the backgroundColor, border, shadow, and other visual attributes of the component.
@@ -4415,6 +4415,69 @@ export enum SystemProperties {
4415 WINDOW_SIZE_PX = 'system.window.size.px'4415 WINDOW_SIZE_PX = 'system.window.size.px'
4416}4416}
4417 4417 
4418+/**
4419+ * Define the gesture and events collection intervention operations.
4420+ *
4421+ * @enum {number}
4422+ * @syscap SystemCapability.ArkUI.ArkUI.Full
4423+ * @stagemodelonly
4424+ * @since 26.0.0 static
4425+ */
4426+export declare enum GestureCollectIntervention {
4427+ /**
4428+ * Continue the normal collection process. No intervention will be applied.
4429+ *
4430+ * @syscap SystemCapability.ArkUI.ArkUI.Full
4431+ * @stagemodelonly
4432+ * @since 26.0.0 static
4433+ */
4434+ CONTINUE = 0,
4435+ 
4436+ /**
4437+ * Discard all pending lower-priority gestures and events.
4438+ * This includes gestures from left sibling nodes and ancestor nodes (parent and above).
4439+ * Only the already collected gestures from the current node and higher-priority nodes will be retained.
4440+ *
4441+ * @syscap SystemCapability.ArkUI.ArkUI.Full
4442+ * @stagemodelonly
4443+ * @since 26.0.0 static
4444+ */
4445+ DISCARD_LOWER = 1,
4446+ 
4447+ /**
4448+ * Discard already collected higher-priority gestures and events.
4449+ * This removes gestures from right sibling nodes that have been collected.
4450+ * The collection will continue with lower-priority gestures (left siblings and ancestors).
4451+ *
4452+ * @syscap SystemCapability.ArkUI.ArkUI.Full
4453+ * @stagemodelonly
4454+ * @since 26.0.0 static
4455+ */
4456+ DISCARD_HIGHER = 2,
4457+ 
4458+ /**
4459+ * Discard gestures and events from the current node itself.
4460+ * The current node's gestures and events will be excluded from the gesture tree.
4461+ * Gestures from sibling nodes (both left and right) and ancestor nodes will still be collected.
4462+ *
4463+ * @syscap SystemCapability.ArkUI.ArkUI.Full
4464+ * @stagemodelonly
4465+ * @since 26.0.0 static
4466+ */
4467+ DISCARD_SELF = 3,
4468+ 
4469+ /**
4470+ * Discard gestures and events from left sibling nodes that are pending collection.
4471+ * Gestures and events from the current node and already collected right sibling nodes will be retained.
4472+ * The collection will continue with ancestor nodes.
4473+ *
4474+ * @syscap SystemCapability.ArkUI.ArkUI.Full
4475+ * @stagemodelonly
4476+ * @since 26.0.0 static
4477+ */
4478+ DISCARD_LOWER_PRIORITY_SIBLINGS = 4,
4479+}
4480+ 
4418/**4481/**
4419 * Define the type of raw input event.4482 * Define the type of raw input event.
4420 *4483 *
@@ -2029,6 +2029,15 @@ export declare class EventTargetInfo {
2029 * @since 23 static2029 * @since 23 static
2030 */2030 */
2031 getId(): string;2031 getId(): string;
2032+ /**
2033+ * Returns the component's unique id.
2034+ *
2035+ * @returns { int } - the unique id of the component
2036+ * @syscap SystemCapability.ArkUI.ArkUI.Full
2037+ * @stagemodelonly
2038+ * @since 26.0.0 static
2039+ */
2040+ getUniqueId(): int;
2032}2041}
2033/**2042/**
2034 * Defines the touch recognizer.2043 * Defines the touch recognizer.
@@ -2055,6 +2064,16 @@ export declare class TouchRecognizer {
2055 * @since 24 static2064 * @since 24 static
2056 */2065 */
2057 cancelTouch(): void;2066 cancelTouch(): void;
2067+ /**
2068+ * Check whether the current gesture binding node is a descendant of the passed-in component.
2069+ *
2070+ * @param { int } uniqueId - the unique id of the component.
2071+ * @returns { boolean } - the query result.
2072+ * @syscap SystemCapability.ArkUI.ArkUI.Full
2073+ * @stagemodelonly
2074+ * @since 26.0.0 static
2075+ */
2076+ isHostBelongsTo(uniqueId: int): boolean;
2058}2077}
2059/**2078/**
2060 * Defines the gesture recognizer.2079 * Defines the gesture recognizer.
@@ -2156,6 +2175,16 @@ export declare class GestureRecognizer {
2156 * @since 23 static2175 * @since 23 static
2157 */2176 */
2158 preventBegin(): void;2177 preventBegin(): void;
2178+ /**
2179+ * Check whether the current gesture binding node is a descendant of the passed-in component.
2180+ *
2181+ * @param { int } uniqueId - the unique id of the component.
2182+ * @returns { boolean } - the query result.
2183+ * @syscap SystemCapability.ArkUI.ArkUI.Full
2184+ * @stagemodelonly
2185+ * @since 26.0.0 static
2186+ */
2187+ isHostBelongsTo(uniqueId: int): boolean;
2159}2188}
2160/**2189/**
2161 * Defines the tap gesture recognizer.2190 * Defines the tap gesture recognizer.