@ -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"
+ "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
// could be an array proper completed on each relevant component registration
var heightAdjustableClasses = ["commands-from-external-json"]
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.
// 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
// ?inputmode=makeymakey
@ -640,7 +641,7 @@ AFRAME.registerComponent('screenstack', {
});
});
function getClosestTargetElements( pos, threshold=0.05 ){
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") ) } })
return targets.filter( e => e.getAttribute("visible") == true).map( t => { return { el: t, dist : pos.distanceTo(t.getAttribute("position") ) } })
.filter( t => t.dist < threshold )
.filter( t => t.dist < threshold )
.sort( (a,b) => a.dist > b.dist)
.sort( (a,b) => a.dist > b.dist)
@ -748,6 +749,7 @@ function appendToFeedbackHUD(txt){
function setFeedbackHUD(txt){
function setFeedbackHUD(txt){
document.querySelector("#feedbackhud").setAttribute("value",txt)
document.querySelector("#feedbackhud").setAttribute("value",txt)
setTimeout( _ => document.querySelector("#feedbackhud").setAttribute("value",""), feedbackHUBClearTime)
}
}
function appendToHUD(txt){
function appendToHUD(txt){
@ -897,7 +899,21 @@ AFRAME.registerComponent('pinchprimary', { // currently only 1 hand, the right o
//targets.push( clone )
//targets.push( clone )
//selectedElement = clone
//selectedElement = clone
//setFeedbackHUD( "pinched" ) // works well even close to the HMD, closer than the HUD
selectedElement = getClosestTargetElement( event.detail.position )
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
// 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 )
this.el.appendChild( feedbackHUDel )
var typingHUDel = document.createElement("a-troika-text")
var typingHUDel = document.createElement("a-troika-text")
typingHUDel.id = "typinghud"
typingHUDel.id = "typinghud"
targets.push(typingHUDel)
typingHUDel.setAttribute("value", startingText)
typingHUDel.setAttribute("value", startingText)
typingHUDel.setAttribute("position", "-0.05 0 -0.2")
typingHUDel.setAttribute("position", "-0.05 0 -0.2")
typingHUDel.setAttribute("scale", "0.05 0.05 0.05")
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', {
AFRAME.registerComponent('fot', {
init:function(){
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) )
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) )
min = Math.min.apply(null, Array.from( document.querySelectorAll("."+c) ).map( e => e.object3D.position.y) )
pushDownClass(c, userHeight - (max-min)/2 )
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 ) )
setFeedbackHUD( "adjusted height by:" + ( userHeight - (max-min)/2 ) )
} )
} )
}, 100 )
}, 100 )
@ -1530,7 +1565,7 @@ function switchSide(){
< div id = "observablehq-viewof-offsetExample-ab4c1560" > < / div >
< div id = "observablehq-viewof-offsetExample-ab4c1560" > < / div >
< div id = "observablehq-result_as_html-ab4c1560" > < / div >
< div id = "observablehq-result_as_html-ab4c1560" > < / div >
< / div >
< / div >
< a-scene cursor = "rayOrigin: mouse" raycaster = "objects: [html]; interval:100;" adjust-height-in-vr
< a-scene cursor = "rayOrigin: mouse" raycaster = "objects: [html]; interval:100;" adjust-height-in-vr fossxr
toolbox disable-components-via-url enable-components-via-url commands-from-external-json >
toolbox disable-components-via-url enable-components-via-url commands-from-external-json >
<!-- screenstack dynamic - view selectionboxonpinches keyboard glossary timeline issues fot
<!-- screenstack dynamic - view selectionboxonpinches keyboard glossary timeline issues fot
networked-scene="serverURL: https://naf.benetou.fr/; adapter: easyrtc; audio: true;"
networked-scene="serverURL: https://naf.benetou.fr/; adapter: easyrtc; audio: true;"