Skip to content

Commit

Permalink
In the event that projections is not an array (this would be the case…
Browse files Browse the repository at this point in the history
… if the widget specification in the flex layout only specifies one projection), coerce into a 1-item array.

Fixes #1416
  • Loading branch information
jumpinjackie committed Apr 21, 2023
1 parent 278923c commit 61c9aeb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/containers/coordinate-tracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ import { useViewerLocale, useCurrentMouseCoordinates } from './hooks';
import { useActiveMapProjection } from './hooks-mapguide';

export interface ICoordinateTrackerContainerProps {
projections: string[];
projections: string | string[];
}


export const CoordinateTrackerContainer = (props: ICoordinateTrackerContainerProps) => {
const { projections } = props;
const aProjections = Array.isArray(projections) ? projections : [projections];
const locale = useViewerLocale();
const mouse = useCurrentMouseCoordinates();
const proj = useActiveMapProjection();
if (projections && projections.length) {
if (aProjections && aProjections.length) {
return <div style={{ margin: 8 }}>
<h4 className="bp3-heading">{tr("COORDTRACKER", locale)}</h4>
{projections.map(p => {
{aProjections.map(p => {
let x = NaN;
let y = NaN;
if (mouse && proj) {
Expand Down

0 comments on commit 61c9aeb

Please sign in to comment.