@panoramax/web-viewer 4.0.2-develop-682e2a36 → 4.0.2-develop-0a728dda

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": "4.0.2-develop-682e2a36",
3
+ "version": "4.0.2-develop-0a728dda",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -996,6 +996,7 @@ export default class Photo extends PSViewer {
996
996
  fill: "var(--orange-transparent)",
997
997
  cursor: "pointer",
998
998
  },
999
+ tooltip: this._parent._t.pnx.semantics_annotation_tooltip,
999
1000
  };
1000
1001
  });
1001
1002
  this._myMarkers.setMarkers(annotations);
@@ -1022,7 +1023,7 @@ export default class Photo extends PSViewer {
1022
1023
  */
1023
1024
  focusOnAnnotation(id) {
1024
1025
  if(!this.areAnnotationsVisible()) { this.toggleAllAnnotations(true); }
1025
- this.unfocusAnnotation();
1026
+ this.unfocusAnnotation(true);
1026
1027
 
1027
1028
  const annotationId = `annotation-${id}`;
1028
1029
  this._myMarkers.updateMarker({
@@ -1043,8 +1044,9 @@ export default class Photo extends PSViewer {
1043
1044
  /**
1044
1045
  * Remove focus styling on annotations.
1045
1046
  * @memberof Panoramax.components.ui.Photo#
1047
+ * @param {boolean} [skipEvent=false] Set to true to avoid launching annotations-unfocused event
1046
1048
  */
1047
- unfocusAnnotation() {
1049
+ unfocusAnnotation(skipEvent = false) {
1048
1050
  const selectedAnnotations = Object.keys(this._myMarkers.markers)
1049
1051
  .filter(id => id.startsWith("annotation-") && this._myMarkers.markers[id]?.config?.data?.selected);
1050
1052
 
@@ -1063,12 +1065,14 @@ export default class Photo extends PSViewer {
1063
1065
  });
1064
1066
  });
1065
1067
 
1066
- /**
1067
- * Event for pictures annotation unfocus
1068
- * @event Panoramax.components.ui.Photo#annotations-unfocused
1069
- * @type {Event}
1070
- */
1071
- this.dispatchEvent(new Event("annotations-unfocused"));
1068
+ if(!skipEvent) {
1069
+ /**
1070
+ * Event for pictures annotation unfocus
1071
+ * @event Panoramax.components.ui.Photo#annotations-unfocused
1072
+ * @type {Event}
1073
+ */
1074
+ this.dispatchEvent(new Event("annotations-unfocused"));
1075
+ }
1072
1076
  }
1073
1077
  }
1074
1078
 
@@ -179,6 +179,7 @@
179
179
  "semantics_features_none": "No feature has been detected or annotated in this picture yet.",
180
180
  "semantics_features_default_title": "Feature #{nb}",
181
181
  "semantics_features_subtitle": "{nb} associated properties",
182
+ "semantics_annotation_tooltip": "Click to see details",
182
183
  "semantics_show_all_tags": "Show all tags",
183
184
  "semantics_hide_all_tags": "Hide all tags",
184
185
  "semantics_key": "Key",
@@ -179,6 +179,7 @@
179
179
  "semantics_features_none": "Aucun objet n'a été détecté ou annoté dans cette photo pour l'instant.",
180
180
  "semantics_features_default_title": "Objet #{nb}",
181
181
  "semantics_features_subtitle": "{nb} attributs associés",
182
+ "semantics_annotation_tooltip": "Cliquez pour voir les détails",
182
183
  "semantics_show_all_tags": "Voir tous les attributs",
183
184
  "semantics_hide_all_tags": "Masquer les attributs",
184
185
  "semantics_key": "Clé",
@@ -150,7 +150,7 @@ export default class URLHandler extends EventTarget {
150
150
  // If hash is compressed
151
151
  if(keyvals.s) {
152
152
  const shortVals = Object.fromEntries(
153
- keyvals.s
153
+ decodeURIComponent(keyvals.s)
154
154
  .split(";")
155
155
  .map(kv => [kv[0], kv.substring(1)])
156
156
  );
@@ -243,6 +243,48 @@ describe("currentURLParams", () => {
243
243
  const uh = new URLHandler(v);
244
244
  expect(uh.currentURLParams()).toStrictEqual({});
245
245
  });
246
+
247
+ it("works with shortlinks", () => {
248
+ delete window.location;
249
+ window.location = { search: "?s=fp;s2;pa0270208-d79d-49a9-85c7-a352bb96962e;c282.09/9.34/30;m17/43.107492/5.868459;va;bs" };
250
+ const v = { addEventListener: jest.fn() };
251
+ const uh = new URLHandler(v);
252
+ expect(uh.currentURLParams()).toStrictEqual({
253
+ "focus": "pic",
254
+ "speed": 200,
255
+ "pic": "a0270208-d79d-49a9-85c7-a352bb96962e",
256
+ "xyz": "282.09/9.34/30",
257
+ "map": "17/43.107492/5.868459",
258
+ "theme": "age",
259
+ "background": "streets",
260
+ "camera": undefined,
261
+ "date_from": undefined,
262
+ "date_to": undefined,
263
+ "pic_score": undefined,
264
+ "users": undefined
265
+ });
266
+ });
267
+
268
+ it("works with shortlinks urlEncoded", () => {
269
+ delete window.location;
270
+ window.location = { search: "?s=fp%3Bs2%3Bpa0270208-d79d-49a9-85c7-a352bb96962e%3Bc282.09/9.34/30%3Bm17/43.107492/5.868459%3Bva%3Bbs" };
271
+ const v = { addEventListener: jest.fn() };
272
+ const uh = new URLHandler(v);
273
+ expect(uh.currentURLParams()).toStrictEqual({
274
+ "focus": "pic",
275
+ "speed": 200,
276
+ "pic": "a0270208-d79d-49a9-85c7-a352bb96962e",
277
+ "xyz": "282.09/9.34/30",
278
+ "map": "17/43.107492/5.868459",
279
+ "theme": "age",
280
+ "background": "streets",
281
+ "camera": undefined,
282
+ "date_from": undefined,
283
+ "date_to": undefined,
284
+ "pic_score": undefined,
285
+ "users": undefined
286
+ });
287
+ });
246
288
  });
247
289
 
248
290
  describe("currentMapString", () => {