Skip to content

Commit

Permalink
Workaround for unused axis % labels
Browse files Browse the repository at this point in the history
  • Loading branch information
elecpower committed Sep 21, 2024
1 parent 34d395d commit c1d0e04
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions companion/src/simulation/widgets/virtualjoystickwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,26 @@ void VirtualJoystickWidget::onButtonChange(bool checked)

void VirtualJoystickWidget::updateNodeValueLabels()
{
if (nodeLabelX)
nodeLabelX->setText(QString("%1").arg(getStickX() * 100.0f, 2, 'f', 0));
if (nodeLabelY)
nodeLabelY->setText(QString("%1").arg(getStickY() * 100.0f, 2, 'f', 0));
if (isBoardSurface) {
if (nodeLabelX) {
if (stickSide == 'L')
nodeLabelX->setText(QString("%1").arg(0)); // workaround for resize event and no analog mapped to set
else
nodeLabelX->setText(QString("%1").arg(getStickX() * 100.0f, 2, 'f', 0));
}
if (nodeLabelY) {
if (stickSide == 'L')
nodeLabelY->setText(QString("%1").arg(getStickY() * 100.0f, 2, 'f', 0));
else
nodeLabelY->setText(QString("%1").arg(0)); // workaround for resize event and no analog mapped to set
}
}
else {
if (nodeLabelX)
nodeLabelX->setText(QString("%1").arg(getStickX() * 100.0f, 2, 'f', 0));
if (nodeLabelY)
nodeLabelY->setText(QString("%1").arg(getStickY() * 100.0f, 2, 'f', 0));
}
}

void VirtualJoystickWidget::onGsMouseEvent(QGraphicsSceneMouseEvent * event)
Expand Down

0 comments on commit c1d0e04

Please sign in to comment.