front_idill/src/search/js/curvesDetector.js
changeset 47 4e1ee94d70b1
parent 46 9d7a2aa112fb
child 52 277c94533395
equal deleted inserted replaced
46:9d7a2aa112fb 47:4e1ee94d70b1
   173 		}
   173 		}
   174 		
   174 		
   175 		if(this.MPActualDist > this.sizeTreshold && MPCurrentA != -1)
   175 		if(this.MPActualDist > this.sizeTreshold && MPCurrentA != -1)
   176 		{
   176 		{
   177 			console.log(this.MPActualAngle, MPCurrentA, this.MPActualAngle != -1, this.MPActualAngle != MPCurrentA);
   177 			console.log(this.MPActualAngle, MPCurrentA, this.MPActualAngle != -1, this.MPActualAngle != MPCurrentA);
       
   178 			
   178 			if(this.MPActualAngle == -1 || this.MPActualAngle != MPCurrentA)
   179 			if(this.MPActualAngle == -1 || this.MPActualAngle != MPCurrentA)
   179 			{
   180 			{
   180 				this.MPActualAngle = MPCurrentA;
   181 				this.MPActualAngle = MPCurrentA;
   181 				this.actualCode += 'D' + MPCurrentA;
   182 				this.actualCode += 'D' + MPCurrentA;
   182 				this.mosaic.actualCode = this.actualCode;
   183 				this.mosaic.actualCode = this.actualCode;
   189 				
   190 				
   190 				if(foundGestures.length == 0 || foundGestures.split(';').length != 1)
   191 				if(foundGestures.length == 0 || foundGestures.split(';').length != 1)
   191 				{
   192 				{
   192 					console.log('many curves');
   193 					console.log('many curves');
   193 					this.mosaic.curvesGesturesFound = true;
   194 					this.mosaic.curvesGesturesFound = true;
   194 					$('.notifications').remove();
   195 					this.mosaic.removeNotifications();
   195 					this.mosaic.curvesGestures(foundGestures);
   196 					this.mosaic.curvesGestures(foundGestures);
       
   197 					
       
   198 					if(foundGestures.length == 0 && !this.mosaic.helpDisplayed)
       
   199 					{
       
   200 						this.mosaic.notifyHelp();
       
   201 						foundGestures = '';
       
   202 						this.mosaic.curvesGesturesFound = false;
       
   203 						this.mosaic.isSearchByCurvesOn = false;
       
   204 						this.mosaic.leaveSearch();
       
   205 					}
       
   206 					else if(foundGestures.split(';').length != 1 && this.mosaic.helpDisplayed)
       
   207 					{
       
   208 						if(this.mosaic.helpDisplayed)
       
   209 						{
       
   210 							this.mosaic.removeHelp();
       
   211 						}
       
   212 					}
   196 				}
   213 				}
   197 				else
   214 				else
   198 				{
   215 				{
   199 					// console.log(this.mosaic.currentMode);
   216 					// console.log(this.mosaic.currentMode);
   200 					this.mosaic.currentSearchGesture = foundGestures;
   217 					this.mosaic.currentSearchGesture[this.mosaic.centerId] = foundGestures;
   201 					this.mosaic.isUserInSearchZone = false;
   218 					this.mosaic.isUserInSearchZone = false;
   202 					
   219 					
   203 					if(this.mosaic.currentMode == "SEARCH" && this.mosaic.playerIsReady)
   220 					if(this.mosaic.currentMode == "SEARCH" && this.mosaic.playerIsReady)
   204 					{
   221 					{
   205 						this.mosaic.player.widgets[0].searchByGesture(foundGestures);
   222 						this.mosaic.player.widgets[0].searchByGesture(foundGestures);
   206 						this.mosaic.isCurrentlyInASearchByGesture = this.mosaic.player.widgets[0].isCurrentlyInASearchByGesture;
   223 						this.mosaic.isCurrentlyInASearchByGesture = this.mosaic.player.widgets[0].isCurrentlyInASearchByGesture;
   207 						
   224 						
   208 						$('.notifications').remove();
   225 						this.mosaic.removeNotifications();
   209 						this.mosaic.searchGesture(foundGestures, 'valid');
   226 						this.mosaic.searchGesture(foundGestures, 'valid');
       
   227 						
       
   228 						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]))
       
   229 						{
       
   230 							this.mosaic.player.widgets[0].goToFirstSearchedMarker(this.mosaic.currentSearchGesture[this.mosaic.centerId]);
       
   231 						}
       
   232 						
       
   233 						this.mosaic.currentSearchGesture[this.mosaic.centerId] = foundGestures;
   210 						
   234 						
   211 						foundGestures = '';
   235 						foundGestures = '';
   212 						this.mosaic.curvesGesturesFound = false;
   236 						this.mosaic.curvesGesturesFound = false;
   213 						
   237 						
   214 						this.mosaic.isSearchByCurvesOn = false;
   238 						this.mosaic.isSearchByCurvesOn = false;
   221 							console.log('1 curve : ' + foundGestures);
   245 							console.log('1 curve : ' + foundGestures);
   222 							this.mosaic.filterSearchedType = foundGestures;
   246 							this.mosaic.filterSearchedType = foundGestures;
   223 							this.mosaic.searchFilter(foundGestures);
   247 							this.mosaic.searchFilter(foundGestures);
   224 							this.mosaic.curvesGesturesFound = false;
   248 							this.mosaic.curvesGesturesFound = false;
   225 							
   249 							
   226 							$('.notifications').remove();
   250 							this.mosaic.removeNotifications();
   227 							this.mosaic.filterGesture(foundGestures, 'valid');
   251 							this.mosaic.filterGesture(foundGestures, 'valid');
   228 							
   252 							
   229 							foundGestures = '';
   253 							foundGestures = '';
   230 							
   254 							
   231 							this.mosaic.isSearchByCurvesOn = false;
   255 							this.mosaic.isSearchByCurvesOn = false;