front_idill/src/mosaic/js/pointers.js
changeset 79 9eff85166868
parent 77 205409da0f32
child 85 b244a7bc0844
equal deleted inserted replaced
78:52277fe2279c 79:9eff85166868
   323 		//Si c'est un voisin.
   323 		//Si c'est un voisin.
   324 		if(_.include(this.neighboursIds, intValueOfId))
   324 		if(_.include(this.neighboursIds, intValueOfId))
   325 		{
   325 		{
   326 			//On le sélectionne.
   326 			//On le sélectionne.
   327 			this.selectNeighbour(snapshot, pointer);
   327 			this.selectNeighbour(snapshot, pointer);
   328 			clearTimeout(this.moveToNeighbourTimeout);
   328 			if(!this.config.mouseInteractions)
   329 			if(isMainPointer)
       
   330 			{
   329 			{
   331 				clearTimeout(this.mainPointerExitBorderTimeout);
   330 				clearTimeout(this.moveToNeighbourTimeout);
   332 				this.mainPointerExitBorder = true;
   331 				if(isMainPointer)
   333 				this.mainPointerNeighbourSelectedId = intValueOfId;
   332 				{
       
   333 					clearTimeout(this.mainPointerExitBorderTimeout);
       
   334 					this.mainPointerExitBorder = true;
       
   335 					this.mainPointerNeighbourSelectedId = intValueOfId;
       
   336 				}
       
   337 				else
       
   338 				{
       
   339 					clearTimeout(this.secondPointerExitBorderTimeout);
       
   340 					this.secondPointerExitBorder = true;
       
   341 					this.secondPointerNeighbourSelectedId = intValueOfId;
       
   342 				}
   334 			}
   343 			}
   335 			else
   344 			else
   336 			{
   345 			{
   337 				clearTimeout(this.secondPointerExitBorderTimeout);
   346 				this.mainPointerNeighbourSelectedId = intValueOfId;
   338 				this.secondPointerExitBorder = true;
       
   339 				this.secondPointerNeighbourSelectedId = intValueOfId;
       
   340 			}
   347 			}
       
   348 			
   341 		}
   349 		}
   342 		else
   350 		else
   343 		{
   351 		{
   344 			//Sinon on déselectionne le snapshot.
   352 			//Sinon on déselectionne le snapshot.
   345 			if(thisPointerNeighbourSelectedId != null && thisPointerNeighbourSelectedId > -1)
   353 			if(thisPointerNeighbourSelectedId != null && thisPointerNeighbourSelectedId > -1)
   346 			{
   354 			{
   347 				this.deselectNeighbour(thisPointerNeighbourSelectedId);
   355 				this.deselectNeighbour(thisPointerNeighbourSelectedId);
   348 				
   356 				
   349 				//Si le pointeur quitte le voisin sans que l'autre pointeur ne fasse de même ailleurs.
   357 				if(!this.config.mouseInteractions)
   350 				if(thisPointerExitBorder && !otherPointerExitBorder)
       
   351 				{
   358 				{
   352 					//On va vers le voisin.
   359 					//Si le pointeur quitte le voisin sans que l'autre pointeur ne fasse de même ailleurs.
   353 					this.correctMoveToNeighbour(thisPointerNeighbourSelectedId, zoomX, zoomY);
   360 					if(thisPointerExitBorder && !otherPointerExitBorder)
       
   361 					{
       
   362 						//On va vers le voisin.
       
   363 						this.correctMoveToNeighbour(thisPointerNeighbourSelectedId, zoomX, zoomY);
       
   364 					}
       
   365 					
       
   366 					//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.
       
   367 					this.moveToNeighbourTimeout = setTimeout(function()
       
   368 					{
       
   369 						_this.canMoveToNeighbour = false;
       
   370 					}, this.config.timeoutMoveToNeighbour);
       
   371 					
       
   372 					if(isMainPointer)
       
   373 					{
       
   374 						this.mainPointerExitBorderTimeout = setTimeout(function()
       
   375 						{
       
   376 							_this.mainPointerExitBorder = false;
       
   377 						}, this.config.timeoutUnzoom);
       
   378 					}
       
   379 					else
       
   380 					{
       
   381 						this.secondPointerExitBorderTimeout = setTimeout(function()
       
   382 						{
       
   383 							_this.secondPointerExitBorder = false;
       
   384 						}, this.config.timeoutUnzoom);
       
   385 					}
       
   386 					
       
   387 					//On regarde si on a voulu faire de dézoom.
       
   388 					this.checkForDezoom();
   354 				}
   389 				}
   355 				
       
   356 				//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.
       
   357 				this.moveToNeighbourTimeout = setTimeout(function()
       
   358 				{
       
   359 					_this.canMoveToNeighbour = false;
       
   360 				}, this.config.timeoutMoveToNeighbour);
       
   361 				
       
   362 				if(isMainPointer)
       
   363 				{
       
   364 					this.mainPointerExitBorderTimeout = setTimeout(function()
       
   365 					{
       
   366 						_this.mainPointerExitBorder = false;
       
   367 					}, this.config.timeoutUnzoom);
       
   368 				}
       
   369 				else
       
   370 				{
       
   371 					this.secondPointerExitBorderTimeout = setTimeout(function()
       
   372 					{
       
   373 						_this.secondPointerExitBorder = false;
       
   374 					}, this.config.timeoutUnzoom);
       
   375 				}
       
   376 				
       
   377 				//On regarde si on a voulu faire de dézoom.
       
   378 				this.checkForDezoom();
       
   379 			}
   390 			}
   380 		}
   391 		}
   381 	}
   392 	}
   382 }
   393 }
   383 
   394 
   407 	
   418 	
   408 	//On vérifie si on veut sélectionner la TL.
   419 	//On vérifie si on veut sélectionner la TL.
   409 	if((this.currentMode != 'TIMELINE' || this.isTLRequested) && this.playerIsReady && !isTLSelectedByOtherPointer && !this.helpDisplayed)
   420 	if((this.currentMode != 'TIMELINE' || this.isTLRequested) && this.playerIsReady && !isTLSelectedByOtherPointer && !this.helpDisplayed)
   410 	{
   421 	{
   411 		//Si la timeline est sélectionnée.
   422 		//Si la timeline est sélectionnée.
   412 		if(this.isTLSelected(true, true) && !this.isTLRequested)
   423 		if(this.isTLSelected(true, true) && !this.isTLRequested && this.isVideoReading)
   413 		{
   424 		{
   414 			//On a demandé à aller dans la TL.
   425 			//On a demandé à aller dans la TL.
   415 			this.isTLRequested = true;
   426 			this.isTLRequested = true;
   416 			if(isMainPointer)
   427 			if(isMainPointer)
   417 			{
   428 			{
   455 				_this.removeNotifications();
   466 				_this.removeNotifications();
   456 				_this.timelineTimeline();
   467 				_this.timelineTimeline();
   457 			}, this.config.timeoutSlideTL);
   468 			}, this.config.timeoutSlideTL);
   458 		}
   469 		}
   459 		//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.
   470 		//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.
   460 		else if(!this.isTLSelected(true, true) && this.isTLRequested)
   471 		else if(!this.isTLSelected(true, true) && this.isTLRequested || !this.isVideoReading)
   461 		{
   472 		{
   462 			this.isTLRequested = false;
   473 			this.isTLRequested = false;
   463 			clearTimeout(this.selectTLTimeout);
   474 			clearTimeout(this.selectTLTimeout);
   464 			//On déselectionne la TL.
   475 			//On déselectionne la TL.
   465 			this.exitTimeline('');
   476 			this.exitTimeline('');
   493 		{
   504 		{
   494 			time = this.player.widgets[0].scaleIntervals(P.position().left, (+P.position().left + TL.width()), 0, this.player.widgets[0].source.getDuration().getSeconds(), pointerX);
   505 			time = this.player.widgets[0].scaleIntervals(P.position().left, (+P.position().left + TL.width()), 0, this.player.widgets[0].source.getDuration().getSeconds(), pointerX);
   495 		}
   506 		}
   496 		
   507 		
   497 		this.player.popcorn.currentTime(time);
   508 		this.player.popcorn.currentTime(time);
       
   509 		this.player.popcorn.play();
   498 	}
   510 	}
   499 }
   511 }
   500 
   512 
   501 /*
   513 /*
   502  * Raffraîchit la position des pointeurs.
   514  * Raffraîchit la position des pointeurs.
  1062 	
  1074 	
  1063 	return false;
  1075 	return false;
  1064 }
  1076 }
  1065 
  1077 
  1066 /*
  1078 /*
       
  1079  * Retourne vrai si le doigt est sur le bouton de lecture de video dans le mode d'interaction tablettes.
       
  1080 */
       
  1081 Mosaic.prototype.isOnPlayButton = function(x, y)
       
  1082 {
       
  1083 	var playButton = $('#tabletPlayButton');
       
  1084 	//S'il n'y a pas d'icone d'aide, on quitte.
       
  1085 	if(playButton.length <= 0)
       
  1086 	{
       
  1087 		return;
       
  1088 	}
       
  1089 	
       
  1090 	//Si la souris est sur l'icone, on retourne true.
       
  1091 	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')))
       
  1092 	{
       
  1093 		return true;
       
  1094 	}
       
  1095 	
       
  1096 	return false;
       
  1097 }
       
  1098 
       
  1099 /*
  1067  * Change la couleur des pointeurs pendant le tracé d'une courbe.
  1100  * Change la couleur des pointeurs pendant le tracé d'une courbe.
  1068 */
  1101 */
  1069 Mosaic.prototype.pointersGreen = function()
  1102 Mosaic.prototype.pointersGreen = function()
  1070 {
  1103 {
  1071 	$('#mainPointer').css('background-image', 'url(./img/cursors/pointerC.png)');
  1104 	$('#mainPointer').css('background-image', 'url(./img/cursors/pointerC.png)');