// // GestureOptimizer.h // YuMi // // Created by AI Assistant on 2025/1/13. // #import #import NS_ASSUME_NONNULL_BEGIN /** * 手势区域类型 */ typedef NS_ENUM(NSInteger, GestureAreaType) { GestureAreaType_Left, // 左侧区域 (1/6) GestureAreaType_Center, // 中央区域 (2/3) GestureAreaType_Right // 右侧区域 (1/6) }; /** * 手势识别器优化管理器 * 负责优化 Banner 区域的手势识别性能 */ @interface GestureOptimizer : NSObject /** * 单例方法 */ + (instancetype)sharedOptimizer; /** * 计算手势区域类型 * @param point 触摸点 * @param containerWidth 容器宽度 * @return 手势区域类型 */ - (GestureAreaType)gestureAreaTypeForPoint:(CGPoint)point containerWidth:(CGFloat)containerWidth; /** * 检查手势是否应该在指定区域生效 * @param gestureRecognizer 手势识别器 * @param point 触摸点 * @param containerWidth 容器宽度 * @return 是否应该生效 */ - (BOOL)shouldGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer receiveTouchAtPoint:(CGPoint)point containerWidth:(CGFloat)containerWidth; /** * 获取区域边界 * @param containerWidth 容器宽度 * @return 包含左边界和右边界的字典 */ - (NSDictionary *)getAreaBoundariesForContainerWidth:(CGFloat)containerWidth; /** * 调试方法:打印手势区域信息 * @param point 触摸点 * @param containerWidth 容器宽度 */ - (void)debugGestureAreaForPoint:(CGPoint)point containerWidth:(CGFloat)containerWidth; /** * 清理缓存 */ - (void)clearCache; @end NS_ASSUME_NONNULL_END