diff --git a/src/res/qml/PlayspacePage.qml b/src/res/qml/PlayspacePage.qml index a109652..cb2d24f 100644 --- a/src/res/qml/PlayspacePage.qml +++ b/src/res/qml/PlayspacePage.qml @@ -233,11 +233,11 @@ MyStackViewPage { Layout.preferredWidth: 40 text: "-" onClicked: { - var val = MoveCenterTabController.rotation - 45 + var val = MoveCenterTabController.tempRotation - 45 if (val < -180) { val = val + 360; } - MoveCenterTabController.rotation = val + MoveCenterTabController.tempRotation = val } } @@ -250,11 +250,11 @@ MyStackViewPage { Layout.fillWidth: true onPositionChanged: { var val = this.from + ( this.position * (this.to - this.from)) - playspaceRotationText.text = Math.round(val) + "°" + MoveCenterTabController.tempRotation = Math.round(val) } onValueChanged: { - MoveCenterTabController.rotation = playspaceRotationSlider.value - playspaceRotationText.text = Math.round(playspaceRotationSlider.value) + "°" + MoveCenterTabController.tempRotation = Math.round(playspaceRotationSlider.value) + //playspaceRotationText.text = Math.round(playspaceRotationSlider.value) + "°" } } @@ -263,11 +263,11 @@ MyStackViewPage { Layout.preferredWidth: 40 text: "+" onClicked: { - var val = MoveCenterTabController.rotation + 45 + var val = MoveCenterTabController.tempRotation + 45 if (val > 180) { val = val -360; } - MoveCenterTabController.rotation = val + MoveCenterTabController.tempRotation = val } } @@ -282,10 +282,10 @@ MyStackViewPage { var val = parseInt(input) if (!isNaN(val)) { val = val % 180 - MoveCenterTabController.rotation = val - text = MoveCenterTabController.rotation + "°" + MoveCenterTabController.tempRotation = val + text = MoveCenterTabController.tempRotation + "°" } else { - text = MoveCenterTabController.rotation + "°" + text = MoveCenterTabController.tempRotation + "°" } } } @@ -294,7 +294,7 @@ MyStackViewPage { Layout.preferredWidth: 145 text:"Apply" onClicked: { - MoveCenterTabController.applyRotation() + MoveCenterTabController.rotation = MoveCenterTabController.tempRotation } } @@ -409,6 +409,10 @@ MyStackViewPage { onRotationChanged: { playspaceRotationSlider.value = MoveCenterTabController.rotation } + onTempRotationChanged: { + playspaceRotationSlider.value = MoveCenterTabController.tempRotation + playspaceRotationText.text = MoveCenterTabController.tempRotation + "°" + } onAdjustChaperoneChanged: { playspaceAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone } diff --git a/src/tabcontrollers/MoveCenterTabController.cpp b/src/tabcontrollers/MoveCenterTabController.cpp index e5c932c..5219087 100644 --- a/src/tabcontrollers/MoveCenterTabController.cpp +++ b/src/tabcontrollers/MoveCenterTabController.cpp @@ -136,13 +136,20 @@ int MoveCenterTabController::rotation() const return m_rotation; } +int MoveCenterTabController::tempRotation() const +{ + return m_tempRotation; +} + void MoveCenterTabController::setRotation( int value, bool notify ) { if ( m_rotation != value ) { - // float angle = (value - m_rotation) * 2 * M_PI / 360.0; - // parent->RotateUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, - // angle, m_adjustChaperone); + float angle = ( value - m_rotation ) * 2 * M_PI / 360.0; + parent->RotateUniverseCenter( + ( vr::TrackingUniverseOrigin ) m_trackingUniverse, + angle, + m_adjustChaperone ); m_rotation = value; if ( notify ) { @@ -151,6 +158,15 @@ void MoveCenterTabController::setRotation( int value, bool notify ) } } +void MoveCenterTabController::setTempRotation( int value, bool notify ) +{ + m_tempRotation = value; + if ( notify ) + { + emit tempRotationChanged( m_tempRotation ); + } +} + void MoveCenterTabController::applyRotation() { if ( m_rotation != m_rotationOld ) diff --git a/src/tabcontrollers/MoveCenterTabController.h b/src/tabcontrollers/MoveCenterTabController.h index 75af55d..70809ad 100644 --- a/src/tabcontrollers/MoveCenterTabController.h +++ b/src/tabcontrollers/MoveCenterTabController.h @@ -25,6 +25,8 @@ class MoveCenterTabController : public QObject float offsetZ READ offsetZ WRITE setOffsetZ NOTIFY offsetZChanged ) Q_PROPERTY( int rotation READ rotation WRITE setRotation NOTIFY rotationChanged ) + Q_PROPERTY( int tempRotation READ tempRotation WRITE setTempRotation NOTIFY + tempRotationChanged ) Q_PROPERTY( bool adjustChaperone READ adjustChaperone WRITE setAdjustChaperone NOTIFY adjustChaperoneChanged ) Q_PROPERTY( bool moveShortcutRight READ moveShortcutRight WRITE @@ -49,6 +51,7 @@ private: float m_offsetY = 0.0f; float m_offsetZ = 0.0f; int m_rotation = 0; + int m_tempRotation = 0; int m_rotationOld = 0; bool m_adjustChaperone = true; bool m_moveShortcutRightPressed = false; @@ -78,6 +81,7 @@ public: float offsetY() const; float offsetZ() const; int rotation() const; + int tempRotation() const; bool adjustChaperone() const; bool moveShortcutRight() const; bool moveShortcutLeft() const; @@ -96,6 +100,8 @@ public slots: void setRotation( int value, bool notify = true ); + void setTempRotation( int value, bool notify = true ); + void setAdjustChaperone( bool value, bool notify = true ); void setMoveShortcutRight( bool value, bool notify = true ); @@ -119,6 +125,7 @@ signals: void offsetYChanged( float value ); void offsetZChanged( float value ); void rotationChanged( int value ); + void tempRotationChanged( int value ); void adjustChaperoneChanged( bool value ); void moveShortcutRightChanged( bool value ); void moveShortcutLeftChanged( bool value );