diff -r cefce0845ac5 -r 8393d3473b98 front_idill/src/mosaic/js/notifications.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/front_idill/src/mosaic/js/notifications.js Fri Jun 29 16:16:24 2012 +0200 @@ -0,0 +1,1535 @@ +/* =============================================== + * * + * ZONE DES NOTIFICATIONS * + * * + =============================================== */ + +/* + * Affiche la notification de sélection/recherche lorsque la mosaique est complète. +*/ +mosaic.prototype.notifySelectionSearchMosaicFull = function() +{ + if(this.currentMode != "MOSAIC" && this.currentMode != "FILTER" || this.isCurrentlyInASearchByGesture || $('#notify_selection').length > 0 || $('#notify_search').length > 0 || $('#notify_point').length > 0) + { + return; + } + + console.log('NOTIFY SEL SEA'); + + //On spécifie les notifications en div. + var notification_selection = "
"; + var notification_search = ""; + + //On les ajoute à la mosaïque. + $('#mainPanel').append(notification_selection + notification_search); + + //On calcule leurs coordonnées et dimensions. + var notify_width = $('.notifications').width(), notify_height = $('.notifications').height(); + var notify_margin = parseInt($('.notifications').css('margin')); + var selection_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2; + var search_left = selection_left + notify_width + notify_margin; + + //On les positionne. + $('#notify_selection').css( + { + left: selection_left + }); + $('#notify_search').css( + { + left: search_left + }); + + //On les fait apparaître. + $('.notifications').css( + { + opacity: "0.9" + }); +} + +/* + * Supprime la notification de sélection/recherche lorsque la mosaique est complète. +*/ +mosaic.prototype.removeSelectionSearchMosaicFull = function() +{ + if(this.isOnASnapshot) + { + // console.log('DEL SEL SEA'); + $('#notify_selection, #notify_search').remove(); + } +} + +/* + * Affiche la notification de maintient du pointage lors d'une phase de prézoom. +*/ +mosaic.prototype.notifyPointMosaicPrezoom = function() +{ + this.removeSelectionSearchMosaicFull(); + if($('#notify_point').length > 0 || $('#notify_search').length > 0 || this.currentMode != 'MOSAIC' && this.currentMode != 'FILTER' && !this.isOnASnapshot) + { + this.removePointMosaicPrezoom(); + return; + } + + //On spécifie les notifications en div. + var notification_point = ""; + + //On les ajoute à la mosaïque. + $('#mainPanel').append(notification_point); + + //On calcule leurs coordonnées et dimensions. + var notify_width = $('.notifications').width(), notify_height = $('.notifications').height(); + var notify_margin = parseInt($('.notifications').css('margin')); + var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin; + + //On les positionne. + $('#notify_point').css( + { + left: point_left + }); + + //On les fait apparaître. + $('.notifications').css( + { + opacity: "0.9" + }); +} + +/* + * Supprime la notification de maintient du pointage. +*/ +mosaic.prototype.removePointMosaicPrezoom = function() +{ + //if(!this.isOnASnapshot) + //{ + $('#notify_point').remove(); + //} +} + +/* + * Affiche la notification de recherche (qu'elle soit par gesture ou par courbes). +*/ +mosaic.prototype.notifySearch = function() +{ + /*this.removeSelectionSearchMosaicFull(); + if($('#notify_point').length > 0 || $('#notify_search').length > 0 || this.currentMode != 'MOSAIC' && this.currentMode != 'FILTER' && !this.isOnASnapshot) + { + //this.removeNotifySearch(); + //return; + }*/ + + if($('.notifications').length > 0) + { + $('.notifications').remove(); + } + + //On spécifie les notifications en div. + var notification_search = ""; + + //On les ajoute à la mosaïque. + $('body').append(notification_search); + + //On calcule leurs coordonnées et dimensions. + var notify_width = $('.notifications').width(), notify_height = $('.notifications').height(); + var notify_margin = parseInt($('.notifications').css('margin')); + var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin; + + //On les positionne. + $('#notify_search').css( + { + left: point_left + }); + + //On les fait apparaître. + $('.notifications').css( + { + opacity: "0.9" + }); +} + +/* + * Supprime la notification de maintient du pointage. +*/ +mosaic.prototype.removeNotifySearch = function() +{ + //if(!this.isOnASnapshot) + //{ + //$('#notify_search').remove(); + //} +} + +/* + * Affiche la notification de changement de voisin et de dezoom. +*/ +mosaic.prototype.notifyMoveUnzoom = function(targetId) +{ + console.log('MOVE & UNZOOM'); + + if($('.notifications').length > 0 || !this.neighboursIds || this.neighboursIds.length == 0 || targetId == -1 || this.currentMode != 'VIDEO' && this.currentMode != 'SEARCH' && this.currentMode != 'TIMELINE') + { + return; + } + + console.log('NOT'); + + var _this = this; + + //On spécifie les notifications en div. + var notification_move_unzoom = ""; + + //On les ajoute à la mosaïque. + $('body').append(notification_move_unzoom); + + // console.log(this.player.config.gui.zoomTop + " " + this.player.config.gui.zoomLeft); + + //On calcule leurs coordonnées et dimensions. + var notify_width = $('.notifications').width(), notify_height = $('.notifications').height(); + var notify_margin = parseInt($('.notifications').css('margin')); + var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin; + + var side = $.inArray(parseInt(targetId), this.neighboursIds); + // console.log(this.neighboursIds, parseInt(targetId), side); + if(side == -1) + { + return; + } + + var sides = ['left', 'right', 'up', 'down']; + var unzooms = ['horizontal', 'vertical']; + + // var notifyTop = this.notifyTopVideo, notifyLeft = this.notifyLeftVideo; + var notifyTop = 0, notifyLeft = 0; + + //On les positionne. + $('#notify_move').css( + { + top: -notifyTop, + left: -notifyLeft + ($(window).width() - notify_width * 2 - notify_margin * 2) / 2, + 'background-image': 'url(./pictos/notifications/move_' + sides[side] + '.png)' + }); + + $('#notify_unzoom').css( + { + top: -notifyTop, + left: -notifyLeft + ($(window).width()) / 2, + 'background-image': 'url(./pictos/notifications/unzoom_' + unzooms[Math.floor(side / 2)] + '.png)' + }); + + // console.log('url(./pictos/notifications/move_' + sides[side] + '.png)'); + // console.log($('#notify_move').css('background-image', 'url(./pictos/notifications/move_' + sides[side] + '.png)')); + // console.log($('#notify_move').css('background-image')); + + //On les fait apparaître. + $('.notifications').css( + { + opacity: "0.9" + }); +} + +/* + * Supprime la notification de recherche de gesture. +*/ +mosaic.prototype.removeNotifyMoveUnzoom = function() +{ + $('#notify_move').remove(); + $('#notify_unzoom').remove(); +} + +/* + * Affiche la notification de dezoom. +*/ +mosaic.prototype.notifyUnzoom = function(targetId) +{ + console.log('UNZOOM'); + + if($('.notifications').length > 0 || !this.neighboursIds || this.neighboursIds.length == 0 || targetId == -1 || this.currentMode != 'VIDEO' && this.currentMode != 'SEARCH' && this.currentMode != 'TIMELINE') + { + return; + } + + console.log('NOT'); + + var _this = this; + + //On spécifie les notifications en div. + var notification_move_unzoom = ""; + + //On les ajoute à la mosaïque. + $('body').append(notification_move_unzoom); + + // console.log(this.player.config.gui.zoomTop + " " + this.player.config.gui.zoomLeft); + + //On calcule leurs coordonnées et dimensions. + var notify_width = $('.notifications').width(), notify_height = $('.notifications').height(); + var notify_margin = parseInt($('.notifications').css('margin')); + var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin; + + var side = $.inArray(parseInt(targetId), this.neighboursIds); + // console.log(this.neighboursIds, parseInt(targetId), side); + if(side == -1) + { + return; + } + + var sides = ['left', 'right', 'up', 'down']; + var unzooms = ['horizontal', 'vertical']; + + // var notifyTop = this.notifyTopVideo, notifyLeft = this.notifyLeftVideo; + var notifyTop = 0, notifyLeft = 0; + + //On les positionne. + $('#notify_move').css( + { + top: -notifyTop, + left: -notifyLeft + ($(window).width() - notify_width * 2 - notify_margin * 2) / 2, + 'background-image': 'url(./pictos/notifications/move_' + sides[side] + '.png)' + }); + + $('#notify_unzoom').css( + { + top: -notifyTop, + left: -notifyLeft + ($(window).width()) / 2, + 'background-image': 'url(./pictos/notifications/unzoom_' + unzooms[Math.floor(side / 2)] + '.png)' + }); + + // console.log('url(./pictos/notifications/move_' + sides[side] + '.png)'); + // console.log($('#notify_move').css('background-image', 'url(./pictos/notifications/move_' + sides[side] + '.png)')); + // console.log($('#notify_move').css('background-image')); + + //On les fait apparaître. + $('.notifications').css( + { + opacity: "0.9" + }); +} + +/* + * Supprime la notification de dezoom. +*/ +mosaic.prototype.removeNotifyUnzoom = function() +{ + $('#notify_unzoom').remove(); +} + +/* + * Affiche la notification de dezoom. + * Direction vaut left ou right. +*/ +mosaic.prototype.notifySwipe = function(direction) +{ + console.log('TRY SWIPE'); + + if($('.notifications').length > 0 || this.currentMode != 'VIDEO' && this.currentMode != 'SEARCH' && this.currentMode != 'TIMELINE' && !this.isSwipe) + { + return; + } + + console.log('IN SWIPE'); + + var _this = this; + + //On spécifie les notifications en div. + var notification_swipe = ""; + + //On les ajoute à la mosaïque. + $('body').append(notification_swipe); + + //On calcule leurs coordonnées et dimensions. + var notify_width = $('.notifications').width(), notify_height = $('.notifications').height(); + var notify_margin = parseInt($('.notifications').css('margin')); + var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin; + + // var notifyTop = this.notifyTopVideo, notifyLeft = this.notifyLeftVideo; + var notifyTop = 0, notifyLeft = 0; + + //On les positionne. + $('#notify_swipe').css( + { + top: -notifyTop, + left: -notifyLeft + ($(window).width() - notify_width - notify_margin) / 2, + 'background-image': 'url(./pictos/notifications/swipe_' + direction + '.png)' + }); + + //On les fait apparaître. + $('.notifications').css( + { + opacity: "0.9" + }); +} + +/* + * Supprime la notification de dezoom. +*/ +mosaic.prototype.removeNotifyUnzoom = function() +{ + $('#notify_unzoom').remove(); +} + +/* + * Affiche l'aide. +*/ +mosaic.prototype.notifyHelp = function(inMosaic) +{ + if(this.helpDisplayed) + { + return; + } + + this.removeSelectionSearchMosaicFull(); + this.removePointMosaicPrezoom(); + + 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 controls_1hand_tab; + var controls_1hand_tab_1; + var controls_1hand_tab_2; + var controls_1hand_tab_opacities; + var controls_1hand_tab_opacities_1; + var controls_1hand_tab_opacities_2; + + if(inMosaic) + { + controls_1hand_tab = ['selection']; + controls_1hand_tab_opacities = [1]; + } + 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]; + } + + //On spécifie les notifications en div. + var search_title = ""; + var search_img = ""; + var search_2hands_text = ""; + var search_2hands_imgs = "