hashchange triggered by setHash is now properly ignored
This commit is contained in:
@@ -3,7 +3,9 @@ overviewer.util = {
|
|||||||
// vars for callback
|
// vars for callback
|
||||||
readyQueue: [],
|
readyQueue: [],
|
||||||
isReady: false,
|
isReady: false,
|
||||||
|
|
||||||
|
lastHash: null,
|
||||||
|
|
||||||
/* fuzz tester!
|
/* fuzz tester!
|
||||||
*/
|
*/
|
||||||
'testMaths': function(t) {
|
'testMaths': function(t) {
|
||||||
@@ -466,18 +468,23 @@ overviewer.util = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
'initHash': function() {
|
'initHash': function() {
|
||||||
if(window.location.hash.split("/").length > 1) {
|
var newHash = window.location.hash;
|
||||||
overviewer.util.goToHash();
|
if (overviewer.util.lastHash !== newHash) {
|
||||||
// Clean up the hash.
|
overviewer.util.lastHash = newHash;
|
||||||
overviewer.util.updateHash();
|
if(newHash.split("/").length > 1) {
|
||||||
|
overviewer.util.goToHash();
|
||||||
|
// Clean up the hash.
|
||||||
|
overviewer.util.updateHash();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'setHash': function(x, y, z, zoom, w, maptype) {
|
'setHash': function(x, y, z, zoom, w, maptype) {
|
||||||
// save this info is a nice easy to parse format
|
// save this info is a nice easy to parse format
|
||||||
var currentWorldView = overviewer.mapModel.get("currentWorldView");
|
var currentWorldView = overviewer.mapModel.get("currentWorldView");
|
||||||
currentWorldView.options.lastViewport = [x,y,z,zoom];
|
currentWorldView.options.lastViewport = [x,y,z,zoom];
|
||||||
window.location.replace("#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + w + "/" + maptype);
|
var newHash = "#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + w + "/" + maptype;
|
||||||
|
overviewer.util.lastHash = newHash; // this should not trigger initHash
|
||||||
|
window.location.replace(newHash);
|
||||||
},
|
},
|
||||||
'updateHash': function() {
|
'updateHash': function() {
|
||||||
var currTileset = overviewer.mapView.options.currentTileSet;
|
var currTileset = overviewer.mapView.options.currentTileSet;
|
||||||
|
|||||||
Reference in New Issue
Block a user