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:
@@ -452,6 +452,23 @@ public:
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto index = adjuster.FindIndex( subView );
|
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 >(
|
return std::make_shared< SubViewRearrangeHandle >(
|
||||||
std::move( adjuster ),
|
std::move( adjuster ),
|
||||||
index, view.GetLastHeight()
|
index, view.GetLastHeight()
|
||||||
|
|||||||
Reference in New Issue
Block a user