Rubber selection should not always select bottom track compositions

parent e9456b2b
......@@ -912,6 +912,8 @@ Rectangle {
var y = rubberSelect.y - ruler.height + scrollView.contentY
var topTrack = Logic.getTrackIndexFromPos(Math.max(0, y))
var bottomTrack = Logic.getTrackIndexFromPos(y + rubberSelect.height)
// Check if bottom of rubber selection covers the last track compositions
var selectBottomCompositions = ((y + rubberSelect.height) - Logic.getTrackYFromId(tracksRepeater.itemAt(bottomTrack).trackInternalId) - scrollView.contentY) > (Logic.getTrackHeightByPos(bottomTrack) * 0.6)
if (bottomTrack >= topTrack) {
var t = []
for (var i = topTrack; i <= bottomTrack; i++) {
......@@ -919,7 +921,7 @@ Rectangle {
}
var startFrame = (scrollView.contentX - tracksArea.x + rubberSelect.x) / timeline.scaleFactor
var endFrame = (scrollView.contentX - tracksArea.x + rubberSelect.x + rubberSelect.width) / timeline.scaleFactor
timeline.selectItems(t, startFrame, endFrame, mouse.modifiers & Qt.ControlModifier);
timeline.selectItems(t, startFrame, endFrame, mouse.modifiers & Qt.ControlModifier, selectBottomCompositions);
}
rubberSelect.y = -1
} else if (shiftPress) {
......
......@@ -1189,7 +1189,7 @@ void TimelineController::setZoneOut(int outPoint)
emit zoneMoved(m_zone);
}
void TimelineController::selectItems(const QVariantList &tracks, int startFrame, int endFrame, bool addToSelect)
void TimelineController::selectItems(const QVariantList &tracks, int startFrame, int endFrame, bool addToSelect, bool selectBottomCompositions)
{
std::unordered_set<int> itemsToSelect;
if (addToSelect) {
......@@ -1199,7 +1199,7 @@ void TimelineController::selectItems(const QVariantList &tracks, int startFrame,
if (m_model->getTrackById_const(tracks.at(i).toInt())->isLocked()) {
continue;
}
auto currentClips = m_model->getItemsInRange(tracks.at(i).toInt(), startFrame, endFrame, true);
auto currentClips = m_model->getItemsInRange(tracks.at(i).toInt(), startFrame, endFrame, i < tracks.count() - 1 ? true : selectBottomCompositions);
itemsToSelect.insert(currentClips.begin(), currentClips.end());
}
m_model->requestSetSelection(itemsToSelect);
......
......@@ -113,7 +113,7 @@ public:
@param start/endFrame Interval from which to select the items
@param addToSelect if true, the old selection is retained
*/
Q_INVOKABLE void selectItems(const QVariantList &tracks, int startFrame, int endFrame, bool addToSelect);
Q_INVOKABLE void selectItems(const QVariantList &tracks, int startFrame, int endFrame, bool addToSelect, bool selectBottomCompositions);
/** @brief request a selection with a list of ids*/
Q_INVOKABLE void selectItems(const QList<int> &ids);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment