@panoramax/web-viewer 3.1.1-develop-7ba76d1c → 3.1.1-develop-baa3e20d

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.1.1-develop-7ba76d1c",
3
+ "version": "3.1.1-develop-baa3e20d",
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
@@ -240,6 +240,13 @@ class Viewer extends CoreView {
240
240
  }).catch(e => console.warn("Error when looking up for user names", e));
241
241
  }
242
242
  }
243
+
244
+ // Dismiss popup with Escape
245
+ document.addEventListener("keyup", e => {
246
+ if(e.key === "Escape" && !this.popupContainer.classList.contains("gvs-hidden")) {
247
+ this.setPopup(false);
248
+ }
249
+ });
243
250
  };
244
251
 
245
252
  this._api.onceReady().then(() => {
@@ -46,7 +46,6 @@
46
46
  "picture_flat": "Klassisch",
47
47
  "picture_360": "360°",
48
48
  "filter_camera_model": "Nach Kameramodell",
49
- "filter_reset": "Filter löschen",
50
49
  "map_background": "Kartenhintergrund",
51
50
  "map_background_aerial": "Satelliten",
52
51
  "map_background_streets": "Straßen",
@@ -96,11 +96,11 @@
96
96
  "filter_date_1month": "1 month",
97
97
  "filter_date_1year": "1 year",
98
98
  "filter_user": "User",
99
+ "filter_user_mypics": "My pictures",
99
100
  "filter_picture": "Picture type",
100
101
  "filter_zoom_in": "Zoom-in for filters to be visible",
101
102
  "picture_flat": "Classic",
102
103
  "picture_360": "360°",
103
- "filter_reset": "Clear filters",
104
104
  "filter_qualityscore": "Quality score",
105
105
  "filter_qualityscore_help": "Click to enable or disable",
106
106
  "map_background": "Map background",
@@ -111,7 +111,6 @@
111
111
  "picture_flat": "Clásico",
112
112
  "picture_360": "360°",
113
113
  "filter_camera_model": "Por modelo de cámara",
114
- "filter_reset": "Quitar filtros",
115
114
  "map_background": "Fondo de mapa",
116
115
  "map_background_aerial": "Vista aérea",
117
116
  "map_theme": "Tema de mapa",
@@ -96,10 +96,10 @@
96
96
  "filter_date_1month": "1 mois",
97
97
  "filter_date_1year": "1 an",
98
98
  "filter_user": "Utilisateur",
99
+ "filter_user_mypics": "Mes photos",
99
100
  "filter_picture": "Type d'image",
100
101
  "picture_flat": "Classique",
101
102
  "picture_360": "360°",
102
- "filter_reset": "Retirer les filtres",
103
103
  "filter_qualityscore": "Score de qualité",
104
104
  "filter_qualityscore_help": "Cliquez pour activer ou désactiver",
105
105
  "filter_zoom_in": "Zoomez plus pour voir les filtres",
@@ -89,7 +89,6 @@
89
89
  "picture_flat": "Klasszikus",
90
90
  "picture_360": "360°",
91
91
  "filter_camera_model": "Kameramodell szerint",
92
- "filter_reset": "Szűrők törlése",
93
92
  "map_background": "Térképháttér",
94
93
  "map_background_aerial": "Légi felvétel",
95
94
  "map_background_streets": "képUtca",
@@ -18,7 +18,6 @@
18
18
  "filter_camera_model": "按相機型號",
19
19
  "filter_date": "日期",
20
20
  "filter_picture": "相片類型",
21
- "filter_reset": "重設",
22
21
  "filter_user": "使用者",
23
22
  "filter_zoom_in": "拉近地圖以顯示篩選結果",
24
23
  "filters": "篩選器",
@@ -111,6 +111,7 @@ export function createSearchBar(
111
111
  const input = document.createElement("input");
112
112
  input.type = "text";
113
113
  input.placeholder = placeholder;
114
+ input.id = `${id}-input`;
114
115
  bar.appendChild(input);
115
116
  const extendInput = () => {
116
117
  bar.classList.remove("gvs-search-bar-reduced");
@@ -154,7 +155,7 @@ export function createSearchBar(
154
155
  bar.resetSearch = resetSearch;
155
156
 
156
157
  // Handle result item click
157
- const goItem = (entry) => {
158
+ input.goItem = (entry) => {
158
159
  if(reduced) {
159
160
  onResultClick(entry);
160
161
  resetSearch();
@@ -164,6 +165,7 @@ export function createSearchBar(
164
165
  input.value = entry.title;
165
166
  list.innerHTML = "";
166
167
  list._toggle(false);
168
+ switchIcon(iconEmpty);
167
169
  onResultClick(entry);
168
170
  }
169
171
  };
@@ -211,7 +213,7 @@ export function createSearchBar(
211
213
  listEntry.classList.add("gvs-search-bar-result");
212
214
  listEntry.innerHTML = `${entry.title}<br /><small>${entry?.subtitle || ""}</small>`;
213
215
  list.appendChild(listEntry);
214
- listEntry.addEventListener("click", () => goItem(entry));
216
+ listEntry.addEventListener("click", () => input.goItem(entry));
215
217
  });
216
218
  }).catch(e => {
217
219
  console.error(e);
@@ -1046,6 +1046,18 @@ export default class Widgets {
1046
1046
  title.innerHTML = `${fat(faUser)} ${this._t.gvs.filter_user}`;
1047
1047
  form.appendChild(title);
1048
1048
 
1049
+ // Shortcut for my own pictures
1050
+ const userAccount = getUserAccount();
1051
+ let mypics;
1052
+ if(userAccount) {
1053
+ const shortcuts = document.createElement("div");
1054
+ shortcuts.classList.add("gvs-input-shortcuts");
1055
+ mypics = document.createElement("button");
1056
+ mypics.appendChild(document.createTextNode(this._t.gvs.filter_user_mypics));
1057
+ shortcuts.appendChild(mypics);
1058
+ form.appendChild(shortcuts);
1059
+ }
1060
+
1049
1061
  const input = document.createElement("div");
1050
1062
  input.id = "gvs-filter-user";
1051
1063
  input.classList.add("gvs-input-group");
@@ -1074,6 +1086,19 @@ export default class Widgets {
1074
1086
  );
1075
1087
  input.appendChild(userSearch);
1076
1088
  form.appendChild(input);
1089
+
1090
+ // Trigger "my pictures" shortcut action
1091
+ if(userAccount) {
1092
+ mypics.addEventListener("click", () => {
1093
+ const userInput = userSearch.querySelector("input");
1094
+ if(userInput.value === userAccount.name) {
1095
+ userSearch.resetSearch();
1096
+ }
1097
+ else {
1098
+ userInput.goItem({ title: userAccount.name, data: { id: userAccount.id } });
1099
+ }
1100
+ });
1101
+ }
1077
1102
  }
1078
1103
 
1079
1104
  // Shortcuts
@@ -1081,8 +1106,10 @@ export default class Widgets {
1081
1106
  btn.addEventListener("click", () => {
1082
1107
  const elem = document.getElementById(btn.getAttribute("data-for"));
1083
1108
  const val = btn.getAttribute("data-value");
1084
- if(elem && elem.value !== val) { elem.value = val; }
1085
- else { elem.value = ""; }
1109
+ if(elem) {
1110
+ if(elem.value !== val) { elem.value = val; }
1111
+ else { elem.value = ""; }
1112
+ }
1086
1113
  });
1087
1114
  });
1088
1115
 
@@ -1205,10 +1232,23 @@ export default class Widgets {
1205
1232
  fScoreD.checked = e.detail.qualityscore.includes(2) && e.detail.qualityscore.length < 5;
1206
1233
  fScoreE.checked = e.detail.qualityscore.includes(1) && e.detail.qualityscore.length < 5;
1207
1234
  }
1208
- btnFilter.setActive(Object.keys(e.detail).filter(d => d && d !== "theme").length > 0);
1235
+ let activeFilters = (
1236
+ Object.keys(e.detail).filter(d => d && d !== "theme").length > 0
1237
+ || this._viewer.map.getVisibleUsers().filter(u => u !== "geovisio").length > 0
1238
+ );
1239
+ btnFilter.setActive(activeFilters);
1209
1240
  this._onMapThemeChange();
1210
1241
  });
1211
1242
 
1243
+ // Listen to user visibility changes to switch the filter active icon
1244
+ this._viewer.addEventListener("map:users-changed", e => {
1245
+ let activeFilters = (
1246
+ Object.keys(this._viewer._mapFilters).filter(d => d && d !== "theme").length > 0
1247
+ || e.detail.usersIds.filter(u => u !== "geovisio").length > 0
1248
+ );
1249
+ btnFilter.setActive(activeFilters);
1250
+ });
1251
+
1212
1252
  // Show/hide zoom in warning when map zoom changes
1213
1253
  const lblZoomIn = document.getElementById("gvs-filter-zoomin");
1214
1254
  const changeLblZoomInDisplay = () => {
@@ -21,7 +21,7 @@ Array [
21
21
  ]
22
22
  `;
23
23
 
24
- exports[`createSearchBar works 1`] = `"<input type=\\"text\\" placeholder=\\"no res\\"><span class=\\"gvs-search-bar-icon\\"><svg aria-hidden=\\"true\\" focusable=\\"false\\" data-prefix=\\"fas\\" data-icon=\\"magnifying-glass\\" class=\\"svg-inline--fa fa-magnifying-glass\\" role=\\"img\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 512 512\\"><path fill=\\"currentColor\\" d=\\"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z\\"></path></svg></span><div id=\\"mysrch-panel\\" class=\\"gvs-panel gvs-widget-bg gvs-hidden gvs-search-bar-results\\"></div>"`;
24
+ exports[`createSearchBar works 1`] = `"<input type=\\"text\\" placeholder=\\"no res\\" id=\\"mysrch-input\\"><span class=\\"gvs-search-bar-icon\\"><svg aria-hidden=\\"true\\" focusable=\\"false\\" data-prefix=\\"fas\\" data-icon=\\"magnifying-glass\\" class=\\"svg-inline--fa fa-magnifying-glass\\" role=\\"img\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 512 512\\"><path fill=\\"currentColor\\" d=\\"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z\\"></path></svg></span><div id=\\"mysrch-panel\\" class=\\"gvs-panel gvs-widget-bg gvs-hidden gvs-search-bar-results\\"></div>"`;
25
25
 
26
26
  exports[`fa works 1`] = `
27
27
  <svg