//
//  InputStackView.swift
//  Visual_Novel_iOS
//
//  Created by mh on 2025/10/21.
//

import UIKit

class InputStackView: UIStackView {
    
    override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        // 1. 自身不可见/无交互 → 剪枝
        if alpha <= 0.01 || isHidden || !isUserInteractionEnabled { return nil }
        
        // 2. 自身命中（含子视图）→ 正常返回
        let hit = super.hitTest(point, with: event)
        if hit != nil { return hit }
        
        // 3. 自身没命中，继续测**所有子视图（含超框）**
        for sub in subviews.reversed() {
            if sub is SessionInputOperateView {
                let converted = sub.convert(point, from: self)
                return sub.hitTest(converted, with: event)
            }
        }
        return nil
    }
}
