diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-07-27 17:52:03 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-07-27 17:52:03 +0200 |
commit | 095a77f1a13aa4024c4ceba9c9dfac4ad948d3c7 (patch) | |
tree | a9e6a1d25a7a842610d88d21b4e963a5008c88e9 /src | |
parent | e69ffe367cf588a726ca15599b115514d9918649 (diff) |
Hide child indicator and description ellipsis when node is expanded.
Diffstat (limited to 'src')
-rw-r--r-- | src/ws/munia.css | 5 | ||||
-rw-r--r-- | src/ws/node.js | 32 | ||||
-rw-r--r-- | src/ws/view.js | 12 |
3 files changed, 26 insertions, 23 deletions
diff --git a/src/ws/munia.css b/src/ws/munia.css index 75321ec..04fd75a 100644 --- a/src/ws/munia.css +++ b/src/ws/munia.css @@ -76,6 +76,11 @@ body opacity: 0.6; } +.children_indicator:not(.collapsed) +{ + display: none; +} + .node .title { clear: both; diff --git a/src/ws/node.js b/src/ws/node.js index 424aa99..fd4a9d7 100644 --- a/src/ws/node.js +++ b/src/ws/node.js @@ -218,19 +218,8 @@ Node.prototype.create = function() // oberveid from the node id alone. node.id = createId(this.subscribeid, this.id); - { - var collapsed = localStorage.getItem(node.id+"_collapsed") == "true"; - if(collapsed) - { - this.element.classList.add('collapsed'); - this.collapse_button.innerHTML = "▼"; - } - else - { - this.element.classList.remove('collapsed'); - this.collapse_button.innerHTML = "▲"; - } - } + var collapsed = localStorage.getItem(node.id+"_collapsed") == "true"; + this.setCollapsed(collapsed); }; Node.prototype.updateAnnotations = function() @@ -250,6 +239,23 @@ Node.prototype.updateAnnotations = function() this.children_indicator_element.innerHTML = ann; }; +Node.prototype.setCollapsed = function(collapsed) +{ + if(collapsed) + { + this.children_indicator_element.classList.add('collapsed'); + this.element.classList.add('collapsed'); + this.collapse_button.innerHTML = "▼"; + } + else + { + this.children_indicator_element.classList.remove('collapsed'); + this.element.classList.remove('collapsed'); + this.collapse_button.innerHTML = "▲"; + } +}; + + //! Recursively set draggable property from node until root node. Node.prototype.setDraggable = function(value) { diff --git a/src/ws/view.js b/src/ws/view.js index bdc5149..5b69a24 100644 --- a/src/ws/view.js +++ b/src/ws/view.js @@ -396,16 +396,8 @@ function collapse(e) localStorage.setItem(id+"_collapsed", collapsed?"true":"false"); e.stopPropagation(); - if(collapsed) - { - node.element.classList.add('collapsed'); - node.collapse_button.innerHTML = "▼"; - } - else - { - node.element.classList.remove('collapsed'); - node.collapse_button.innerHTML = "▲"; - } + + node.setCollapsed(collapsed); } function changeState(e) |