Skip to content

Commit d274307

Browse files
[Maps] Always show current zoom level (#62684)
Co-authored-by: Elastic Machine <[email protected]>
1 parent 635b0ad commit d274307

File tree

1 file changed

+16
-11
lines changed
  • x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/view_control

1 file changed

+16
-11
lines changed

x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/view_control/view_control.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,33 @@
55
*/
66

77
import _ from 'lodash';
8-
import React from 'react';
8+
import React, { Fragment } from 'react';
99
import { EuiText } from '@elastic/eui';
1010
import { DECIMAL_DEGREES_PRECISION } from '../../../../common/constants';
1111
import { FormattedMessage } from '@kbn/i18n/react';
1212

1313
export function ViewControl({ mouseCoordinates, zoom }) {
14-
if (!mouseCoordinates) {
15-
return null;
14+
let latLon;
15+
if (mouseCoordinates) {
16+
latLon = (
17+
<Fragment>
18+
<strong>
19+
<FormattedMessage id="xpack.maps.viewControl.latLabel" defaultMessage="lat:" />
20+
</strong>{' '}
21+
{_.round(mouseCoordinates.lat, DECIMAL_DEGREES_PRECISION)},{' '}
22+
<strong>
23+
<FormattedMessage id="xpack.maps.viewControl.lonLabel" defaultMessage="lon:" />
24+
</strong>{' '}
25+
{_.round(mouseCoordinates.lon, DECIMAL_DEGREES_PRECISION)},{' '}
26+
</Fragment>
27+
);
1628
}
1729

1830
return (
1931
<div className="mapViewControl__coordinates">
2032
<EuiText size="xs">
2133
<small>
22-
<strong>
23-
<FormattedMessage id="xpack.maps.viewControl.latLabel" defaultMessage="lat:" />
24-
</strong>{' '}
25-
{_.round(mouseCoordinates.lat, DECIMAL_DEGREES_PRECISION)},{' '}
26-
<strong>
27-
<FormattedMessage id="xpack.maps.viewControl.lonLabel" defaultMessage="lon:" />
28-
</strong>{' '}
29-
{_.round(mouseCoordinates.lon, DECIMAL_DEGREES_PRECISION)},{' '}
34+
{latLon}
3035
<strong>
3136
<FormattedMessage id="xpack.maps.viewControl.zoomLabel" defaultMessage="zoom:" />
3237
</strong>{' '}

0 commit comments

Comments
 (0)