seekable: prioritize dragging playhead over workarea
This commit is contained in:
@@ -219,10 +219,13 @@ void SeekableWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
}
|
||||
} else {
|
||||
// Look for resize points
|
||||
if (!selection_manager_.GetObjectAtPoint(event->pos()) && FindResizeHandle(event)) {
|
||||
if (!last_playhead_shape_.containsPoint(event->pos(), Qt::OddEvenFill)
|
||||
&& !selection_manager_.GetObjectAtPoint(event->pos())
|
||||
&& FindResizeHandle(event)) {
|
||||
setCursor(Qt::SizeHorCursor);
|
||||
} else {
|
||||
unsetCursor();
|
||||
ClearResizeHandle();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -425,16 +428,16 @@ void SeekableWidget::DrawPlayhead(QPainter *p, int x, int y)
|
||||
|
||||
int half_text_height = text_height() / 3;
|
||||
|
||||
QPoint points[] = {
|
||||
last_playhead_shape_ = QPolygon({
|
||||
QPoint(x, y),
|
||||
QPoint(x - half_width, y - half_text_height),
|
||||
QPoint(x - half_width, y - text_height()),
|
||||
QPoint(x + 1 + half_width, y - text_height()),
|
||||
QPoint(x + 1 + half_width, y - half_text_height),
|
||||
QPoint(x + 1, y),
|
||||
};
|
||||
});
|
||||
|
||||
p->drawPolygon(points, 6);
|
||||
p->drawPolygon(last_playhead_shape_);
|
||||
|
||||
p->setRenderHint(QPainter::Antialiasing, false);
|
||||
}
|
||||
@@ -482,8 +485,7 @@ bool SeekableWidget::FindResizeHandle(QMouseEvent *event)
|
||||
return false;
|
||||
}
|
||||
|
||||
resize_item_ = nullptr;
|
||||
resize_mode_ = kResizeNone;
|
||||
ClearResizeHandle();
|
||||
|
||||
QPointF scene = mapToScene(event->pos());
|
||||
const int border = 10;
|
||||
@@ -531,6 +533,12 @@ bool SeekableWidget::FindResizeHandle(QMouseEvent *event)
|
||||
return resize_item_;
|
||||
}
|
||||
|
||||
void SeekableWidget::ClearResizeHandle()
|
||||
{
|
||||
resize_item_ = nullptr;
|
||||
resize_mode_ = kResizeNone;
|
||||
}
|
||||
|
||||
void SeekableWidget::DragResizeHandle(const QPointF &scene)
|
||||
{
|
||||
qreal diff = scene.x() - resize_start_.x();
|
||||
|
||||
@@ -125,6 +125,8 @@ private:
|
||||
|
||||
bool FindResizeHandle(QMouseEvent *event);
|
||||
|
||||
void ClearResizeHandle();
|
||||
|
||||
void DragResizeHandle(const QPointF &scene_pos);
|
||||
|
||||
void CommitResizeHandle();
|
||||
@@ -153,6 +155,8 @@ private:
|
||||
|
||||
bool marker_editing_enabled_;
|
||||
|
||||
QPolygon last_playhead_shape_;
|
||||
|
||||
private slots:
|
||||
void SetMarkerColor(int c);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user