@panoramax/web-viewer 3.0.2-develop-a8ea8e60 → 3.0.2-develop-a8ea8e60-develop-ac07ac0a
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/CHANGELOG.md +1 -0
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/Widgets.js +4 -0
- package/src/viewer/Widgets.js +29 -13
package/package.json
CHANGED
package/src/utils/Widgets.js
CHANGED
|
@@ -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");
|
package/src/viewer/Widgets.js
CHANGED
|
@@ -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
|
-
|
|
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) {
|