Correctly handle full screen and vsync buttons.

Fixes #1110.

The code was using outdated indices since 48eb75ae92. It now uses the more stable pdata pointer.

PiperOrigin-RevId: 574805349
Change-Id: If6112fb2af7d60f17b35599233b24f33b6a8cac6
This commit is contained in:
Nimrod Gileadi
2023-10-19 03:37:22 -07:00
committed by Copybara-Service
parent 44ba099fd6
commit 9393c690d4
2 changed files with 13 additions and 15 deletions
+8
View File
@@ -2,6 +2,14 @@
Changelog
=========
Upcoming version (not yet released)
-----------------------------------
Bug fixes
^^^^^^^^^
1. Fix in simulate: correct handling of "Pause update", "Fullscreen" and "VSync" buttons.
Version 3.0.0 (October 18, 2023)
--------------------------------
+5 -15
View File
@@ -1343,28 +1343,18 @@ void UiEvent(mjuiState* state) {
// option section
else if (it && it->sectionid==SECT_OPTION) {
switch (it->itemid) {
case 0: // Spacing
if (it->pdata == &sim->spacing) {
sim->ui0.spacing = mjui_themeSpacing(sim->spacing);
sim->ui1.spacing = mjui_themeSpacing(sim->spacing);
break;
case 1: // Color
} else if (it->pdata == &sim->color) {
sim->ui0.color = mjui_themeColor(sim->color);
sim->ui1.color = mjui_themeColor(sim->color);
break;
case 2: // Font
} else if (it->pdata == &sim->font) {
mjr_changeFont(50*(sim->font+1), &sim->platform_ui->mjr_context());
break;
case 9: // Full screen
} else if (it->pdata == &sim->fullscreen) {
sim->platform_ui->ToggleFullscreen();
break;
case 10: // Vertical sync
} else if (it->pdata == &sim->vsync) {
sim->platform_ui->SetVSync(sim->vsync);
break;
}
// modify UI