diff --git a/GesturesConfictPractice/entry/src/main/ets/pages/GesturesConflictScene8.ets b/GesturesConfictPractice/entry/src/main/ets/pages/GesturesConflictScene8.ets new file mode 100644 index 0000000000000000000000000000000000000000..6345f0e51f6aac0b1550aa7179460e7cc9ad29ab --- /dev/null +++ b/GesturesConfictPractice/entry/src/main/ets/pages/GesturesConflictScene8.ets @@ -0,0 +1,50 @@ +/* +* Copyright (C) 2024 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. +*/ + +/* + * 最佳实践:手势事件冲突解决方案 + * + * 场景七:手势事件透传 + */ + +// [Start component_scene4] +@Entry +@Component +struct GesturesConflictScene4 { + build() { + Stack() { + Column()//Underlying Column + .width('100%') + .height('100%') + .backgroundColor(Color.Black) + .gesture( + SwipeGesture({ direction: SwipeDirection.Horizontal })//Horizontal swipe gesture + .onAction((event) => { + if (event) { + console.info('Column SwipeGesture'); + } + }) + ) + Column()//Upper Column + .width(300) + .height(100) + .backgroundColor(Color.Red) + .hitTestBehavior(HitTestMode.None) + } + .width(300) + .height(300) + } +} +// [End component_scene4] \ No newline at end of file