refactor: change pan method

This commit is contained in:
parker
2025-06-20 02:07:11 +01:00
parent 9a7458f2c0
commit b829ba639b
3 changed files with 8 additions and 1 deletions

View File

@@ -58,7 +58,8 @@ void NetworkGraphicsView::mouseMoveEvent(QMouseEvent *mouseEvent)
std::cout << "delta: " << delta.x() << " " << delta.y() << "\n";
float speed = 1.0f;
setSceneRect(sceneRect().translated(-delta.x()*speed, -delta.y()*speed));
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - delta.x());
verticalScrollBar()->setValue(verticalScrollBar()->value() - delta.y());
panStartPos = mouseEvent->pos();
mouseEvent->accept();
return;