From d6b6105fcd7f8a7c1d1669468fdb303862a167ad Mon Sep 17 00:00:00 2001 From: Steven Honson Date: Sun, 4 Oct 2015 18:13:52 +1100 Subject: [PATCH] Re-zoom map on autozoom enable When enabling autozoom, re-zoom the map immediately instead of needing to wait for the next update of a marker for the autozoom to occur. Also tidied up a comment. --- docroot/last/functions.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docroot/last/functions.js b/docroot/last/functions.js index f67091e..086d6d2 100644 --- a/docroot/last/functions.js +++ b/docroot/last/functions.js @@ -60,10 +60,13 @@ function ButtonControl(controlDiv, map) { controlText.innerHTML = 'Autozoom'; controlUI.appendChild(controlText); - // Setup the click event listeners: simply set the map to Chicago. + // Setup the click event listener. controlUI.addEventListener('click', function() { do_fit = !do_fit; controlText.style.color = (do_fit) ? 'rgb(0,153,0)' : 'rgb(25,25,25)'; + if (do_fit) { + fitbounds(); + } }); }