1e41f4b71Sopenharmony_ci# Custom Event Interception
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe custom event interception capability provided for components lets you determine the **HitTestMode** attribute of a component based on the position where the event is triggered on the component, and other event information such as the input source.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci>  **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci>  The initial APIs of this module are supported since API version 12. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## onTouchIntercept
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_cionTouchIntercept(callback: Callback<TouchEvent, HitTestMode>)
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci**Parameters**
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci| Name       | Type                   | Mandatory | Description                         |
21e41f4b71Sopenharmony_ci| ---------- | -------------------------- | ------- | ----------------------------- |
22e41f4b71Sopenharmony_ci| callback      | Callback<[TouchEvent](ts-universal-events-touch.md#touchevent), [HitTestMode](ts-universal-attributes-hit-test-behavior.md#HitTestMode)> | Yes    |  Custom event interception callback to bind to the component, which is called during hit testing. |
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci## Example
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci```ts
28e41f4b71Sopenharmony_ci// xxx.ets
29e41f4b71Sopenharmony_ci@Entry
30e41f4b71Sopenharmony_ci@Component
31e41f4b71Sopenharmony_cistruct Index {
32e41f4b71Sopenharmony_ci  isPolygon(event: TouchEvent) {
33e41f4b71Sopenharmony_ci    return true;
34e41f4b71Sopenharmony_ci  }
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci  build(){
37e41f4b71Sopenharmony_ci    Row(){
38e41f4b71Sopenharmony_ci      Column(){
39e41f4b71Sopenharmony_ci        Text("hello world")
40e41f4b71Sopenharmony_ci          .backgroundColor(Color.Blue)
41e41f4b71Sopenharmony_ci          .fontSize(50)
42e41f4b71Sopenharmony_ci          .fontWeight(FontWeight.Bold)
43e41f4b71Sopenharmony_ci          .onClick(()=>{
44e41f4b71Sopenharmony_ci            console.log("Text click");
45e41f4b71Sopenharmony_ci          })
46e41f4b71Sopenharmony_ci      }
47e41f4b71Sopenharmony_ci      .width(400)
48e41f4b71Sopenharmony_ci      .height(300)
49e41f4b71Sopenharmony_ci      .backgroundColor(Color.Pink)
50e41f4b71Sopenharmony_ci      .onClick(()=>{
51e41f4b71Sopenharmony_ci        console.log("Column click");
52e41f4b71Sopenharmony_ci      })
53e41f4b71Sopenharmony_ci      // Call onTouchIntercept to modify the HitTestMode attribute of the component.
54e41f4b71Sopenharmony_ci      .onTouchIntercept((event : TouchEvent) => {
55e41f4b71Sopenharmony_ci        console.log("OnTouchIntercept + " + JSON.stringify(event));
56e41f4b71Sopenharmony_ci        if (this.isPolygon(event)) {
57e41f4b71Sopenharmony_ci          return HitTestMode.None
58e41f4b71Sopenharmony_ci        }
59e41f4b71Sopenharmony_ci        return HitTestMode.Default
60e41f4b71Sopenharmony_ci      })
61e41f4b71Sopenharmony_ci    }
62e41f4b71Sopenharmony_ci    .width('100%')
63e41f4b71Sopenharmony_ci  }
64e41f4b71Sopenharmony_ci}
65e41f4b71Sopenharmony_ci```
66