|
|
|
@ -32,6 +32,38 @@ then |
|
|
|
|
target position=" -0.3 1.35 0" rotation="0 40 0" scale="0.1 0.1 0.1"> |
|
|
|
|
</a-troika-text> |
|
|
|
|
*/ |
|
|
|
|
var library |
|
|
|
|
AFRAME.registerComponent('library-load', { |
|
|
|
|
init: function(){ |
|
|
|
|
//fetch("../content/library-acm22.json").then( res => res.json() ).then( res => { |
|
|
|
|
fetch("https://webdav.benetou.fr/fotsave/test_newfot.json").then( res => res.json() ).then( res => { |
|
|
|
|
library = res |
|
|
|
|
console.log(res) |
|
|
|
|
res.documents.map( (doc,i) => { |
|
|
|
|
if (doc.customData[0].position) |
|
|
|
|
addNewNote( doc.title, doc.customData[0].position ) |
|
|
|
|
else |
|
|
|
|
addNewNote( doc.title, '.5 '+(1+i/50)+' -.5' ) |
|
|
|
|
.setAttribute("onreleased", "updateDatasetThenSave(e.detail.element)") |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
function updateDatasetThenSave(element){ |
|
|
|
|
if (!library) return |
|
|
|
|
let pos = element.getAttribute('position') |
|
|
|
|
let title = element.getAttribute('value') |
|
|
|
|
console.log(pos, title) |
|
|
|
|
library.documents.filter( el => el.title == title ).map( found => found.customData[0].position = pos ) |
|
|
|
|
//library.documents.filter( el => el.title == title ).map( found => console.log( found.customData[0] ) ) |
|
|
|
|
const webdavurl = "https://webdav.benetou.fr"; |
|
|
|
|
const client = window.WebDAV.createClient(webdavurl) |
|
|
|
|
async function w(path, data){ return await client.putFileContents(path, data); } |
|
|
|
|
w("/fotsave/test_newfot.json", JSON.stringify(library) ) |
|
|
|
|
setFeedbackHUD( "file saved" ) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function cloneTarget(target){ |
|
|
|
|
let el = target.cloneNode(true) |
|
|
|
@ -184,7 +216,7 @@ AFRAME.registerComponent('teleporter', { |
|
|
|
|
</a> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<a-scene startfunctions onemptypinch="onHoveredTeleport()" > |
|
|
|
|
<a-scene startfunctions library-load onemptypinch="onHoveredTeleport()" > |
|
|
|
|
<a-gltf-model hide-on-enter-ar="" id="environment" src="../content/CubeRoom.glb" rotation="0 -90 0" position="0 0 1" scale="" ></a-gltf-model> |
|
|
|
|
<!-- Cube Room by Anonymous [CC-BY] via Poly Pizza --> |
|
|
|
|
|
|
|
|
|