only change to mouse after click

This commit is contained in:
thecozies 2024-03-04 09:16:35 -06:00
parent 6845e5ef4f
commit a84258c3f6
5 changed files with 38 additions and 4 deletions

View File

@ -18,7 +18,7 @@
<label class="config-option__title">Rumble Strength</label>
<div class="config-option__list config-option__list">
<label class="config-option__range-label">{{rumble_strength}}</label>
<input id="rumble_strength_input" type="range" min="0" max="100" style="flex:1;margin: 0dp;nav-up:auto;nav-down:auto;" data-value="rumble_strength"/>
<input class="nav-vert" id="rumble_strength_input" type="range" min="0" max="100" style="flex: 1; margin: 0dp;" data-value="rumble_strength"/>
</div>
</div>
</div>

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,21 @@ body
pointer-events: none;
}
}
.nav-vert {
@extend %nav-vert;
}
.nav-horiz {
@extend %nav-horiz;
}
.nav-dir {
@extend %nav-dir;
}
.nav-foc {
@extend %nav-foc;
}
.nav-all {
@extend %nav-all;
}
*, *:before, *:after {
box-sizing: border-box;

View File

@ -1,11 +1,19 @@
%nav-dir {
%nav-vert {
nav-up: auto;
nav-down: auto;
}
%nav-horiz {
nav-right: auto;
nav-left: auto;
}
%nav-dir {
@extend %nav-vert;
@extend %nav-horiz;
}
%nav-foc {
focus: auto;
tab-index: auto;

View File

@ -771,9 +771,9 @@ struct UIContext {
std::unordered_map<recomp::Menu, Rml::ElementDocument*> documents;
Rml::ElementDocument* current_document;
Rml::Element* prev_focused;
bool mouse_is_active = true;
bool mouse_is_active_changed = false;
public:
bool mouse_is_active = false;
std::unique_ptr<SystemInterface_SDL> system_interface;
std::unique_ptr<RmlRenderInterface_RT64> render_interface;
std::unique_ptr<Rml::FontEngineInterface> font_interface;
@ -811,6 +811,8 @@ struct UIContext {
current_document = nullptr;
}
prev_focused = nullptr;
mouse_is_active = false;
mouse_is_active_changed = false;
}
void swap_config_menu(recomp::ConfigSubmenu submenu) {
@ -821,6 +823,8 @@ struct UIContext {
if (config_tabset != nullptr) {
config_tabset->SetActiveTab(static_cast<int>(submenu));
prev_focused = nullptr;
mouse_is_active = false;
mouse_is_active_changed = false;
}
}
}
@ -851,6 +855,8 @@ struct UIContext {
}
prev_focused = nullptr;
mouse_is_active = false;
mouse_is_active_changed = false;
}
void make_event_listeners() {
@ -1100,6 +1106,11 @@ void draw_hook(RT64::RenderCommandList* command_list, RT64::RenderFramebuffer* s
// Implement some additional behavior for specific events on top of what RmlUi normally does with them.
switch (cur_event.type) {
case SDL_EventType::SDL_MOUSEMOTION:
if (!ui_context->rml.mouse_is_active) {
break;
}
// fallthrough
case SDL_EventType::SDL_MOUSEBUTTONDOWN:
mouse_moved = true;
break;