Rune Halvorsen avatar Rune Halvorsen committed ae5dfa8

Adjusted timeouts for image refresh. Make sure image is refreshed when mouse move ends

Comments (0)

Files changed (1)

src/screenwatcher/screenwatcher.js

   var _reload_interval = 3000;
   var _metrics = null;
   var _current_image_metrics = null;
-  var _min_mouse_move_interval = 250; // in MS
+  var _min_mouse_move_interval = 400; // in MS
   var _last_move_timestamp = 0;
   var _img = null;
 
 
   this._onImageMouseMove = function(evt)
   {
+    if (_timer_id) {
+      window.clearTimeout(_timer_id);
+    }
+
     var now = (new Date()).getTime();
     var diff = now - _last_move_timestamp;
     if (diff > _min_mouse_move_interval)
     {
       _last_move_timestamp = now;
       this._forwardMouse(evt.offsetX, evt.offsetY);
-      }
-
+    }
+    else
+    {
+      // do a mouse forward after the last movement, so the idle screenshot
+      // is up to date
+      _timer_id = window.setTimeout(function() {
+                                       opera.postError("finashed");
+                                       self._forwardMouse(evt.offsetX, evt.offsetY);
+                                     }, _min_mouse_move_interval/2);
+    }
   }
 
-
   new Settings
   (
     'browser-window-viewer',
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.