sensitivity settings

sceneinput
Marc Zinnschlag 9 years ago
parent 1d4f8b2595
commit 323f8bb29f

@ -405,6 +405,21 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
Setting *contextSensitive = createSetting (Type_CheckBox, "context-select", "Context Sensitive Selection");
contextSensitive->setDefaultValue ("false");
Setting *dragMouseSensitivity = createSetting (Type_DoubleSpinBox, "drag-factor",
"Mouse sensitivity during drag operations");
dragMouseSensitivity->setDefaultValue (1.0);
dragMouseSensitivity->setRange (0.001, 100.0);
Setting *dragWheelSensitivity = createSetting (Type_DoubleSpinBox, "drag-wheel-factor",
"Mouse wheel sensitivity during drag operations");
dragWheelSensitivity->setDefaultValue (1.0);
dragWheelSensitivity->setRange (0.001, 100.0);
Setting *dragShiftFactor = createSetting (Type_DoubleSpinBox, "drag-shift-factor",
"Acceleration factor during drag operations while holding down shift");
dragShiftFactor->setDefaultValue (4.0);
dragShiftFactor->setRange (0.001, 100.0);
}
{

@ -54,10 +54,10 @@ bool CSVRender::EditMode::selectStartDrag (osg::ref_ptr<TagBase> tag)
return false;
}
void CSVRender::EditMode::drag (int diffX, int diffY) {}
void CSVRender::EditMode::drag (int diffX, int diffY, double speedFactor) {}
void CSVRender::EditMode::dragCompleted() {}
void CSVRender::EditMode::dragAborted() {}
void CSVRender::EditMode::dragWheel (int diff) {}
void CSVRender::EditMode::dragWheel (int diff, double speedFactor) {}

@ -61,7 +61,7 @@ namespace CSVRender
virtual bool selectStartDrag (osg::ref_ptr<TagBase> tag);
/// Default-implementation: ignored
virtual void drag (int diffX, int diffY);
virtual void drag (int diffX, int diffY, double speedFactor);
/// Default-implementation: ignored
virtual void dragCompleted();
@ -73,7 +73,7 @@ namespace CSVRender
virtual void dragAborted();
/// Default-implementation: ignored
virtual void dragWheel (int diff);
virtual void dragWheel (int diff, double speedFactor);
};
}

@ -81,6 +81,10 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg
key += sMappingSettings[i];
storeMappingSetting (key, CSMSettings::UserSettings::instance().settingValue (key));
}
mDragFactor = CSMSettings::UserSettings::instance().settingValue ("scene-input/drag-factor").toDouble();
mDragWheelFactor = CSMSettings::UserSettings::instance().settingValue ("scene-input/drag-wheel-factor").toDouble();
mDragShiftFactor = CSMSettings::UserSettings::instance().settingValue ("scene-input/drag-shift-factor").toDouble();
}
CSVRender::WorldspaceWidget::~WorldspaceWidget ()
@ -284,7 +288,14 @@ void CSVRender::WorldspaceWidget::updateUserSetting (const QString& name, const
if (!value.isEmpty() && storeMappingSetting (name, value.first()))
return;
dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent()).updateUserSetting (name, value);
if (name=="scene-input/drag-factor")
mDragFactor = value.at (0).toDouble();
else if (name=="scene-input/drag-wheel-factor")
mDragWheelFactor = value.at (0).toDouble();
else if (name=="scene-input/drag-shift-factor")
mDragShiftFactor = value.at (0).toDouble();
else
dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent()).updateUserSetting (name, value);
}
void CSVRender::WorldspaceWidget::setEditLock (bool locked)
@ -530,9 +541,14 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
mDragX = event->x();
mDragY = height() - event->y();
double factor = mDragFactor;
if (QApplication::keyboardModifiers() & Qt::ShiftModifier)
factor *= mDragShiftFactor;
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
editMode.drag (diffX, diffY);
editMode.drag (diffX, diffY, factor);
}
RenderWidget::mouseMoveEvent(event);
@ -601,9 +617,14 @@ void CSVRender::WorldspaceWidget::wheelEvent (QWheelEvent *event)
{
if (mDragging)
{
double factor = mDragWheelFactor;
if (QApplication::keyboardModifiers() & Qt::ShiftModifier)
factor *= mDragShiftFactor;
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
editMode.dragWheel (event->delta());
editMode.dragWheel (event->delta(), factor);
}
RenderWidget::wheelEvent(event);

@ -43,6 +43,9 @@ namespace CSVRender
bool mDragging;
int mDragX;
int mDragY;
double mDragFactor;
double mDragWheelFactor;
double mDragShiftFactor;
public:

Loading…
Cancel
Save