front_idill/src/mosaic/js/pointers.js
changeset 79 9eff85166868
parent 77 205409da0f32
child 85 b244a7bc0844
--- a/front_idill/src/mosaic/js/pointers.js	Wed Aug 08 18:42:01 2012 +0200
+++ b/front_idill/src/mosaic/js/pointers.js	Thu Aug 16 14:32:19 2012 +0200
@@ -325,19 +325,27 @@
 		{
 			//On le sélectionne.
 			this.selectNeighbour(snapshot, pointer);
-			clearTimeout(this.moveToNeighbourTimeout);
-			if(isMainPointer)
+			if(!this.config.mouseInteractions)
 			{
-				clearTimeout(this.mainPointerExitBorderTimeout);
-				this.mainPointerExitBorder = true;
-				this.mainPointerNeighbourSelectedId = intValueOfId;
+				clearTimeout(this.moveToNeighbourTimeout);
+				if(isMainPointer)
+				{
+					clearTimeout(this.mainPointerExitBorderTimeout);
+					this.mainPointerExitBorder = true;
+					this.mainPointerNeighbourSelectedId = intValueOfId;
+				}
+				else
+				{
+					clearTimeout(this.secondPointerExitBorderTimeout);
+					this.secondPointerExitBorder = true;
+					this.secondPointerNeighbourSelectedId = intValueOfId;
+				}
 			}
 			else
 			{
-				clearTimeout(this.secondPointerExitBorderTimeout);
-				this.secondPointerExitBorder = true;
-				this.secondPointerNeighbourSelectedId = intValueOfId;
+				this.mainPointerNeighbourSelectedId = intValueOfId;
 			}
+			
 		}
 		else
 		{
@@ -346,36 +354,39 @@
 			{
 				this.deselectNeighbour(thisPointerNeighbourSelectedId);
 				
-				//Si le pointeur quitte le voisin sans que l'autre pointeur ne fasse de même ailleurs.
-				if(thisPointerExitBorder && !otherPointerExitBorder)
-				{
-					//On va vers le voisin.
-					this.correctMoveToNeighbour(thisPointerNeighbourSelectedId, zoomX, zoomY);
-				}
-				
-				//Il n'est possible de se déplacer vers un voisin que dans un certain laps de temps lorsqu'on quitte la sélection d'un voisin.
-				this.moveToNeighbourTimeout = setTimeout(function()
-				{
-					_this.canMoveToNeighbour = false;
-				}, this.config.timeoutMoveToNeighbour);
-				
-				if(isMainPointer)
+				if(!this.config.mouseInteractions)
 				{
-					this.mainPointerExitBorderTimeout = setTimeout(function()
+					//Si le pointeur quitte le voisin sans que l'autre pointeur ne fasse de même ailleurs.
+					if(thisPointerExitBorder && !otherPointerExitBorder)
+					{
+						//On va vers le voisin.
+						this.correctMoveToNeighbour(thisPointerNeighbourSelectedId, zoomX, zoomY);
+					}
+					
+					//Il n'est possible de se déplacer vers un voisin que dans un certain laps de temps lorsqu'on quitte la sélection d'un voisin.
+					this.moveToNeighbourTimeout = setTimeout(function()
+					{
+						_this.canMoveToNeighbour = false;
+					}, this.config.timeoutMoveToNeighbour);
+					
+					if(isMainPointer)
 					{
-						_this.mainPointerExitBorder = false;
-					}, this.config.timeoutUnzoom);
+						this.mainPointerExitBorderTimeout = setTimeout(function()
+						{
+							_this.mainPointerExitBorder = false;
+						}, this.config.timeoutUnzoom);
+					}
+					else
+					{
+						this.secondPointerExitBorderTimeout = setTimeout(function()
+						{
+							_this.secondPointerExitBorder = false;
+						}, this.config.timeoutUnzoom);
+					}
+					
+					//On regarde si on a voulu faire de dézoom.
+					this.checkForDezoom();
 				}
-				else
-				{
-					this.secondPointerExitBorderTimeout = setTimeout(function()
-					{
-						_this.secondPointerExitBorder = false;
-					}, this.config.timeoutUnzoom);
-				}
-				
-				//On regarde si on a voulu faire de dézoom.
-				this.checkForDezoom();
 			}
 		}
 	}
@@ -409,7 +420,7 @@
 	if((this.currentMode != 'TIMELINE' || this.isTLRequested) && this.playerIsReady && !isTLSelectedByOtherPointer && !this.helpDisplayed)
 	{
 		//Si la timeline est sélectionnée.
-		if(this.isTLSelected(true, true) && !this.isTLRequested)
+		if(this.isTLSelected(true, true) && !this.isTLRequested && this.isVideoReading)
 		{
 			//On a demandé à aller dans la TL.
 			this.isTLRequested = true;
@@ -457,7 +468,7 @@
 			}, this.config.timeoutSlideTL);
 		}
 		//Sinon si on était sur la timeline sans qu'elle soit sélectionnée encore et qu'on l'a quitté avant la sélection.
-		else if(!this.isTLSelected(true, true) && this.isTLRequested)
+		else if(!this.isTLSelected(true, true) && this.isTLRequested || !this.isVideoReading)
 		{
 			this.isTLRequested = false;
 			clearTimeout(this.selectTLTimeout);
@@ -495,6 +506,7 @@
 		}
 		
 		this.player.popcorn.currentTime(time);
+		this.player.popcorn.play();
 	}
 }
 
@@ -1064,6 +1076,27 @@
 }
 
 /*
+ * Retourne vrai si le doigt est sur le bouton de lecture de video dans le mode d'interaction tablettes.
+*/
+Mosaic.prototype.isOnPlayButton = function(x, y)
+{
+	var playButton = $('#tabletPlayButton');
+	//S'il n'y a pas d'icone d'aide, on quitte.
+	if(playButton.length <= 0)
+	{
+		return;
+	}
+	
+	//Si la souris est sur l'icone, on retourne true.
+	if(x > playButton.position().left && x < +playButton.position().left + playButton.width() + 2 * parseInt(playButton.css('margin-left')) && y > playButton.position().top && y < +playButton.position().top + playButton.height() + 2 * parseInt(playButton.css('margin-left')))
+	{
+		return true;
+	}
+	
+	return false;
+}
+
+/*
  * Change la couleur des pointeurs pendant le tracé d'une courbe.
 */
 Mosaic.prototype.pointersGreen = function()