@panoramax/web-viewer 3.2.3-develop-efc61aeb → 3.2.3-develop-78cd3228

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.3-develop-efc61aeb",
3
+ "version": "3.2.3-develop-78cd3228",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -60,8 +60,8 @@ export default class Basic extends LitElement {
60
60
  this.mapstyle = this.getAttribute("mapstyle") || DEFAULT_TILES;
61
61
  this.lang = this.getAttribute("lang") || null;
62
62
  this.endpoint = this.getAttribute("endpoint") || null; // No default
63
- this.picture = null;
64
- this.sequence = null;
63
+ this.picture = this.getAttribute("picture") || null;
64
+ this.sequence = this.getAttribute("sequence") || null;
65
65
 
66
66
  // Display version in logs
67
67
  console.info(`📷 Panoramax ${this.getClassName()} - Version ${PACKAGE_JSON.version} (${__COMMIT_HASH__})
@@ -2,6 +2,7 @@ import { LitElement, html, nothing, css } from "lit";
2
2
  import { classMap } from "lit/directives/class-map.js";
3
3
  import { fa } from "../../utils/widgets";
4
4
  import { faArrowLeft } from "@fortawesome/free-solid-svg-icons/faArrowLeft";
5
+ import { faChevronUp } from "@fortawesome/free-solid-svg-icons/faChevronUp";
5
6
  import { faChevronDown } from "@fortawesome/free-solid-svg-icons/faChevronDown";
6
7
  import { faUser } from "@fortawesome/free-solid-svg-icons/faUser";
7
8
  import { faCalendarAlt } from "@fortawesome/free-solid-svg-icons/faCalendarAlt";
@@ -151,7 +152,7 @@ export default class PictureLegend extends LitElement {
151
152
  _onPicChange(picMeta) {
152
153
  clearTimeout(this._addrTimer1);
153
154
  this._caption = picMeta?.caption;
154
- this._expanded = !this.collapsable;
155
+ this._expanded = this._expanded && this.collapsable;
155
156
 
156
157
  if(picMeta) {
157
158
  const coordsHash = `${picMeta.gps[0]}/${picMeta.gps[1]}`;
@@ -177,8 +178,7 @@ export default class PictureLegend extends LitElement {
177
178
 
178
179
  /** @private */
179
180
  _onBackClick() {
180
- if(this._expanded && this.collapsable) { this._expanded = false; }
181
- else { this._parent.select(); }
181
+ this._parent._setFocus?.("map");
182
182
  }
183
183
 
184
184
  /** @private */
@@ -190,12 +190,14 @@ export default class PictureLegend extends LitElement {
190
190
 
191
191
  return html`
192
192
  <div class="headline">
193
- <pnx-button
194
- kind="superinline"
195
- @click=${this._onBackClick}
196
- >
197
- ${fa(faArrowLeft)}
198
- </pnx-button>
193
+ ${this._parent._setFocus ? html`
194
+ <pnx-button
195
+ kind="superinline"
196
+ @click=${this._onBackClick}
197
+ >
198
+ ${fa(faArrowLeft)}
199
+ </pnx-button>
200
+ ` : nothing}
199
201
 
200
202
  <div id="pic-legend-addr">
201
203
  ${this._addr?.length > 0 ? this._addr : html`<span class="pnx-placeholder-loading">&nbsp;</span>`}
@@ -236,14 +238,14 @@ export default class PictureLegend extends LitElement {
236
238
  </slot>
237
239
  </div>
238
240
 
241
+ <pnx-picture-metadata class=${shownExpanded} ._parent=${this._parent}></pnx-picture-metadata>
242
+
239
243
  ${this.collapsable ? html`<pnx-button
240
- kind="full"
244
+ kind="inline"
245
+ size="sm"
241
246
  id="pic-legend-expand"
242
- class=${hiddenExpanded}
243
- @click=${() => this._expanded = true}
244
- >${fa(faChevronDown)}</pnx-button>` : nothing}
245
-
246
- <pnx-picture-metadata class=${shownExpanded} ._parent=${this._parent}></pnx-picture-metadata>
247
+ @click=${() => this._expanded = !this._expanded}
248
+ >${this._expanded ? fa(faChevronUp) : fa(faChevronDown)}</pnx-button>` : nothing}
247
249
  `;
248
250
  }
249
251
  }
@@ -358,7 +358,7 @@ export function alterPhotoViewerState(viewer, params) {
358
358
  console.warn("Multiple picture IDs passed in URL, only first one kept");
359
359
  }
360
360
 
361
- viewer.select(null, picIds[0]);
361
+ viewer.select(null, picIds[0], true);
362
362
  }
363
363
  else {
364
364
  viewer.select();
@@ -451,7 +451,7 @@ describe("alterViewerState", () => {
451
451
  it("should select the first picture ID when picture param is provided", () => {
452
452
  const params = { picture: "pic1;pic2" };
453
453
  alterViewerState(viewer, params);
454
- expect(viewer.select).toHaveBeenCalledWith(null, "pic1");
454
+ expect(viewer.select).toHaveBeenCalledWith(null, "pic1", true);
455
455
  expect(console.warn).toHaveBeenCalledWith("Multiple picture IDs passed in URL, only first one kept");
456
456
  });
457
457
 
@@ -492,7 +492,7 @@ describe("alterViewerState", () => {
492
492
  const params = { picture: "pic1", focus: "map", forceFocus: true };
493
493
  viewer.map = {};
494
494
  alterViewerState(viewer, params);
495
- expect(viewer.select).toHaveBeenCalledWith(null, "pic1");
495
+ expect(viewer.select).toHaveBeenCalledWith(null, "pic1", true);
496
496
  expect(viewer.setPopup).toHaveBeenCalledWith(false);
497
497
  expect(viewer._setFocus).toHaveBeenCalledWith("map", null, true);
498
498
  });