front_idill/src/mosaic/js/notifications.js
changeset 79 9eff85166868
parent 77 205409da0f32
child 85 b244a7bc0844
--- a/front_idill/src/mosaic/js/notifications.js	Wed Aug 08 18:42:01 2012 +0200
+++ b/front_idill/src/mosaic/js/notifications.js	Thu Aug 16 14:32:19 2012 +0200
@@ -271,7 +271,14 @@
     //Le texte de recherche et les images changent en fonction du mode d'intéraction (souris/Kinect).
     if(this.config.mouseInteractions)
     {
-        $('#search_2hands_text').html(this.helpText.search_2hands_text);
+		if(this.isTablet)
+		{
+			$('#search_2hands_text').html(this.helpText.search_touch_text);
+		}
+		else
+		{
+			$('#search_2hands_text').html(this.helpText.search_mouse_text);
+		}
         MI = 'MI/';
     }
     else
@@ -300,7 +307,22 @@
     
     //Actions de contrôle de l'interface.
     $('#controls_title').html(this.helpText.controls_title);
-    $('#controls_1hand_text').html(this.helpText.controls_1hand_text);
+	
+	if(this.config.mouseInteractions)
+	{
+		if(this.isTablet)
+		{
+			$('#controls_1hand_text').html(this.helpText.controls_touch_text);
+		}
+		else
+		{
+			$('#controls_1hand_text').html(this.helpText.controls_mouse_text);
+		}
+	}
+	else
+	{
+		$('#controls_1hand_text').html(this.helpText.controls_1hand_text);
+	}
     
 	//On affecte les images des actions de contrôle de l'interface.
 	for(var i = 0 ; i < controls_1hand_tab.length ; i++)
@@ -382,7 +404,14 @@
 		//On calcule leurs coordonnées.
 		search_left = ($(window).width() / 2 - notify_width / 2 - notify_margin);
 		var img = $('#notify_search').css('background-image');
-		$('#notify_search').css('background-image', img.replace('notifications/', 'notifications/MI/'));
+		if(this.isTablet)
+		{
+			$('#notify_search').css('background-image', img.replace('notifications/', 'notifications/TI/'));
+		}
+		else
+		{
+			$('#notify_search').css('background-image', img.replace('notifications/', 'notifications/MI/'));
+		}
 	}
 	else
 	{
@@ -491,7 +520,15 @@
 	if(this.config.mouseInteractions)
 	{
 		var img = $('#notify_search').css('background-image');
-		$('#notify_search').css('background-image', img.replace('notifications/', 'notifications/MI/'));
+		
+		if(this.isTablet)
+		{
+			$('#notify_search').css('background-image', img.replace('notifications/', 'notifications/TI/'));
+		}
+		else
+		{
+			$('#notify_search').css('background-image', img.replace('notifications/', 'notifications/MI/'));
+		}
 	}
 	
 	this.putText($('#notify_search'), this.notificationStrings.search);
@@ -541,7 +578,15 @@
 		$('#notify_selection').css('background-image', imgSel.replace('notifications/', 'notifications/MI/'));
 		
 		var imgSearch = $('#notify_search').css('background-image');
-		$('#notify_search').css('background-image', imgSearch.replace('notifications/', 'notifications/MI/'));
+		
+		if(this.isTablet)
+		{
+			$('#notify_search').css('background-image', imgSearch.replace('notifications/', 'notifications/TI/'));
+		}
+		else
+		{
+			$('#notify_search').css('background-image', imgSearch.replace('notifications/', 'notifications/MI/'));
+		}
 	}
 	
 	this.putText($('#notify_selection'), this.notificationStrings.confirm);
@@ -1648,8 +1693,10 @@
 	
 	//Nombre de notifications dans une ligne.
 	var notify_in_a_row = Math.floor($(window).width() / (+notify_width + 2 * notify_margin));
+	//Notifications sur la première ligne.
+	var notify_in_first_row = (gestures_tab.length > notify_in_a_row) ? notify_in_a_row : gestures_tab.length;
 	//Espace libre restant sur la ligne.
-	var free_space = $(window).width() - notify_in_a_row * (+notify_width + 2 * notify_margin);
+	var free_space = $(window).width() - notify_in_first_row * (+notify_width + 2 * notify_margin);
 	
 	//On met à jour le container.
 	$('#notify_curves_container').css(
@@ -1659,24 +1706,12 @@
 		'margin-right': free_space / 2
 	});
 	
-    // var curves_gestures_left = [];
-    
     //On calcule leurs dimensions et leur backgrounds.
-    // curves_gestures_left[0] = $(window).width() / 2 - (notify_width * (gestures_tab.length) + notify_margin * (gestures_tab.length + 2)) / 2;
-    
-    for(var i = 0 ; i < gestures_tab.length ; i++)
+	for(var i = 0 ; i < gestures_tab.length ; i++)
     {
         //On va chercher leurs backgrounds.
         $('#notify_curves_' + gestures_tab[i]).css('background-image', 'url("./pictos/big/' + (this.config.mouseInteractions ? 'MI/' : '') + 'normal/' + gestures_tab[i] + '.png")');
         
-        //On calcule leurs coordonnées.
-        if(i+1 < gestures_tab.length)
-        {
-            // curves_gestures_left[i+1] = curves_gestures_left[i] + notify_width + notify_margin * 2;
-        }
-        
-        //On les place.
-        // $('#notify_curves_' + gestures_tab[i]).css('left', curves_gestures_left[i]);
 		this.putText($('#notify_curves_' + gestures_tab[i]), this.notificationStrings[gestures_tab[i]]);
     }