Skip to content

Commit

Permalink
Fix unit selector
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed May 9, 2024
1 parent 6814829 commit 75678b7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
9 changes: 4 additions & 5 deletions app/static/app/js/components/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,6 @@ class Map extends React.Component {
mapView: this
});

//add zoom control with your options
let zoomControl = Leaflet.control.zoom({
position:'bottomleft'
}).addTo(this.map);

const UnitsCtrl = Leaflet.Control.extend({
options: {
position: 'bottomleft'
Expand All @@ -419,6 +414,10 @@ class Map extends React.Component {
});
new UnitsCtrl().addTo(this.map);

//add zoom control with your options
let zoomControl = Leaflet.control.zoom({
position:'bottomleft'
}).addTo(this.map);

if (showBackground) {
this.basemaps = {};
Expand Down
5 changes: 2 additions & 3 deletions app/static/app/js/components/UnitSelector.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { systems, getPreferredUnitSystem, setPreferredUnitSystem } from '../classes/Units';
import '../css/UnitSelector.scss';

class UnitSelector extends React.Component {
static propTypes = {
Expand All @@ -12,8 +13,6 @@ class UnitSelector extends React.Component {
this.state = {
system: getPreferredUnitSystem()
}

// console.log(systems.metric.length(1.01).toString());
}

handleChange = e => {
Expand All @@ -23,7 +22,7 @@ class UnitSelector extends React.Component {

render() {
return (
<select value={this.state.system} onChange={this.handleChange}>
<select className="unit-selector" value={this.state.system} onChange={this.handleChange}>
{Object.keys(systems).map(k =>
<option value={k} key={k}>{systems[k].getName()}</option>)}
</select>
Expand Down
4 changes: 4 additions & 0 deletions app/static/app/js/css/UnitSelector.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.unit-selector{
font-size: 14px;
padding: 5px;
}

0 comments on commit 75678b7

Please sign in to comment.