Complete hash_layout for menu::List
This commit is contained in:
parent
625979b665
commit
9fa0b4da5d
1 changed files with 12 additions and 3 deletions
|
|
@ -113,6 +113,9 @@ where
|
||||||
fn hash_layout(&self, state: &mut Hasher, position: Point) {
|
fn hash_layout(&self, state: &mut Hasher, position: Point) {
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
|
struct Marker;
|
||||||
|
std::any::TypeId::of::<Marker>().hash(state);
|
||||||
|
|
||||||
(position.x as u32).hash(state);
|
(position.x as u32).hash(state);
|
||||||
(position.y as u32).hash(state);
|
(position.y as u32).hash(state);
|
||||||
}
|
}
|
||||||
|
|
@ -138,10 +141,11 @@ where
|
||||||
clipboard,
|
clipboard,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let option_was_selected = current_messages < messages.len();
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left))
|
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left))
|
||||||
if !bounds.contains(cursor_position)
|
if !bounds.contains(cursor_position) || option_was_selected =>
|
||||||
|| current_messages < messages.len() =>
|
|
||||||
{
|
{
|
||||||
*self.is_open = false;
|
*self.is_open = false;
|
||||||
}
|
}
|
||||||
|
|
@ -245,7 +249,12 @@ where
|
||||||
fn hash_layout(&self, state: &mut Hasher) {
|
fn hash_layout(&self, state: &mut Hasher) {
|
||||||
use std::hash::Hash as _;
|
use std::hash::Hash as _;
|
||||||
|
|
||||||
0.hash(state);
|
struct Marker;
|
||||||
|
std::any::TypeId::of::<Marker>().hash(state);
|
||||||
|
|
||||||
|
self.options.len().hash(state);
|
||||||
|
self.text_size.hash(state);
|
||||||
|
self.padding.hash(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_event(
|
fn on_event(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue