diff --git a/app/assets/javascripts/Jit/graphsettings.js b/app/assets/javascripts/Jit/graphsettings.js index 5e19339e..36acdacd 100644 --- a/app/assets/javascripts/Jit/graphsettings.js +++ b/app/assets/javascripts/Jit/graphsettings.js @@ -76,7 +76,7 @@ function graphSettings(type) { tempNode2 = null; tempInit = false; } - else if (dragged != 0 && goRealtime) { saveLayout(dragged); } + else if (dragged != 0 && goRealtime) { saveLayout(dragged); } }, onDragCancel: function() { tempNode = null; @@ -94,6 +94,8 @@ function graphSettings(type) { }, //Add also a click handler to nodes onClick: function (node, eventInfo, e) { + console.log(e); + if (e.target.id != "infovis-canvas") return false; //clicking on a node, or clicking on blank part of canvas? if (node.nodeFrom) { selectEdgeOnClickHandler(node); @@ -121,9 +123,14 @@ function graphSettings(type) { var left = parseInt(style.left); var top = parseInt(style.top); var w = domElement.offsetWidth; - style.left = (left - w / 2) + 'px'; - style.top = (top+25) + 'px'; + style.left = (left - w / 2 + 107) + 'px'; + //style.left = (left - w / 2) + 'px'; + style.top = (top-165) + 'px'; style.display = ''; + var label = document.getElementById('topic_' + node.id + '_label'); + w = label.offsetWidth; + style = label.style; + style.left = (-(w / 2 + 106)) + 'px'; } }; } else if (type = "centered") { @@ -222,6 +229,7 @@ function graphSettings(type) { }, //Add also a click handler to nodes onClick: function (node, eventInfo, e) { + if (e.target.id != "infovis-canvas") return false; //clicking on an edge, a node, or clicking on blank part of canvas? if (eventInfo.getEdge() != false || node.nodeFrom) { if (eventInfo.getEdge() != false) selectEdgeOnClickHandler(eventInfo.getEdge()); @@ -256,9 +264,14 @@ function graphSettings(type) { var left = parseInt(style.left); var top = parseInt(style.top); var w = domElement.offsetWidth; - style.left = (left - w / 2) + 'px'; - style.top = (top+25) + 'px'; + style.left = (left - w / 2 + 107) + 'px'; + //style.left = (left - w / 2) + 'px'; + style.top = (top-165) + 'px'; style.display = ''; + var label = document.getElementById('topic_' + node.id + '_label'); + w = label.offsetWidth; + style = label.style; + style.left = (-(w / 2 + 106)) + 'px'; } }; } @@ -568,7 +581,10 @@ function onCreateLabelHandler(domElement, node) { data-object="topic" \ data-nil="$_desc_nil_$" \ data-attribute="desc" \ + data-ok-button="Save" \ + data-cancel-button="Discard" \ data-type="textarea">$_desc_$ \ +
\ \ \ $_go_link_$ \ @@ -672,8 +688,10 @@ function onCreateLabelHandler(domElement, node) { // Create a 'name' button and add it to the main node label var nameContainer = document.createElement('span'), - style = nameContainer.style; + style = nameContainer.style; nameContainer.className = 'name topic_' + node.id; + nameContainer.id = 'topic_' + node.id + '_label'; + var littleHTML = ' \
$_name_$
\
'; diff --git a/app/assets/stylesheets/ForceDirected.css b/app/assets/stylesheets/ForceDirected.css index c185bb4c..9c4662df 100644 --- a/app/assets/stylesheets/ForceDirected.css +++ b/app/assets/stylesheets/ForceDirected.css @@ -12,4 +12,6 @@ span.name { cursor: pointer; + position: absolute; + top: 185px; } diff --git a/app/assets/stylesheets/base.css b/app/assets/stylesheets/base.css index 21244347..a0c2cf78 100644 --- a/app/assets/stylesheets/base.css +++ b/app/assets/stylesheets/base.css @@ -12,9 +12,6 @@ color:#FFF; text-align: left; overflow: visible; - position: relative; - top: -185px; - left: 107px; z-index:14000; } @@ -92,3 +89,20 @@ overflow: hidden; text-overflow: ellipsis; } + +.best_in_place_desc { + width:160px; + height:200px; + display:block; + margin-top:2px; +} + +.best_in_place_desc input { + float: right; + margin: 2px 0px 0px 2px; + padding: 1px 5px; +} + +.best_in_place_desc input[value="Save"] { +margin-right: -8px; +}