Lively Kernel canvas
// this script is evaluated on world load
MyConsole = WorldMorph.current().submorphs.detect(function(ea){return ea.name == "MyConsole"});
if(!MyConsole) return;
MyConsole = MyConsole.component;
MyConsole.setText("-- start --");
MyConsole.log = function(s) {
this.setText(this.formalModel.getText() + "\n" + s);
};
MyConsole.log("My Console initialized!");
MyConsole.morph.resetScrollPane = function() {
var sp = this.enclosingScrollPane();
if (sp) sp.scrollToBottom();
};
// console.consumers seems to be broken... so we go the hard waz
console.log = console.log.wrap(function(proceed, s) {
MyConsole.log(s)
proceed(s)})
console.log("wrapped console for MyConsole successfully")
10000.44851614822364055Wikicontroltrue
10000.00024274951454710022Wikicontroltrue
null
null-1.6890837923255078nullfalse
true
null-1.78058575055508nullfalse
true
null-1.6612929406081942nullfalse
true
null-1.4983523489553157nullfalse
true
nulltrue
10001.6439712571753878e-11Wikicontroltrue
-----falsetruefalse0
worldis1:WorldMorph([0,0,2000,1000])falsetruefalse0
Errorevaluatinginitializer:SyntaxError:Invalidreturnstatement.falsetruefalse0
http://localhost/lk/webwerkstatt/anonymous_module_1loadedin399msfalsetruefalse0
fontHelvetica16:spacewidth4from20xWidth8falsetruefalse0
fontHelvetica40:spacewidth11from51xWidth20falsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
Warn:ERROR:146816:HandMorph([0,0,9,9]),anemptyhand,local=true,id=146816:HandMorph.EventHandler([objectKeyboardEvent]):err:TypeError:Resultofexpression'this.keysDown'[undefined]isnotanobject.falsetruefalse0
==Stack==0:$logErrorsAdvice1:HandMorph.handleEvent2falsetruefalse0
fontCourier12:spacewidth7from21xWidth7falsetruefalse0
status:TypeError:Resultofexpression'morph.energy'[undefined]isnotafunction.falsetruefalse0
Moduleloadcheckdone.18modulesloaded.falsetruefalse0
status:TypeError:Resultofexpression'morph.energy'[undefined]isnotafunction.falsetruefalse0
morphmenu:falsetruefalse0
-------------------------------------------falsetruefalse0
invoke1:WorldMorph([0,0,2000,1000])falsetruefalse0
status200onGEThttp://localhost/lk/webwerkstatt/LayoutWithForce.xhtml?1264628138706falsetruefalse0
extendForSerializationundefinedfalsetruefalse0827-1nulltrue0falsetruetruefalse
false1truefalse
nullfalse
nullfalse
nullfalse
nullfalsefalsetruetruefalse
truetrue100false
truefalse050
nullfalsetruenullfalse
Consolefalsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
10001.2336497349080234e-14Wikicontroltrue
10000.00010470432056140624Wikicontroltrue
null-1.7724746337908903nullfalse
true
10001.5372767520723675e-9Wikicontroltrue
10000.01865910194810647Wikicontroltrue
10008.844699122966197e-9Wikicontroltrue
Morph16
WorldMorph16
- null
Text16
null1.1633103633626471null
Text16
Text16
LayoutMorphwithForce....40false
- null
PasteUpMorph16
- null
layerClass(NodeMorphLayer,Morph,{getisNodeMorph(){returntrue},connectedNodes:function(){returnthis.getConnectorMorphs().collect(function(ea){if(this===ea.startMorph)returnea.endMorphelsereturnea.startMorph},this)},isConnectedTo:function(proceed,otherNode){returnthis.connectedNodes().indexOf(otherNode)!=-1;},})19truetruefalsetruetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
Object.subclass('NodeMorphLayouter',{})NodeMorphLayouter.addMethods({maxDist:200,minDist:100,step:15,minStepLength:0,findOtherMorphsDelay:10,//optimizedcomparedtoisConnectedTo...areConnected:function(firstMorph,secondMorph){varconnectors=firstMorph.connectorMorphs;if(!connectors)returnfalse;for(vari=0;i<connectors.length;i++){varconnector=connectors[i];if(!connector)continue;varstart=connector.startMorph;varend=connector.endMorph;if(start===firstMorph&&end===secondMorph)returntrue;//forwardif(start===secondMorph&&end===firstMorph)returntrue;//back}returnfalse;},centerOf:function(morph){if(!morph._cached_node_center)morph._cached_node_center=morph.getCenter();returnmorph._cached_node_center},energy:function(morph){return0.1;},//deferemorphmorphmovement...moveMorphBy:function(morph,v){morph._cached_node_center=morph._cached_node_center.addPt(v);},applyMoveCacheToMorph:function(morph){if(!morph._cached_node_center)return;varv=morph._cached_node_center.subPt(morph.getCenter());morph.moveBy(v);this.ensureToStayInWorldBounds(morph);morph._cached_node_center=undefined;},forceOfMorphs:function(morph,morphs){varavg=pt(0,0);for(vari=0;i<morphs.length;i++){varea=morphs[i];if(ea===morph)continue;vard=this.centerOf(morph).subPt(this.centerOf(ea));vardist=d.fastR();varisConnected=this.areConnected(morph,ea);if(!isConnected&&dist>this.maxDist+150*this.energy(morph))continue;varforce=this.forceOfMorph(ea,d,dist,isConnected);avg=avg.addPt(force);}if(avg.eqPt(pt(0,0)))returnavg;returnPoint.polar(this.energy(morph)*this.step,avg.theta());},forceOfMorph:function(morph,vector,dist,isConnected){//effectpositive-->pushaway,negative->attractif(dist==0)returnpt(0,0);vareffect;if(dist<this.minDist){effect=1;}elseif(isConnected){if(dist<=this.maxDist)returnpt(0,0);effect=-1;}else{if(dist>=this.maxDist)returnpt(0,0);effect=1;}returnvector.fastNormalized().scaleBy(effect);},stepMorph:function(morph,nodes){if(this.energy(morph)<=0)return;if(!this.calls){this.calls=1;}this.calls++;varv=this.forceOfMorphs(morph,nodes);if(!v.x||!v.y)return;this.moveMorphBy(morph,v);},ensureToStayInWorldBounds:function(morph){if(!this.activeBoundsOfWorld){//Worldboundsaresometimeswrong???Usecanvas...varcanvas=Global.document.getElementById('canvas');this.activeBoundsOfWorld=pt(canvas.clientWidth,canvas.clientHeight).subPt(morph.getExtent()).extentAsRectangle();}if(!this.activeBoundsOfWorld.containsPoint(morph.getPosition())){varpos=this.activeBoundsOfWorld.closestPointToPt(morph.getPosition());morph.setPosition(pos);}}}) this.maxDist + 150 * this.energy(morph))\n\t\t\t\tcontinue;\n\t\t\tvar force = this.forceOfMorph(ea, d, dist, isConnected);\r\t\t\tavg = avg.addPt(force);\n\t\t}\n\t\tif (avg.eqPt(pt(0,0))) \r\t\t\treturn avg;\r\t\treturn Point.polar(this.energy(morph) * this.step, avg.theta());\n\t},\r\n\tforceOfMorph: function(morph, vector, dist, isConnected) {\n\t\t// effect positive --> push away, negative -> attract\n\t\tif (dist == 0) \r\t\t\treturn pt(0,0); \r\t\tvar effect;\n\t\tif (dist < this.minDist) {\n\t\t\teffect = 1;\n\t\t} else if (isConnected) {\n\t\t\tif (dist <= this.maxDist) return pt(0,0);\n\t\t\teffect = -1;\n\t\t} else {\n\t\t\tif (dist >= this.maxDist) return pt(0,0);\n\t\t\teffect = 1;\n\t\t}\n\t\treturn vector.fastNormalized().scaleBy(effect);\n\t},\r\r\r\tstepMorph: function(morph, nodes) {\n\t\tif (this.energy(morph) <= 0) return;\n\r\t\tif (!this.calls) {\n\t\t\tthis.calls = 1;\n\t\t}\n\t\tthis.calls++;\n\t\tvar v = this.forceOfMorphs(morph, nodes);\n\t\tif (!v.x || !v.y ) return; \n\t\tthis.moveMorphBy(morph, v);\n\t},\n\r\tensureToStayInWorldBounds: function(morph) {\n\t\tif (!this.activeBoundsOfWorld) {\n\t\t\t// World bounds are sometimes wrong??? Use canvas ...\n\t\t\tvar canvas = Global.document.getElementById('canvas');\n\t\t\tthis.activeBoundsOfWorld = pt(canvas.clientWidth,\r\t\t\t\tcanvas.clientHeight).subPt(morph.getExtent()).extentAsRectangle();\n\t\t}\n\t\tif (!this.activeBoundsOfWorld.containsPoint(morph.getPosition())) {\r\t\t\tvar pos = this.activeBoundsOfWorld.closestPointToPt(morph.getPosition());\r\t\t\tmorph.setPosition(pos);\r\t\t}\n\t}\n})\r\r\n"]]>114truetruefalsetruetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
Layouter...falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
nulltruetimeToRun=function(func){vartime=newDate();func();returnnewDate()-time;}nodes=WorldMorph.current().submorphs.select(function(ea){returnea.isNodeMorph});l=newNodeMorphLayouter();timeToRun(function(){for(vari=0;i<100;i++){nodes.each(function(ea){l.stepMorph(ea,nodes)})}nodes.each(function(ea){l.applyMoveCacheToMorph(ea)})})truetruefalsefalse27truetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
workspacefalsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
Wrapper16
Shape16
- null
SVGNode16null
Node16
- null
Widget16
null51