[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

nap naparuba at gmail.com
Tue Feb 28 22:08:58 UTC 2012


The following commit has been merged in the debian/master branch:
commit 03f672e550a65f9bf56557baa3a4fc8912e43173
Author: nap <naparuba at gmail.com>
Date:   Thu Dec 15 22:25:25 2011 +0100

    Add : (try to add) touch management in the /mobile/impacts pâge. Need more fix :p

diff --git a/shinken/webui/plugins/mobile/htdocs/js/mobile_impacts.js b/shinken/webui/plugins/mobile/htdocs/js/mobile_impacts.js
index 1837763..4c9c6a0 100644
--- a/shinken/webui/plugins/mobile/htdocs/js/mobile_impacts.js
+++ b/shinken/webui/plugins/mobile/htdocs/js/mobile_impacts.js
@@ -58,6 +58,18 @@ function focus_on(idx){
     
 }
 
+function go_to_pos_x(pos_x){
+    pos_x = -pos_x;
+    var idx=3;
+    alert(pos_x);
+    n = (pos_x - Math.floor(pos_x)%250)/250;
+    n = Math.ceil(n);
+    n = Math.abs(n);
+    alert('N'+n);
+    focus_on(n);    
+}
+
+
 
 function go_left(){
     if(current_idx > 0){
@@ -73,6 +85,11 @@ function go_right(){
     }
 }
 
+function limit_it(v){
+    v = Math.min(v, 250*nb_impacts);
+    v = Math.max(v, 0);
+    return v;
+}
 
 window.addEvent('domready', function(){
 
@@ -81,4 +98,50 @@ window.addEvent('domready', function(){
     nb_impacts = all_impacts.length;
 
     focus_on(0);
+    var currentX = 0;
+    var startX = 0;
+    var touchMoved = false;
+    var lastMoveTime = 0;
+
+    window.addEventListener("touchstart", function (event){
+	startX = event.touches[0].pageX - currentX;
+	touchMoved = false;
+
+	event.preventDefault();
+    }, false);
+
+    window.addEventListener("touchmove", function (e){
+	touchMoved = true;
+	lastX = currentX;
+	lastMoveTime = new Date();
+	currentX = event.touches[0].pageX - startX;
+	currentX = limit_it(currentX);
+	e.preventDefault();
+    }, false);
+
+    window.addEventListener('touchend', function (e){
+	if (touchMoved)
+	{
+            /* Approximate some inertia -- the transition function takes care of the decay over 0.4s for us, but we need to amplify the last movement */
+            var delta = currentX - lastX;
+            var dt = (new Date()) - lastMoveTime + 1;
+            /* dx * 400 / dt */
+	    alert('delta'+delta+'dt'+dt);
+            currentX = currentX + delta * 200 / dt;
+	    currentX = limit_it(currentX);
+	    go_to_pos_x(currentX);
+            //this.delegate.updateTouchEnd(this);
+	    //alert(currentX);
+
+
+	}
+	else
+	{
+            //this.delegate.clicked(this.currentX);
+	}
+	alert('CurrentX'+currentx);
+	e.preventDefault();
+    }, false);
+
+
 });
\ No newline at end of file

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list