From 1cbc2a6f157fa3233d9f0a341cd9cae10f354955 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Sun, 16 Jul 2023 11:01:15 +0200 Subject: [PATCH] binded code snippets --- index.html | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 33cdd5c..717b0f4 100644 --- a/index.html +++ b/index.html @@ -3424,6 +3424,8 @@ function setNearbyEditor(el){ AFRAME.registerComponent('knuckles-docs',{ init: function () { // to handle going from cylinder to image back and forth could have a parent entity holding both then toggling visibility + // consider how a very large radius cylinder is equivalent to a plane + // ability to morph back and forth var el = this.el this.worldPosition=new THREE.Vector3(); Array.from( document.querySelectorAll(".docs") ).map( doc => { @@ -3499,8 +3501,26 @@ AFRAME.registerComponent('knuckles-docs',{ AFRAME.registerComponent('startfunctions', { init: function () { - addCodeMultipleEditors(1, 'hello world', '', name='editortodropon') - setOnDropFromAttribute() + document.body.addEventListener('highlighterready', _ => { + fetch('https://fabien.benetou.fr/pub/home/future_of_text_demo/engine/codesplits.txt').then( r => r.text()).then( s => { + s.split(/^$/m).filter( l => l.match(/\nfunc|\nAFRAME/)).slice(0,5).map( snippet => { + //let nw = addCodeEditor( snippet, "javascript", "0 "+(1+Math.random()/2)+" -.4" ) + //nw.element.classList.add('docs') + //setTimeout( _ => nw.element.setAttribute('scale', '.01 .01 .01'), 1000 ) + /* debug tests for picking */ + let el = document.createElement("a-box") + el.classList.add('docs') + el.setAttribute("scale", '.05 .05 .05') + el.setAttribute("position", '.0 1.5 -.5') + el.setAttribute("wireframe", 'true') + el.setAttribute("target", '') + AFRAME.scenes[0].appendChild(el) + // somehow can't get picket + } + ) + } ) + } ) + //setOnDropFromAttribute() //ontouch() //tensionVisualized() //startExperience() @@ -3541,11 +3561,6 @@ AFRAME.registerComponent('startfunctions', { - -