Merge branch '1115-Redimensiónde-los-iconos-y-texto-en-mapas-GIS' into 'develop'

Hold mark labels font size when autorefresh and fix drag map font size bug - #1115

See merge request !660
This commit is contained in:
vgilc 2017-07-13 17:16:49 +02:00
commit f8a1b77158
2 changed files with 19 additions and 4 deletions

View File

@ -368,6 +368,7 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null, $publ
} }
} }
} }
EventZoomEnd(null,map.zoom);
} }
}); });
} }
@ -405,11 +406,16 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null, $publ
idIntervalAjax = setInterval("clock_ajax_refresh()", refreshAjaxIntervalSeconds); idIntervalAjax = setInterval("clock_ajax_refresh()", refreshAjaxIntervalSeconds);
oldRefreshAjaxIntervalSeconds = refreshAjaxIntervalSeconds; oldRefreshAjaxIntervalSeconds = refreshAjaxIntervalSeconds;
} }
EventZoomEnd(null,map.zoom);
} }
$(document).ready ( $(document).ready (
function () { function () {
idIntervalAjax = setInterval("clock_ajax_refresh()", refreshAjaxIntervalSeconds); idIntervalAjax = setInterval("clock_ajax_refresh()", refreshAjaxIntervalSeconds);
EventZoomEnd(null,map.zoom);
} }
); );
</script> </script>

View File

@ -138,6 +138,7 @@ function js_printMap(id_div, initial_zoom, center_latitude, center_longitude, ob
var baseLayer = null; var baseLayer = null;
map.events.on({"zoomend": EventZoomEnd}); map.events.on({"zoomend": EventZoomEnd});
map.events.on({"mouseup": EventZoomEnd});
//Define the maps layer //Define the maps layer
for (var baselayerIndex in objBaseLayers) { for (var baselayerIndex in objBaseLayers) {
@ -224,10 +225,18 @@ function js_printMap(id_div, initial_zoom, center_latitude, center_longitude, ob
.transform(map.displayProjection, map.getProjectionObject()); .transform(map.displayProjection, map.getProjectionObject());
map.setCenter (lonLat, initial_zoom); map.setCenter (lonLat, initial_zoom);
} }
function EventZoomEnd (evt) { function EventZoomEnd (evt,zoom = map.zoom) {
var actual_zoom = (evt.object.zoom < 6) ? 6 : evt.object.zoom; if(evt == null){
var actual_zoom = (zoom < 6) ? 6 : zoom;
}
else{
var actual_zoom = (evt.object.zoom < 6) ? 6 : evt.object.zoom;
}
var max_width_marker = 38; var max_width_marker = 38;
var max_zoom_map = map.numZoomLevels; var max_zoom_map = map.numZoomLevels;
var max_font_size = 15; var max_font_size = 15;
@ -258,7 +267,6 @@ function EventZoomEnd (evt) {
var new_width_marker = (actual_zoom * max_width_marker) / max_zoom_map; var new_width_marker = (actual_zoom * max_width_marker) / max_zoom_map;
var new_height_marker = (actual_zoom * max_width_marker) / max_zoom_map; var new_height_marker = (actual_zoom * max_width_marker) / max_zoom_map;
console.log(feature);
feature.style.fontSize = '' + actual_font_size + ' !important'; feature.style.fontSize = '' + actual_font_size + ' !important';
feature.style.graphicHeight = new_height_marker; feature.style.graphicHeight = new_height_marker;
feature.style.graphicWidth = new_width_marker; feature.style.graphicWidth = new_width_marker;
@ -280,6 +288,7 @@ function EventZoomEnd (evt) {
function changeShowStatus(newShowStatus) { function changeShowStatus(newShowStatus) {
statusShow = newShowStatus; statusShow = newShowStatus;
hideAgentsStatus(); hideAgentsStatus();
EventZoomEnd(null,map.zoom);
js_refreshParentLines(); js_refreshParentLines();
} }