front_idill/src/mosaic/js/pointers.js
changeset 45 0e29ae4568a0
parent 44 8393d3473b98
child 47 4e1ee94d70b1
--- a/front_idill/src/mosaic/js/pointers.js	Fri Jun 29 16:16:24 2012 +0200
+++ b/front_idill/src/mosaic/js/pointers.js	Thu Jul 05 16:04:33 2012 +0200
@@ -3,6 +3,11 @@
 */
 mosaic.prototype.addPointers = function()
 {
+	if(this.mouseInteractions)
+	{
+		return;
+	}
+	
 	var mainPointer = '<div id="mainPointer" class="pointers"></div>';
 	var secondPointer = '<div id="secondPointer" class="pointers"></div>';
 	$('body').append(mainPointer + secondPointer);
@@ -181,7 +186,18 @@
 		this.mainPointerLastY = y;
 	}
 	
-	var pointerX = x - $('#mainPointer').width()/2, pointerY = y - $('#mainPointer').height()/2;
+	var pointerX, pointerY;
+
+	if(this.mouseInteractions)
+	{
+		pointerX = x;
+		pointerY = y;
+	}
+	else
+	{
+		pointerX = x - $('#mainPointer').width()/2;
+		pointerY = y - $('#mainPointer').height()/2;
+	}
 	var _this = this;
 	
 	$('#mainPointer').css(
@@ -234,7 +250,7 @@
 		// /!\ // RAJOUTE EN ATTENDANT UN GESTE DE CANCEL.
 		if(this.isMosaicFiltered && !this.isMosaicFiltering)
 		{
-			console.log('CHECK IF ON NOTIFY GESTURE');
+			//console.log('CHECK IF ON NOTIFY GESTURE');
 			this.checkIfPointerIsOnSearchNotification(pointerX, pointerY, $('#mainPointer'));
 		}
 	}
@@ -257,19 +273,22 @@
 				this.player.widgets[0].selectTimeline();
 				$('#mainPointer').css('background-image', 'url(./img/cursors/selector_gray.png)');
 				
-				//On met le spinner gif sur le pointeur.
-				var spinner = "<img id='spinner'></div>";
-				$('body').append(spinner);
-				$('#spinner').css(
+				if(!this.mouseInteractions)
 				{
-					position: 'absolute',
-					top: $('#mainPointer').position().top,
-					left: $('#mainPointer').position().left,
-					width: 85,
-					height: 85,
-					'z-index': 600
-				});
-				$('#spinner').attr('src', './img/cursors/selector_anim.gif');
+					//On met le spinner gif sur le pointeur.
+					var spinner = "<img id='spinner'></div>";
+					$('body').append(spinner);
+					$('#spinner').css(
+					{
+						position: 'absolute',
+						top: $('#mainPointer').position().top,
+						left: $('#mainPointer').position().left,
+						width: 85,
+						height: 85,
+						'z-index': 600
+					});
+					$('#spinner').attr('src', './img/cursors/selector_anim.gif');
+				}
 				
 				this.selectTLTimeout = setTimeout(function()
 				{
@@ -532,20 +551,23 @@
 				this.player.widgets[0].selectTimeline();
 				$('#secondPointer').css('background-image', 'url(./img/cursors/selector_gray.png)');
 				
-				//On met le spinner gif sur le pointeur.
-				var spinner = "<div id='spinner'></div>";
-				$('body').append(spinner);
-				$('#spinner').css(
+				if(!this.mouseInteractions)
 				{
-					position: 'absolute',
-					'background-repeat': 'no-repeat',
-					top: $('#mainPointer').position().top,
-					left: $('#mainPointer').position().left,
-					width: 85,
-					height: 85,
-					'z-index': 600
-				});
-				$('#spinner').attr('src', './img/cursors/selector_anim.gif');
+					//On met le spinner gif sur le pointeur.
+					var spinner = "<div id='spinner'></div>";
+					$('body').append(spinner);
+					$('#spinner').css(
+					{
+						position: 'absolute',
+						'background-repeat': 'no-repeat',
+						top: $('#mainPointer').position().top,
+						left: $('#mainPointer').position().left,
+						width: 85,
+						height: 85,
+						'z-index': 600
+					});
+					$('#spinner').attr('src', './img/cursors/selector_anim.gif');
+				}
 				
 				this.selectTLTimeout = setTimeout(function()
 				{
@@ -889,64 +911,142 @@
 		//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()))
 		{
-			// console.log('IN NOTIFICATION');
-			if(!this.alreadyOnNotification && $('#spinner').length == 0)
+			/*if($('#a').length == 0)
 			{
-				notification_search.css('background-image', currentPicto.replace('/big/valid/', '/big/hover/'));
-				
-				console.log(this.date() + ' try remove not');
-				//On met le spinner gif sur le pointeur.
-				var spinner = "<img id='spinner'></div>";
-				$('body').append(spinner);
-				$('#spinner').css(
+				var a = "<div id='a'></div>";
+				$('body').append(a);
+				$('#a').css(
 				{
+					left: notification_search.position().left,
+					top: notification_search.position().top,
+					width: notification_search.width(),
+					height: notification_search.height(),
+					"background-color": "#fff",
 					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.arrowSpinnerTimeout = setTimeout(function()
+			}*/
+			
+			if(!this.alreadyOnNotification && ($('#spinner').length == 0 && !this.mouseInteractions || this.mouseInteractions))
+			{
+				notification_search.css('background-image', currentPicto.replace('/big/' + (this.mouseInteractions ? 'MI/' : '') + 'valid/', '/big/' + (this.mouseInteractions ? 'MI/' : '') + 'hover/'));
+				
+				this.gestureDelRequested = true;
+				
+				// console.log(this.date() + ' try remove not ' + currentPicto.replace('/big/' + (this.mouseInteractions ? 'MI/' : '') + 'valid/', '/big/' + (this.mouseInteractions ? 'MI/' : '') + 'hover/'));
+				
+				if(!this.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');
 					
-				}, this.config['timeoutRemoveSpinner']);*/
-				
-				this.removeNotificationByGestureTimeout = setTimeout(function()
-				{
-					if(_this.currentMode == 'SEARCH')
-					{
-						_this.player.widgets[0].removeSearchByGesture();
-						_this.currentMode = 'VIDEO';
-					}
-					else if(_this.currentMode == 'TIMELINE')
+					this.removeNotificationByGestureTimeout = setTimeout(function()
 					{
-						_this.player.widgets[0].removeSearchByGesture();
-						_this.currentMode = 'TIMELINE';
-					}
-					else if(_this.currentMode == 'FILTER')
-					{
-						_this.removeFilter();
-					}
-					
-					_this.alreadyOnNotification = false;
-					_this.isCurrentlyInASearchByGesture = false;
-					_this.currentSearchGesture = '';
-					_this.canNotifyHelp = false;
-				}, this.config['timeoutRemoveNotificationByGesture']);
+						if(_this.currentMode == 'SEARCH')
+						{
+							_this.player.widgets[0].removeSearchByGesture();
+							_this.currentMode = 'VIDEO';
+						}
+						else if(_this.currentMode == 'TIMELINE')
+						{
+							_this.player.widgets[0].removeSearchByGesture();
+							_this.currentMode = 'TIMELINE';
+						}
+						else if(_this.currentMode == 'FILTER')
+						{
+							_this.removeFilter();
+						}
+						
+						_this.alreadyOnNotification = false;
+						_this.isCurrentlyInASearchByGesture = false;
+						_this.currentSearchGesture = '';
+						_this.canNotifyHelp = false;
+					}, this.config['timeoutRemoveNotificationByGesture']);
+				}
+				else
+				{
+				
+				}
+				
 				this.alreadyOnNotification = true;
 			}
+			
+			return true;
 		}
 		else
 		{
 			if(this.alreadyOnNotification)
 			{
-				notification_search.css('background-image', currentPicto.replace('/big/hover/', '/big/valid/'));
+				notification_search.css('background-image', currentPicto.replace('/big/' + (this.mouseInteractions ? 'MI/' : '') + 'hover/', '/big/' + (this.mouseInteractions ? 'MI/' : '') + 'valid/'));
+				
+				this.gestureDelRequested = false;
+				
+				// console.log(currentPicto.replace('/big/' + (this.mouseInteractions ? 'MI/' : '') + 'hover/', '/big/' + (this.mouseInteractions ? 'MI/' : '') + 'valid/'));
+				
 				clearTimeout(this.removeNotificationByGestureTimeout);
 				this.alreadyOnNotification = false;
 				$('#spinner').remove();
 			}
+			
+			return false;
+		}
+	}
+	
+	return false;
+}
+
+/*
+ * Si on se trouve sur la notification de recherche par gesture, on la supprime.
+*/
+mosaic.prototype.removeSearchNotificationIfOnIt = function(x, y)
+{
+	var _this = this;
+	
+	var notification_search = $('#notify_search_1gesture');
+	
+	//Si la notification de recherche existe (dans le player).
+	if(notification_search.length > 0)
+	{
+		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()))
+		{
+			$('.notifications').remove();
+			if(_this.currentMode == 'SEARCH')
+			{
+				_this.player.widgets[0].removeSearchByGesture();
+				_this.currentMode = 'VIDEO';
+			}
+			else if(_this.currentMode == 'TIMELINE')
+			{
+				_this.player.widgets[0].removeSearchByGesture();
+				_this.currentMode = 'TIMELINE';
+			}
+			else if(_this.currentMode == 'FILTER')
+			{
+				_this.removeFilter();
+			}
+			
+			_this.alreadyOnNotification = false;
+			_this.isCurrentlyInASearchByGesture = false;
+			_this.curvesGesturesFound = false;
+			_this.canDrawNextCurve = false;
+			_this.isSearchByCurvesOn = false;
+			_this.canNotifyHelp = false;
+			
+			//Si on est dans une vidéo, on laisse cette variable afin de ne pas dézoomer / bouger.
+			if(_this.currentMode != 'VIDEO' && _this.currentMode != 'TIMELINE')
+			{
+				_this.gestureDelRequested = false;
+			}
 		}
 	}
 }
\ No newline at end of file