diff options
-rw-r--r-- | js/mapspecs.js | 14 | ||||
-rw-r--r-- | pages/scores.php | 8 |
2 files changed, 19 insertions, 3 deletions
diff --git a/js/mapspecs.js b/js/mapspecs.js index 7c74a92..3e649fd 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -850,8 +850,18 @@ function mapAsHTML(map, targetWidth, mapEditor) { //console.log("MapObj", map);
mapdata[map.ID] = map;
- if ((map.width * 35) <= targetWidth) targetWidth = (map.width * 35);
- if (!targetWidth) targetWidth = (map.width * 35);
+ if (!targetWidth || (map.width * 35) <= targetWidth)
+ {
+ targetWidth = (map.width * 35);
+ }
+ else
+ {
+ //Need to take into account padding of .grid_outer
+ var fakeGridDom = $('<div class="grid_outer"></div>');
+ var gridOuterPadding = parseInt(fakeGridDom.css('padding-left')) + parseInt(fakeGridDom.css('padding-right'));
+ targetWidth -= gridOuterPadding;
+ }
+
var scale = map.width / targetWidth;
//alert(scale);
diff --git a/pages/scores.php b/pages/scores.php index 60ce2e8..4154fea 100644 --- a/pages/scores.php +++ b/pages/scores.php @@ -114,8 +114,14 @@ function displayMapScores(mapID) { $('#currentlyRunningMessage').toggle(showCurrentMapMessage);
$("#mapDisplay").fadeOut('fast');
- displayMap(mapID, "mapDisplay", 682);
+
scoresShowPage(pointerPage, mapID);
+
+ //Create a fake DOM element to determine the margin-left of the map, to get the target width
+ var fakeMapDom = $('<div class="mapCol"></div>');
+ var mapMargin = parseInt(fakeMapDom.css('margin-left'));
+ var targetWidth = $('.mapNavCon').width() - $('#scoreDisplay').width() - mapMargin;
+ displayMap(mapID, "mapDisplay", targetWidth);
}
function updateHash() {
|