front_idill/src/mosaic/js/mosaic.js
changeset 55 afd60399a7b5
parent 52 277c94533395
child 58 a28488078053
--- a/front_idill/src/mosaic/js/mosaic.js	Tue Jul 24 16:35:10 2012 +0200
+++ b/front_idill/src/mosaic/js/mosaic.js	Thu Jul 26 14:34:02 2012 +0200
@@ -26,7 +26,7 @@
  */
 function Mosaic(config, default_conf)
 {
-    this.gestures = ["fall", "jump", "circle", "screw", "bend", "arc", "pendulum", "knee-up", "right-angle", "wave", "slow", "hello", "no-motion", "wheel", "contact", "run", "up-down", "grand-jete"];
+    this.gestures = ["fall", "jump", "circle", "screw", "bend", "arc", "knee_up", "right_angle", "wave", "slow", "hello", "no_motion", "contact", "up_down", "grand_jete"];
 
     //Chemin du fichier de configuration.
     this.config_path = config;
@@ -46,6 +46,48 @@
     
     //Dictionnaire pour les courbes de recherche.
     this.dictionary = [];
+	
+	//Strings des notifications.
+	this.notificationStrings = {
+	"select":"Select", 
+	"confirm":"Confirm", 
+	"timeline":"Timeline move", 
+	"move":"Move", 
+	"search":"Search", 
+	"next":"Next", 
+	"previous":"Previous", 
+	"unzoom":"Unzoom", 
+	"unknown":"Unknown gesture", 
+	"fall":"Fall", 
+	"jump":"Jump", 
+	"spin":"Spin", 
+	"screw":"Screw", 
+	"bend":"Bend", 
+	"arc":"Arc", 
+	"knee_up":"Knee up", 
+	"breakdance":"Breakdance", 
+	"wave":"Wave", 
+	"no_motion":"No motion", 
+	"contact":"Contact"};
+	
+	this.helpText = {
+	"search_title":"Search", 
+	"search_2hands_text":"Curves to be drawn with both hands",  
+	"search_mouse_text":"Curves to be mouse-drawn",  
+	"search_body_text":"Gestures to be performed with your body", 
+	"controls_title":"Controls", 
+	"controls_1hand_text":"Gestures to be performed with your hand", 
+	"controls_timeline":"Move in timeline", 
+	"controls_mos_horizontal":"Unzoom", 
+	"controls_mos_vertical":"Unzoom", 
+	"controls_move_down":"Move", 
+	"controls_move_left":"Move", 
+	"controls_move_right":"Move", 
+	"controls_move_up":"Move", 
+	"controls_next":"Next", 
+	"controls_previous":"Previous", 
+	"controls_selection":"Selection"
+	}
     
     //Dernières positions des pointeurs.
     this.mainPointerLastX = null;
@@ -148,6 +190,10 @@
 	this.isMouseDown = false;
 	//Indique si on est en train de prézoomer.
 	this.isPrezooming = false;
+	//Indique si l'icone d'aide a été agrandie.
+	this.isHelpIconZoomed = false;
+	//Indique si l'icone d'aide est dans une interaction de zoom/dezoom en cours.
+	this.isHelpIconZooming = false;
     
     //Timeout (attente) pour le zoom après un préZoom.
     this.zoomTimeout = null;
@@ -271,7 +317,7 @@
         'margin-top': this.MPTop_margin
     });
     
-    var len = this.config.length, imgs = this.config.imagesToShow, imgsTotal = this.config.imagesTotal;
+    var len = this.config.imagesByLine, imgs = this.config.imagesToShow, imgsTotal = this.config.imagesTotal;
     
     //S'il s'agit d'un rectangle.
     if(imgs % len == 0)
@@ -308,6 +354,20 @@
 {
 	this.isMouseDown = true;
 	
+	//Si on se trouve sur l'icone d'aide et qu'elle est zoomée.
+	if(this.isHelpIconZoomed)
+	{
+		//On affiche différentes aides en fonction de si on se trouve dans une vidéo ou non.
+		if(this.currentMode == 'SEARCH' || this.currentMode == 'VIDEO' || this.currentMode == 'TIMELINE')
+		{
+			this.notifyHelp(false);
+		}
+		else if(this.currentMode == 'FILTER' || this.currentMode == 'MOSAIC')
+		{
+			this.notifyHelp(true);
+		}
+	}
+	
 	//On met à jour les coordonnées de la souris au dernier mouse down.
 	this.mouseDownPosX = e.pageX;
 	this.mouseDownPosY = e.pageY;
@@ -330,6 +390,18 @@
 */
 Mosaic.prototype.onMouseMove = function(e)
 {
+	//On vérifie si la souris n'est pas sur l'icone d'aide.
+	if(this.isOnHelpIcon(this.mousePosX, this.mousePosY))
+	{
+		//On agrandit l'icone d'aide.
+		this.showBigHelp();
+	}
+	else
+	{
+		//On la rétrecit sinon.
+		this.showSmallHelp();
+	}
+	
 	//Si on n'a pas appuyé sur la souris avant, on part.
 	if(!this.isMouseDown)
 	{
@@ -574,7 +646,7 @@
 	}
 	
 	//Si l'aide est affichée, un clic la ferme.
-	if(this.helpDisplayed)
+	if(this.helpDisplayed && !this.isHelpIconZoomed && !this.isHelpIconZooming)
 	{
 		this.removeHelp();
 	}
@@ -607,7 +679,7 @@
     //On calcule la taille des divs contenant les snapshots.
     this.width = $('#mainPanel').innerWidth();
     //On ne calculera pas tout de suite la hauteur de la mosaique étant donnée qu'elle est calculée par la suite dynamiquement.
-    this.snapshotWidth = this.width / this.config.length - this.marginWidth;
+    this.snapshotWidth = this.width / this.config.imagesByLine - this.marginWidth;
     this.snapshotHeight = this.snapshotWidth*9/16;
     $('.snapshotDivs').css('width', this.snapshotWidth).css('height', this.snapshotHeight).css('margin', this.marginWidth/2);
     
@@ -690,6 +762,9 @@
     //Si on est en mode d'intéraction souris.
     if(this.config.mouseInteractions)
     {
+		//On affiche l'icone d'aide.
+		this.helpIcon();
+		
         //Si on fait un mouse down sur le body, on vérifie enregistre le déplacement de la souris jusqu'au prochain mouse up.
         $(window).mousedown(function (e)
         {
@@ -746,7 +821,7 @@
     var _this = this;
     
     //Variables censées être des ints.
-    var supposedToBeInt = ['length', 'imagesToShow', 'totalImages', 'timeReloadAfterResize', 'timePrezoom', 'timePreUnzoom', 'timeZoom', 'zoomTime', 'timeUnzoom', 'timeNeighbourGlowing', 'timeNeighbourUnglowing', 'timeMovingToNeighbour', 'timeSearchFade', 'timeNotifyFade', 'timeFilterFade', 'timeANFade', 'timeFilling', 'zoomedMargin', 'timeoutZoom', 'timeoutUnzoom', 'timeoutMoveToNeighbour', 'timeoutPointersIdle', 'timeoutAreBothPointersHere', 'timeoutRemoveNotificationByGesture', 'timeoutRemoveFailedNotificationByGesture', 'timeoutNotifySwipe', 'timeoutSelectTL', 'timeoutSlideTL', 'timeoutCanNotifyHelp', 'timeoutRemoveSpinner', 'timeoutNouser', 'timeoutNextDrawCurve', 'mouseUpDownDeltaTreshold'];
+    var supposedToBeInt = ['imagesByLine', 'imagesToShow', 'totalImages', 'timeReloadAfterResize', 'timePrezoom', 'timePreUnzoom', 'zoomTime', 'timeUnzoom', 'timeNeighbourGlowing', 'timeNeighbourUnglowing', 'timeMovingToNeighbour', 'timeSearchFade', 'timeNotifyFade', 'timeFilterFade', 'timeANFade', 'timeFilling', 'zoomedMargin', 'timeoutZoom', 'timeoutUnzoom', 'timeoutMoveToNeighbour', 'timeoutPointersIdle', 'timeoutAreBothPointersHere', 'timeoutRemoveNotificationByGesture', 'timeoutNotifySwipe', 'timeoutSelectTL', 'timeoutSlideTL', 'timeoutCanNotifyHelp', 'timeoutRemoveSpinner', 'timeoutNouser', 'timeoutNextDrawCurve', 'mouseUpDownDeltaTreshold', 'helpBorderSize'];
     //Variables censées êtres des floats.
     var supposedToBeFloat = ['zoomPercentage', 'prezoomPercentage'];