Skip to content

Commit

Permalink
[Maps] Always show current zoom level (#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 authored Apr 7, 2020
1 parent b65de27 commit 7882e0c
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 7882e0c

Please sign in to comment.