mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Always enter mouse drag mode when clicking on overview widget. (#1539)
Fixes #1503.
This commit is contained in:
parent
5a59546009
commit
7bc4dd06bc
@ -82,29 +82,21 @@ void OverviewView::paintEvent(QPaintEvent *event)
|
||||
p.drawRect(rangeRect);
|
||||
}
|
||||
|
||||
bool OverviewView::mouseContainsRect(QMouseEvent *event)
|
||||
{
|
||||
if (rangeRect.contains(event->pos())) {
|
||||
mouseActive = true;
|
||||
initialDiff = QPointF(event->localPos().x() - rangeRect.x(), event->localPos().y() - rangeRect.y());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void OverviewView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (mouseContainsRect(event)) {
|
||||
return;
|
||||
mouseActive = true;
|
||||
if (rangeRect.contains(event->pos())) {
|
||||
initialDiff = QPointF(event->localPos().x() - rangeRect.x(), event->localPos().y() - rangeRect.y());
|
||||
} else {
|
||||
qreal w = rangeRect.width();
|
||||
qreal h = rangeRect.height();
|
||||
qreal x = event->localPos().x() - w / 2;
|
||||
qreal y = event->localPos().y() - h / 2;
|
||||
rangeRect = QRectF(x, y, w, h);
|
||||
initialDiff = QPointF(w / 2, h / 2);
|
||||
viewport()->update();
|
||||
emit mouseMoved();
|
||||
}
|
||||
qreal w = rangeRect.width();
|
||||
qreal h = rangeRect.height();
|
||||
qreal x = event->localPos().x() - w / 2;
|
||||
qreal y = event->localPos().y() - h / 2;
|
||||
rangeRect = QRectF(x, y, w, h);
|
||||
viewport()->update();
|
||||
emit mouseMoved();
|
||||
mouseContainsRect(event);
|
||||
}
|
||||
|
||||
void OverviewView::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
@ -105,11 +105,6 @@ private:
|
||||
virtual GraphView::EdgeConfiguration edgeConfiguration(GraphView::GraphBlock &from,
|
||||
GraphView::GraphBlock *to) override;
|
||||
|
||||
/**
|
||||
* @brief if the mouse is in the rect in Overview.
|
||||
*/
|
||||
bool mouseContainsRect(QMouseEvent *event);
|
||||
|
||||
/**
|
||||
* @brief base background color changing depending on the theme
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user