Automatically disable anti-aliasing on high zoom levels

This commit is contained in:
Markus Koch 2020-04-20 00:02:28 +02:00
parent b2958f15d7
commit be16cf2f6e
2 changed files with 8 additions and 1 deletions

View File

@ -359,7 +359,15 @@ function dragstart(e) {
is_user_drag = 1; is_user_drag = 1;
} }
function update_aa_status() {
if (mymap.getZoom() > zoom_level_real)
document.getElementById('mapid').classList.add("no-aa");
else
document.getElementById('mapid').classList.remove("no-aa");
}
mymap.on('zoomend', function () {is_user_drag = 1; update_hash_from_position();}); mymap.on('zoomend', function () {is_user_drag = 1; update_hash_from_position();});
mymap.on('zoomend', update_aa_status);
mymap.on('moveend', update_hash_from_position); mymap.on('moveend', update_hash_from_position);
mymap.on('dragstart', function () { is_user_drag = 1;}); mymap.on('dragstart', function () { is_user_drag = 1;});
mymap.on('keydown', function (e) { if (e.originalEvent.code.match(/Arrow.*/)) is_user_drag = 1;}); mymap.on('keydown', function (e) { if (e.originalEvent.code.match(/Arrow.*/)) is_user_drag = 1;});

View File

@ -94,7 +94,6 @@ if (editor_mode) {
window.addEventListener("mouseup", onDragEnd, false); // Workaround as polyline.on(dragend, ) doesn't seem to work window.addEventListener("mouseup", onDragEnd, false); // Workaround as polyline.on(dragend, ) doesn't seem to work
// Configure map for better editing // Configure map for better editing
document.getElementById('mapid').classList.add("no-aa");
mymap.setMaxZoom(14); mymap.setMaxZoom(14);
mymap.off('click', onMapClick); mymap.off('click', onMapClick);