added clear canvas button back to topics view, including javascript code to back it up

This commit is contained in:
Devin Howard 2013-02-22 18:01:15 -05:00
parent e2c28da81e
commit 195889e6fe
3 changed files with 6 additions and 4 deletions

View file

@ -164,9 +164,10 @@ function clearCanvasExceptRoot() {
ids.forEach(function(id, index) {
if (id != root.id) {
Mconsole.graph.removeNode(id);
//OK I feel bad about this, but not too bad
//TODO: this leaves labels hidden on the map
//don't use disposeLabel or they'll never come back!
//maybe there's a better way that recreates the labels later??
Mconsole.labels.hideLabel(id);
$('#topic_' + id + '_label').hide();
}
});
fetchRelatives(root); //also runs Mconsole.plot()

View file

@ -507,6 +507,7 @@ function onPlaceLabelHandler(domElement, node) {
style.top = (top-165) + 'px';
style.display = '';
var label = document.getElementById('topic_' + node.id + '_label');
$(label).show();
w = label.offsetWidth;
style = label.style;
style.left = (-(w / 2 + 106)) + 'px';

View file

@ -10,7 +10,7 @@
# map recenters on a new topic, it's like you're on that topic's page.
# Nice, but the URL and being unable to remove the root node still hamper that
# experience.
# TODO: What URL accesses this view?
# URL: /topics/<topicid>
#
#%>
@ -18,7 +18,7 @@
<% if authenticated? %>
<button onclick="saveToMap();">Save to Map</button>
<% end %>
<!-- <button onclick='clearCanvasExceptRoot();'>Clear Canvas</button> -->
<button onclick='clearCanvasExceptRoot();'>Clear Canvas</button>
</div>
<div class="clearfloat"></div>