1. @Entry
1. @Component
1. export struct OnClickGesture {
1. private judgeCount: number = 0;
1.
1. increaseJudgeGuard(): void {
1. this.judgeCount++;
1. }
1.
1. build() {
1. NavDestination() {
1. Column() {
1. Column() {
1. Column()
1. .width('60%')
1. .height('50%')
1. .backgroundColor(Color.Grey)
1. .onClick(() => {
1. console.info('Clicked on child');
1. this.increaseJudgeGuard();
1. })
1. .onGestureJudgeBegin((gestureInfo: GestureInfo, event: BaseGestureEvent) => {
1.
1. if (this.judgeCount % 5 == 0 && gestureInfo.type == GestureControl.GestureType.CLICK) {
1. return GestureJudgeResult.REJECT;
1. } else {
1. return GestureJudgeResult.CONTINUE;
1. }
1. })
1. }
1. .width('80%')
1. .height('80%')
1. .justifyContent(FlexAlign.Center)
1. .backgroundColor(Color.Green)
1. .gesture(
1. TapGesture()
1. .onAction(() => {
1. console.info('Clicked on parent');
1. this.increaseJudgeGuard();
1. }))
1. }
1. .height('100%')
1. .width('100%')
1. .justifyContent(FlexAlign.Center)
1. }
1. .backgroundColor('#f1f2f3')
1.
1. .title($r('app.string.singlegesture_Index_Click_title'))
1. }
1. }