set preview stops refreshing
authorCalin Crisan <ccrisan@gmail.com>
Sun, 13 Oct 2013 09:49:05 +0000 (12:49 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 13 Oct 2013 09:49:05 +0000 (12:49 +0300)
doc/todo.txt
static/js/main.js

index 50b7e7af337a4c34885c41cbfc6ef23e39297558..bd4dcd75c9620c39e3c092e10e43034c269d7c23 100644 (file)
@@ -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
index 6fd6d42280b507ebf91182d9a90ec2fe0313ee47..c40de507b8a04b8b97451803a40d8f1cff5b9279 100644 (file)
@@ -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);