//
//  KBCategoryTitleView.m
//  keyBoard
//
//  Swap in KBCategoryTitleCell to add a custom unselected pill background.
//

#import "KBCategoryTitleView.h"
#import "KBCategoryTitleCell.h"
#import <JXCategoryView/JXCategoryView.h>
#import <JXCategoryView/JXCategoryTitleCellModel.h>

@implementation KBCategoryTitleView

- (Class)preferredCellClass {
    return [KBCategoryTitleCell class];
}

// 关闭左右滑动时的颜色/背景渐变（保持状态不变）
- (void)refreshLeftCellModel:(JXCategoryBaseCellModel *)leftCellModel
             rightCellModel:(JXCategoryBaseCellModel *)rightCellModel
                      ratio:(CGFloat)ratio {
    // 不调用 super，避免 JXCategoryIndicatorView/JXCategoryTitleView 内部的渐变计算
    JXCategoryTitleCellModel *left = (JXCategoryTitleCellModel *)leftCellModel;
    JXCategoryTitleCellModel *right = (JXCategoryTitleCellModel *)rightCellModel;

    // 固定颜色：选中用选中色，未选中用普通色
    left.titleCurrentColor = left.isSelected ? left.titleSelectedColor : left.titleNormalColor;
    right.titleCurrentColor = right.isSelected ? right.titleSelectedColor : right.titleNormalColor;
}

@end
