1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-14 17:14:07 +01:00

Restrict y coords of the hot zone for the new sub-view rearrangement

This commit is contained in:
Paul Licameli
2020-01-16 14:48:05 -05:00
parent 876cd92ed3
commit 6fd29ad863

View File

@@ -452,6 +452,23 @@ public:
return {};
auto index = adjuster.FindIndex( subView );
// Hit on the rearrange cursor only in the top and bottom thirds of
// sub-view height, leaving the rest free to hit the selection cursor
// first.
// And also exclude the top third of the topmost sub-view and bottom
// third of bottommost.
auto relY = state.state.GetY() - state.rect.GetTop();
auto height = state.rect.GetHeight();
bool hit =
( ( 3 * relY < height ) && index > 0 ) // top hit
||
( ( 3 * relY > 2 * height ) &&
index < adjuster.mPermutation.size() - 1 ) // bottom
;
if ( ! hit )
return {};
return std::make_shared< SubViewRearrangeHandle >(
std::move( adjuster ),
index, view.GetLastHeight()