Skip to content

Commit

Permalink
[Maps] Always show current zoom level (elastic#62684)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
nreese and elasticmachine committed Apr 7, 2020
1 parent 635b0ad commit d274307
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,33 @@
*/

import _ from 'lodash';
import React from 'react';
import React, { Fragment } from 'react';
import { EuiText } from '@elastic/eui';
import { DECIMAL_DEGREES_PRECISION } from '../../../../common/constants';
import { FormattedMessage } from '@kbn/i18n/react';

export function ViewControl({ mouseCoordinates, zoom }) {
if (!mouseCoordinates) {
return null;
let latLon;
if (mouseCoordinates) {
latLon = (
<Fragment>
<strong>
<FormattedMessage id="xpack.maps.viewControl.latLabel" defaultMessage="lat:" />
</strong>{' '}
{_.round(mouseCoordinates.lat, DECIMAL_DEGREES_PRECISION)},{' '}
<strong>
<FormattedMessage id="xpack.maps.viewControl.lonLabel" defaultMessage="lon:" />
</strong>{' '}
{_.round(mouseCoordinates.lon, DECIMAL_DEGREES_PRECISION)},{' '}
</Fragment>
);
}

return (
<div className="mapViewControl__coordinates">
<EuiText size="xs">
<small>
<strong>
<FormattedMessage id="xpack.maps.viewControl.latLabel" defaultMessage="lat:" />
</strong>{' '}
{_.round(mouseCoordinates.lat, DECIMAL_DEGREES_PRECISION)},{' '}
<strong>
<FormattedMessage id="xpack.maps.viewControl.lonLabel" defaultMessage="lon:" />
</strong>{' '}
{_.round(mouseCoordinates.lon, DECIMAL_DEGREES_PRECISION)},{' '}
{latLon}
<strong>
<FormattedMessage id="xpack.maps.viewControl.zoomLabel" defaultMessage="zoom:" />
</strong>{' '}
Expand Down

0 comments on commit d274307

Please sign in to comment.