--- a/front_idill/src/mosaic/js/notifications.js Fri Jul 06 13:44:25 2012 +0200
+++ b/front_idill/src/mosaic/js/notifications.js Mon Jul 09 14:24:42 2012 +0200
@@ -14,21 +14,35 @@
return;
}
- this.removeSelectionSearchMosaicFull();
- this.removePointMosaicPrezoom();
+ console.log('HELP DISPLAYED');
+
+ this.removeNotifications();
this.helpDisplayed = true;
- var search_2hands_tab = ['arret', 'contact', 'grandjete', 'group_spin', 'port_de_bras', 'rythme', 'slow', 'spin', 'up_down', 'wave'];
- var search_2hands_tab_opacities = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5];
- var search_body_tab = ['chute', 'knee_up', 'jump', 'bend'];
- var search_body_tab_opacities = [1, 1, 1, 1];
+ var search_2hands_tab;
+ var search_2hands_tab_opacities;
+ var search_body_tab;
+ var search_body_tab_opacities;
+ var controls_1hand_tab;
var controls_1hand_tab;
- var controls_1hand_tab_1;
- var controls_1hand_tab_2;
+ var controls_1hand_tab_opacities;
var controls_1hand_tab_opacities;
- var controls_1hand_tab_opacities_1;
- var controls_1hand_tab_opacities_2;
+
+ var img_directory = './pictos/help/';
+
+ if(this.mouseInteractions)
+ {
+ search_2hands_tab = ['arret', 'contact', 'grandjete', 'group_spin', 'port_de_bras', 'spin', 'up_down', 'wave', 'chute', 'knee_up', 'jump', 'bend'];
+ search_2hands_tab_opacities = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
+ }
+ else
+ {
+ search_2hands_tab = ['arret', 'contact', 'grandjete', 'group_spin', 'port_de_bras', 'spin', 'up_down', 'wave'];
+ search_body_tab = ['chute', 'knee_up', 'jump', 'bend'];
+ search_2hands_tab_opacities = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5];
+ search_body_tab_opacities = [1, 1, 1, 1];
+ }
if(inMosaic)
{
@@ -37,10 +51,8 @@
}
else
{
- controls_1hand_tab_1 = ['deplacer', 'precedent', 'suivant', 'mosaique_horizontal', 'mosaique_vertical'];
- controls_1hand_tab_2 = ['move_down', 'move_up', 'move_right', 'move_left'];
- controls_1hand_tab_opacities_1 = [1, 1, 1, 1, 1];
- controls_1hand_tab_opacities_2 = [1, 1, 1, 1];
+ controls_1hand_tab = ['deplacer', 'precedent', 'suivant', 'mosaique_horizontal', 'mosaique_vertical', 'move_down', 'move_up', 'move_right', 'move_left'];
+ controls_1hand_tab_opacities = [1, 1, 1, 1, 1, 1, 1, 1, 1];
}
//On spécifie les notifications en div.
@@ -55,58 +67,47 @@
}
search_2hands_imgs += "</div>";
- var search_body_text = "<div id='search_body_text'></div>";
- var search_body_imgs = "<div id='search_body_imgs' class='notify_imgs'>"
+ var search_body_text;
+ var search_body_imgs;
- for(var i = 0 ; i < search_body_tab.length ; i++)
+ if(!this.mouseInteractions)
{
- search_body_imgs += "<div id='body_" + search_body_tab[i] + "' class='notify_imgs_small' style='opacity: " + search_body_tab_opacities[i] + ";'></div>";
+ search_body_text = "<div id='search_body_text'></div>";
+ search_body_imgs = "<div id='search_body_imgs' class='notify_imgs'>"
+
+ for(var i = 0 ; i < search_body_tab.length ; i++)
+ {
+ search_body_imgs += "<div id='body_" + search_body_tab[i] + "' class='notify_imgs_small' style='opacity: " + search_body_tab_opacities[i] + ";'></div>";
+ }
+ search_body_imgs += "</div>";
}
- search_body_imgs += "</div>";
var controls_title = "<div id='controls_title'></div>";
var controls_img = "<div id='controls_img' class='notify_imgs'></div>";
var controls_1hand_text = "<div id='controls_1hand_text'></div>";
var controls_1hand_imgs;
- var controls_1hand_imgs_1;
- var controls_1hand_imgs_2;
+ var controls_1hand_imgs;
- if(inMosaic)
+ controls_1hand_imgs = "<div id='controls_1hand_imgs' class='notify_imgs'>";
+ for(var i = 0 ; i < controls_1hand_tab.length ; i++)
{
- controls_1hand_imgs = "<div id='controls_1hand_imgs' class='notify_imgs'>";
- for(var i = 0 ; i < controls_1hand_tab.length ; i++)
- {
- controls_1hand_imgs += "<div id='1hand_" + controls_1hand_tab[i] + "' class='notify_imgs_small' style='opacity: " + controls_1hand_tab_opacities[i] + ";'></div>";
- }
- controls_1hand_imgs += "</div>";
+ controls_1hand_imgs += "<div id='1hand_" + controls_1hand_tab[i] + "' class='notify_imgs_small' style='opacity: " + controls_1hand_tab_opacities[i] + ";'></div>";
+ }
+ controls_1hand_imgs += "</div>";
+
+ var help_search;
+
+ if(this.mouseInteractions)
+ {
+ help_search = "<div id='help_search'>" + search_title + search_img + search_2hands_text + search_2hands_imgs + "</div>";
}
else
{
- controls_1hand_imgs_1 = "<div id='controls_1hand_imgs_1' class='notify_imgs'>";
- controls_1hand_imgs_2 = "<div id='controls_1hand_imgs_2' class='notify_imgs'>";
- for(var i = 0 ; i < controls_1hand_tab_1.length ; i++)
- {
- controls_1hand_imgs_1 += "<div id='1hand_" + controls_1hand_tab_1[i] + "' class='notify_imgs_small' style='opacity: " + controls_1hand_tab_opacities_1[i] + ";'></div>";
- }
- controls_1hand_imgs_1 += "</div>";
- for(var i = 0 ; i < controls_1hand_tab_2.length ; i++)
- {
- controls_1hand_imgs_2 += "<div id='1hand_" + controls_1hand_tab_2[i] + "' class='notify_imgs_small' style='opacity: " + controls_1hand_tab_opacities_2[i] + ";'></div>";
- }
- controls_1hand_imgs_2 += "</div>";
+ help_search = "<div id='help_search'>" + search_title + search_img + search_2hands_text + search_2hands_imgs + search_body_text + search_body_imgs + "</div>";
}
-
- var help_search = "<div id='help_search'>" + search_title + search_img + search_2hands_text + search_2hands_imgs + search_body_text + search_body_imgs + "</div>";
var help_controls;
- if(inMosaic)
- {
- help_controls = "<div id='help_controls'>" + controls_title + controls_img + controls_1hand_text + controls_1hand_imgs + "</div>";
- }
- else
- {
- help_controls = "<div id='help_controls'>" + controls_title + controls_img + controls_1hand_text + controls_1hand_imgs_1 + controls_1hand_imgs_2 + "</div>";
- }
+ help_controls = "<div id='help_controls'>" + controls_title + controls_img + controls_1hand_text + controls_1hand_imgs + "</div>";
var notification_help = "<div id='notify_help'>" + help_search + "<div id='help_sep'></div>" + help_controls + "</div>";
@@ -130,78 +131,92 @@
// console.log(($('#help_search').width() - ($('.notify_imgs_small').width() * 5 + parseInt($('.notify_imgs_small').css('margin')))) / 2);
+ var margins = parseInt($('.notify_imgs_small').css('margin'));
+ var widths = $('.notify_imgs_small').width();
+ var heights = $('.notify_imgs_small').height();
+
+ var sep_left = $('#help_sep').position().left;
+ var help_margin = parseInt($('#notify_help').css('margin'));
+
+ //On calcule la taille d'une zone de recherche (une des deux parties).
+ var help_column_width = sep_left - help_margin;
+ //Longueur d'une image.
+ var img_width = (margins * 2 + widths);
+ //Longueur totale des images de recherche à deux mains mises bout à bout.
+ // var search_2hands_total_width = search_2hands_tab.length * img_width;
+
+ //On récupère le nombre d'images affichables horizontalement pour les gestures de recherche à deux mains dans une des parties de l'aide.
+ var search_2hands_n_imgs = Math.floor(help_column_width / img_width);
+ //Calcul du padding-left de cette section.
+ var search_2hands_padding_left = (help_column_width - search_2hands_n_imgs * img_width) / 2;
+
$('#search_2hands_imgs').css(
{
- 'padding-left': ($('#help_search').width() - ($('.notify_imgs_small').width() * 5 + parseInt($('.notify_imgs_small').css('margin')))) / 2,
- 'height': ($('.notify_imgs_small').height() * 2 + parseInt($('.notify_imgs_small').css('margin')))
- });
-
- $('#search_body_imgs').css(
- {
- 'padding-left': ($('#help_search').width() - ($('.notify_imgs_small').width() * 4 + parseInt($('.notify_imgs_small').css('margin')))) / 2,
+ // 'padding-left': ($('#help_search').width() - ($('.notify_imgs_small').width() * 5 + parseInt($('.notify_imgs_small').css('margin')))) / 2,
+ 'padding-left': search_2hands_padding_left,
'height': ($('.notify_imgs_small').height() * 2 + parseInt($('.notify_imgs_small').css('margin')))
});
- if(inMosaic)
- {
- $('#controls_1hand_imgs').css(
- {
- 'padding-left': ($('#help_controls').width() - ($('.notify_imgs_small').width())) / 2,
- 'height': ($('.notify_imgs_small').height())
- });
- }
- else
+ //On récupère le nombre d'images affichables horizontalement pour les gestures de recherche corporelles dans une des parties de l'aide.
+ var search_body_n_imgs = Math.floor(help_column_width / img_width);
+ //Calcul du padding-left de cette section.
+ var search_body_padding_left = (help_column_width - search_body_n_imgs * img_width) / 2;
+
+ $('#search_body_imgs').css(
{
- $('#controls_1hand_imgs_1').css(
- {
- 'padding-left': ($('#help_controls').width() - ($('.notify_imgs_small').width() * 5 + parseInt($('.notify_imgs_small').css('margin')))) / 2,
- 'height': ($('.notify_imgs_small').height())
- });
- $('#controls_1hand_imgs_2').css(
- {
- 'padding-left': ($('#help_controls').width() - ($('.notify_imgs_small').width() * 4 + parseInt($('.notify_imgs_small').css('margin')))) / 2,
- 'height': ($('.notify_imgs_small').height())
- });
- }
+ // 'padding-left': ($('#help_search').width() - ($('.notify_imgs_small').width() * 4 + parseInt($('.notify_imgs_small').css('margin')))) / 2,
+ 'padding-left': search_body_padding_left,
+ 'height': ($('.notify_imgs_small').height() * 2 + parseInt($('.notify_imgs_small').css('margin')))
+ });
+
+ //On récupère le nombre d'images affichables horizontalement pour les gestures de controle dans une des parties de l'aide.
+ var controls_1hand_n_imgs = Math.floor(help_column_width / img_width);
+ //Calcul du padding-left de cette section.
+ var controls_1hand_padding_left = (help_column_width - controls_1hand_n_imgs * img_width) / 2;
+
+ $('#controls_1hand_imgs').css(
+ {
+ // 'padding-left': ($('#help_controls').width() - ($('.notify_imgs_small').width())) / 2,
+ 'padding-left': controls_1hand_padding_left,
+ 'height': ($('.notify_imgs_small').height())
+ });
var search_width = $('#help_search').width();
$('#search_title').html('Recherche');
- $('#search_2hands_text').html('Gestes à effectuer avec les deux mains');
- $('#search_body_text').html('Gestes à effectuer avec le corps entier');
+
+ if(this.mouseInteractions)
+ {
+ $('#search_2hands_text').html('Courbes à effectuer avec la souris');
+ }
+ else
+ {
+ $('#search_2hands_text').html('Gestes à effectuer avec les deux mains');
+ }
for(var i = 0 ; i < search_2hands_tab.length ; i++)
{
- $("#2hands_" + search_2hands_tab[i]).css("background-image", "url('./pictos/help/" + search_2hands_tab[i] + ".png')");
+ $("#2hands_" + search_2hands_tab[i]).css("background-image", "url('" + img_directory + 'MI/' + search_2hands_tab[i] + ".png')");
//console.log("url('../../pictos/help/" + search_2hands_tab[i] + ".png')");
}
- for(var i = 0 ; i < search_body_tab.length ; i++)
+ if(!this.mouseInteractions)
{
- $("#body_" + search_body_tab[i]).css("background-image", "url('./pictos/help/" + search_body_tab[i] + ".png')");
- //console.log("url('../../pictos/help/" + search_2hands_tab[i] + ".png')");
+ $('#search_body_text').html('Gestes à effectuer avec le corps entier');
+
+ for(var i = 0 ; i < search_body_tab.length ; i++)
+ {
+ $("#body_" + search_body_tab[i]).css("background-image", "url('" + img_directory + search_body_tab[i] + ".png')");
+ //console.log("url('../../pictos/help/" + search_2hands_tab[i] + ".png')");
+ }
}
$('#controls_title').html('Contrôles');
$('#controls_1hand_text').html('Gestes à effectuer avec une seule main');
- if(inMosaic)
- {
- for(var i = 0 ; i < controls_1hand_tab.length ; i++)
- {
- $("#1hand_" + controls_1hand_tab[i]).css("background-image", "url('./pictos/help/" + controls_1hand_tab[i] + ".png')");
- }
- }
- else
+ for(var i = 0 ; i < controls_1hand_tab.length ; i++)
{
- for(var i = 0 ; i < controls_1hand_tab_1.length ; i++)
- {
- $("#1hand_" + controls_1hand_tab_1[i]).css("background-image", "url('./pictos/help/" + controls_1hand_tab_1[i] + ".png')");
- }
- for(var i = 0 ; i < controls_1hand_tab_2.length ; i++)
- {
- $("#1hand_" + controls_1hand_tab_2[i]).css("background-image", "url('./pictos/help/" + controls_1hand_tab_2[i] + ".png')");
- }
+ $("#1hand_" + controls_1hand_tab[i]).css("background-image", "url('" + img_directory + controls_1hand_tab[i] + ".png')");
}
//On les fait apparaître.
@@ -253,7 +268,7 @@
//Si on a effectué une demande de recherche auparavant, on supprime la notification de demande de recherche.
if($('#notify_search').length > 0)
{
- $('.notifications').remove();
+ this.removeNotifications();
}
var _this = this;
@@ -1061,11 +1076,12 @@
*/
mosaic.prototype.searchGesture = function(gestureName, mode)
{
- if(this.currentMode != 'SEARCH' || !this.isCurrentlyInASearchByGesture)
+ console.log('NOTIFY GESTURE ' + this.currentMode + ' ' + this.centerId + ' ' + this.currentSearchGesture[this.centerId]);
+ if(this.currentMode != 'SEARCH' || this.currentSearchGesture[this.centerId] == '')
{
return;
}
-
+ console.log('NOTIFY GESTURE');
var _this = this;
//On spécifie les notifications en div.
@@ -1081,8 +1097,10 @@
var notify_margin = parseInt($('.notifications').css('margin'));
var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
+ // console.log('SHOW GESTURE NOTIFICATION 1');
if(_.include(this.gestures, gestureName))
{
+ // console.log('SHOW GESTURE NOTIFICATION 2');
$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + (this.mouseInteractions ? 'MI/' : '') + mode + '/' + gestureName + '.png")');
}
else if(mode == 'none')
@@ -1425,4 +1443,13 @@
{
opacity: "0.9"
});
+}
+
+/*
+ * Efface les notifications.
+*/
+mosaic.prototype.removeNotifications = function()
+{
+ // console.trace();
+ $('.notifications').remove();
}
\ No newline at end of file