aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-03-18 23:53:48 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-03-18 23:53:48 -0700
commit889bc0667e21d1154ac2749842696aac0812ef8c (patch)
tree320b976b61bb16c72bebb4426f88584d5056392a /modern/src
parent10f244d54f795bbeebc280248e26f9c078a639fd (diff)
downloadetbsa-traccar-web-889bc0667e21d1154ac2749842696aac0812ef8c.tar.gz
etbsa-traccar-web-889bc0667e21d1154ac2749842696aac0812ef8c.tar.bz2
etbsa-traccar-web-889bc0667e21d1154ac2749842696aac0812ef8c.zip
Change map initialization
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/MainMap.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/modern/src/MainMap.js b/modern/src/MainMap.js
index 1bda966..8b363c9 100644
--- a/modern/src/MainMap.js
+++ b/modern/src/MainMap.js
@@ -1,6 +1,8 @@
import 'ol/ol.css';
import React, { Component } from 'react';
import { connect } from 'react-redux';
+import { Map, View } from 'ol';
+import { fromLonLat } from 'ol/proj';
import olms from 'ol-mapbox-style';
const mapStateToProps = state => ({
@@ -9,7 +11,15 @@ const mapStateToProps = state => ({
class MainMap extends Component {
componentDidMount() {
- olms(this.el, 'https://cdn.traccar.com/map/basic.json');
+ this.map = new Map({
+ target: this.el,
+ view: new View({
+ constrainResolution: true,
+ center: fromLonLat([14.5, 46.05]),
+ zoom: 3
+ })
+ });
+ olms(this.map, 'https://cdn.traccar.com/map/basic.json');
}
render() {