Showing
2 changed files
with
39 additions
and
20 deletions
... | @@ -140,7 +140,6 @@ | ... | @@ -140,7 +140,6 @@ |
140 | // click handler for "selectable" objects | 140 | // click handler for "selectable" objects |
141 | $(document).on('click', '.select-object', function () { | 141 | $(document).on('click', '.select-object', function () { |
142 | // when any object of class "select-object" is clicked... | 142 | // when any object of class "select-object" is clicked... |
143 | - // TODO: get a reference to the object via lookup... | ||
144 | var obj = network.lookup[$(this).data('id')]; | 143 | var obj = network.lookup[$(this).data('id')]; |
145 | if (obj) { | 144 | if (obj) { |
146 | selectObject(obj); | 145 | selectObject(obj); |
... | @@ -862,6 +861,7 @@ | ... | @@ -862,6 +861,7 @@ |
862 | 861 | ||
863 | if (node.classed('selected')) { | 862 | if (node.classed('selected')) { |
864 | deselectObject(); | 863 | deselectObject(); |
864 | + flyinPane(null); | ||
865 | return; | 865 | return; |
866 | } | 866 | } |
867 | deselectObject(false); | 867 | deselectObject(false); |
... | @@ -871,9 +871,8 @@ | ... | @@ -871,9 +871,8 @@ |
871 | el : el | 871 | el : el |
872 | }; | 872 | }; |
873 | 873 | ||
874 | -// highlightObject(obj); | ||
875 | - | ||
876 | node.classed('selected', true); | 874 | node.classed('selected', true); |
875 | + flyinPane(obj); | ||
877 | 876 | ||
878 | // TODO animate incoming info pane | 877 | // TODO animate incoming info pane |
879 | // resize(true); | 878 | // resize(true); |
... | @@ -889,7 +888,26 @@ | ... | @@ -889,7 +888,26 @@ |
889 | // deselect all nodes in the network... | 888 | // deselect all nodes in the network... |
890 | network.node.classed('selected', false); | 889 | network.node.classed('selected', false); |
891 | selected = {}; | 890 | selected = {}; |
892 | -// highlightObject(null); | 891 | + flyinPane(null); |
892 | + } | ||
893 | + | ||
894 | + function flyinPane(obj) { | ||
895 | + var pane = d3.select('#flyout'), | ||
896 | + right = (obj ? '20px' : '-320px'), // TODO: parameterize | ||
897 | + opac = (obj ? 1.0 : 0.0); | ||
898 | + | ||
899 | + if (obj) { | ||
900 | + $('#flyout').empty(); | ||
901 | + pane.append('h2').text(obj.id); | ||
902 | + pane.append('p').text('class: ' + obj.class); | ||
903 | + if (obj.type) { | ||
904 | + pane.append('p').text('type: ' + obj.type); | ||
905 | + } | ||
906 | + } | ||
907 | + | ||
908 | + pane.transition().duration(750) | ||
909 | + .style('right', right) | ||
910 | + .style('opacity', opac); | ||
893 | } | 911 | } |
894 | 912 | ||
895 | function highlightObject(obj) { | 913 | function highlightObject(obj) { |
... | @@ -929,17 +947,7 @@ | ... | @@ -929,17 +947,7 @@ |
929 | } | 947 | } |
930 | 948 | ||
931 | 949 | ||
932 | - function resize(showDetails) { | 950 | + function resize() { |
933 | - console.log("resize() called..."); | ||
934 | - | ||
935 | - var $details = $('#details'); | ||
936 | - | ||
937 | - if (typeof showDetails == 'boolean') { | ||
938 | - var showingDetails = showDetails; | ||
939 | - // TODO: invoke $details.show() or $details.hide()... | ||
940 | - // $details[showingDetails ? 'show' : 'hide'](); | ||
941 | - } | ||
942 | - | ||
943 | view.height = window.innerHeight - config.mastHeight; | 951 | view.height = window.innerHeight - config.mastHeight; |
944 | view.width = window.innerWidth; | 952 | view.width = window.innerWidth; |
945 | $('#view') | 953 | $('#view') | ... | ... |
... | @@ -203,14 +203,25 @@ svg .legend .category text { | ... | @@ -203,14 +203,25 @@ svg .legend .category text { |
203 | } | 203 | } |
204 | 204 | ||
205 | #flyout { | 205 | #flyout { |
206 | + position: absolute; | ||
207 | + z-index: 100; | ||
208 | + display: block; | ||
209 | + top: 10%; | ||
206 | width: 300px; | 210 | width: 300px; |
207 | height: 80%; | 211 | height: 80%; |
208 | - top: 10%; | 212 | + right: -320px; |
209 | - right: 2%; | 213 | + opacity: 0; |
210 | background-color: rgba(0,0,0,0.5); | 214 | background-color: rgba(0,0,0,0.5); |
215 | + padding: 10px; | ||
216 | + color: white; | ||
217 | +} | ||
211 | 218 | ||
212 | - position: absolute; | 219 | +#flyout h2 { |
213 | - z-index: 100; | 220 | + margin: 8px 4px; |
214 | - display: none; | 221 | + color: yellow; |
222 | +} | ||
223 | + | ||
224 | +#flyout p { | ||
225 | + margin: 4px 4px; | ||
215 | } | 226 | } |
216 | 227 | ... | ... |
-
Please register or login to post a comment