diff --git a/index.html b/index.html index d65c503..b5fe7e3 100644 --- a/index.html +++ b/index.html @@ -2349,6 +2349,49 @@ function addGrid(){ // not actually correct but does the job AFRAME.scenes[0].appendChild( plot ) } +function emptyPinchToMove(){ // functions call by event listener should be within this scope + // thus hopefully not conflicting with other listeners + const startRadius = .00001 + const maxRadius = .1 + const maxDist = .05 + let controlSphere = document.createElement("a-sphere") + let r = startRadius + controlSphere.setAttribute("radius", r) + controlSphere.setAttribute("color", "blue") + controlSphere.setAttribute("position", "0 9999 0") + AFRAME.scenes[0].appendChild( controlSphere ) + //targets.push(controlSphere) // keeping it out for specific control for now but should consider generalization + let el = document.querySelector('[pinchprimary]') + el.addEventListener('pinchended', function end(event) { + // add moving sphere then hide it far away, could also disable it + // could also no unregister but check for empty selectedElement +// el.removeEventListener('pinchended', end) +// el.removeEventListener('pinchstarted', pinched) +// el.removeEventListener('pinchmoved', moved) + r = startRadius + controlSphere.setAttribute("radius", r) + }); + el.addEventListener('pinchmoved', moved ); + function moved(event){ + if (selectedElement) return + controlSphere.setAttribute("position", AFRAME.utils.coordinates.stringify( event.detail.position) ) + if (r >= maxDist){ + // start be movable after .05 diam + pushBackClass("hidableenvironment") + pushBackClass("keyboard") + // not sufficient but a start + // only moving forward rather than compared to previous moment + } + if (r < maxRadius) { + r += 0.01 + controlSphere.setAttribute("radius", r) + } + } + el.addEventListener('pinchstarted', pinched ); + function pinched( event){ + } +} +