mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
expand calltree node only when click icon
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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', '',
|
||||
|
||||
Reference in New Issue
Block a user