Skip to content

Commit c9059ff

Browse files
committed
Merge branch 'hotfix/resizemap_and_printscale' into 'develop'
Fixed resize map and print scale issues See merge request gtt/redmine_gtt!23
2 parents 700a3ca + c54907f commit c9059ff

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

assets/javascripts/app.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,20 @@ var App = (function ($, publ) {
187187

188188
// Fixing issue with sidebar hide button
189189
$("#hideSidebarButton").on('click', function (evt) {
190-
setTimeout(function(){
191-
map.updateSize();
192-
}, 50);
190+
//setTimeout(function(){
191+
maps.forEach(function (m) {
192+
m.updateSize();
193+
});
194+
//}, 50);
193195
});
194196

195197
// Sidebar hack, which does some weird resizing otherwise
196198
if ($('#sidebar').not(':visible')) {
197-
setTimeout(function(){
198-
map.updateSize();
199-
}, 50);
199+
//setTimeout(function(){
200+
maps.forEach(function (m) {
201+
map.updateSize();
202+
});
203+
//}, 50);
200204
}
201205

202206
// When one or more issues is selected, zoom to selected map features
@@ -211,13 +215,17 @@ var App = (function ($, publ) {
211215
// a Redmine problem
212216
$("div.contextual a.icon-edit").on('click', function (evt) {
213217
setTimeout( function() {
214-
map.updateSize();
218+
maps.forEach(function (m) {
219+
m.updateSize();
220+
});
215221
}, 200);
216222
});
217223

218224
// Redraw the map, when a GTT Tab gets activated
219225
$("#tab-gtt").click(function(){
220-
map.updateSize();
226+
maps.forEach(function (m) {
227+
m.updateSize();
228+
});
221229
publ.zoomToExtent();
222230
});
223231

@@ -844,7 +852,9 @@ var App = (function ($, publ) {
844852
};
845853

846854
publ.getScale = function () {
847-
var resolution = map.getView().getResolution();
855+
// Always use 1st subject map
856+
var m = maps[0];
857+
var resolution = m.getView().getResolution();
848858
var units = map.getView().getProjection().getUnits();
849859
var dpi = 25.4 / 0.28;
850860
var mpu = ol.proj.METERS_PER_UNIT[units];
@@ -853,7 +863,9 @@ var App = (function ($, publ) {
853863
};
854864

855865
publ.getBasemapUrl = function () {
856-
var layers = map.getLayers();
866+
// Always use 1st subject map
867+
var m = maps[0];
868+
var layers = m.getLayers();
857869
if (layers.getLength() === 0) {
858870
console.error("There is no baselayer available!");
859871
return;

0 commit comments

Comments
 (0)