mirror of
https://github.com/imgurbot12/rmenu.git
synced 2024-11-10 11:33:48 +01:00
fix: execute must trigger render update
This commit is contained in:
parent
deda448b71
commit
63057c6f7d
@ -215,14 +215,14 @@ fn gui_entry(mut row: Row) -> Element {
|
|||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
row.position.with_mut(|p| p.set(row.search_index, 0));
|
row.position.with_mut(|p| p.set(row.search_index, 0));
|
||||||
if single_click && !menu_active {
|
if single_click && !menu_active {
|
||||||
let pos = row.position.clone();
|
let mut pos = row.position.clone();
|
||||||
result_ctx1.borrow_mut().execute(row.entry_index, &pos);
|
result_ctx1.borrow_mut().execute(row.entry_index, &mut pos);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ondoubleclick: move |_| {
|
ondoubleclick: move |_| {
|
||||||
if !menu_active {
|
if !menu_active {
|
||||||
let pos = row.position.clone();
|
let mut pos = row.position.clone();
|
||||||
result_ctx2.borrow_mut().execute(row.entry_index, &pos);
|
result_ctx2.borrow_mut().execute(row.entry_index, &mut pos);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// content
|
// content
|
||||||
@ -280,13 +280,13 @@ fn gui_entry(mut row: Row) -> Element {
|
|||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
row.position.with_mut(|p| p.set(row.search_index, 0));
|
row.position.with_mut(|p| p.set(row.search_index, 0));
|
||||||
if single_click {
|
if single_click {
|
||||||
let pos = row.position.clone();
|
let mut pos = row.position.clone();
|
||||||
ctx.borrow_mut().execute(row.entry_index, &pos);
|
ctx.borrow_mut().execute(row.entry_index, &mut pos);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ondoubleclick: move |_| {
|
ondoubleclick: move |_| {
|
||||||
let pos = row.position.clone();
|
let mut pos = row.position.clone();
|
||||||
ctx2.borrow_mut().execute(row.entry_index, &pos);
|
ctx2.borrow_mut().execute(row.entry_index, &mut pos);
|
||||||
},
|
},
|
||||||
// content
|
// content
|
||||||
div {
|
div {
|
||||||
@ -333,8 +333,8 @@ fn context_menu(ctx_menu: Signal<ContextMenu>, position: Signal<Position>) -> El
|
|||||||
href: "#",
|
href: "#",
|
||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
position.with_mut(|p| p.subpos = idx);
|
position.with_mut(|p| p.subpos = idx);
|
||||||
let pos = position.clone();
|
let mut pos = position.clone();
|
||||||
ctx.borrow_mut().execute(index, &pos);
|
ctx.borrow_mut().execute(index, &mut pos);
|
||||||
},
|
},
|
||||||
"{name}"
|
"{name}"
|
||||||
}
|
}
|
||||||
|
@ -173,9 +173,10 @@ impl Context {
|
|||||||
self.scroll(pos.with(|p| p.pos) + 3);
|
self.scroll(pos.with(|p| p.pos) + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute(&mut self, index: usize, pos: &Pos) {
|
//NOTE: using with_mut to trigger rendering update
|
||||||
|
pub fn execute(&mut self, index: usize, pos: &mut Pos) {
|
||||||
let entry = self.get_entry(index);
|
let entry = self.get_entry(index);
|
||||||
let (pos, subpos) = pos.with(|p| (p.pos, p.subpos));
|
let (pos, subpos) = pos.with_mut(|p| (p.pos, p.subpos));
|
||||||
log::debug!("execute-pos {pos} {subpos}");
|
log::debug!("execute-pos {pos} {subpos}");
|
||||||
let Some(action) = entry.actions.get(subpos) else {
|
let Some(action) = entry.actions.get(subpos) else {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user