href: always commit last position first
This commit is contained in:
parent
631d2bdc9e
commit
c675748edb
4 changed files with 16 additions and 8 deletions
6
dist/xrfragment.aframe.js
vendored
6
dist/xrfragment.aframe.js
vendored
|
|
@ -1107,11 +1107,13 @@ xrf.frag.href = function(v, opts){
|
||||||
}else if( mesh.material){ mesh.material = mesh.material.clone() }
|
}else if( mesh.material){ mesh.material = mesh.material.clone() }
|
||||||
|
|
||||||
let click = mesh.userData.XRF.href.exec = (e) => {
|
let click = mesh.userData.XRF.href.exec = (e) => {
|
||||||
|
let lastPos = `#pos=${camera.position.x},${camera.position.y},${camera.position.z}`
|
||||||
xrf
|
xrf
|
||||||
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
||||||
.then( () => {
|
.then( () => {
|
||||||
|
xrf.navigator.to(lastPos) // commit last position
|
||||||
const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
|
const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
|
||||||
xrf.navigator.to(v.string,flags) // or let's surf to HREF!
|
xrf.navigator.to(v.string,flags) // let's surf to HREF!
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
6
dist/xrfragment.three.js
vendored
6
dist/xrfragment.three.js
vendored
|
|
@ -1107,11 +1107,13 @@ xrf.frag.href = function(v, opts){
|
||||||
}else if( mesh.material){ mesh.material = mesh.material.clone() }
|
}else if( mesh.material){ mesh.material = mesh.material.clone() }
|
||||||
|
|
||||||
let click = mesh.userData.XRF.href.exec = (e) => {
|
let click = mesh.userData.XRF.href.exec = (e) => {
|
||||||
|
let lastPos = `#pos=${camera.position.x},${camera.position.y},${camera.position.z}`
|
||||||
xrf
|
xrf
|
||||||
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
||||||
.then( () => {
|
.then( () => {
|
||||||
|
xrf.navigator.to(lastPos) // commit last position
|
||||||
const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
|
const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
|
||||||
xrf.navigator.to(v.string,flags) // or let's surf to HREF!
|
xrf.navigator.to(v.string,flags) // let's surf to HREF!
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
6
dist/xrfragment.three.module.js
vendored
6
dist/xrfragment.three.module.js
vendored
|
|
@ -1107,11 +1107,13 @@ xrf.frag.href = function(v, opts){
|
||||||
}else if( mesh.material){ mesh.material = mesh.material.clone() }
|
}else if( mesh.material){ mesh.material = mesh.material.clone() }
|
||||||
|
|
||||||
let click = mesh.userData.XRF.href.exec = (e) => {
|
let click = mesh.userData.XRF.href.exec = (e) => {
|
||||||
|
let lastPos = `#pos=${camera.position.x},${camera.position.y},${camera.position.z}`
|
||||||
xrf
|
xrf
|
||||||
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
||||||
.then( () => {
|
.then( () => {
|
||||||
|
xrf.navigator.to(lastPos) // commit last position
|
||||||
const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
|
const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
|
||||||
xrf.navigator.to(v.string,flags) // or let's surf to HREF!
|
xrf.navigator.to(v.string,flags) // let's surf to HREF!
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,11 +90,13 @@ xrf.frag.href = function(v, opts){
|
||||||
}else if( mesh.material){ mesh.material = mesh.material.clone() }
|
}else if( mesh.material){ mesh.material = mesh.material.clone() }
|
||||||
|
|
||||||
let click = mesh.userData.XRF.href.exec = (e) => {
|
let click = mesh.userData.XRF.href.exec = (e) => {
|
||||||
|
let lastPos = `#pos=${camera.position.x},${camera.position.y},${camera.position.z}`
|
||||||
xrf
|
xrf
|
||||||
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
.emit('href',{click:true,mesh,xrf:v}) // let all listeners agree
|
||||||
.then( () => {
|
.then( () => {
|
||||||
|
xrf.navigator.to(lastPos) // commit last position
|
||||||
const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
|
const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
|
||||||
xrf.navigator.to(v.string,flags) // or let's surf to HREF!
|
xrf.navigator.to(v.string,flags) // let's surf to HREF!
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue