diff --git a/static/js/theme-map/Maps/Providers/Google.js b/static/js/theme-map/Maps/Providers/Google.js index 7d0b78645..fa2b2432f 100644 --- a/static/js/theme-map/Maps/Providers/Google.js +++ b/static/js/theme-map/Maps/Providers/Google.js @@ -28,7 +28,7 @@ class GoogleMap extends ProviderMap { constructor(options) { super(options); - const zoomControlPosition = isRTL(options.language) + const zoomControlPosition = isRTL(options.locale) ? google.maps.ControlPosition.LEFT_TOP : google.maps.ControlPosition.RIGHT_TOP; diff --git a/static/js/theme-map/Maps/Providers/Mapbox.js b/static/js/theme-map/Maps/Providers/Mapbox.js index f428a5a2b..2ce6f69a9 100644 --- a/static/js/theme-map/Maps/Providers/Mapbox.js +++ b/static/js/theme-map/Maps/Providers/Mapbox.js @@ -35,7 +35,7 @@ class MapboxMap extends ProviderMap { // Add the zoom control if (options.controlEnabled) { const zoomControl = new mapboxgl.NavigationControl({showCompass: false}) - isRTL(options.language) + isRTL(options.locale) ? this.map.addControl(zoomControl, 'top-left') : this.map.addControl(zoomControl); } diff --git a/static/js/theme-map/ThemeMapConfig.js b/static/js/theme-map/ThemeMapConfig.js index fe36953bd..684348265 100644 --- a/static/js/theme-map/ThemeMapConfig.js +++ b/static/js/theme-map/ThemeMapConfig.js @@ -3,6 +3,7 @@ import { PinImages } from './PinImages.js'; import { ClusterPinImages } from './ClusterPinImages.js'; import { getLanguageForProvider } from './Util/helpers.js'; import { defaultCenterCoordinate } from './constants.js'; +import isRTL from '../../common/rtl'; /** * The configuration for the ThemeMap component. @@ -100,8 +101,8 @@ export default class ThemeMapConfig { this.padding = { top: () => window.innerWidth <= this.mobileBreakpointMax ? 150 : 50, bottom: () => 50, - right: () => 50, - left: () => this.getLeftVisibleBoundary(), + right: () => isRTL(this.language) ? this.getVisibleBoundary() : 50, + left: () => !isRTL(this.language) ? this.getVisibleBoundary() : 50 }; /** @@ -238,11 +239,14 @@ export default class ThemeMapConfig { } /** - * Get the leftmost point on the map, such that pins will still be visible + * Get the leftmost point on the map, or rightmost point for RTL locales, such that pins + * will still be visible. + * * @return {Number} The boundary (in pixels) for the visible area of the map, from the left - * hand side of the viewport + * or right hand side of the viewport depending on if the language displayed + * is left-to-right or right-to-left */ - getLeftVisibleBoundary () { + getVisibleBoundary () { if (window.innerWidth <= this.mobileBreakpointMax) { return 50; } diff --git a/templates/vertical-full-page-map/markup/map.hbs b/templates/vertical-full-page-map/markup/map.hbs index 4192b3d06..85cba5151 100644 --- a/templates/vertical-full-page-map/markup/map.hbs +++ b/templates/vertical-full-page-map/markup/map.hbs @@ -1 +1 @@ -
+
diff --git a/templates/vertical-map/markup/map.hbs b/templates/vertical-map/markup/map.hbs index ad381326a..43b8882c7 100644 --- a/templates/vertical-map/markup/map.hbs +++ b/templates/vertical-map/markup/map.hbs @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file