Hold mark labels font size when autorefresh and fix drag map font size bug - #1115
This commit is contained in:
parent
f907f3cdb7
commit
c9219107bf
|
@ -368,6 +368,7 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null, $publ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EventZoomEnd(null,map.zoom);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -396,7 +397,7 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null, $publ
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
}
|
}
|
||||||
|
|
||||||
last_time_of_data = Math.round(new Date().getTime() / 1000); //Unixtimestamp
|
last_time_of_data = Math.round(new Date().getTime() / 1000); //Unixtimestamp
|
||||||
|
|
||||||
//Test if the user change the refresh time.
|
//Test if the user change the refresh time.
|
||||||
|
@ -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>
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -236,11 +245,11 @@ function EventZoomEnd (evt) {
|
||||||
|
|
||||||
jQuery.each($("tspan"), function (i, tspan) {
|
jQuery.each($("tspan"), function (i, tspan) {
|
||||||
if (actual_zoom <= 18 && actual_zoom > 13)
|
if (actual_zoom <= 18 && actual_zoom > 13)
|
||||||
actual_font_size = (max_font_size - 3);
|
actual_font_size = (max_font_size + 5);
|
||||||
else if (actual_zoom <= 13 && actual_zoom >= 8)
|
else if (actual_zoom <= 13 && actual_zoom >= 8)
|
||||||
actual_font_size = (max_font_size - 6);
|
actual_font_size = (max_font_size);
|
||||||
else if (actual_zoom <= 8)
|
else if (actual_zoom <= 8)
|
||||||
actual_font_size = (max_font_size - 6);
|
actual_font_size = (max_font_size);
|
||||||
$(tspan).css('font-size', actual_font_size);
|
$(tspan).css('font-size', actual_font_size);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue