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")
2.3634577800417180.06600490906275809
FixTextCompositionLayer
Research:ObservetheDangerofdynamicscope!Thelayeractivationpropageditselftounanticipatedregions.ByusingdynamicscopetheinnerTextMorphsoftheconsolegetalsolayeredleadingintoaninfiniteregresswhenduringthecompositionoftheconsole'sTextMorphs"console.log()"iscalled.getCharWidth:function(proceed,charString){console.log("getCharWidth"+charString)returnproceed();},Wefixedthisandsimilarbehaviorbyintroducinga"GuardConsoleLayer"thatdisablesalllayeractivationsinsidetheconsole.logcall.1
WI20
createLayer("FixTextCompositionLayer");createLayer("FixTextCompositionDynamicLayer");layerClass(FixTextCompositionDynamicLayer,lively.Text.Font,{getCharWidth:function(proceed,charString){console.log("getCharWidth"+charString)returnproceed();},})//ThetheFontisnotstrucurallyconntectytotheTextMorph//whoisintheobject-specificLayerof"FixTextCompositionLayer"//Butwecanpropagatethatlayerintothedynamicscopewith//the"withLayers"construct.//Sincetheobject-specificscopedoesnotpropagateitselfintothe//dynamicscopeinourimplementation,wedoitmanually.layerClass(FixTextCompositionLayer,TextMorph,{composeLines:function(proceed){varargs=$A(arguments);args.shift();varresult;withLayers([FixTextCompositionDynamicLayer],function(){result=proceed(args)});returnresult}})createLayer("GuardConsoleLayer");enableLayer(GuardConsoleLayer);//DeactivateAlllayersduringtheloggingcode//topreventendlessrecursions...layerObject(GuardConsoleLayer,console,{log:function(proceed){varargs=$A(arguments);args.shift();varresult;withoutLayers(currentLayers(),function(){result=proceed(args)});returnresult}})28
true
10000.014615447227663069Wikicontroltrue
fontHelvetica30:spacewidth8from38xWidth15falsetruefalse0
-------------------------------------------falsetruefalse0
invoke106991:TextMorph([4,19,518,59.33333206176758])falsetruefalse0
-------------------------------------------falsetruefalse0
invoke1:WorldMorph([0,0,1734,1059])falsetruefalse0
status200onGEThttp://lively-kernel.org/repository/webwerkstatt/ContextJSFixTextMorphExample.xhtml?1265888867321falsetruefalse0
extendForSerializationundefinedfalsetruefalse0
status204onPUThttp://lively-kernel.org/repository/webwerkstatt/ContextJSFixTextMorphExample.xhtmlfalsetruefalse0
successpublishingworldathttp://lively-kernel.org/repository/webwerkstatt/ContextJSFixTextMorphExample.xhtml,status204falsetruefalse0
-------------------------------------------falsetruefalse0
invoke121478:TextMorph([0,0,203,107.33333587646484])falsetruefalse0
computingwheelfor49falsetruefalse0
gotselectionsimplefalsetruefalse0
computingwheelfor49falsetruefalse0
computingwheelfor49falsetruefalse0
computingwheelfor49falsetruefalse0
fontHelvetica16:spacewidth4from20xWidth8falsetruefalse0
computingwheelfor53falsetruefalse0
-------------------------------------------falsetruefalse0
invoke121478:TextMorph([0,0,203,66.66666412353516])falsetruefalse0
computingwheelfor49falsetruefalse0
gotselectionsimplefalsetruefalse0
computingwheelfor49falsetruefalse0
computingwheelfor49falsetruefalse0
computingwheelfor49falsetruefalse0
computingwheelfor53falsetruefalse0
-------------------------------------------falsetruefalse0
invoke123048:TextMorph([0,0,204,107.33333587646484])falsetruefalse0
computingwheelfor49falsetruefalse0
gotselectionsimplefalsetruefalse0
computingwheelfor49falsetruefalse0
computingwheelfor49falsetruefalse0
computingwheelfor49falsetruefalse0
-------------------------------------------falsetruefalse0
invoke123048:TextMorph([0,0,182,107.33333587646484])falsetruefalse0
computingwheelfor49falsetruefalse0
gotselectionsimplefalsetruefalse0
computingwheelfor49falsetruefalse0
computingwheelfor49falsetruefalse0
computingwheelfor49falsetruefalse0
-------------------------------------------falsetruefalse0
invoke1:WorldMorph([0,0,1734,1059])falsetruefalse0
status200onGEThttp://lively-kernel.org/repository/webwerkstatt/ContextJSFixTextMorphExample.xhtml?1265888867321falsetruefalse0
extendForSerializationundefinedfalsetruefalse0
status204onPUThttp://lively-kernel.org/repository/webwerkstatt/ContextJSFixTextMorphExample.xhtmlfalsetruefalse0
successpublishingworldathttp://lively-kernel.org/repository/webwerkstatt/ContextJSFixTextMorphExample.xhtml,status204falsetruefalse0
-------------------------------------------falsetruefalse0
invoke1:WorldMorph([0,0,1734,1059])falsetruefalse0
status200onGEThttp://lively-kernel.org/repository/webwerkstatt/ContextJSFixTextMorphExample.xhtml?1265888867321falsetruefalse0
extendForSerializationundefinedfalsetruefalse0808-1nulltrue0falsetruetruefalse
false1truefalse
nullfalse
nullfalse
nullfalse
nullfalsefalsetruetruefalse
truetrue100false
truefalsenull050
nullfalsetruenullfalse
Consolefalsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
WI20
10003.978507397636364e-13Wikicontroltrue
10009.718765002854623Wikicontroltrue
ContextJSExample:InterplayofObject-specificanddynamicLayerActivation301
Research::IdecidetousealayerduringtheFixingofthe"BoldTexthaswrongwidthBug"because,Idon'twanttobreaktheToolsIamcurrentlyworkingwith.3
3.layerthemethodofinterest202
2.duringtextcompositiontheobject-specificallyactivated162
4.preventthelayer-activationfrompropagationintotheTools163
1.dragintoobject-specificscope202null58