feat: legible ReaSampler 9000 editor — bigger knobs, ms time constants, per-ring double-click reset, and an antialiased draw pass
This commit is contained in:
@@ -190,4 +190,28 @@ DeckHit hitTestDeck(const DeckLayout& layout, int x, int y) {
|
||||
return {};
|
||||
}
|
||||
|
||||
namespace {
|
||||
// Squared distance from a rect's centre, in the rect's own pixel units.
|
||||
double distSqFromCentre(const Rect& r, int x, int y) {
|
||||
const double dx = x - (r.x + r.width / 2.0);
|
||||
const double dy = y - (r.y + r.height / 2.0);
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
DeckFaceHit hitTestKnobFace(const DeckLayout& layout, int x, int y) {
|
||||
for (const DeckGroupLayout& g : layout.groups) {
|
||||
if (!contains(g.box, x, y)) continue;
|
||||
for (const DeckCellLayout& c : g.cells) {
|
||||
const double rOuter = c.knob.width / 2.0;
|
||||
if (distSqFromCentre(c.knob, x, y) >= rOuter * rOuter) continue;
|
||||
const double rInner = c.inner.width / 2.0;
|
||||
const bool inner = distSqFromCentre(c.inner, x, y) < rInner * rInner;
|
||||
return {c.id, inner};
|
||||
}
|
||||
return {}; // inside the group but off every dial
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace reasampler::instrument::ui
|
||||
|
||||
Reference in New Issue
Block a user