visual basis to start

draw2d-with-lines
Fabien Benetou 2 years ago
parent 4418866691
commit 7dbeeed9fd
  1. 38
      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', {
<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 class="reader" value="jxr onNextPinchSplitReader()" position="0. 1.55 -0.4" scale="0.1 0.1 0.1"></a-troika-text>
<a-troika-text anchor=left target class="reader" value="jxr previousPageCodeEditor()" position="-0.5 1.25 -0.4" scale="0.1 0.1 0.1"></a-troika-text>
<a-troika-text anchor=left target class="reader" value="jxr nextPageCodeEditor()" position="0 1.25 -0.4" 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>

Loading…
Cancel
Save