Skip to main content

should_flip

Function should_flip 

Source
fn should_flip(
    trigger_top: f64,
    trigger_bottom: f64,
    viewport_height: f64,
    panel_height: f64,
) -> bool
Expand description

面板应向上展开的条件:视口下方空间不足,且上方空间比下方更宽余。

纯函数便于单测;panel_height 由调用方按选项数估算(见 measure_flip)。