Merge pull request #22 from ewized/fix/addressbar

Fix/addressbar
This commit is contained in:
Lukas Rieger 2020-01-19 18:38:24 +01:00 committed by GitHub
commit fe3f8eb53e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,10 @@ export default class BlueMap {
this.initModules(); this.initModules();
this.start(); this.start();
}).catch(error => this.onLoadError(error.toString())); }).catch(error => {
this.onLoadError(error.toString())
console.error(error);
});
} }
initModules() { initModules() {
@ -204,14 +207,17 @@ export default class BlueMap {
} }
this.locationHash = this.locationHash =
'#' + this.map '#' + this.map
+ ':' + Math.floor(this.controls.targetPosition.x) + ':' + Math.floor(this.controls.targetPosition.x)
+ ':' + Math.floor(this.controls.targetPosition.z) + ':' + Math.floor(this.controls.targetPosition.z)
+ ':' + Math.round(this.controls.targetDirection * 100) / 100 + ':' + Math.round(this.controls.targetDirection * 100) / 100
+ ':' + Math.round(this.controls.targetDistance * 100) / 100 + ':' + Math.round(this.controls.targetDistance * 100) / 100
+ ':' + Math.ceil(this.controls.targetAngle * 100) / 100 + ':' + Math.ceil(this.controls.targetAngle * 100) / 100
+ ':' + Math.floor(this.controls.targetPosition.y); + ':' + Math.floor(this.controls.targetPosition.y);
history.replaceState(undefined, undefined, this.locationHash); // only update hash when changed
if (window.location.hash !== this.locationHash) {
history.replaceState(undefined, undefined, this.locationHash);
}
}; };
render = () => { render = () => {