This commit is contained in:
Leon van Kammen 2023-08-31 12:40:41 +02:00
parent 6849ac4625
commit f36cc0ab5f
11 changed files with 472 additions and 202 deletions

View file

@ -1023,6 +1023,7 @@ xrf.navigator.updateHash = (hash) => {
xrf.navigator.pushState = (file,hash) => { xrf.navigator.pushState = (file,hash) => {
if( file == document.location.search.substr(1) ) return // page is in its default state if( file == document.location.search.substr(1) ) return // page is in its default state
console.log("pushstate")
window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` ) window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` )
} }
xrf.frag.bg = function(v, opts){ xrf.frag.bg = function(v, opts){
@ -1162,12 +1163,14 @@ xrf.frag.href = function(v, opts){
let click = mesh.userData.XRF.href.exec = (e) => { let click = mesh.userData.XRF.href.exec = (e) => {
let isLocal = v.string[0] == '#' let isLocal = v.string[0] == '#'
let lastPos = `#pos=${camera.position.x},${camera.position.y},${camera.position.z}` let lastPos = `pos=${camera.position.x.toFixed(1)},${camera.position.y.toFixed(1)},${camera.position.z.toFixed(1)}`
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] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
if( !isLocal || v.string.match(/pos=/) ) xrf.navigator.to(lastPos) // commit last position //const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
if( !v.string.match(/pos=/) ) v.string += `${v.string[0] == '#' ? '&' : '#'}${lastPos}` // always commit last position
console.log(v.string)
xrf.navigator.to(v.string,flags) // let's surf to HREF! xrf.navigator.to(v.string,flags) // let's surf to HREF!
}) })
} }
@ -1324,10 +1327,12 @@ xrf.frag.updatePredefinedView = (opts) => {
if( pviews.length ) xrf.navigator.updateHash( pviews.join("&") ) if( pviews.length ) xrf.navigator.updateHash( pviews.join("&") )
} }
// when predefined view occurs in url changes // react to url changes
//xrf.addEventListener('updateHash', (opts) => { //xrf.addEventListener('updateHash', (opts) => {
// let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) // console.log("update hash");
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf}) // console.dir(opts)
// let frag = xrf.URI.parse( opts.hash, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene})
//}) //})
// clicking href url with predefined view // clicking href url with predefined view

View file

@ -1023,6 +1023,7 @@ xrf.navigator.updateHash = (hash) => {
xrf.navigator.pushState = (file,hash) => { xrf.navigator.pushState = (file,hash) => {
if( file == document.location.search.substr(1) ) return // page is in its default state if( file == document.location.search.substr(1) ) return // page is in its default state
console.log("pushstate")
window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` ) window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` )
} }
xrf.frag.bg = function(v, opts){ xrf.frag.bg = function(v, opts){
@ -1162,12 +1163,14 @@ xrf.frag.href = function(v, opts){
let click = mesh.userData.XRF.href.exec = (e) => { let click = mesh.userData.XRF.href.exec = (e) => {
let isLocal = v.string[0] == '#' let isLocal = v.string[0] == '#'
let lastPos = `#pos=${camera.position.x},${camera.position.y},${camera.position.z}` let lastPos = `pos=${camera.position.x.toFixed(1)},${camera.position.y.toFixed(1)},${camera.position.z.toFixed(1)}`
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] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
if( !isLocal || v.string.match(/pos=/) ) xrf.navigator.to(lastPos) // commit last position //const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
if( !v.string.match(/pos=/) ) v.string += `${v.string[0] == '#' ? '&' : '#'}${lastPos}` // always commit last position
console.log(v.string)
xrf.navigator.to(v.string,flags) // let's surf to HREF! xrf.navigator.to(v.string,flags) // let's surf to HREF!
}) })
} }
@ -1324,10 +1327,12 @@ xrf.frag.updatePredefinedView = (opts) => {
if( pviews.length ) xrf.navigator.updateHash( pviews.join("&") ) if( pviews.length ) xrf.navigator.updateHash( pviews.join("&") )
} }
// when predefined view occurs in url changes // react to url changes
//xrf.addEventListener('updateHash', (opts) => { //xrf.addEventListener('updateHash', (opts) => {
// let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) // console.log("update hash");
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf}) // console.dir(opts)
// let frag = xrf.URI.parse( opts.hash, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene})
//}) //})
// clicking href url with predefined view // clicking href url with predefined view

View file

@ -1023,6 +1023,7 @@ xrf.navigator.updateHash = (hash) => {
xrf.navigator.pushState = (file,hash) => { xrf.navigator.pushState = (file,hash) => {
if( file == document.location.search.substr(1) ) return // page is in its default state if( file == document.location.search.substr(1) ) return // page is in its default state
console.log("pushstate")
window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` ) window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` )
} }
xrf.frag.bg = function(v, opts){ xrf.frag.bg = function(v, opts){
@ -1162,12 +1163,14 @@ xrf.frag.href = function(v, opts){
let click = mesh.userData.XRF.href.exec = (e) => { let click = mesh.userData.XRF.href.exec = (e) => {
let isLocal = v.string[0] == '#' let isLocal = v.string[0] == '#'
let lastPos = `#pos=${camera.position.x},${camera.position.y},${camera.position.z}` let lastPos = `pos=${camera.position.x.toFixed(1)},${camera.position.y.toFixed(1)},${camera.position.z.toFixed(1)}`
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] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
if( !isLocal || v.string.match(/pos=/) ) xrf.navigator.to(lastPos) // commit last position //const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
if( !v.string.match(/pos=/) ) v.string += `${v.string[0] == '#' ? '&' : '#'}${lastPos}` // always commit last position
console.log(v.string)
xrf.navigator.to(v.string,flags) // let's surf to HREF! xrf.navigator.to(v.string,flags) // let's surf to HREF!
}) })
} }
@ -1324,10 +1327,12 @@ xrf.frag.updatePredefinedView = (opts) => {
if( pviews.length ) xrf.navigator.updateHash( pviews.join("&") ) if( pviews.length ) xrf.navigator.updateHash( pviews.join("&") )
} }
// when predefined view occurs in url changes // react to url changes
//xrf.addEventListener('updateHash', (opts) => { //xrf.addEventListener('updateHash', (opts) => {
// let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) // console.log("update hash");
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf}) // console.dir(opts)
// let frag = xrf.URI.parse( opts.hash, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene})
//}) //})
// clicking href url with predefined view // clicking href url with predefined view

5
doc/RFC.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
set -e
mmark RFC.template.md > RFC_XR_Fragments.xml
mmark --html RFC.template.md > RFC_XR_Fragments.html
xml2rfc --v3 RFC_XR_Fragments.xml # RFC_XR_Fragments.txt

47
doc/RFC.template.md Normal file
View file

@ -0,0 +1,47 @@
%%%
Title = "XR Fragments"
area = "Internet"
workgroup = "Internet Engineering Task Force"
[seriesInfo]
name = "XR-Fragments"
value = "draft-XRFRAGMENTS-leonvankammen-00"
stream = "IETF"
status = "informational"
date = 2023-04-12T00:00:00Z
[[author]]
initials="L.R."
surname="van Kammen"
fullname="L.R. van Kammen"
%%%
<!-- for annotated version see: https://raw.githubusercontent.com/ietf-tools/rfcxml-templates-and-schemas/main/draft-rfcxml-general-template-annotated-00.xml -->
.# Abstract
This is a small test document.
{mainmatter}
# Introduction
TODO Introduction
# Conventions and Definitions
{::boilerplate bcp14-tagged}
# Security Considerations
TODO Security
# IANA Considerations
This document has no IANA actions.
# Acknowledgments
TODO acknowledge.

11
doc/shell.nix Normal file
View file

@ -0,0 +1,11 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
# nativeBuildInputs is usually what you want -- tools you need to run
nativeBuildInputs = with pkgs.buildPackages; [
mmark
xml2rfc
];
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -63,5 +63,6 @@ xrf.navigator.updateHash = (hash) => {
xrf.navigator.pushState = (file,hash) => { xrf.navigator.pushState = (file,hash) => {
if( file == document.location.search.substr(1) ) return // page is in its default state if( file == document.location.search.substr(1) ) return // page is in its default state
console.log("pushstate")
window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` ) window.history.pushState({},`${file}#${hash}`, document.location.pathname + `?${file}#${hash}` )
} }

View file

@ -91,12 +91,14 @@ xrf.frag.href = function(v, opts){
let click = mesh.userData.XRF.href.exec = (e) => { let click = mesh.userData.XRF.href.exec = (e) => {
let isLocal = v.string[0] == '#' let isLocal = v.string[0] == '#'
let lastPos = `#pos=${camera.position.x},${camera.position.y},${camera.position.z}` let lastPos = `pos=${camera.position.x.toFixed(1)},${camera.position.y.toFixed(1)},${camera.position.z.toFixed(1)}`
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] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
if( !isLocal || v.string.match(/pos=/) ) xrf.navigator.to(lastPos) // commit last position //const flags = v.string[0] == '#' && v.string.match(/(\||#q)/) ? xrf.XRF.PV_OVERRIDE : undefined
if( !v.string.match(/pos=/) ) v.string += `${v.string[0] == '#' ? '&' : '#'}${lastPos}` // always commit last position
console.log(v.string)
xrf.navigator.to(v.string,flags) // let's surf to HREF! xrf.navigator.to(v.string,flags) // let's surf to HREF!
}) })
} }

View file

@ -77,10 +77,12 @@ xrf.frag.updatePredefinedView = (opts) => {
if( pviews.length ) xrf.navigator.updateHash( pviews.join("&") ) if( pviews.length ) xrf.navigator.updateHash( pviews.join("&") )
} }
// when predefined view occurs in url changes // react to url changes
//xrf.addEventListener('updateHash', (opts) => { //xrf.addEventListener('updateHash', (opts) => {
// let frag = xrf.URI.parse( opts.xrf.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA ) // console.log("update hash");
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene,href:opts.xrf}) // console.dir(opts)
// let frag = xrf.URI.parse( opts.hash, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
// xrf.frag.updatePredefinedView({frag,scene:xrf.scene})
//}) //})
// clicking href url with predefined view // clicking href url with predefined view