expand calltree node only when click icon

This commit is contained in:
Dmitry Vasilev
2024-02-02 02:30:28 +08:00
parent ccc435d950
commit e94eee537e
4 changed files with 51 additions and 37 deletions

View File

@@ -551,7 +551,12 @@ export const toggle_expanded = (state, is_exp) => {
)
}
const click = (state, id) => {
const select_node = (state, id) => {
const node = find_node(state.calltree, n => n.id == id)
return jump_calltree_node(state, node)
}
const select_and_toggle_expanded = (state, id) => {
const node = find_node(state.calltree, n => n.id == id)
const nextstate = jump_calltree_node(state, node)
if(is_expandable(node)) {
@@ -950,7 +955,8 @@ export const calltree_commands = {
arrow_up,
arrow_left,
arrow_right,
click,
select_node,
select_and_toggle_expanded,
select_return_value,
select_arguments,
select_error,

View File

@@ -67,8 +67,12 @@ export class CallTree {
}
on_click_node(id) {
exec('calltree.click', id)
on_click_node(ev, id) {
if(ev.target.classList.contains('expand_icon')) {
exec('calltree.select_and_toggle_expanded', id)
} else {
exec('calltree.select_node', id)
}
}
clear_calltree(){
@@ -83,11 +87,11 @@ export class CallTree {
const result = el('div', 'callnode',
el('div', {
'class': 'call_el',
click: () => this.on_click_node(n.id),
click: e => this.on_click_node(e, n.id),
},
!is_expandable(n)
? '\xa0'
: is_expanded ? '▼' : '▶',
: el('span', 'expand_icon', is_expanded ? '▼' : '▶'),
n.toplevel
? el('span', '',
el('i', '',