@panoramax/web-viewer 3.2.2-develop-19a0de46 → 3.2.2-develop-e0cee138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viewer/URLHash.js +8 -0
- package/tests/viewer/URLHash.test.js +3 -0
package/package.json
CHANGED
package/src/viewer/URLHash.js
CHANGED
|
@@ -277,6 +277,7 @@ export default class URLHash extends EventTarget {
|
|
|
277
277
|
|
|
278
278
|
// Change focus
|
|
279
279
|
if(vals.focus && ["map", "pic"].includes(vals.focus)) {
|
|
280
|
+
this._viewer.setPopup(false);
|
|
280
281
|
this._viewer.setFocus(vals.focus);
|
|
281
282
|
}
|
|
282
283
|
if(vals.focus && vals.focus == "meta") {
|
|
@@ -434,11 +435,18 @@ export default class URLHash extends EventTarget {
|
|
|
434
435
|
const prevPic = this._getCurrentHash().pic || "";
|
|
435
436
|
const nextPic = this._viewer?.psv?.getPictureMetadata()?.id || "";
|
|
436
437
|
|
|
438
|
+
const prevFocus = this._getCurrentHash().focus || "";
|
|
439
|
+
const nextFocus = nextUrl.hash.includes("focus=meta") ? "meta" : (nextUrl.hash.includes("focus=map") ? "map" : "pic");
|
|
440
|
+
|
|
437
441
|
try {
|
|
438
442
|
// If different pic, add entry in browser history
|
|
439
443
|
if(prevPic != nextPic) {
|
|
440
444
|
window.history.pushState(window.history.state, null, nextUrl.href);
|
|
441
445
|
}
|
|
446
|
+
// If metadata popup is open, come back to pic/map
|
|
447
|
+
else if(prevFocus != nextFocus && nextFocus == "meta") {
|
|
448
|
+
window.history.pushState(window.history.state, null, nextUrl.href);
|
|
449
|
+
}
|
|
442
450
|
// If same pic, just update viewer params
|
|
443
451
|
else {
|
|
444
452
|
window.history.replaceState(window.history.state, null, nextUrl.href);
|
|
@@ -319,6 +319,7 @@ describe("_onHashChange", () => {
|
|
|
319
319
|
select: jest.fn(),
|
|
320
320
|
setFocus: jest.fn(),
|
|
321
321
|
setFilters: jest.fn(),
|
|
322
|
+
setPopup: jest.fn(),
|
|
322
323
|
};
|
|
323
324
|
const uh = new URLHash(v);
|
|
324
325
|
uh._getCurrentHash = () => ({
|
|
@@ -383,6 +384,7 @@ describe("_onHashChange", () => {
|
|
|
383
384
|
select: jest.fn(),
|
|
384
385
|
setFocus: jest.fn(),
|
|
385
386
|
setFilters: jest.fn(),
|
|
387
|
+
setPopup: jest.fn(),
|
|
386
388
|
};
|
|
387
389
|
const uh = new URLHash(v);
|
|
388
390
|
uh._getCurrentHash = () => ({
|
|
@@ -414,6 +416,7 @@ describe("_onHashChange", () => {
|
|
|
414
416
|
select: jest.fn(),
|
|
415
417
|
setFocus: jest.fn(),
|
|
416
418
|
setFilters: jest.fn(),
|
|
419
|
+
setPopup: jest.fn(),
|
|
417
420
|
};
|
|
418
421
|
const uh = new URLHash(v);
|
|
419
422
|
uh._getCurrentHash = () => ({
|