diff --git a/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp b/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp index de3d81708590d..3b58ded626439 100644 --- a/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp +++ b/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp @@ -73,10 +73,7 @@ void CustomToggleSwitch::paintEvent(QPaintEvent *) void CustomToggleSwitch::mouseReleaseEvent(QMouseEvent * event) { if (event->button() == Qt::LeftButton) { - int middleX = rect().center().x(); // Calculate the middle of the switch - bool newState = event->pos().x() >= middleX; // Determine new state based on click position - - setCheckedState(newState); + setCheckedState(!isChecked()); } QCheckBox::mouseReleaseEvent(event); }