bugfix: always save position when clicking
This commit is contained in:
parent
3aad020eb6
commit
d3eb478223
1 changed files with 5 additions and 2 deletions
|
|
@ -93,15 +93,18 @@ xrf.frag.href = function(v, opts){
|
||||||
|
|
||||||
let isLocal = v.string[0] == '#'
|
let isLocal = v.string[0] == '#'
|
||||||
let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}`
|
let lastPos = `pos=${camera.position.x.toFixed(2)},${camera.position.y.toFixed(2)},${camera.position.z.toFixed(2)}`
|
||||||
|
console.dir(lastPos)
|
||||||
|
|
||||||
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( () => {
|
||||||
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
|
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
|
||||||
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
|
||||||
|
let url = v.string
|
||||||
// always keep a trail of last positions before we navigate
|
// always keep a trail of last positions before we navigate
|
||||||
if( !v.string.match(/pos=/) ) v.string += `${v.string[0] == '#' ? '&' : '#'}${lastPos}`
|
if( v.string.match(/pos=/) == null ) {
|
||||||
if( !document.location.hash.match(/pos=/) ) xrf.navigator.to(`#${lastPos}`,flags)
|
url += `${v.string[0] == '#' ? '&' : '#'}${lastPos}`
|
||||||
|
}
|
||||||
xrf.navigator.to(v.string) // let's surf to HREF!
|
xrf.navigator.to(v.string) // let's surf to HREF!
|
||||||
})
|
})
|
||||||
.catch( console.error )
|
.catch( console.error )
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue