|
|
|
@ -3251,6 +3251,17 @@ function traverseFunctionGraph( g ){ |
|
|
|
|
return callStack |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function generateGraphThenRun(){ |
|
|
|
|
let g = generateGraphFromEditors(editors) |
|
|
|
|
traverseFunctionGraph( g ).map( e => { |
|
|
|
|
try { |
|
|
|
|
nodalValue = eval?.( e.editor.page ) |
|
|
|
|
} catch (error) { |
|
|
|
|
console.error(`Evaluation failed with ${error}`); |
|
|
|
|
} |
|
|
|
|
} ) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// used for testing |
|
|
|
|
AFRAME.registerComponent('startfunctions', { |
|
|
|
|
init: function () { |
|
|
|
@ -3264,15 +3275,8 @@ AFRAME.registerComponent('startfunctions', { |
|
|
|
|
setTimeout( _ => { |
|
|
|
|
console.clear() |
|
|
|
|
//console.log( connectionsBetweenEditors( editors[0], editors[2] ) ) |
|
|
|
|
let g = generateGraphFromEditors(editors) |
|
|
|
|
//console.log( numberOfPredecessors( g ), numberOfSuccessors( g ) ) |
|
|
|
|
traverseFunctionGraph( g ).map( e => { |
|
|
|
|
try { |
|
|
|
|
nodalValue = eval?.( e.editor.page ) |
|
|
|
|
} catch (error) { |
|
|
|
|
console.error(`Evaluation failed with ${error}`); |
|
|
|
|
} |
|
|
|
|
} ) |
|
|
|
|
generateGraphThenRun() |
|
|
|
|
} , 1000 ) |
|
|
|
|
// should be done after each codeEditors gets connectors added then on editor moves |
|
|
|
|
}, false); |
|
|
|
@ -3331,7 +3335,7 @@ AFRAME.registerComponent('startfunctions', { |
|
|
|
|
<a-entity hide-on-enter-ar="" id="environmentsky" class="hidableenvironment" ></a-entity> |
|
|
|
|
<a-troika-text anchor=left target value="instructions : \n--right pinch to move\n--left pinch to execute" position="0 0.65 -0.2" scale="0.1 0.1 0.1"></a-troika-text> |
|
|
|
|
|
|
|
|
|
<a-troika-text anchor=left target id="displaypred" value="jxr displayPred()" position="0 1.40 -0.1" scale="0.1 0.1 0.1"></a-troika-text> |
|
|
|
|
<a-troika-text anchor=left target id="generategraphthenrun" value="jxr generateGraphThenRun()" position="0 1.40 -0.1" scale="0.1 0.1 0.1"></a-troika-text> |
|
|
|
|
<a-troika-text anchor=left target id="locationreload" value="jxr location.reload()" position="0 1.20 -0.1" scale="0.1 0.1 0.1"></a-troika-text> |
|
|
|
|
<a-troika-text anchor=left target id="makeAnchorsVisibleOnTargets" value="jxr makeAnchorsVisibleOnTargets()" position="0 1.05 -0.1" scale="0.1 0.1 0.1"></a-troika-text> |
|
|
|
|
|
|
|
|
|