From 6fd29ad86307fb3208db996fd2c873624a156160 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 16 Jan 2020 14:48:05 -0500 Subject: [PATCH] Restrict y coords of the hot zone for the new sub-view rearrangement --- .../wavetrack/ui/WaveTrackView.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp b/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp index 8c82540fe..04cfe6f16 100644 --- a/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp +++ b/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp @@ -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()