This commit is contained in:
Devin Howard 2013-01-05 13:05:06 -05:00
commit db3836360a
3 changed files with 43 additions and 9 deletions

View file

@ -94,6 +94,8 @@ function graphSettings(type) {
}, },
//Add also a click handler to nodes //Add also a click handler to nodes
onClick: function (node, eventInfo, e) { 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? //clicking on a node, or clicking on blank part of canvas?
if (node.nodeFrom) { if (node.nodeFrom) {
selectEdgeOnClickHandler(node); selectEdgeOnClickHandler(node);
@ -121,9 +123,14 @@ function graphSettings(type) {
var left = parseInt(style.left); var left = parseInt(style.left);
var top = parseInt(style.top); var top = parseInt(style.top);
var w = domElement.offsetWidth; var w = domElement.offsetWidth;
style.left = (left - w / 2) + 'px'; style.left = (left - w / 2 + 107) + 'px';
style.top = (top+25) + 'px'; //style.left = (left - w / 2) + 'px';
style.top = (top-165) + 'px';
style.display = ''; 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") { } else if (type = "centered") {
@ -222,6 +229,7 @@ function graphSettings(type) {
}, },
//Add also a click handler to nodes //Add also a click handler to nodes
onClick: function (node, eventInfo, e) { 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? //clicking on an edge, a node, or clicking on blank part of canvas?
if (eventInfo.getEdge() != false || node.nodeFrom) { if (eventInfo.getEdge() != false || node.nodeFrom) {
if (eventInfo.getEdge() != false) selectEdgeOnClickHandler(eventInfo.getEdge()); if (eventInfo.getEdge() != false) selectEdgeOnClickHandler(eventInfo.getEdge());
@ -256,9 +264,14 @@ function graphSettings(type) {
var left = parseInt(style.left); var left = parseInt(style.left);
var top = parseInt(style.top); var top = parseInt(style.top);
var w = domElement.offsetWidth; var w = domElement.offsetWidth;
style.left = (left - w / 2) + 'px'; style.left = (left - w / 2 + 107) + 'px';
style.top = (top+25) + 'px'; //style.left = (left - w / 2) + 'px';
style.top = (top-165) + 'px';
style.display = ''; 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-object="topic" \
data-nil="$_desc_nil_$" \ data-nil="$_desc_nil_$" \
data-attribute="desc" \ data-attribute="desc" \
data-ok-button="Save" \
data-cancel-button="Discard" \
data-type="textarea">$_desc_$</span> \ data-type="textarea">$_desc_$</span> \
<div class="clearfloat"></div> \
</div> \ </div> \
</div> \ </div> \
$_go_link_$ \ $_go_link_$ \
@ -674,6 +690,8 @@ function onCreateLabelHandler(domElement, node) {
var nameContainer = document.createElement('span'), var nameContainer = document.createElement('span'),
style = nameContainer.style; style = nameContainer.style;
nameContainer.className = 'name topic_' + node.id; nameContainer.className = 'name topic_' + node.id;
nameContainer.id = 'topic_' + node.id + '_label';
var littleHTML = ' \ var littleHTML = ' \
<div class="label">$_name_$</div> \ <div class="label">$_name_$</div> \
<div class="nodeOptions">'; <div class="nodeOptions">';

View file

@ -12,4 +12,6 @@
span.name { span.name {
cursor: pointer; cursor: pointer;
position: absolute;
top: 185px;
} }

View file

@ -12,9 +12,6 @@
color:#FFF; color:#FFF;
text-align: left; text-align: left;
overflow: visible; overflow: visible;
position: relative;
top: -185px;
left: 107px;
z-index:14000; z-index:14000;
} }
@ -92,3 +89,20 @@
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; 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;
}