mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:53:52 +00:00
Make scene controls use configurable speed modifier.
This commit is contained in:
parent
bf2ab4ed45
commit
f73d60cc73
2 changed files with 16 additions and 3 deletions
|
@ -44,6 +44,7 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg
|
|||
, mDragging (false)
|
||||
, mDragX(0)
|
||||
, mDragY(0)
|
||||
, mSpeedMode(false)
|
||||
, mDragFactor(0)
|
||||
, mDragWheelFactor(0)
|
||||
, mDragShiftFactor(0)
|
||||
|
@ -97,8 +98,10 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg
|
|||
CSMPrefs::get()["Tooltips"].update();
|
||||
|
||||
// Shortcuts
|
||||
CSMPrefs::Shortcut* primaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-primary", this);
|
||||
CSMPrefs::Shortcut* primaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-primary", "scene-speed-modifier",
|
||||
CSMPrefs::Shortcut::SM_Detach, this);
|
||||
connect(primaryEditShortcut, SIGNAL(activated(bool)), this, SLOT(primaryEdit(bool)));
|
||||
connect(primaryEditShortcut, SIGNAL(secondary(bool)), this, SLOT(speedMode(bool)));
|
||||
|
||||
CSMPrefs::Shortcut* secondaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-secondary", this);
|
||||
connect(secondaryEditShortcut, SIGNAL(activated(bool)), this, SLOT(secondaryEdit(bool)));
|
||||
|
@ -602,7 +605,7 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
|
|||
|
||||
double factor = mDragFactor;
|
||||
|
||||
if (event->modifiers() & Qt::ShiftModifier)
|
||||
if (mSpeedMode)
|
||||
factor *= mDragShiftFactor;
|
||||
|
||||
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
||||
|
@ -656,7 +659,7 @@ void CSVRender::WorldspaceWidget::wheelEvent (QWheelEvent *event)
|
|||
{
|
||||
double factor = mDragWheelFactor;
|
||||
|
||||
if (event->modifiers() & Qt::ShiftModifier)
|
||||
if (mSpeedMode)
|
||||
factor *= mDragShiftFactor;
|
||||
|
||||
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
||||
|
@ -706,6 +709,11 @@ void CSVRender::WorldspaceWidget::secondarySelect(bool activate)
|
|||
handleInteraction(InteractionType_SecondarySelect, activate);
|
||||
}
|
||||
|
||||
void CSVRender::WorldspaceWidget::speedMode(bool activate)
|
||||
{
|
||||
mSpeedMode = activate;
|
||||
}
|
||||
|
||||
void CSVRender::WorldspaceWidget::handleInteraction(InteractionType type, bool activate)
|
||||
{
|
||||
if (activate)
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace CSVRender
|
|||
bool mDragging;
|
||||
int mDragX;
|
||||
int mDragY;
|
||||
bool mSpeedMode;
|
||||
double mDragFactor;
|
||||
double mDragWheelFactor;
|
||||
double mDragShiftFactor;
|
||||
|
@ -208,6 +209,8 @@ namespace CSVRender
|
|||
|
||||
EditMode *getEditMode();
|
||||
|
||||
bool getSpeedMode();
|
||||
|
||||
private:
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
|
@ -269,6 +272,8 @@ namespace CSVRender
|
|||
|
||||
void secondarySelect(bool activate);
|
||||
|
||||
void speedMode(bool activate);
|
||||
|
||||
protected slots:
|
||||
|
||||
void elementSelectionChanged();
|
||||
|
|
Loading…
Reference in a new issue