fix the cursor glitch

This commit is contained in:
Greenlamp 2024-05-19 10:26:59 +02:00
parent 6dff1477da
commit 4785d6b849

View File

@ -373,6 +373,7 @@ export default abstract class AbstractSettingsUiUiHandler extends UiHandler {
// Make the settings container visible to the user. // Make the settings container visible to the user.
this.settingsContainer.setVisible(true); this.settingsContainer.setVisible(true);
// Reset the scroll cursor to the top of the settings container. // Reset the scroll cursor to the top of the settings container.
this.setCursor(0);
this.setScrollCursor(0); this.setScrollCursor(0);
// Move the settings container to the end of the UI stack to ensure it is displayed on top. // Move the settings container to the end of the UI stack to ensure it is displayed on top.
@ -404,12 +405,6 @@ export default abstract class AbstractSettingsUiUiHandler extends UiHandler {
// Extract the type of the gamepad from the active configuration. // Extract the type of the gamepad from the active configuration.
const configType = activeConfig.padType; const configType = activeConfig.padType;
// If a cursor object exists, destroy it to clean up previous UI states.
this.cursorObj?.destroy();
// Reset the cursor object and scroll cursor to ensure they are re-initialized correctly.
this.cursorObj = null;
this.scrollCursor = null;
// Retrieve the layout settings based on the type of the gamepad. // Retrieve the layout settings based on the type of the gamepad.
const layout = this.layout[configType]; const layout = this.layout[configType];
// Update the main controller with configuration details from the selected layout. // Update the main controller with configuration details from the selected layout.