diff -r 085632de8798 -r db42ef1faa7a front_idill/src/mosaic/js/pointers.js --- a/front_idill/src/mosaic/js/pointers.js Tue Sep 18 23:46:41 2012 +0200 +++ b/front_idill/src/mosaic/js/pointers.js Thu Sep 20 04:12:52 2012 +0200 @@ -1112,28 +1112,6 @@ var margin = parseInt(creditsNotification.css('margin-left')); - /*if($('#aa').length <= 0) - { - var a = '
'; - $('body').append(a); - $('#aa').css( - { - position: 'absolute', - 'background-color': '#0000FF', - top: +upArrow.position().top + 2 * margin, - left: upArrow.position().left + 2 * margin, - width: upArrow.width(), - height: upArrow.height() - }); - } - - console.log('---------------UP----------------------'); - console.log(x + ' > ' + (+upArrow.position().left + 2 * margin)); - console.log(x + ' < ' + (+upArrow.position().left + upArrow.width() + 2 * margin)); - console.log(y + ' > ' + (+upArrow.position().top + 2 * margin)); - console.log(y + ' < ' + (+upArrow.position().top + upArrow.height() + 2 * margin)); - console.log('---------------------------------------');*/ - //Si la flèche est visible et si la souris est dessus, on retourne true. if(upArrow.length > 0 && upArrow.css('opacity') == '1' && x > (+upArrow.position().left + margin) && x < (+upArrow.position().left + upArrow.width() + margin) && y > (+upArrow.position().top + margin) && y < (+upArrow.position().top + upArrow.height() + margin)) { @@ -1159,13 +1137,6 @@ var margin = parseInt(creditsNotification.css('margin-left')); - /*console.log('--------------DOWN---------------------'); - console.log(x + ' > ' + (+downArrow.position().left + margin)); - console.log(x + ' < ' + (+downArrow.position().left + downArrow.width() + margin)); - console.log(y + ' > ' + (+downArrow.position().top + margin)); - console.log(y + ' < ' + (+downArrow.position().top + downArrow.height() + margin)); - console.log('---------------------------------------');*/ - //Si la flèche est visible et si la souris est dessus, on retourne true. if(downArrow.length > 0 && downArrow.css('opacity') == '1' && x > (+downArrow.position().left + margin) && x < (+downArrow.position().left + downArrow.width() + margin) && y > (+downArrow.position().top + margin) && y < (+downArrow.position().top + downArrow.height() + margin)) { @@ -1286,7 +1257,172 @@ }); } +/* + * Retourne vrai si la souris est sur la flèche haute dans le panneau d'aide. +*/ +Mosaic.prototype.isOnHelpUpArrow = function(x, y) +{ + var helpNotification = $('#notify_help'), upArrow = $('#help_details_upArrow'); + //Si les crédits ne sont pas affichés, on retourne faux. + if(helpNotification.length <= 0) + { + return false; + } + + var margin = parseInt(helpNotification.css('margin-left')); + + //Si la flèche est visible et si la souris est dessus, on retourne true. + if(upArrow.length > 0 && upArrow.css('opacity') == '1' && x > (+upArrow.position().left + margin) && x < (+upArrow.position().left + upArrow.width() + margin) && y > (+upArrow.position().top + margin) && y < (+upArrow.position().top + upArrow.height() + margin)) + { + return true; + } + + return false; +} +/* + * Retourne vrai si la souris est sur la flèche basse dans le panneau d'aide. +*/ +Mosaic.prototype.isOnHelpDownArrow = function(x, y) +{ + var helpNotification = $('#notify_help'), downArrow = $('#help_details_downArrow'); + //Si les crédits ne sont pas affichés, on retourne faux. + if(helpNotification.length <= 0) + { + return false; + } + + var margin = parseInt(helpNotification.css('margin-left')); + + //Si la flèche est visible et si la souris est dessus, on retourne true. + if(downArrow.length > 0 && downArrow.css('opacity') == '1' && x > (+downArrow.position().left + margin) && x < (+downArrow.position().left + downArrow.width() + margin) && y > (+downArrow.position().top + margin) && y < (+downArrow.position().top + downArrow.height() + margin)) + { + return true; + } + + return false; +} + +/* + * Retourne vrai si la souris est sur une des flèches du panneau d'aide. +*/ +Mosaic.prototype.isOnHelpArrow = function(x, y) +{ + //Si la souris est sur une flèche des crédits, on retourne vrai. + if(this.isOnHelpUpArrow(x, y) || this.isOnHelpDownArrow(x, y)) + { + return true; + } + + return false; +} + +/* + * Va a la page d'aide suivante. +*/ +Mosaic.prototype.goToNextHelpDetailsPage = function() +{ + // console.log(+this.helpDetailsPageNumber + 1 + ' >= ' + this.helpDetailsPageLength); + //Si on est sur la dernière page, on quitte. + if(this.helpDetailsPageNumber + 1 >= this.helpDetailsPageLength) + { + return; + } + + this.helpDetailsPageNumber++; + this.goToHelpDetailsPageN(this.helpDetailsPageNumber); +} + +/* + * Va a la page d'aide précédente. +*/ +Mosaic.prototype.goToPreviousHelpDetailsPage = function() +{ + //Si on est sur la première page, on quitte. + if(this.helpDetailsPageNumber == 0) + { + return; + } + + this.helpDetailsPageNumber--; + this.goToHelpDetailsPageN(this.helpDetailsPageNumber); +} + +/* + * Va à la page N des crédits. +*/ +Mosaic.prototype.goToHelpDetailsPageN = function(N) +{ + var notify_help = $('#notify_help'), arrowHeight = $('#help_details_upArrow').height(), margin = parseInt($('#notify_help').css('margin-left')) + parseInt($('#notify_help').css('border-width')); + + //Si on est sur la première page, on cache la flèche haut. + if(this.helpDetailsPageNumber == 0) + { + //On affiche la page principale. + $('#help_search, #help_controls').css('opacity', '1'); + + $('#help_details_upArrow').css( + { + opacity: 0 + }); + $('#help_details_downArrow').css( + { + opacity: 1 + }); + $('.help_details_containers').css( + { + top: margin, + // height: notify_help.height() - arrowHeight + }); + } + //Si on est sur la dernière page, on cache la flèche bas. + else if(this.helpDetailsPageNumber + 1 >= this.helpDetailsPageLength) + { + //On masque la page principale. + $('#help_search, #help_controls').css('opacity', '0'); + + $('#help_details_upArrow').css( + { + opacity: 1 + }); + $('#help_details_downArrow').css( + { + opacity: 0 + }); + $('.help_details_containers').css( + { + top: +arrowHeight + margin, + // height: notify_help.height() - arrowHeight - margin + }); + } + //Si on est dans les autres pages, on affiche les deux flèches. + else + { + //On masque la page principale. + $('#help_search, #help_controls').css('opacity', '0'); + + $('#help_details_upArrow').css( + { + opacity: 1 + }); + $('#help_details_downArrow').css( + { + opacity: 1 + }); + $('.help_details_containers').css( + { + top: +arrowHeight + margin, + // height: notify_help.height() - 2 * arrowHeight - margin + }); + } + + //On déplace le texte des crédits. + $('.help_details_containers').css( + { + // top: -($('.help_details_containers').height() * N - margin)// + this.column_gap) + top: $('#notify_help').height() - ($('#notify_help').height() * N - margin)// + this.column_gap) + }); +} /* * Retourne vrai si le doigt est sur le bouton de lecture de video dans le mode d'interaction tablettes.