DVUI

handleGap

The full gap added between panes to accomodate the handle.

The handle itself may be drawn outside this gap when the split ratio is at or near the start or end of the paned widget.

Parameters

#
self:*PanedWidget
*PanedWidget

Source

Implementation

#
pub fn handleGap(self: *PanedWidget) f32 {
    const r = self.data().contentRect();
    const space = switch (self.init_opts.direction) {
        .horizontal => r.w,
        .vertical => r.h,
    };
    const split_point = space * self.split_ratio.*;

    // when the handle is at the start or end of paned, the gap shrinks to 0
    return 2 * @min(self.handleSize(), split_point, space - split_point);
}