I've got a quick question.I successfully customized edges in a Space Tree by implementing my own EdgeType, and then created a label which had an image on it, then positioned the label in such a way that it is located exactly on top of the node. At this point, I'm running in to couple of issues.
$jit.ST.Plot.EdgeTypes.implement({
'mySpecialType': {
'render': function(adj, canvas) {
var data = adj.data;
/*
if(data.labelid) {
var label = document.getElementById(data.labelid);
var labelcontainer = this.labels.getLabelContainer();
if(label && labelcontainer) {
alert(label.parentNode.id);
labelcontainer.removeChild(label);
}
}
*/
if(data.labelid) {
var domlabel = document.getElementById(data.labelid);
if(!domlabel) {
domlabel= document.createElement('span');
domlabel.id = data.labelid;
domlabel.innerHTML = "<img src='http://dl.dropbox.com/u/358218/static/spacetree/icons/favourite.gif'/>";
var style = domlabel.style;
style.position = 'absolute';
style.display = 'block';
}
var pos = adj.nodeFrom.pos.getc(true);
var posChild = adj.nodeTo.pos.getc(true);
var radius = this.viz.canvas.getSize();
domlabel.style.left = parseInt((pos.x + posChild.x + radius.width - domlabel.offsetWidth) /2) + 'px';
domlabel.style.top = parseInt((pos.y + posChild.y + radius.height) /2) + 'px';
domlabel.style.display = 'block';
this.labels.getLabelContainer().appendChild(domlabel);
}
this.edgeTypes.bezier.render.call(this, adj, canvas);
},
'contains': function(adj, pos) {
return false;
}
}
});Thanks,
Socratees.