diff --git a/index.html b/index.html index 160acca..5d08c0c 100644 --- a/index.html +++ b/index.html @@ -116,6 +116,7 @@ var generators = "line-link-entities link screenstack dynamic-view selectionboxo + "commands-from-external-json glossary timeline issues web-url background-via-url observableui hidableenvironmentfot fot" // could be an array proper completed on each relevant component registration var heightAdjustableClasses = ["commands-from-external-json"] +const feedbackHUBClearTime = 5000 // could add a dedicated MakeyMakey mode with a fixed camera, e.g bird eye view, and an action based on some physical input that others, thanks to NAF, could see or even use. // ?inputmode=makeymakey @@ -640,7 +641,7 @@ AFRAME.registerComponent('screenstack', { }); function getClosestTargetElements( pos, threshold=0.05 ){ - // TODO Bbox intersects rather than position + // TODO Bbox intersects rather than position, especially as most people try to pick from center rather than beginning return targets.filter( e => e.getAttribute("visible") == true).map( t => { return { el: t, dist : pos.distanceTo(t.getAttribute("position") ) } }) .filter( t => t.dist < threshold ) .sort( (a,b) => a.dist > b.dist) @@ -748,6 +749,7 @@ function appendToFeedbackHUD(txt){ function setFeedbackHUD(txt){ document.querySelector("#feedbackhud").setAttribute("value",txt) + setTimeout( _ => document.querySelector("#feedbackhud").setAttribute("value",""), feedbackHUBClearTime) } function appendToHUD(txt){ @@ -897,7 +899,21 @@ AFRAME.registerComponent('pinchprimary', { // currently only 1 hand, the right o //targets.push( clone ) //selectedElement = clone + //setFeedbackHUD( "pinched" ) // works well even close to the HMD, closer than the HUD selectedElement = getClosestTargetElement( event.detail.position ) + if (selectedElement) { // never works with #typinghud + setFeedbackHUD( "selectedElement:"+selectedElement.getAttribute("value") ) + // somehow never happens trying to get text from HUD + if (selectedElement.id == "typinghud"){ + setFeedbackHUD( "cloned typinghud" ) + var clone = selectedElement.cloneNode() + clone.removeAttribute("id") + clone.className += "typinghud" + AFRAME.scenes[0].appendChild( clone ) + targets.push( clone ) + selectedElement = clone + } + } // if close enough to a target among a list of potential targets, unselect previous target then select new }); }, @@ -1052,6 +1068,7 @@ AFRAME.registerComponent('hud', { this.el.appendChild( feedbackHUDel ) var typingHUDel = document.createElement("a-troika-text") typingHUDel.id = "typinghud" + targets.push(typingHUDel) typingHUDel.setAttribute("value", startingText) typingHUDel.setAttribute("position", "-0.05 0 -0.2") typingHUDel.setAttribute("scale", "0.05 0.05 0.05") @@ -1310,6 +1327,23 @@ AFRAME.registerComponent('glossary', { }, }); +AFRAME.registerComponent('fossxr', { + init:function(){ + }, + tick: function(){ + let generatorName = this.attrName + fetch("https://fabien.benetou.fr/Testing/FOSSXR2022?action=source#" + Date.now()).then(res => res.text() ).then(res => { + res.split("\n").filter(e => (e[0] && e[0] == "*")).slice(0,maxItemsFromSources).map( (n,i) => { + found = added.find((str) => str === n) + if (typeof found === 'undefined'){ + added.push(n) + addNewNote( n, "-1 "+(1+i/10)+" -2.5", ".1 .1 .1", null, generatorName ) + } + }) + }) + } +}); + AFRAME.registerComponent('fot', { init:function(){ }, @@ -1399,6 +1433,7 @@ AFRAME.registerComponent('adjust-height-in-vr', { max = Math.max.apply(null, Array.from( document.querySelectorAll("."+c) ).map( e => e.object3D.position.y) ) min = Math.min.apply(null, Array.from( document.querySelectorAll("."+c) ).map( e => e.object3D.position.y) ) pushDownClass(c, userHeight - (max-min)/2 ) + // to adjust, works well while seated but now on floor or standing up setFeedbackHUD( "adjusted height by:" + ( userHeight - (max-min)/2 ) ) } ) }, 100 ) @@ -1530,7 +1565,7 @@ function switchSide(){
-