front_idill/src/mosaic/js/neighbours.js
changeset 47 4e1ee94d70b1
parent 45 0e29ae4568a0
child 52 277c94533395
--- a/front_idill/src/mosaic/js/neighbours.js	Fri Jul 06 13:44:25 2012 +0200
+++ b/front_idill/src/mosaic/js/neighbours.js	Mon Jul 09 14:24:42 2012 +0200
@@ -6,7 +6,11 @@
     ////TEST
     //$('.test').empty();
 	console.log('LISTEN TO NEIGHBOURS');
-	$('.notifications').remove();
+	
+	if(this.currentMode != 'SEARCH')
+	{
+		this.removeNotifications();
+	}
 	
 	if(this.currentMode == "NO-USER" || this.currentMode.indexOf("INCOMING") != -1)
 	{
@@ -152,6 +156,14 @@
 	{
 		return;
 	}
+	
+	if(this.gestureDelRequested)
+	{
+		var tab = neighbour.attr('id').split('-');
+		var snapshotId = tab[1];
+		this.deselectNeighbour(snapshotId);
+		return;
+	}
 
 	// console.log('test (2)');
 	
@@ -242,18 +254,18 @@
 			{
 				if(_this.currentMode == 'VIDEO')
 				{
-					$('.notifications').remove();
+					_this.removeNotifications();
 					_this.videoMove(snapshotId);
 				}
-				else if(_this.currentMode == 'SEARCH' && !_this.currentSearchGesture)
+				else if(_this.currentMode == 'SEARCH' && !_this.currentSearchGesture[_this.centerId])
 				{
-					$('.notifications').remove();
+					_this.removeNotifications();
 					_this.searchSearchAndMove(snapshotId);
 				}
-				else if(_this.currentMode == 'SEARCH' && _this.currentSearchGesture)
+				else if(_this.currentMode == 'SEARCH' && _this.currentSearchGesture[_this.centerId])
 				{
-					$('.notifications').remove();
-					_this.searchGestureAndMove(_this.currentSearchGesture, 'valid', snapshotId);
+					_this.removeNotifications();
+					_this.searchGestureAndMove(_this.currentSearchGesture[_this.centerId], 'valid', snapshotId);
 				}
 				
 				_this.canMoveToNeighbour = true;
@@ -262,18 +274,18 @@
 			{
 				if(_this.currentMode == 'VIDEO')
 				{
-					$('.notifications').remove();
+					_this.removeNotifications();
 					_this.videoMoveAndUnzoom(snapshotId);
 				}
-				else if(_this.currentMode == 'SEARCH' && !_this.currentSearchGesture)
+				else if(_this.currentMode == 'SEARCH' && !_this.currentSearchGesture[_this.centerId])
 				{
-					$('.notifications').remove();
+					_this.removeNotifications();
 					_this.searchSearchAndMoveAndUnzoom(snapshotId);
 				}
-				else if(_this.currentMode == 'SEARCH' && _this.currentSearchGesture)
+				else if(_this.currentMode == 'SEARCH' && _this.currentSearchGesture[_this.centerId])
 				{
-					$('.notifications').remove();
-					_this.searchGestureAndMoveAndUnzoom(_this.currentSearchGesture, 'valid', snapshotId);
+					_this.removeNotifications();
+					_this.searchGestureAndMoveAndUnzoom(_this.currentSearchGesture[_this.centerId], 'valid', snapshotId);
 				}
 			}
 		});
@@ -328,15 +340,15 @@
         {
             //Une fois invisible, on le supprime.
             neighbourFrame.remove();
-			$('.notifications').remove();
+			_this.removeNotifications();
 			
-			if(_this.currentMode == 'SEARCH' && !_this.currentSearchGesture)
+			if(_this.currentMode == 'SEARCH' && _this.currentSearchGesture[_this.centerId] == '')
 			{
 				_this.searchSearch();
 			}
-			else if(_this.currentMode == 'SEARCH' && _this.currentSearchGesture)
+			else if(_this.currentMode == 'SEARCH' && _this.currentSearchGesture[_this.centerId] != '')
 			{
-				_this.searchGesture(_this.currentSearchGesture, 'valid');
+				_this.searchGesture(_this.currentSearchGesture[_this.centerId], 'valid');
 			}
 			
 			_this.canSwipe = true;
@@ -462,7 +474,7 @@
 			_this.exitTimeline('move');
 		}
 		
-		console.log(Math.floor(_this.player.popcorn.currentTime()));
+		// console.log(Math.floor(_this.player.popcorn.currentTime()));
 		if(_this.autoMove)
 		{
 			_this.timeToGoAt[_this.centerId] = 0;
@@ -493,6 +505,15 @@
         left: MPCurrentLeft
     }, _this.config['timeMovingToNeighbour'], function()
     {
+		if(_this.currentSearchGesture[_this.centerId] != '')
+		{
+			console.log('notify move');
+			_this.currentMode = 'SEARCH';
+			_this.isCurrentlyInASearchByGesture = true;
+			_this.removeNotifications();
+			_this.searchGesture(_this.currentSearchGesture[_this.centerId], 'valid');
+		}
+		
         //On fait apparaître le snapshot vers lequel on s'est déplacé.
         $('#snapshotDiv-' + destinationId).fadeTo(_this.config['zoomTime'], '1', function()
         {