if u want 2 load a img as Node Type , u could do this
First make your own custom node type:
$jit.RGraph.Plot.NodeTypes
.implement(
{
'exampleIMG' : {
'img' : "default.png",
'render' : function(node, canvas) {
var ctx = (typeof canvas.getCtx == "function" ? canvas
.getCtx()
: canvas.getContext("2d"));
var img = new Image();
var pos = node.pos.getc(true);
ctx.drawImage(img, pos.x - (img.width / 2),
pos.y - (img.height / 2));
},
'contains' : function(node, pos) {
return false;
}
}
});
just defined node as "exampleIMG" in your JSON data structure
or test direct in your debug console (chrome)
$jit.Graph.Util.eachNode(rgraph.graph, function(test) {
test.data.$type = "exampleIMG";
});
rgraph.refresh();
Good luck :P
Op vrijdag 27 januari 2017 20:15:21 UTC+1 schreef Eoin Irwin: