refresh improvements
- cancel existing refrest timer on start zoom/drag - add a manual refresh option into the status box when idle
This commit is contained in:
parent
42d5b8d8f9
commit
7248b17ea8
@ -236,8 +236,8 @@ window.setupMap = function() {
|
|||||||
map.on('moveend zoomend', function() { window.mapRunsUserAction = false });
|
map.on('moveend zoomend', function() { window.mapRunsUserAction = false });
|
||||||
|
|
||||||
// update map hooks
|
// update map hooks
|
||||||
map.on('movestart zoomstart', window.requests.abort);
|
map.on('movestart zoomstart', function() { window.requests.abort(); window.startRefreshTimeout(-1); });
|
||||||
map.on('moveend zoomend', function() { console.log('map moveend'); window.startRefreshTimeout(ON_MOVE_REFRESH*1000) });
|
map.on('moveend zoomend', function() { window.startRefreshTimeout(ON_MOVE_REFRESH*1000) });
|
||||||
|
|
||||||
window.addResumeFunction(window.requestData);
|
window.addResumeFunction(window.requestData);
|
||||||
window.requests.addRefreshFunction(window.requestData);
|
window.requests.addRefreshFunction(window.requestData);
|
||||||
|
@ -38,6 +38,7 @@ window.requests.abort = function() {
|
|||||||
// gives user feedback about pending operations. Draws current status
|
// gives user feedback about pending operations. Draws current status
|
||||||
// to website. Updates info in layer chooser.
|
// to website. Updates info in layer chooser.
|
||||||
window.renderUpdateStatus = function() {
|
window.renderUpdateStatus = function() {
|
||||||
|
|
||||||
var t = '<b>map status:</b> ';
|
var t = '<b>map status:</b> ';
|
||||||
if(mapRunsUserAction)
|
if(mapRunsUserAction)
|
||||||
t += 'paused during interaction';
|
t += 'paused during interaction';
|
||||||
@ -48,7 +49,7 @@ window.renderUpdateStatus = function() {
|
|||||||
else if(window.requests._quickRefreshPending)
|
else if(window.requests._quickRefreshPending)
|
||||||
t += 'refreshing...';
|
t += 'refreshing...';
|
||||||
else
|
else
|
||||||
t += 'Up to date.';
|
t += 'Up to date. <a style="cursor: pointer" onclick="startRefreshTimeout(10)" title="Refresh">⟳</a>';
|
||||||
|
|
||||||
if(renderLimitReached())
|
if(renderLimitReached())
|
||||||
t += ' <span style="color:#f66" class="help" title="Can only render so much before it gets unbearably slow. Not all entities are shown. Zoom in or increase the limit (search for MAX_DRAWN_*).">RENDER LIMIT</span> '
|
t += ' <span style="color:#f66" class="help" title="Can only render so much before it gets unbearably slow. Not all entities are shown. Zoom in or increase the limit (search for MAX_DRAWN_*).">RENDER LIMIT</span> '
|
||||||
@ -82,6 +83,8 @@ window.startRefreshTimeout = function(override) {
|
|||||||
// status bar
|
// status bar
|
||||||
window.renderUpdateStatus();
|
window.renderUpdateStatus();
|
||||||
if(refreshTimeout) clearTimeout(refreshTimeout);
|
if(refreshTimeout) clearTimeout(refreshTimeout);
|
||||||
|
if(override == -1) return; //don't set a new timeout
|
||||||
|
|
||||||
var t = 0;
|
var t = 0;
|
||||||
if(override) {
|
if(override) {
|
||||||
window.requests._quickRefreshPending = true;
|
window.requests._quickRefreshPending = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user