Add snap turn angle settings ui
This commit is contained in:
@@ -78,6 +78,11 @@ void MoveCenterTabController::initStage1()
|
||||
{
|
||||
m_turnComfortFactor = value.toUInt();
|
||||
}
|
||||
value = settings->value( "snapTurnAngle", m_snapTurnAngle );
|
||||
if ( value.isValid() && !value.isNull() )
|
||||
{
|
||||
m_snapTurnAngle = value.toInt();
|
||||
}
|
||||
value = settings->value( "heightToggleOffset", m_heightToggleOffset );
|
||||
if ( value.isValid() && !value.isNull() )
|
||||
{
|
||||
@@ -256,6 +261,28 @@ void MoveCenterTabController::setTempRotation( int value, bool notify )
|
||||
}
|
||||
}
|
||||
|
||||
int MoveCenterTabController::snapTurnAngle() const
|
||||
{
|
||||
return m_snapTurnAngle;
|
||||
}
|
||||
|
||||
void MoveCenterTabController::setSnapTurnAngle( int value, bool notify )
|
||||
{
|
||||
if ( m_snapTurnAngle != value )
|
||||
{
|
||||
m_snapTurnAngle = value;
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup( "playspaceSettings" );
|
||||
settings->setValue( "snapTurnAngle", m_snapTurnAngle );
|
||||
settings->endGroup();
|
||||
settings->sync();
|
||||
if ( notify )
|
||||
{
|
||||
emit snapTurnAngleChanged( m_snapTurnAngle );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool MoveCenterTabController::adjustChaperone() const
|
||||
{
|
||||
return m_adjustChaperone;
|
||||
@@ -1363,7 +1390,7 @@ void MoveCenterTabController::snapTurnLeft( bool snapTurnLeftJustPressed )
|
||||
|
||||
// TODO add interface to configure snap angle.
|
||||
// temporarily hard coded to 45 degrees
|
||||
int newRotationAngleDeg = m_rotation - 4500;
|
||||
int newRotationAngleDeg = m_rotation - m_snapTurnAngle;
|
||||
// Keep angle within -18000 ~ 18000 centidegrees
|
||||
if ( newRotationAngleDeg > 18000 )
|
||||
{
|
||||
@@ -1386,7 +1413,7 @@ void MoveCenterTabController::snapTurnRight( bool snapTurnRightJustPressed )
|
||||
|
||||
// TODO add interface to configure snap angle.
|
||||
// temporarily hard coded to 45 degrees
|
||||
int newRotationAngleDeg = m_rotation + 4500;
|
||||
int newRotationAngleDeg = m_rotation + m_snapTurnAngle;
|
||||
// Keep angle within -18000 ~ 18000 centidegrees
|
||||
if ( newRotationAngleDeg > 18000 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user