From 7dbeeed9fd90d2b1e88535686b8c63a8feb1e525 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Thu, 25 May 2023 20:14:46 +0200 Subject: [PATCH] visual basis to start --- index.html | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index d763d61..0ea0a4d 100644 --- a/index.html +++ b/index.html @@ -3124,26 +3124,31 @@ function onNextPinchSplitReader(){ }, 50) // relatively cheap check, filtering on small array } +function addConnectorsToCodeEditor( codeEditor ){ + let el = codeEditor.element + el.addEventListener("object3dset", e => { + el.object3D.children[0].addEventListener("synccomplete", e => { + b = el.object3D.children[0]._textRenderInfo.blockBounds + w = b[2]-b[0] + h = b[3]-b[1] + el.setAttribute("line__input", `start: 0 0 0; end : -1 1 0; opacity: 1;`) + el.setAttribute("line__input__end", `start: -1 1 0; end : -2 1 0; opacity: 1;`) + el.setAttribute("line__output", `start: ${w} ${-h} 0; end : ${w+1} ${-h-1} 0; opacity: 1;`) + el.setAttribute("line__output__end", `start: ${w+1} ${-h-1} 0; end : ${w+2} ${-h-1} 0; opacity: 1;`) + }) + }) + return el +} // used for testing AFRAME.registerComponent('startfunctions', { init: function () { - fetch( 'https://webdav.benetou.fr/fot-demo-day/mobydick-extract.txt').then(r=>r.text()).then( src => { - //addCodeMultipleEditors(2, src, '', name='splitreader') - let ed = addCodeMultipleEditors(1, src, '', name='splitreader') - // setTimeout( _ => ed[0].element.setAttribute('position', '0 1 -.4') , 1000) - }) - /* - setTimeout( _ => editors.filter(e=>e.element.id.includes('reader') ).map( e=> e.element.object3D.position.x++ ), 1000) document.body.addEventListener( "highlighterready", (e) => { - //fetch("colorme.js").then(r=>r.text()).then( page => { addCodeEditor( page ) }) - fetch( 'colorme.js').then(r=>r.text()).then( src => { - addCodeMultipleEditors(4, src, 'javascript', name='splitededitor') - }) + let ed = addCodeEditor( 'function NodalTestSquare(x){ return x*x}', 'javascript', '-.3 2.2 -.8') + addConnectorsToCodeEditor( ed ) + let ed2 = addCodeEditor( 'function NodalPrintToJXR(x){ addNewNote(x) }', 'javascript', '.4 1.9 -.8') + addConnectorsToCodeEditor( ed2 ) }, false); - */ - - // should become a component instead //startExperience() //doublePinchToScale() //emptyPinchToMove() @@ -3199,11 +3204,6 @@ AFRAME.registerComponent('startfunctions', { - - - - -