Skip to content

Commit

Permalink
chore: validate breakpoint dependency 'boundsOptions'
Browse files Browse the repository at this point in the history
  • Loading branch information
vesameskanen committed Nov 18, 2024
1 parent f9ca6bc commit a446d9a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/component/map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,15 @@ export default class Map extends React.Component {

// eslint-disable-next-line react/no-unused-class-component-methods
setBottomPadding = padding => {
this.boundsOptions.paddingBottomRight = [
0,
Math.max(
Math.min(padding, window.innerHeight - 2 * EXTRA_PADDING),
EXTRA_PADDING,
),
];
if (this.boundsOptions) {
this.boundsOptions.paddingBottomRight = [
0,
Math.max(
Math.min(padding, window.innerHeight - 2 * EXTRA_PADDING),
EXTRA_PADDING,
),
];
}
};

render() {
Expand All @@ -211,7 +213,7 @@ export default class Map extends React.Component {
const { config } = this.context;

const naviProps = {}; // these define map center and zoom
if (bottomPadding !== undefined) {
if (bottomPadding !== undefined && this.boundsOptions) {
this.boundsOptions.paddingBottomRight = [
0,
Math.min(bottomPadding + EXTRA_PADDING, window.innerHeight - 60),
Expand Down

0 comments on commit a446d9a

Please sign in to comment.