Files
reasampler/src/core/view/mode_switch.h
T

24 lines
915 B
C++

#pragma once
#include "core/ui/rect.h"
// Pure segment layout + hit-test for the bank_panel's Design-View mode switch.
// Mirror of bank_grid. See src/core/view/CLAUDE.md.
#include <vector>
namespace reasampler::view {
using HeaderRect = ui::Rect;
using SegmentRect = ui::Rect;
// Divides `header` into `segmentCount` equal segments left-to-right. Boundaries
// use header.x + (i * width) / segmentCount so segments abut exactly despite
// integer rounding. segmentCount <= 0 or non-positive width returns empty.
std::vector<SegmentRect> computeSegmentRects(const HeaderRect& header,
int segmentCount);
// Segment index containing (px, py), or -1 for a miss (outside header bounds,
// or segmentCount <= 0). Half-open bounds match computeSegmentRects.
int hitTestSegment(int px, int py, const HeaderRect& header, int segmentCount);
} // namespace reasampler::view