Skip to content

armgit / core

Public Imported from GitHub
0

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

Admin Interface (WIP) - Survey panel - Geofence panel

robindekkers20614fb688a8
diff --git a/ui/component/or-header/src/index.ts b/ui/component/or-header/src/index.ts
index a7c38fbaa..c591c5bf0 100644
--- a/ui/component/or-header/src/index.ts
+++ b/ui/component/or-header/src/index.ts
@@ -46,7 +46,8 @@ class OrHeader extends LitElement {
}
#logo {
- height: 60px;
+ margin: var(--header-logo-margin, 0);
+ height: var(--header-logo-height, 60px);
display: block;
}
diff --git a/ui/component/or-input/src/style.ts b/ui/component/or-input/src/style.ts
index c149a1633..7486ed710 100644
--- a/ui/component/or-input/src/style.ts
+++ b/ui/component/or-input/src/style.ts
@@ -12,7 +12,7 @@ export const orInputStyle = css`
font-size: 14px;
border-bottom: 2px solid #d5d5d5;
- background-color: #f2f2f2;
+ background-color: var(--or-input-background, #f2f2f2);
}
input:invalid { border-bottom: 2px solid red;}
diff --git a/ui/component/or-map/src/mapwidget.ts b/ui/component/or-map/src/mapwidget.ts
index a96506e99..c7cfb0ede 100644
--- a/ui/component/or-map/src/mapwidget.ts
+++ b/ui/component/or-map/src/mapwidget.ts
@@ -4,9 +4,14 @@ import {LngLatLike, Map as MapGL, MapboxOptions as OptionsGL, Marker as MarkerGL
MapMouseEvent} from "mapbox-gl";
import L, {Map as MapJS, MapOptions as OptionsJS, Marker as MarkerJS} from "mapbox.js";
import {Type, ViewSettings} from "./index";
-import {OrMapMarker, OrMapMarkerClickedEvent} from "./markers/or-map-marker";
+import {OrMapMarker, OrMapMarkerChangedEvent, OrMapMarkerClickedEvent} from "./markers/or-map-marker";
import {getLatLng, getLatLngBounds, getLngLat, getLngLatBounds} from "./util";
+// TODO were to place this
+// fix any type
+const metersToPixelsAtMaxZoom = (meters:number, latitude:number) =>
+ meters / 0.075 / Math.cos(latitude * Math.PI / 180);
+
export class MapWidget {
protected static _mapboxGlStyle?: any;
protected static _mapboxJsStyle?: any;
@@ -214,11 +219,14 @@ export class MapWidget {
if (marker.lat && marker.lng) {
if (marker._actualMarkerElement) {
this._updateMarkerPosition(marker);
+ this._createMarkerRadius(marker);
} else {
this._updateMarkerElement(marker, true);
+
}
} else if (marker._actualMarkerElement) {
this._updateMarkerElement(marker, false);
+
}
break;
}
@@ -295,12 +303,51 @@ export class MapWidget {
if (marker.interactive) {
this._addMarkerClickHandler(marker, mGl.getElement());
}
+
}
}
break;
}
}
+ protected _createMarkerRadius(marker:OrMapMarker){
+ if(this._mapGl && marker.radius && marker.lat && marker.lng){
+ // this._mapGl.addSource('circleData', {
+ // type: 'geojson',
+ // data: {
+ // type: 'FeatureCollection',
+ // features: [{
+ // type: "Feature",
+ // geometry: {
+ // "type": "Point",
+ // "coordinates": [marker.lng, marker.lat]
+ // },
+ // properties: {
+ // "title": "You Found Me",
+ // }
+ // }]
+ // }
+ // });
+ //
+ // this._mapGl.addLayer({
+ // "id":"marker-radius-circle",
+ // "type": "circle",
+ // "source": "circleData",
+ // "paint": {
+ // "circle-radius": {
+ // stops: [
+ // [5, 1],
+ // [15, 1024]
+ // ],
+ // base: 2
+ // },
+ // "circle-color": "red",
+ // "circle-opacity": 0.6
+ // }
+ // });
+ }
+ }
+
protected _addMarkerClickHandler(marker: OrMapMarker, elem: HTMLElement) {
if (elem) {
const handler = (ev: MouseEvent) => {
diff --git a/ui/component/or-map/src/markers/or-map-marker.ts b/ui/component/or-map/src/markers/or-map-marker.ts
index 0be9c1844..f72a523cc 100644
--- a/ui/component/or-map/src/markers/or-map-marker.ts
+++ b/ui/component/or-map/src/markers/or-map-marker.ts
@@ -107,6 +107,9 @@ export class OrMapMarker extends LitElement {
@property({type: Number, reflect: true})
public lng?: number;
+ @property({type: Number, reflect: true})
+ public radius?: number;
+
@property({type: Boolean})
public visible: boolean = true;
diff --git a/ui/component/or-smart-notify/src/index.ts b/ui/component/or-smart-notify/src/index.ts
index b8d1a33d9..5d7f8e195 100644
--- a/ui/component/or-smart-notify/src/index.ts
+++ b/ui/component/or-smart-notify/src/index.ts
@@ -92,6 +92,7 @@ class OrSmartNotify extends LitElement {
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = null;
this.isActive = false;
}
+
REST.api.AssetResource.update(this.smartNotify.id, this.smartNotify).then((response: any) => {
console.log("Setting Smart Notify");
this.smartNotify.version = this.smartNotify.version + 1;