@panoramax/web-viewer 3.2.3-develop-7e5ca4d2 → 3.2.3-develop-587a6b56

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-7e5ca4d2",
3
+ "version": "3.2.3-develop-587a6b56",
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__})
@@ -127,8 +127,18 @@ export default class PictureMetadata extends LitElement {
127
127
  this._meta?.caption?.date && {
128
128
  title: this._parent?._t.pnx.metadata_general_date,
129
129
  content: html`
130
- <strong>${new Intl.DateTimeFormat(undefined, {dateStyle: "short"}).format(this._meta.caption.date)}</strong>
131
- <br />${new Intl.DateTimeFormat(undefined, {hour: "numeric", minute: "numeric", second: "numeric", fractionalSecondDigits: 3, timeZoneName: "longOffset"}).format(this._meta.caption.date)}
130
+ <strong>${new Intl.DateTimeFormat(undefined, {
131
+ timeZone: this._meta.caption.tz,
132
+ dateStyle: "short"
133
+ }).format(this._meta.caption.date)}</strong>
134
+ <br />${new Intl.DateTimeFormat(undefined, {
135
+ timeZone: this._meta.caption.tz,
136
+ hour: "numeric",
137
+ minute: "numeric",
138
+ second: "numeric",
139
+ fractionalSecondDigits: 3,
140
+ timeZoneName: "longOffset"
141
+ }).format(this._meta.caption.date)}
132
142
  `
133
143
  }
134
144
  ];
@@ -216,8 +226,8 @@ export default class PictureMetadata extends LitElement {
216
226
  this._meta?.caption?.date && {
217
227
  title: this._parent?._t.pnx.metadata_general_date,
218
228
  content: html`
219
- <strong>${new Intl.DateTimeFormat(undefined, {dateStyle: "long"}).format(this._meta.caption.date)}</strong>
220
- <br />${new Intl.DateTimeFormat(undefined, {hour: "numeric",minute:"numeric"}).format(this._meta.caption.date)}
229
+ <strong>${new Intl.DateTimeFormat(undefined, {timeZone: this._meta.caption.tz, dateStyle: "long"}).format(this._meta.caption.date)}</strong>
230
+ <br />${new Intl.DateTimeFormat(undefined, {timeZone: this._meta.caption.tz, hour: "numeric",minute:"numeric"}).format(this._meta.caption.date)}
221
231
  `
222
232
  },
223
233
  // Camera
@@ -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();
@@ -235,6 +235,14 @@ export function getNodeCaption(metadata, t) {
235
235
  // Timestamp
236
236
  if(metadata?.properties?.datetimetz) {
237
237
  caption.date = new Date(metadata.properties.datetimetz);
238
+ const timeZoneMatch = metadata.properties.datetimetz.match(/([+-]\d{2}):(\d{2})$|Z$/);
239
+ if (timeZoneMatch) {
240
+ if (timeZoneMatch[0] === "Z") {
241
+ caption.tz = "UTC";
242
+ } else {
243
+ caption.tz = timeZoneMatch[0];
244
+ }
245
+ }
238
246
  }
239
247
  else if(metadata?.properties?.datetime) {
240
248
  caption.date = new Date(metadata.properties.datetime);
@@ -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
  });
@@ -8,6 +8,7 @@ Object {
8
8
  "producer": Array [
9
9
  "Hopen111",
10
10
  ],
11
+ "tz": "+00:00",
11
12
  },
12
13
  "gps": Array [
13
14
  -92.70188245,
@@ -297,6 +298,7 @@ Object {
297
298
  "date": Object {
298
299
  "toLocaleDateString": [Function],
299
300
  },
301
+ "tz": "-03:00",
300
302
  }
301
303
  `;
302
304