track: cache length change invalidations and release when not dragging
Not sure if this is the best solution, we'll see. Fixes issue where cache wouldn't respond to length slider.
This commit is contained in:
@@ -672,6 +672,17 @@ void Track::BlockLengthChanged()
|
||||
|
||||
TimeRange invalidate_region(qMin(old_out, new_out), track_length());
|
||||
|
||||
// The cache won't start while dragging, so we store up our invalidations if it's held down
|
||||
// and release them once the mouse is no longer pressed
|
||||
if (qApp->mouseButtons() & Qt::LeftButton) {
|
||||
block_length_pending_invalidations_.insert(invalidate_region);
|
||||
} else if (!block_length_pending_invalidations_.isEmpty()) {
|
||||
foreach (const TimeRange& r, block_length_pending_invalidations_) {
|
||||
Node::InvalidateCache(r, kBlockInput);
|
||||
}
|
||||
block_length_pending_invalidations_.clear();
|
||||
}
|
||||
|
||||
Node::InvalidateCache(invalidate_region, kBlockInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -422,6 +422,8 @@ private:
|
||||
|
||||
void SetLengthInternal(const rational& r, bool invalidate = true);
|
||||
|
||||
TimeRangeList block_length_pending_invalidations_;
|
||||
|
||||
QVector<Block*> blocks_;
|
||||
QVector<int> block_array_indexes_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user