1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 08:49:55 +00:00
openmw-tes3mp/apps/opencs/view/render/orbitcameramode.cpp

38 lines
925 B
C++
Raw Normal View History

2016-04-03 20:32:07 +00:00
#include "orbitcameramode.hpp"
#include <QMenu>
#include "worldspacewidget.hpp"
namespace CSVRender
{
OrbitCameraMode::OrbitCameraMode(WorldspaceWidget* worldspaceWidget, const QIcon& icon, const QString& tooltip,
QWidget* parent)
: ModeButton(icon, tooltip, parent)
, mWorldspaceWidget(worldspaceWidget)
, mCenterOnSelection(0)
{
}
void OrbitCameraMode::activate(CSVWidget::SceneToolbar* toolbar)
{
mCenterOnSelection = new QAction("Center on selected object", this);
connect(mCenterOnSelection, SIGNAL(triggered()), this, SLOT(centerSelection()));
}
bool OrbitCameraMode::createContextMenu(QMenu* menu)
{
if (menu)
{
menu->addAction(mCenterOnSelection);
}
return true;
}
void OrbitCameraMode::centerSelection()
{
mWorldspaceWidget->centerOrbitCameraOnSelection();
}
}