front_idill/src/search/js/curvesDetector.js
changeset 47 4e1ee94d70b1
parent 46 9d7a2aa112fb
child 52 277c94533395
--- a/front_idill/src/search/js/curvesDetector.js	Fri Jul 06 13:44:25 2012 +0200
+++ b/front_idill/src/search/js/curvesDetector.js	Mon Jul 09 14:24:42 2012 +0200
@@ -175,6 +175,7 @@
 		if(this.MPActualDist > this.sizeTreshold && MPCurrentA != -1)
 		{
 			console.log(this.MPActualAngle, MPCurrentA, this.MPActualAngle != -1, this.MPActualAngle != MPCurrentA);
+			
 			if(this.MPActualAngle == -1 || this.MPActualAngle != MPCurrentA)
 			{
 				this.MPActualAngle = MPCurrentA;
@@ -191,13 +192,29 @@
 				{
 					console.log('many curves');
 					this.mosaic.curvesGesturesFound = true;
-					$('.notifications').remove();
+					this.mosaic.removeNotifications();
 					this.mosaic.curvesGestures(foundGestures);
+					
+					if(foundGestures.length == 0 && !this.mosaic.helpDisplayed)
+					{
+						this.mosaic.notifyHelp();
+						foundGestures = '';
+						this.mosaic.curvesGesturesFound = false;
+						this.mosaic.isSearchByCurvesOn = false;
+						this.mosaic.leaveSearch();
+					}
+					else if(foundGestures.split(';').length != 1 && this.mosaic.helpDisplayed)
+					{
+						if(this.mosaic.helpDisplayed)
+						{
+							this.mosaic.removeHelp();
+						}
+					}
 				}
 				else
 				{
 					// console.log(this.mosaic.currentMode);
-					this.mosaic.currentSearchGesture = foundGestures;
+					this.mosaic.currentSearchGesture[this.mosaic.centerId] = foundGestures;
 					this.mosaic.isUserInSearchZone = false;
 					
 					if(this.mosaic.currentMode == "SEARCH" && this.mosaic.playerIsReady)
@@ -205,9 +222,16 @@
 						this.mosaic.player.widgets[0].searchByGesture(foundGestures);
 						this.mosaic.isCurrentlyInASearchByGesture = this.mosaic.player.widgets[0].isCurrentlyInASearchByGesture;
 						
-						$('.notifications').remove();
+						this.mosaic.removeNotifications();
 						this.mosaic.searchGesture(foundGestures, 'valid');
 						
+						if(this.mosaic.player && this.mosaic.player.widgets[0] && this.mosaic.timeToGoAt[this.mosaic.centerId] === 0 && this.mosaic.player.widgets[0].atLeastOneSearchMarker(this.mosaic.currentSearchGesture[this.mosaic.centerId]))
+						{
+							this.mosaic.player.widgets[0].goToFirstSearchedMarker(this.mosaic.currentSearchGesture[this.mosaic.centerId]);
+						}
+						
+						this.mosaic.currentSearchGesture[this.mosaic.centerId] = foundGestures;
+						
 						foundGestures = '';
 						this.mosaic.curvesGesturesFound = false;
 						
@@ -223,7 +247,7 @@
 							this.mosaic.searchFilter(foundGestures);
 							this.mosaic.curvesGesturesFound = false;
 							
-							$('.notifications').remove();
+							this.mosaic.removeNotifications();
 							this.mosaic.filterGesture(foundGestures, 'valid');
 							
 							foundGestures = '';