From be16cf2f6e4548d3ba6f0554202c921b0c90b5a5 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Mon, 20 Apr 2020 00:02:28 +0200 Subject: [PATCH] Automatically disable anti-aliasing on high zoom levels --- htdocs/mapscript.js | 8 ++++++++ htdocs/streeteditor.js | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js index 1887c2a..365a41d 100644 --- a/htdocs/mapscript.js +++ b/htdocs/mapscript.js @@ -359,7 +359,15 @@ function dragstart(e) { 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', update_aa_status); mymap.on('moveend', update_hash_from_position); mymap.on('dragstart', function () { is_user_drag = 1;}); mymap.on('keydown', function (e) { if (e.originalEvent.code.match(/Arrow.*/)) is_user_drag = 1;}); diff --git a/htdocs/streeteditor.js b/htdocs/streeteditor.js index 6cc8e18..2d9f074 100644 --- a/htdocs/streeteditor.js +++ b/htdocs/streeteditor.js @@ -94,7 +94,6 @@ if (editor_mode) { window.addEventListener("mouseup", onDragEnd, false); // Workaround as polyline.on(dragend, ) doesn't seem to work // Configure map for better editing - document.getElementById('mapid').classList.add("no-aa"); mymap.setMaxZoom(14); mymap.off('click', onMapClick);