front_idill/src/mosaic/js/pointers.js
changeset 58 a28488078053
parent 55 afd60399a7b5
child 77 205409da0f32
--- a/front_idill/src/mosaic/js/pointers.js	Mon Jul 30 16:45:46 2012 +0200
+++ b/front_idill/src/mosaic/js/pointers.js	Tue Jul 31 16:26:00 2012 +0200
@@ -29,6 +29,11 @@
     {
         return;
     }
+	
+	this.minX = $(window).width();
+	this.minY = $(window).height();
+	this.maxX = 0;
+	this.maxY = 0;
     
     //On crée et ajoute les pointeurs.
     var mainPointer = '<div id="mainPointer" class="pointers"></div>';
@@ -154,13 +159,21 @@
 	{
 		isOtherPointerDisplayed = this.isSecondPointerDisplayed;
 		pointer = $('#mainPointer');
-		pointerImg = 'url(./img/cursors/pointer.png)';
+		
+		if(!this.isSearchByCurvesOn)
+		{
+			pointerImg = 'url(./img/cursors/pointer.png)';
+		}
 	}
 	else
 	{
 		isOtherPointerDisplayed = this.isMainPointerDisplayed;
 		pointer = $('#secondPointer');
-		pointerImg = 'url(./img/cursors/pointer2.png)';
+		
+		if(!this.isSearchByCurvesOn)
+		{
+			pointerImg = 'url(./img/cursors/pointer2.png)';
+		}
 	}
 	
 	//On regarde si on est sur un snapshot.
@@ -217,17 +230,25 @@
 	{
 		pointer = $('#mainPointer');
 		thisPointerNeighbourSelectedId = this.mainPointerNeighbourSelectedId;
-		pointerImg = 'url(./img/cursors/pointer.png)';
 		thisPointerExitBorder = this.mainPointerExitBorder;
 		otherPointerExitBorder = this.secondPointerExitBorder;
+
+		if(!this.isSearchByCurvesOn)
+		{
+			pointerImg = 'url(./img/cursors/pointer.png)';
+		}
 	}
 	else
 	{
 		pointer = $('#secondPointer');
 		thisPointerNeighbourSelectedId = this.secondPointerNeighbourSelectedId;
-		pointerImg = 'url(./img/cursors/pointer2.png)';
 		thisPointerExitBorder = this.secondPointerExitBorder;
 		otherPointerExitBorder = this.mainPointerExitBorder;
+
+		if(!this.isSearchByCurvesOn)
+		{
+			pointerImg = 'url(./img/cursors/pointer2.png)';
+		}
 	}
 	
 	var zoomX = pointerX - this.notifyLeftVideo, zoomY = pointerY - this.notifyTopVideo;
@@ -236,7 +257,7 @@
 	this.pointersTimelineSelection(pointerX, pointerY, isMainPointer);
 	
 	//Si on se trouve actuellement dans une recherche par gestures.
-	if(this.isCurrentlyInASearchByGesture)
+	if(this.currentSearchGesture[this.centerId])
 	{
 		this.checkIfPointerIsOnSearchNotification(pointerX, pointerY, pointer);
 	}
@@ -409,19 +430,22 @@
 			//Si on est en mode d'interaction Kinect.
 			if(!this.config.mouseInteractions)
 			{
-				//On met le spinner gif sur le pointeur.
-				var spinner = "<img id='spinner'></div>";
-				$('body').append(spinner);
-				$('#spinner').css(
+				//On met le spinner gif sur le pointeur s'il existe.
+				if(pointer.length > 0)
 				{
-					position: 'absolute',
-					top: pointer.position().top,
-					left: pointer.position().left,
-					width: 85,
-					height: 85,
-					'z-index': 600
-				});
-				$('#spinner').attr('src', './img/cursors/selector_anim.gif');
+					var spinner = "<img id='spinner'></div>";
+					$('body').append(spinner);
+					$('#spinner').css(
+					{
+						position: 'absolute',
+						top: pointer.position().top,
+						left: pointer.position().left,
+						width: 85,
+						height: 85,
+						'z-index': 600
+					});
+					$('#spinner').attr('src', './img/cursors/selector_anim.gif');
+				}
 			}
 			
 			this.selectTLTimeout = setTimeout(function()
@@ -490,10 +514,13 @@
     //Si on est en mode d'interaction Kinect, on effectue un réhaussement de la position.
     if(!this.config.mouseInteractions)
     {
-        x *= 7;
+		this.minMax(x, y);
+		x = this.scaleIntervals(this.config.kinectMinCoordX, this.config.kinectMaxCoordX, 0, $(window).width(), x);
+		y = this.scaleIntervals(this.config.kinectMinCoordY, this.config.kinectMaxCoordY, 0, $(window).height(), y);
+        /*x *= 7;
         y *= 7;
         x -= $(window).width() * 3 / 4;
-        y -= $(window).height() * 2 / 4;
+        y -= $(window).height() * 2 / 4;*/
     }
     
 	var pointer;
@@ -625,7 +652,7 @@
     }
     
     //Si l'aide est affichée, on la masque.
-    if(this.helpDisplayed)
+    if(this.helpDisplayed && !this.mustTakeOutHands)
     {
         this.removeHelp();
     }
@@ -768,13 +795,13 @@
 {
     var _this = this;
     var notification_search = $('#notify_search_1gesture');
-    
+	
     //Si la notification de recherche existe (dans le player).
     if(notification_search.length > 0)
     {
         //Pictogramme actuel de la notification.
         var currentPicto = notification_search.css('background-image');
-        
+		
         //Si le pointeur est sur la notification.
         if(x > notification_search.position().left && x < (+notification_search.position().left + notification_search.width()) && y > notification_search.position().top && y < (+notification_search.position().top + notification_search.height()))
         {
@@ -789,22 +816,36 @@
                 if(!this.config.mouseInteractions)
                 {
                     //On met le spinner gif sur le pointeur.
-                    var spinner = "<img id='spinner'></div>";
-                    $('body').append(spinner);
-                    $('#spinner').css(
-                    {
-                        position: 'absolute',
-                        top: pointer.position().top,
-                        left: pointer.position().left,
-                        width: 85,
-                        height: 85,
-                        'z-index': 600
-                    });
-                    $('#spinner').attr('src', './img/cursors/selector_anim.gif');
+					if(pointer != null && pointer.length > 0)
+					{
+						//On modifie l'apparence du pointeur.
+						pointer.css('background-image', 'url(./img/cursors/selector_gray.png)');
+						var spinner = "<img id='spinner'></div>";
+						$('body').append(spinner);
+						$('#spinner').css(
+						{
+							position: 'absolute',
+							top: pointer.position().top,
+							left: pointer.position().left,
+							width: 85,
+							height: 85,
+							'z-index': 600
+						});
+						$('#spinner').attr('src', './img/cursors/selector_anim.gif');
+					}
                     
                     //Après un laps de temps sur la notification, on supprime la recherche et on revient au mode précédent.
                     this.removeNotificationByGestureTimeout = setTimeout(function()
                     {
+						if(pointer.attr('id') == 'mainPanel')
+						{
+							pointer.css('background-image', 'url(./img/cursors/pointer.png)');
+						}
+						else
+						{
+							pointer.css('background-image', 'url(./img/cursors/pointer2.png)');
+						}
+						
                         //Si on est en recherche, on revient en video.
                         if(_this.currentMode == 'SEARCH')
                         {
@@ -825,6 +866,7 @@
                         
                         _this.alreadyOnNotification = false;
                         _this.isCurrentlyInASearchByGesture = false;
+						_this.gestureDelRequested = false;
                         
                         //Si on n'est ni en recherche, ni en filtrage, on enlève la gesture de recherche.
                         if(_this.currentMode != 'MOSAIC' && _this.currentMode != 'FILTER')
@@ -935,4 +977,21 @@
 	}
 	
 	return false;
+}
+
+/*
+ * Change la couleur des pointeurs pendant le tracé d'une courbe.
+*/
+Mosaic.prototype.pointersGreen = function()
+{
+	$('#mainPointer').css('background-image', 'url(./img/cursors/pointerC.png)');
+	$('#secondPointer').css('background-image', 'url(./img/cursors/pointer2C.png)');
+}
+
+Mosaic.prototype.minMax = function(x, y)
+{
+	if(x < this.minX) {this.minX = x;}
+	if(x > this.maxX) {this.maxX = x;}
+	if(y < this.minY) {this.minY = y;}
+	if(y > this.maxY) {this.maxY = y;}
 }
\ No newline at end of file