diff --git a/django/contrib/gis/static/gis/css/ol3.css b/django/contrib/gis/static/gis/css/ol3.css index 9c8a9f5e06..ac8f0a8ec2 100644 --- a/django/contrib/gis/static/gis/css/ol3.css +++ b/django/contrib/gis/static/gis/css/ol3.css @@ -1,3 +1,11 @@ +.dj_map_wrapper { + position: relative; + float: left; +} +html[dir="rtl"] .dj_map_wrapper { + float: right; +} + .switch-type { background-repeat: no-repeat; cursor: pointer; diff --git a/django/contrib/gis/static/gis/js/OLMapWidget.js b/django/contrib/gis/static/gis/js/OLMapWidget.js index 9dea7d05aa..839c8cd7cc 100644 --- a/django/contrib/gis/static/gis/js/OLMapWidget.js +++ b/django/contrib/gis/static/gis/js/OLMapWidget.js @@ -61,6 +61,9 @@ class MapWidget { this.options.base_layer = new ol.layer.Tile({source: new ol.source.OSM()}); } + const mapContainer = document.getElementById(this.options.map_id); + mapContainer.style.width = `${mapContainer.dataset.width}px`; + mapContainer.style.height = `${mapContainer.dataset.height}px`; this.map = this.createMap(); this.featureCollection = new ol.Collection(); this.featureOverlay = new ol.layer.Vector({ diff --git a/django/contrib/gis/templates/gis/openlayers.html b/django/contrib/gis/templates/gis/openlayers.html index fa336469b8..bde2650ca2 100644 --- a/django/contrib/gis/templates/gis/openlayers.html +++ b/django/contrib/gis/templates/gis/openlayers.html @@ -1,17 +1,11 @@ {% load i18n l10n %} - -
-
+
+
{% if not disabled %}{% translate "Delete all Features" %}{% endif %} {% if display_raw %}

{% translate "Debugging window (serialized value)" %}

{% endif %} - +