diff --git a/index.html b/index.html
index 41db328..532a401 100644
--- a/index.html
+++ b/index.html
@@ -3388,11 +3388,46 @@ function ontouch(){
}, 20)
}
+function setOnDropFromAttribute(){
+ // add to file descriptor from offtopus
+ // could also be prototyped with a URL instead, doesn't need offtopus even cached version
+ // could also prototype by doing so via https://webdav.benetou.fr/fot-demo-day/mobydick-extract.txt
+ targets.map( el => {
+ if ( el.getAttribute('ondrop')?.length > 0 )
+ el.addEventListener('released', e => {
+ let code = el.getAttribute('ondrop')
+ console.log('do', code)
+ try {
+ eval( code )
+ } catch (error) {
+ console.error(`Evaluation failed with ${error}`);
+ }
+ })
+ } )
+ // if dropped close enough to an editor, load file content in editor
+ // could try a jxr command...
+}
+
+function setNearbyEditor(el){
+ let pos = el.getAttribute('position')
+ fetch(el.getAttribute('value')).then( res => res.text() ).then( content => {
+ console.log( content )
+ // assumes plain text
+ editors.map( ed => {
+ console.log(ed)
+ if ( pos.distanceTo( ed.element.getAttribute('position') ) < 1 )
+ updateCodeEditorWithContent(ed, content)
+ })
+ })
+}
+
// used for testing
AFRAME.registerComponent('startfunctions', {
init: function () {
- ontouch()
+ addCodeMultipleEditors(1, 'hello world', '', name='editortodropon')
+ setOnDropFromAttribute()
+ //ontouch()
//tensionVisualized()
//startExperience()
//doublePinchToScale()
@@ -3471,6 +3506,10 @@ AFRAME.registerComponent('startfunctions', {
+
+