Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

OrMap updated with flyTo function

robindekkers1ac3339a8911
diff --git a/ui/component/or-map/src/index.ts b/ui/component/or-map/src/index.ts
index 5c994f099..6f02a201f 100644
--- a/ui/component/or-map/src/index.ts
+++ b/ui/component/or-map/src/index.ts
@@ -137,7 +137,6 @@ export class OrMap extends LitElement {
}
if (this._mapContainer && this._slotElement) {
-
this._map = new MapWidget(this.type, this.shadowRoot!, this._mapContainer)
.setCenter(this.center)
.setZoom(this.zoom);
@@ -153,6 +152,12 @@ export class OrMap extends LitElement {
this._loaded = true;
}
+ public flyTo(LngLat: LngLatLike) {
+ if (this._map) {
+ this._map.flyTo(LngLat);
+ }
+ }
+
protected _onMarkerChangedEvent(evt: OrMapMarkerChangedEvent) {
if (this._map) {
this._map.onMarkerChanged(evt.detail.marker, evt.detail.property);
diff --git a/ui/component/or-map/src/mapwidget.ts b/ui/component/or-map/src/mapwidget.ts
index 6b60677e5..f3939cb8f 100644
--- a/ui/component/or-map/src/mapwidget.ts
+++ b/ui/component/or-map/src/mapwidget.ts
@@ -52,6 +52,26 @@ export class MapWidget {
return this;
}
+ public flyTo(LngLat:LngLatLike): this {
+ switch (this._type) {
+ case Type.RASTER:
+ if (this._mapJs) {
+ //TODO implement fylTo
+ }
+ break;
+ case Type.VECTOR:
+ if (this._mapGl && LngLat) {
+ this._mapGl.flyTo({
+ center: LngLat,
+ zoom: 17
+ });
+ }
+ break;
+ }
+
+ return this;
+ }
+
public setZoom(zoom?: number): this {
this._zoom = zoom;