Bug 3136 - Preview - infinity loop on accelerometer
authorEugene Ostroukhov <eugeneo@symbian.org>
Thu, 01 Jul 2010 15:41:21 -0700
changeset 413 817cf8083ab8
parent 412 72448215f517
child 414 dbe3521f62de
Bug 3136 - Preview - infinity loop on accelerometer
org.symbian.tools.wrttools.previewer/preview/script/accelerometer.js
--- a/org.symbian.tools.wrttools.previewer/preview/script/accelerometer.js	Thu Jul 01 15:01:44 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/accelerometer.js	Thu Jul 01 15:41:21 2010 -0700
@@ -44,13 +44,16 @@
 		};
 
 		$("#" + buttonId).mousedown(function() {
-			timeout = window.setTimeout(function() {
-				id = window.setInterval(function() {
-					timeout = false;
-					adjust(input, fn, increment);
-				}, 10);
-			}, 250);
-		}).mouseup(stop).focusout(stop).blur(stop).mouseleave(stop);
+			if (!timeout && !id) {
+				timeout = window.setTimeout(function() {
+					id = window.setInterval(function() {
+						timeout = false;
+						adjust(input, fn, increment);
+					}, 10);
+				}, 250);
+			}
+		}).mouseup(stop).focusout(stop).blur(stop).mouseleave(stop).dblclick(
+				stop);
 	}
 
 	function adjust(input, callback, increment) {