@panoramax/web-viewer 3.0.2-develop-a8ea8e60 → 3.0.2-develop-a8ea8e60-develop-10c06f44

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/docs/02_Usage.md CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  **Extends EventTarget**
17
17
 
18
- Core view is an abstract class used for setting up any of the main Panoramax view components.
18
+ Core view is an abstract class used for setting up any of the main Panoramax JS view components.
19
19
 
20
20
  It is used to prepare API, internationalization, options checks... for Viewer, StandaloneMap and Editor classes.
21
21
 
@@ -41,6 +41,13 @@ It is used to prepare API, internationalization, options checks... for Viewer, S
41
41
  * `_options` **[object][12]** The stored options
42
42
  * `container` **[Element][10]** The DOM container
43
43
 
44
+ ### getClassName
45
+
46
+ This allows to retrieve an always correct class name.
47
+ This is crap, but avoids issues with Webpack & so on.
48
+
49
+ Each inheriting class must override this method.
50
+
44
51
  ### destroy
45
52
 
46
53
  Ends all form of life in this object.
@@ -453,6 +460,16 @@ Changes the duration of stay on a picture during a sequence play.
453
460
 
454
461
  * `value` **[number][17]** The new duration (in milliseconds, between 100 and 3000)
455
462
 
463
+ ### showErrorOverlay
464
+
465
+ Display an error message to user on screen
466
+
467
+ #### Parameters
468
+
469
+ * `e` **[object][12]** The initial error
470
+ * `label` **str** The main error label to display
471
+ * `dissmisable` **[boolean][16]** Is error dissmisable
472
+
456
473
  ## Editor
457
474
 
458
475
  **Extends CoreView**
@@ -545,7 +562,7 @@ Returns **[object][12]** Object like {"id", "name"} or null if no authenticated
545
562
 
546
563
  **Extends CoreView**
547
564
 
548
- Viewer is the main component of the library, showing pictures and map.
565
+ Viewer is the main component of Panoramax JS library, showing pictures and map.
549
566
 
550
567
  Note that you can use any of the [CoreView][25] class functions as well.
551
568
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "3.0.2-develop-a8ea8e60",
3
+ "version": "3.0.2-develop-a8ea8e60-develop-10c06f44",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -185,6 +185,10 @@ export function createSearchBar(
185
185
  list.innerHTML = `<div class="gvs-search-empty">${container._t.gvs.search_empty}</li>`;
186
186
  return;
187
187
  }
188
+ else if(data === true) {
189
+ list._toggle(false);
190
+ return;
191
+ }
188
192
 
189
193
  data.forEach(entry => {
190
194
  const listEntry = document.createElement("div");
@@ -710,22 +710,38 @@ export default class Widgets {
710
710
  * @private
711
711
  */
712
712
  _initWidgetSearch() {
713
+ const overridenGeocoder = query => {
714
+ const rgxCoords = /([-+]?\d{1,2}\.\d+),\s*([-+]?\d{1,3}\.\d+)/;
715
+ const coordsMatch = query.match(rgxCoords);
716
+
717
+ if(coordsMatch) {
718
+ const lat = parseFloat(coordsMatch[1]);
719
+ const lon = parseFloat(coordsMatch[2]);
720
+ this._viewer.map.flyTo({
721
+ center: [lon, lat],
722
+ zoom: 16,
723
+ });
724
+ return Promise.resolve(true);
725
+ } else {
726
+ return this._viewer.map.geocoder({
727
+ query,
728
+ limit: 3,
729
+ bbox: this._viewer.map.getBounds().toArray().map(d => d.join(",")).join(","),
730
+ proximity: this._viewer.map.getCenter().lat+","+this._viewer.map.getCenter().lng,
731
+ }).then(data => {
732
+ data = data.features.map(f => ({
733
+ title: f.place_name.split(",")[0],
734
+ subtitle: f.place_name.split(",").slice(1).join(", "),
735
+ data: f
736
+ }));
737
+ return data;
738
+ });
739
+ }
740
+ };
713
741
  const geocoder = createSearchBar(
714
742
  "gvs-widget-search-bar",
715
743
  this._t.gvs.search_address,
716
- (query) => this._viewer.map.geocoder({
717
- query,
718
- limit: 3,
719
- bbox: this._viewer.map.getBounds().toArray().map(d => d.join(",")).join(","),
720
- proximity: this._viewer.map.getCenter().lat+","+this._viewer.map.getCenter().lng,
721
- }).then(data => {
722
- data = data.features.map(f => ({
723
- title: f.place_name.split(",")[0],
724
- subtitle: f.place_name.split(",").slice(1).join(", "),
725
- data: f
726
- }));
727
- return data;
728
- }),
744
+ overridenGeocoder,
729
745
  (entry) => {
730
746
  if(entry) {
731
747
  if(entry.data.bounds) {