From a31ec4512fde0f7f618fbeecb1aa914ee2b5769c Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 13 Oct 2013 12:49:05 +0300 Subject: [PATCH] set preview stops refreshing --- doc/todo.txt | 2 -- static/js/main.js | 13 +++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/todo.txt b/doc/todo.txt index 50b7e7a..bd4dcd7 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -1,5 +1,3 @@ --> default sat/contrast/hue... for existing conf file is somehow 0 --> request closed while setting the preview params -> applying progress sometimes does not appear on frame -> style scroll bars diff --git a/static/js/main.js b/static/js/main.js index 6fd6d42..c40de50 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1,5 +1,6 @@ var pushConfigs = {}; +var refreshDisabled = 0; /* utils */ @@ -661,6 +662,8 @@ function showProgress() { applyButton.addClass('progress'); $('div.camera-progress').css('opacity', '0.5'); + + refreshDisabled++; } function hideApply() { @@ -685,6 +688,8 @@ function endProgress() { } $('div.camera-progress').css('opacity', '0'); + + refreshDisabled--; } function isProgress() { @@ -859,7 +864,11 @@ function pushPreview() { 'hue': hue }; + refreshDisabled++; + ajax('POST', '/config/' + cameraId + '/set_preview/', data, function (data) { + refreshDisabled--; + if (data == null || data.error) { showErrorMessage(data && data.error); return; @@ -1259,8 +1268,8 @@ function doCloseCamera(cameraId) { } function refreshCameraFrames() { - if (isProgress()) { - /* no camera refreshing while in progress */ + if (refreshDisabled) { + /* camera refreshing disabled, retry later */ setTimeout(refreshCameraFrames, 1000); -- 2.39.5