@panoramax/web-viewer 3.2.0-develop-082597d1 → 3.2.0-develop-1458d56d

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "3.2.0-develop-082597d1",
3
+ "version": "3.2.0-develop-1458d56d",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
package/src/Viewer.js CHANGED
@@ -200,6 +200,10 @@ class Viewer extends CoreView {
200
200
  if(this._options.selectedPicture) {
201
201
  this.select(null, this._options.selectedPicture, true);
202
202
  this.addEventListener("psv:picture-loaded", () => {
203
+ // Force setting of sequence ID after load
204
+ if(!this._selectedSeqId && this.psv?._myVTour?.getCurrentNode()?.sequence?.id) {
205
+ this.select(this.psv._myVTour.getCurrentNode().sequence.id, this._options.selectedPicture);
206
+ }
203
207
  if(this.map && this._options.map) {
204
208
  this.map.jumpTo(this._options.map);
205
209
  }
@@ -145,7 +145,7 @@ export default class CoreView extends EventTarget {
145
145
  select(seqId = null, picId = null, force = false) {
146
146
  const prevSeqId = this._selectedSeqId || null;
147
147
  const prevPicId = this._selectedPicId || null;
148
- if(!force && prevPicId == picId) { return; } // Avoid running if already selected
148
+ if(!force && prevPicId == picId && prevSeqId == seqId) { return; } // Avoid running if already selected
149
149
 
150
150
  this._selectedSeqId = seqId;
151
151
  this._selectedPicId = picId;
package/src/utils/API.js CHANGED
@@ -116,8 +116,8 @@ export default class API {
116
116
  throw new Error("API Landing page doesn't contain 'links' list");
117
117
  }
118
118
 
119
- if(!landing.stac_version.startsWith("1.0")) {
120
- throw new Error(`API is not in a supported STAC version (Panoramax viewer supports only 1.0, API is ${landing.stac_version})`);
119
+ if(!landing.stac_version.startsWith("1.")) {
120
+ throw new Error(`API is not in a supported STAC version (Panoramax viewer supports only 1.x, API is ${landing.stac_version})`);
121
121
  }
122
122
 
123
123
  // Read metadata
package/src/utils/I18n.js CHANGED
@@ -20,6 +20,7 @@ const TRANSLATIONS = {
20
20
  * @param {str[]} supportedTranslations List of supported languages
21
21
  * @param {str} fallback The fallback language
22
22
  * @returns The best matching language
23
+ * @private
23
24
  */
24
25
  export function autoDetectLocale(supportedTranslations, fallback) { // eslint-ignore import/no-unused-modules
25
26
  for (const navigatorLang of window.navigator.languages) {
@@ -46,6 +46,7 @@ const ArrowTurn = svgToPSVLink(ArrowTurnSVG, COLORS.NEXT);
46
46
  * @param {number[]} ranges The QUALITYSCORE_*_VALUES definition
47
47
  * @param {number} value The picture value
48
48
  * @return {number} The corresponding grade (1 to 5, or null if missing)
49
+ * @private
49
50
  */
50
51
  export function getGrade(ranges, value) {
51
52
  if(value === null || value === undefined || value === "") { return null; }
@@ -588,6 +589,7 @@ export function isInternetFast() {
588
589
  * Get a cookie value
589
590
  * @param {str} name The cookie name
590
591
  * @returns {str} The cookie value, or null if not found
592
+ * @private
591
593
  */
592
594
  export function getCookie(name) {
593
595
  const parts = document.cookie
@@ -602,6 +604,7 @@ export function getCookie(name) {
602
604
  /**
603
605
  * Checks if an user account exists
604
606
  * @returns {object} Object like {"id", "name"} or null if no authenticated account
607
+ * @private
605
608
  */
606
609
  export function getUserAccount() {
607
610
  const session = getCookie("session");
@@ -502,6 +502,7 @@ export function createLabel(forAttr, text, faIcon = null) {
502
502
  * Show a grade in a nice, user-friendly way
503
503
  * @param {number} grade The obtained grade
504
504
  * @returns {string} Nice to display grade display
505
+ * @private
505
506
  */
506
507
  export function showGrade(grade, t) {
507
508
  let label = "<span class=\"gvs-grade\">";
@@ -523,6 +524,7 @@ export function showGrade(grade, t) {
523
524
  * Displays a nice QualityScore
524
525
  * @param {number} grade The 1 to 5 grade
525
526
  * @returns {Element} The HTML code for showing the grade
527
+ * @private
526
528
  */
527
529
  export function showQualityScore(grade) {
528
530
  const span = document.createElement("span");
@@ -180,7 +180,7 @@ describe("_parseLanding", () => {
180
180
  it("fails if API version is not supported", () => {
181
181
  const api = new API (ENDPOINT, { skipReadLanding: true });
182
182
  const landing = { stac_version: "0.1", links: [] };
183
- expect(() => api._parseLanding(landing)).toThrow("API is not in a supported STAC version (Panoramax viewer supports only 1.0, API is 0.1)");
183
+ expect(() => api._parseLanding(landing)).toThrow("API is not in a supported STAC version (Panoramax viewer supports only 1.x, API is 0.1)");
184
184
  });
185
185
 
186
186
  it("fails if mandatory links are not set", () => {