binded code snippets

knuckle-code-snippets
Fabien Benetou 1 year ago
parent ab791aaf8c
commit 1cbc2a6f15
  1. 29
      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', {
<a-entity id="rightHand" pinchprimary hand-tracking-controls="hand: right;"></a-entity>
<a-entity id="leftHand" pinchsecondary knuckles-docs wristattachsecondary="target: #box" hand-tracking-controls="hand: left;"></a-entity>
</a-entity>
<a-cylinder open-ended="true" material="repeat: 3 1; side: double;" target class="docs" src='https://fabien.benetou.fr/pub/home/future_of_text_demo/content/fabien.benetou.fr_Analysis_Analysis.png'></a-cylinder>
<!-- <a-image target class="docs" src='https://vatelier.benetou.fr/MyDemo/newtooling/web/renders/fabien.benetou.fr_Analysis_Analysis.png'></a-image>
<a-image target class="docs" src='https://vatelier.benetou.fr/MyDemo/newtooling/web/renders/fabien.benetou.fr_Analysis_CostsAndBenefitsOfSocietalMembership.png'></a-image>
<a-image target class="docs" src='https://vatelier.benetou.fr/MyDemo/newtooling/web/renders/fabien.benetou.fr_Analysis_UsingEpistemotaxis.png'></a-image>
-->
<a-box pressable start-on-press id="box" scale="0.05 0.05 0.05" color="pink">
<a-entity collider-check raycaster="objects: .collidable; showLine:true;" ></a-entity>
</a-box>

Loading…
Cancel
Save