front_idill/src/mosaic/js/mosaic.js
changeset 46 9d7a2aa112fb
parent 45 0e29ae4568a0
child 47 4e1ee94d70b1
--- a/front_idill/src/mosaic/js/mosaic.js	Thu Jul 05 16:04:33 2012 +0200
+++ b/front_idill/src/mosaic/js/mosaic.js	Fri Jul 06 13:44:25 2012 +0200
@@ -143,6 +143,8 @@
 	this.gestureDelRequested = false;
 	//Code de gesture actuellement calculé par les détecteurs de courbes.
 	this.actualCode = '';
+	//Indique si l'utilisateur est entré dans la zone de recherche.
+	this.isUserInSearchZone = false;
 	
 	//Timeout (attente) pour le zoom après un préZoom.
 	this.zoomTimeout = null;
@@ -368,7 +370,7 @@
 				//Si on gère les interactions à la souris.
 				if(_this.mouseInteractions)
 				{
-					$('body').mousemove(function(e)
+					$(window).mousemove(function(e)
 					{
 						_this.refreshMainPointer(e.pageX, e.pageY, _this);
 						_this.mousePosX = e.pageX;
@@ -407,15 +409,12 @@
 	
 	if(this.mouseInteractions)
 	{
-		//On bind le clic pour supprimer une recherche.
-		$('body').click(function(e)
+		//Si on fait un mouse down sur le body, on vérifie enregistre le déplacement de la souris jusqu'au prochain mouse up.
+		$(window).mousedown(function (e)
 		{
 			_this.removeSearchNotificationIfOnIt(e.pageX, e.pageY);
-		});
-		
-		//Si on fait un mouse down sur le body, on vérifie enregistre le déplacement de la souris jusqu'au prochain mouse up.
-		$(window).mousedown(function ()
-		{
+			
+			_this.isUserInSearchZone = true;
 			if(_this.isSearchByCurvesOn)
 			{
 				_this.searchCanvas.onPointerIn(_this.mousePosX, _this.mousePosY, null, null);
@@ -469,15 +468,15 @@
 						_this.isSearchByCurvesOn = true;
 						_this.startSearch();
 						
-						if(!_this.curvesGesturesFound)
+						/*if(!_this.curvesGesturesFound)
 						{
 							$('.notifications').remove();
 							_this.filterSearch();
-						}
+						}*/
 						
 						_this.searchCanvas.onPointerIn(_this.mousePosX, _this.mousePosY - _this.MPTop_margin, null, null);
 					}
-					else if(_this.currentMode == "FILTER" && !_this.isSearchByCurvesOn)
+					else if(_this.currentMode == "FILTER" && !_this.isSearchByCurvesOn && _this.isUserInSearchZone)
 					{
 						console.log('after search');
 						_this.preUnzoom();
@@ -495,11 +494,11 @@
 						_this.isSearchByCurvesOn = true;
 						_this.startSearch();
 						
-						if(!_this.curvesGesturesFound)
+						/*if(!_this.curvesGesturesFound)
 						{
 							$('.notifications').remove();
 							_this.searchSearch();
-						}
+						}*/
 						
 						_this.searchCanvas.onPointerIn(_this.mousePosX, _this.mousePosY - _this.MPTop_margin, null, null);
 					}
@@ -528,6 +527,8 @@
 				
 				if(_this.isSearchByCurvesOn)
 				{
+					_this.isUserInSearchZone = false;
+					
 					var gesture_match = _this.gestureWithSameCode(_this.actualCode);
 					_this.actualCode = '';
 					
@@ -562,7 +563,7 @@
 				$(window).unbind('mousemove');
 				$(window).unbind('mouseup');
 				//On rebind le mousemove principal du body, car ils ont tous été unbindés.
-				$('body').mousemove(function(e)
+				$(window).mousemove(function(e)
 				{
 					_this.refreshMainPointer(e.pageX, e.pageY, _this);
 					_this.mousePosX = e.pageX;
@@ -682,6 +683,7 @@
 		}
 		
 		_this.getDictionary();
+		_this.getLang();
 	});
 }
 
@@ -803,89 +805,6 @@
 	
 	var gestureReceived = '';
 	
-	//Sinon si on a appuyé sur 'g' ou 'G'.
-	// if(event.which == 103 || event.which == 71)
-	/*if(event == "CURVES")
-	{
-		//Si on est déjà en recherche par courbes.
-		if(this.currentMode == "SEARCH" || this.currentMode == "FILTER")
-		{
-			//On quitte cette recherche.
-			this.leaveSearch();
-			//Si on était en mode recherche.
-			if(this.currentMode == "SEARCH")
-			{
-				//On revient dans la vidéo.
-				this.currentMode = "VIDEO";
-			}
-			else
-			{
-				//Sinon c'est qu'on était dans la mosaïque.
-				this.currentMode = "MOSAIC";
-			}
-		}
-		else
-		{
-			//Si on est en plein écran.
-			if(this.fullscreen)
-			{
-				//On entre en mode recherche.
-				this.currentMode = "SEARCH";
-			}
-			//Sinon.
-			else
-			{
-				//On entre en mode filtrage.
-				this.currentMode = "FILTER";
-			}
-			
-			this.startSearch();
-		}
-	}
-	//Si c'est a ou A.
-	// else if(event.which == 65 || event.which == 97)
-	else if(event == "HELP")
-	{
-		if(!this.helpDisplayed)
-		{
-			this.notifyHelp();
-		}
-		else
-		{
-			this.removeHelp();
-		}
-	}
-	//Si c'est v ou V.
-	// else if(event.which == 86 || event.which == 118)
-	else if(event == "NOTIFY-SEARCH")
-	{
-		this.notifySearchMarkers('run;jump;fall');
-	}
-	//Si c'est b ou B.
-	// else if(event.which == 66 || event.which == 98)
-	else if(event == "REMOVE-SEARCH")
-	{
-		this.removeSearchMarkers();
-	}
-	//Si c'est k ou K.
-	// else if(event.which == 75 || event.which == 107)
-	else if(event == "FILTER")
-	{
-		this.searchFilter('circle');
-	}
-	//Si c'est l ou L.
-	// else if(event.which == 76 || event.which == 108)
-	else if(event == "REMOVE-FILTER")
-	{
-		this.removeFilter();
-	}
-	//Si on a appuié sur la touche 'q' ou 'Q';
-	// else if(event.which == 113 || event.which == 81)
-	else if(event == "UNZOOM")
-	{
-		this.unzoom();
-	}*/
-	// else if(event.which == 111 || event.which == 79)
 	if(event.indexOf("INCOMING-") != -1 && this.prephaseEnabled)
 	{
 		// console.log(this.date() + ' ' + event);
@@ -1187,6 +1106,10 @@
 				if(_this.player.widgets[0])
 				{
 					_this.player.widgets[0].setMouseInteractions(_this.mouseInteractions);
+					if(_this.gesturesText.length > 0)
+					{
+						_this.player.widgets[0].setLang(_this.gesturesText);
+					}
 				}
 				
 				if(_this.currentMode == 'VIDEO' || _this.currentMode == 'SEARCH' || _this.currentMode == 'TIMELINE')