From 9d4b586686936c39a34e9e60adab935f07e0ed01 Mon Sep 17 00:00:00 2001 From: Joshua Rodriguez Date: Sun, 19 Jan 2020 08:27:27 -0800 Subject: [PATCH 1/2] Also log error message to the console --- BlueMapCore/src/main/webroot/js/libs/BlueMap.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BlueMapCore/src/main/webroot/js/libs/BlueMap.js b/BlueMapCore/src/main/webroot/js/libs/BlueMap.js index d7b0aa11..caade00c 100644 --- a/BlueMapCore/src/main/webroot/js/libs/BlueMap.js +++ b/BlueMapCore/src/main/webroot/js/libs/BlueMap.js @@ -88,7 +88,10 @@ export default class BlueMap { this.initModules(); this.start(); - }).catch(error => this.onLoadError(error.toString())); + }).catch(error => { + this.onLoadError(error.toString()) + console.error(error); + }); } initModules() { From f4f24bb7708d54636f028044fa5b63825cbb3843 Mon Sep 17 00:00:00 2001 From: Joshua Rodriguez Date: Sun, 19 Jan 2020 08:27:57 -0800 Subject: [PATCH 2/2] Only update location on hash change fixes #9 --- .../src/main/webroot/js/libs/BlueMap.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/BlueMapCore/src/main/webroot/js/libs/BlueMap.js b/BlueMapCore/src/main/webroot/js/libs/BlueMap.js index caade00c..777dc504 100644 --- a/BlueMapCore/src/main/webroot/js/libs/BlueMap.js +++ b/BlueMapCore/src/main/webroot/js/libs/BlueMap.js @@ -207,14 +207,17 @@ export default class BlueMap { } this.locationHash = - '#' + this.map - + ':' + Math.floor(this.controls.targetPosition.x) - + ':' + Math.floor(this.controls.targetPosition.z) - + ':' + Math.round(this.controls.targetDirection * 100) / 100 - + ':' + Math.round(this.controls.targetDistance * 100) / 100 - + ':' + Math.ceil(this.controls.targetAngle * 100) / 100 - + ':' + Math.floor(this.controls.targetPosition.y); - history.replaceState(undefined, undefined, this.locationHash); + '#' + this.map + + ':' + Math.floor(this.controls.targetPosition.x) + + ':' + Math.floor(this.controls.targetPosition.z) + + ':' + Math.round(this.controls.targetDirection * 100) / 100 + + ':' + Math.round(this.controls.targetDistance * 100) / 100 + + ':' + Math.ceil(this.controls.targetAngle * 100) / 100 + + ':' + Math.floor(this.controls.targetPosition.y); + // only update hash when changed + if (window.location.hash !== this.locationHash) { + history.replaceState(undefined, undefined, this.locationHash); + } }; render = () => {