Skip to content

Commit

Permalink
remove the "cancel on escape" behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Paril committed Jul 30, 2024
1 parent ad5b411 commit c065ea6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
22 changes: 0 additions & 22 deletions Source/Core/Elements/WidgetDropDown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,6 @@ int WidgetDropDown::AddOption(const String& rml, const String& option_value, int

int result = AddOption(std::move(element), before);

value_last_selected = -1;

return result;
}

Expand All @@ -418,8 +416,6 @@ int WidgetDropDown::AddOption(ElementPtr element, int before)
option_index = before;
}

value_last_selected = -1;

return option_index;
}

Expand All @@ -429,17 +425,13 @@ void WidgetDropDown::RemoveOption(int index)
if (!element)
return;

value_last_selected = -1;

selection_element->RemoveChild(element);
}

void WidgetDropDown::ClearOptions()
{
while (Element* element = selection_element->GetLastChild())
selection_element->RemoveChild(element);

value_last_selected = -1;
}

Element* WidgetDropDown::GetOption(int index)
Expand Down Expand Up @@ -468,7 +460,6 @@ void WidgetDropDown::OnChildAdd(Element* element)
SetSelection(element, true);

selection_dirty = true;
value_last_selected = -1;
box_layout_dirty = DropDownBoxLayoutType::Switch;
}

Expand All @@ -483,7 +474,6 @@ void WidgetDropDown::OnChildRemove(Element* element)
SetSelection(nullptr);

selection_dirty = true;
value_last_selected = -1;
box_layout_dirty = DropDownBoxLayoutType::Switch;
}

Expand Down Expand Up @@ -604,17 +594,6 @@ void WidgetDropDown::ProcessEvent(Event& event)
parent_element->Click();
event.StopPropagation();
break;
case Input::KI_ESCAPE:
if (!box_visible)
break;
if (value_last_selected != -1)
{
SetSelection(GetOption(value_last_selected), true);
value_last_selected = -1;
}
ShowSelectBox(false);
event.StopPropagation();
break;
default: break;
}
}
Expand Down Expand Up @@ -653,7 +632,6 @@ void WidgetDropDown::ShowSelectBox(bool show)
value_element->SetPseudoClass("checked", true);
button_element->SetPseudoClass("checked", true);
box_layout_dirty = DropDownBoxLayoutType::Open;
value_last_selected = GetSelection();
AttachScrollEvent();
}
else
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Elements/WidgetDropDown.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ class WidgetDropDown : public EventListener {
bool value_layout_dirty;
DropDownBoxLayoutType box_layout_dirty;
bool box_visible;
int value_last_selected;
};

} // namespace Rml
Expand Down

0 comments on commit c065ea6

Please sign in to comment.