added apply button to rotate playspace instead of automatically rotating

This commit is contained in:
ykeara
2018-12-16 13:58:00 -06:00
parent 859e30dad1
commit 9782839749
3 changed files with 27 additions and 5 deletions
+12
View File
@@ -92,6 +92,7 @@ MyStackViewPage {
} }
MyToggleButton { MyToggleButton {
Layout.preferredWidth: 240
id: lockXToggle id: lockXToggle
text: "Lock X" text: "Lock X"
onCheckedChanged: { onCheckedChanged: {
@@ -141,6 +142,7 @@ MyStackViewPage {
MyToggleButton { MyToggleButton {
Layout.preferredWidth: 240
id: lockYToggle id: lockYToggle
text: "Lock Y" text: "Lock Y"
onCheckedChanged: { onCheckedChanged: {
@@ -190,6 +192,7 @@ MyStackViewPage {
MyToggleButton { MyToggleButton {
Layout.preferredWidth: 240
id: lockZToggle id: lockZToggle
text: "Lock Z" text: "Lock Z"
onCheckedChanged: { onCheckedChanged: {
@@ -286,6 +289,15 @@ MyStackViewPage {
} }
} }
} }
MyPushButton {
id: playSpaceRotationApplyButton
Layout.preferredWidth: 145
text:"Apply"
onClicked: {
MoveCenterTabController.applyRotation()
}
}
} }
} }
} }
+10 -2
View File
@@ -113,8 +113,8 @@ int MoveCenterTabController::rotation() const {
void MoveCenterTabController::setRotation(int value, bool notify) { void MoveCenterTabController::setRotation(int value, bool notify) {
if (m_rotation != value) { if (m_rotation != value) {
float angle = (value - m_rotation) * 2 * M_PI / 360.0; //float angle = (value - m_rotation) * 2 * M_PI / 360.0;
parent->RotateUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, angle, m_adjustChaperone); //parent->RotateUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, angle, m_adjustChaperone);
m_rotation = value; m_rotation = value;
if (notify) { if (notify) {
emit rotationChanged(m_rotation); emit rotationChanged(m_rotation);
@@ -122,6 +122,14 @@ void MoveCenterTabController::setRotation(int value, bool notify) {
} }
} }
void MoveCenterTabController::applyRotation() {
if (m_rotation != m_rotationOld) {
float angle = (m_rotationOld - m_rotation) * 2 * M_PI / 360.0;
parent->RotateUniverseCenter((vr::TrackingUniverseOrigin)m_trackingUniverse, angle, m_adjustChaperone);
m_rotationOld = m_rotation;
}
}
bool MoveCenterTabController::adjustChaperone() const { bool MoveCenterTabController::adjustChaperone() const {
return m_adjustChaperone; return m_adjustChaperone;
} }
@@ -37,6 +37,7 @@ private:
float m_offsetY = 0.0f; float m_offsetY = 0.0f;
float m_offsetZ = 0.0f; float m_offsetZ = 0.0f;
int m_rotation = 0; int m_rotation = 0;
int m_rotationOld = 0;
bool m_adjustChaperone = true; bool m_adjustChaperone = true;
bool m_moveShortcutRightPressed = false; bool m_moveShortcutRightPressed = false;
bool m_moveShortcutLeftPressed = false; bool m_moveShortcutLeftPressed = false;
@@ -96,6 +97,7 @@ public slots:
void setLockY(bool value, bool notify = true); void setLockY(bool value, bool notify = true);
void setLockZ(bool value, bool notify = true); void setLockZ(bool value, bool notify = true);
void applyRotation();
void reset(); void reset();
signals: signals: