Skip to content

Commit fe3f8eb

Browse files
authored
Merge pull request #22 from ewized/fix/addressbar
Fix/addressbar
2 parents 0436606 + f4f24bb commit fe3f8eb

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

BlueMapCore/src/main/webroot/js/libs/BlueMap.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ export default class BlueMap {
8888

8989
this.initModules();
9090
this.start();
91-
}).catch(error => this.onLoadError(error.toString()));
91+
}).catch(error => {
92+
this.onLoadError(error.toString())
93+
console.error(error);
94+
});
9295
}
9396

9497
initModules() {
@@ -204,14 +207,17 @@ export default class BlueMap {
204207
}
205208

206209
this.locationHash =
207-
'#' + this.map
208-
+ ':' + Math.floor(this.controls.targetPosition.x)
209-
+ ':' + Math.floor(this.controls.targetPosition.z)
210-
+ ':' + Math.round(this.controls.targetDirection * 100) / 100
211-
+ ':' + Math.round(this.controls.targetDistance * 100) / 100
212-
+ ':' + Math.ceil(this.controls.targetAngle * 100) / 100
213-
+ ':' + Math.floor(this.controls.targetPosition.y);
214-
history.replaceState(undefined, undefined, this.locationHash);
210+
'#' + this.map
211+
+ ':' + Math.floor(this.controls.targetPosition.x)
212+
+ ':' + Math.floor(this.controls.targetPosition.z)
213+
+ ':' + Math.round(this.controls.targetDirection * 100) / 100
214+
+ ':' + Math.round(this.controls.targetDistance * 100) / 100
215+
+ ':' + Math.ceil(this.controls.targetAngle * 100) / 100
216+
+ ':' + Math.floor(this.controls.targetPosition.y);
217+
// only update hash when changed
218+
if (window.location.hash !== this.locationHash) {
219+
history.replaceState(undefined, undefined, this.locationHash);
220+
}
215221
};
216222

217223
render = () => {

0 commit comments

Comments
 (0)