CenterInMyPosition and refactor

This commit is contained in:
vjrj 2017-12-06 19:24:42 +01:00
parent 93d9ca43f1
commit 3dc8edb4a8
10 changed files with 102 additions and 32 deletions

View file

@ -8,8 +8,10 @@ import geolocation from '/imports/startup/client/geolocation';
import 'leaflet-graphicscale/dist/Leaflet.GraphicScale.min.css';
import 'leaflet-graphicscale/dist/Leaflet.GraphicScale.min.js';
import Control from 'react-leaflet-control';
import { Button } from 'react-bootstrap';
import { Button, ButtonToolbar } from 'react-bootstrap';
import DistanceSlider from '/imports/ui/components/DistanceSlider/DistanceSlider';
import CenterInMyPosition from '/imports/ui/components/CenterInMyPosition/CenterInMyPosition.js';
import './SelectionMap.scss';
const positionIcon = new Leaflet.Icon({
iconUrl: "/your-position.png",
@ -52,6 +54,7 @@ class SelectionMap extends Component {
marker: [ lat, lng ],
modified: true
});
this.fit();
}
fit() {
@ -77,6 +80,10 @@ class SelectionMap extends Component {
console.log(event);
}
centerOnUserLocation = (event) => {
console.log(event);
}
render() {
this.state.center = !this.state.modified && this.props.lat?
[this.props.lat, this.props.lng]: this.state.center;
@ -112,10 +119,13 @@ class SelectionMap extends Component {
fillColor="green"
fillOpacity={.1}
radius={this.state.distance * 1000} />
<Control position="topright" >
<Button bsStyle="success" onClick={this.doSubs}>
{this.props.t("Subscribirme a fuegos en este rádio")}
</Button>
<ButtonToolbar>
<Button bsStyle="success" onClick={(event) => this.doSubs(event)}>
{this.props.t("Subscribirme a fuegos en este rádio")}
</Button>
</ButtonToolbar>
</Control>
</Map> }
</div>