-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ import sprites1 from '@elastic/maki/dist/[email protected]'; | |
import sprites2 from '@elastic/maki/dist/[email protected]'; | ||
import { DrawControl } from './draw_control'; | ||
import { TooltipControl } from './tooltip_control'; | ||
import { clampToLatBounds, clampToLonBounds } from '../../../elasticsearch_geo_utils'; | ||
|
||
mapboxgl.workerUrl = mbWorkerUrl; | ||
mapboxgl.setRTLTextPlugin(mbRtlPlugin); | ||
|
@@ -234,12 +235,12 @@ export class MBMapContainer extends React.Component { | |
//clamping ot -89/89 latitudes since Mapboxgl does not seem to handle bounds that contain the poles (logs errors to the console when using -90/90) | ||
const lnLatBounds = new mapboxgl.LngLatBounds( | ||
new mapboxgl.LngLat( | ||
clamp(goto.bounds.min_lon, -180, 180), | ||
clamp(goto.bounds.min_lat, -89, 89) | ||
clampToLonBounds(goto.bounds.min_lon), | ||
clampToLatBounds(goto.bounds.min_lat) | ||
), | ||
new mapboxgl.LngLat( | ||
clamp(goto.bounds.max_lon, -180, 180), | ||
clamp(goto.bounds.max_lat, -89, 89) | ||
clampToLonBounds(goto.bounds.max_lon), | ||
clampToLatBounds(goto.bounds.max_lat) | ||
) | ||
); | ||
//maxZoom ensure we're not zooming in too far on single points or small shapes | ||
|
@@ -306,9 +307,3 @@ export class MBMapContainer extends React.Component { | |
); | ||
} | ||
} | ||
|
||
function clamp(val, min, max) { | ||
if (val > max) val = max; | ||
else if (val < min) val = min; | ||
return val; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters