feat: zoom and pan in networkView

This commit is contained in:
parker
2025-06-19 17:33:13 +01:00
parent 5f0dfbfe6b
commit 2feb6eb5b4
10 changed files with 138 additions and 35 deletions

View File

@@ -0,0 +1,28 @@
#include "gui/network/NetworkGraphicsScene.h"
#include <QGraphicsScene>
#include <QGraphicsSceneWheelEvent>
#include <iostream>
#include <qgraphicsview.h>
NetworkGraphicsScene::NetworkGraphicsScene(QGraphicsView *parent)
: QGraphicsScene()
{
parent_ = parent;
}
void NetworkGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
{
std::cout << "delta: " << wheelEvent->delta() << "\n";
int delta = wheelEvent->delta();
if(delta > 0)
{
parent_->scale(1.1, 1.1);
}
else if(delta < 0)
{
parent_->scale(0.9, 0.9);
}
wheelEvent->accept();
}