Lively Kernel canvas
DebuggingZIPlibraryRemove//libURL=URL.codeBase.withFilename('apps/Dropbox.js')/*libURL=URL.codeBase.withFilename('apps/Zip.js')res=newWebResource(libURL);sourceCode=res.get().content;parser=newJsParser();output=parser.parseSource(sourceCode);*/if(typeofdep!='undefined')dep.remove();if(typeofbox!='undefined')box.remove();box=newBoxMorph(newRectangle(800.5,40.5,780,780));dep=newDependencyGraph(box);box.applyStyle({borderColor:Color.black,borderWidth:1,fill:Color.lightGray,opacity:1,suppressGrabbing:true,suppressHandles:true});dep.setData(output);box.openInWorld();dep.render();WorkspaceX–ProtoVisDrawing.subclass('DependencyGraph',{//ProtoVisMorph.subclass('DependencyGraph',{MODULE_GROUP:1,CLASS_GROUP:2,METHOD_GROUP:3,setData:function(data){varself=this;this.data=data;this.nodes=[];this.links=[];functioncreateNodeAndLink(d,parent){switch(d.type){case'moduleDef':varid=self.nodes.push({nodeName:d.name,group:self.MODULE_GROUP});d.__id=id-1;d._subElements.each(function(ea){createNodeAndLink(ea,d)});break;case'klassDef':varid=self.nodes.push({nodeName:d.name,group:self.CLASS_GROUP});self.links.push({source:parent.__id,target:id-1,value:4});d.__id=id-1;break;}}this.data.each(createNodeAndLink);console.log([this.nodes,this.links]);},draw:function(w,h){varcolors=pv.Colors.category19();varvis=newpv.Panel().width(w).height(h).event("mousedown",pv.Behavior.pan()).event("mousewheel",pv.Behavior.zoom()).fillStyle('white');varforce=vis.add(pv.Layout.Force).springLength(60).iterations(100).nodes(this.nodes).links(this.links);force.link.add(pv.Line);force.node.add(pv.Bar).width(60).height(20)//.size(function(d){//return(d.linkDegree+4)*Math.pow(this.scale,-1.5);//}).fillStyle(function(d){returnd.fix?'brown':colors(d.group);}).strokeStyle(function(){returnthis.fillStyle().darker();}).lineWidth(1).title(function(d){returnd.nodeName;}).event('mousedown',pv.Behavior.drag()).event('drag',force).anchor('center').add(pv.Label).text(function(d){returnd.nodeName;});returnvis;},});WorkspaceX–Wikicontrol