front_idill/src/mosaic/js/notifications.js
changeset 45 0e29ae4568a0
parent 44 8393d3473b98
child 46 9d7a2aa112fb
equal deleted inserted replaced
44:8393d3473b98 45:0e29ae4568a0
     1 /* ===============================================
     1 /* ===============================================
     2  *												   *
     2  *												   *
     3  *		      ZONE DES NOTIFICATIONS			   *
     3  *		      ZONE DES NOTIFICATIONS			   *
     4  *												   *
     4  *												   *
     5    =============================================== */
     5    =============================================== */
     6 
       
     7 /*
       
     8  * Affiche la notification de sélection/recherche lorsque la mosaique est complète.
       
     9 */
       
    10 mosaic.prototype.notifySelectionSearchMosaicFull = function()
       
    11 {
       
    12 	if(this.currentMode != "MOSAIC" && this.currentMode != "FILTER" || this.isCurrentlyInASearchByGesture || $('#notify_selection').length > 0 || $('#notify_search').length > 0 || $('#notify_point').length > 0)
       
    13 	{
       
    14 		return;
       
    15 	}
       
    16 	
       
    17 	console.log('NOTIFY SEL SEA');
       
    18 	
       
    19 	//On spécifie les notifications en div.
       
    20 	var notification_selection = "<div id='notify_selection' class='notifications'></div>";
       
    21 	var notification_search = "<div id='notify_search' class='notifications'></div>";
       
    22 	
       
    23 	//On les ajoute à la mosaïque.
       
    24 	$('#mainPanel').append(notification_selection + notification_search);
       
    25 
       
    26 	//On calcule leurs coordonnées et dimensions.
       
    27 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
    28 	var notify_margin = parseInt($('.notifications').css('margin'));
       
    29 	var selection_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
       
    30 	var search_left = selection_left + notify_width + notify_margin;
       
    31 	
       
    32 	//On les positionne.
       
    33 	$('#notify_selection').css(
       
    34 	{
       
    35 		left: selection_left
       
    36 	});
       
    37 	$('#notify_search').css(
       
    38 	{
       
    39 		left: search_left
       
    40 	});
       
    41 	
       
    42 	//On les fait apparaître.
       
    43 	$('.notifications').css(
       
    44 	{
       
    45 		opacity: "0.9"
       
    46 	});
       
    47 }
       
    48 
       
    49 /*
       
    50  * Supprime la notification de sélection/recherche lorsque la mosaique est complète.
       
    51 */
       
    52 mosaic.prototype.removeSelectionSearchMosaicFull = function()
       
    53 {
       
    54 	if(this.isOnASnapshot)
       
    55 	{
       
    56 		// console.log('DEL SEL SEA');
       
    57 		$('#notify_selection, #notify_search').remove();
       
    58 	}
       
    59 }
       
    60 
       
    61 /*
       
    62  * Affiche la notification de maintient du pointage lors d'une phase de prézoom.
       
    63 */
       
    64 mosaic.prototype.notifyPointMosaicPrezoom = function()
       
    65 {
       
    66 	this.removeSelectionSearchMosaicFull();
       
    67 	if($('#notify_point').length > 0 || $('#notify_search').length > 0 || this.currentMode != 'MOSAIC' && this.currentMode != 'FILTER' && !this.isOnASnapshot)
       
    68 	{
       
    69 		this.removePointMosaicPrezoom();
       
    70 		return;
       
    71 	}
       
    72 	
       
    73 	//On spécifie les notifications en div.
       
    74 	var notification_point = "<div id='notify_point' class='notifications'></div>";
       
    75 	
       
    76 	//On les ajoute à la mosaïque.
       
    77 	$('#mainPanel').append(notification_point);
       
    78 	
       
    79 	//On calcule leurs coordonnées et dimensions.
       
    80 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
    81 	var notify_margin = parseInt($('.notifications').css('margin'));
       
    82 	var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
       
    83 	
       
    84 	//On les positionne.
       
    85 	$('#notify_point').css(
       
    86 	{
       
    87 		left: point_left
       
    88 	});
       
    89 	
       
    90 	//On les fait apparaître.
       
    91 	$('.notifications').css(
       
    92 	{
       
    93 		opacity: "0.9"
       
    94 	});
       
    95 }
       
    96 
       
    97 /*
       
    98  * Supprime la notification de maintient du pointage.
       
    99 */
       
   100 mosaic.prototype.removePointMosaicPrezoom = function()
       
   101 {
       
   102 	//if(!this.isOnASnapshot)
       
   103 	//{
       
   104 		$('#notify_point').remove();
       
   105 	//}
       
   106 }
       
   107 
       
   108 /*
       
   109  * Affiche la notification de recherche (qu'elle soit par gesture ou par courbes).
       
   110 */
       
   111 mosaic.prototype.notifySearch = function()
       
   112 {
       
   113 	/*this.removeSelectionSearchMosaicFull();
       
   114 	if($('#notify_point').length > 0 || $('#notify_search').length > 0 || this.currentMode != 'MOSAIC' && this.currentMode != 'FILTER' && !this.isOnASnapshot)
       
   115 	{
       
   116 		//this.removeNotifySearch();
       
   117 		//return;
       
   118 	}*/
       
   119 	
       
   120 	if($('.notifications').length > 0)
       
   121 	{
       
   122 		$('.notifications').remove();
       
   123 	}
       
   124 	
       
   125 	//On spécifie les notifications en div.
       
   126 	var notification_search = "<div id='notify_search' class='notifications'></div>";
       
   127 	
       
   128 	//On les ajoute à la mosaïque.
       
   129 	$('body').append(notification_search);
       
   130 	
       
   131 	//On calcule leurs coordonnées et dimensions.
       
   132 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
   133 	var notify_margin = parseInt($('.notifications').css('margin'));
       
   134 	var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
       
   135 	
       
   136 	//On les positionne.
       
   137 	$('#notify_search').css(
       
   138 	{
       
   139 		left: point_left
       
   140 	});
       
   141 	
       
   142 	//On les fait apparaître.
       
   143 	$('.notifications').css(
       
   144 	{
       
   145 		opacity: "0.9"
       
   146 	});
       
   147 }
       
   148 
       
   149 /*
       
   150  * Supprime la notification de maintient du pointage.
       
   151 */
       
   152 mosaic.prototype.removeNotifySearch = function()
       
   153 {
       
   154 	//if(!this.isOnASnapshot)
       
   155 	//{
       
   156 		//$('#notify_search').remove();
       
   157 	//}
       
   158 }
       
   159 
       
   160 /*
       
   161  * Affiche la notification de changement de voisin et de dezoom.
       
   162 */
       
   163 mosaic.prototype.notifyMoveUnzoom = function(targetId)
       
   164 {
       
   165 	console.log('MOVE & UNZOOM');
       
   166 	
       
   167 	if($('.notifications').length > 0 || !this.neighboursIds || this.neighboursIds.length == 0 || targetId == -1 || this.currentMode != 'VIDEO' && this.currentMode != 'SEARCH' && this.currentMode != 'TIMELINE')
       
   168 	{
       
   169 		return;
       
   170 	}
       
   171 	
       
   172 	console.log('NOT');
       
   173 		
       
   174 	var _this = this;
       
   175 	
       
   176 	//On spécifie les notifications en div.
       
   177 	var notification_move_unzoom = "<div id='notify_move' class='notifications'></div><div id='notify_unzoom' class='notifications'></div>";
       
   178 	
       
   179 	//On les ajoute à la mosaïque.
       
   180 	$('body').append(notification_move_unzoom);
       
   181 	
       
   182 	// console.log(this.player.config.gui.zoomTop + " " + this.player.config.gui.zoomLeft);
       
   183 	
       
   184 	//On calcule leurs coordonnées et dimensions.
       
   185 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
   186 	var notify_margin = parseInt($('.notifications').css('margin'));
       
   187 	var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
       
   188 	
       
   189 	var side = $.inArray(parseInt(targetId), this.neighboursIds);
       
   190 	// console.log(this.neighboursIds, parseInt(targetId), side);
       
   191 	if(side == -1)
       
   192 	{
       
   193 		return;
       
   194 	}
       
   195 	
       
   196 	var sides = ['left', 'right', 'up', 'down'];
       
   197 	var unzooms = ['horizontal', 'vertical'];
       
   198 	
       
   199 	// var notifyTop = this.notifyTopVideo, notifyLeft = this.notifyLeftVideo;
       
   200 	var notifyTop = 0, notifyLeft = 0;
       
   201 	
       
   202 	//On les positionne.
       
   203 	$('#notify_move').css(
       
   204 	{
       
   205 		top: -notifyTop,
       
   206 		left: -notifyLeft + ($(window).width() - notify_width * 2 - notify_margin * 2) / 2,
       
   207 		'background-image': 'url(./pictos/notifications/move_' + sides[side] + '.png)'
       
   208 	});
       
   209 	
       
   210 	$('#notify_unzoom').css(
       
   211 	{
       
   212 		top: -notifyTop,
       
   213 		left: -notifyLeft + ($(window).width()) / 2,
       
   214 		'background-image': 'url(./pictos/notifications/unzoom_' + unzooms[Math.floor(side / 2)] + '.png)'
       
   215 	});
       
   216 	
       
   217 	// console.log('url(./pictos/notifications/move_' + sides[side] + '.png)');
       
   218 	// console.log($('#notify_move').css('background-image', 'url(./pictos/notifications/move_' + sides[side] + '.png)'));
       
   219 	// console.log($('#notify_move').css('background-image'));
       
   220 	
       
   221 	//On les fait apparaître.
       
   222 	$('.notifications').css(
       
   223 	{
       
   224 		opacity: "0.9"
       
   225 	});
       
   226 }
       
   227 
       
   228 /*
       
   229  * Supprime la notification de recherche de gesture.
       
   230 */
       
   231 mosaic.prototype.removeNotifyMoveUnzoom = function()
       
   232 {
       
   233 	$('#notify_move').remove();
       
   234 	$('#notify_unzoom').remove();
       
   235 }
       
   236 
       
   237 /*
       
   238  * Affiche la notification de dezoom.
       
   239 */
       
   240 mosaic.prototype.notifyUnzoom = function(targetId)
       
   241 {
       
   242 	console.log('UNZOOM');
       
   243 	
       
   244 	if($('.notifications').length > 0 || !this.neighboursIds || this.neighboursIds.length == 0 || targetId == -1 || this.currentMode != 'VIDEO' && this.currentMode != 'SEARCH' && this.currentMode != 'TIMELINE')
       
   245 	{
       
   246 		return;
       
   247 	}
       
   248 	
       
   249 	console.log('NOT');
       
   250 		
       
   251 	var _this = this;
       
   252 	
       
   253 	//On spécifie les notifications en div.
       
   254 	var notification_move_unzoom = "<div id='notify_move' class='notifications'></div><div id='notify_unzoom' class='notifications'></div>";
       
   255 	
       
   256 	//On les ajoute à la mosaïque.
       
   257 	$('body').append(notification_move_unzoom);
       
   258 	
       
   259 	// console.log(this.player.config.gui.zoomTop + " " + this.player.config.gui.zoomLeft);
       
   260 	
       
   261 	//On calcule leurs coordonnées et dimensions.
       
   262 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
   263 	var notify_margin = parseInt($('.notifications').css('margin'));
       
   264 	var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
       
   265 	
       
   266 	var side = $.inArray(parseInt(targetId), this.neighboursIds);
       
   267 	// console.log(this.neighboursIds, parseInt(targetId), side);
       
   268 	if(side == -1)
       
   269 	{
       
   270 		return;
       
   271 	}
       
   272 	
       
   273 	var sides = ['left', 'right', 'up', 'down'];
       
   274 	var unzooms = ['horizontal', 'vertical'];
       
   275 	
       
   276 	// var notifyTop = this.notifyTopVideo, notifyLeft = this.notifyLeftVideo;
       
   277 	var notifyTop = 0, notifyLeft = 0;
       
   278 	
       
   279 	//On les positionne.
       
   280 	$('#notify_move').css(
       
   281 	{
       
   282 		top: -notifyTop,
       
   283 		left: -notifyLeft + ($(window).width() - notify_width * 2 - notify_margin * 2) / 2,
       
   284 		'background-image': 'url(./pictos/notifications/move_' + sides[side] + '.png)'
       
   285 	});
       
   286 	
       
   287 	$('#notify_unzoom').css(
       
   288 	{
       
   289 		top: -notifyTop,
       
   290 		left: -notifyLeft + ($(window).width()) / 2,
       
   291 		'background-image': 'url(./pictos/notifications/unzoom_' + unzooms[Math.floor(side / 2)] + '.png)'
       
   292 	});
       
   293 	
       
   294 	// console.log('url(./pictos/notifications/move_' + sides[side] + '.png)');
       
   295 	// console.log($('#notify_move').css('background-image', 'url(./pictos/notifications/move_' + sides[side] + '.png)'));
       
   296 	// console.log($('#notify_move').css('background-image'));
       
   297 	
       
   298 	//On les fait apparaître.
       
   299 	$('.notifications').css(
       
   300 	{
       
   301 		opacity: "0.9"
       
   302 	});
       
   303 }
       
   304 
       
   305 /*
       
   306  * Supprime la notification de dezoom.
       
   307 */
       
   308 mosaic.prototype.removeNotifyUnzoom = function()
       
   309 {
       
   310 	$('#notify_unzoom').remove();
       
   311 }
       
   312 
       
   313 /*
       
   314  * Affiche la notification de dezoom.
       
   315  * Direction vaut left ou right.
       
   316 */
       
   317 mosaic.prototype.notifySwipe = function(direction)
       
   318 {
       
   319 	console.log('TRY SWIPE');
       
   320 	
       
   321 	if($('.notifications').length > 0 || this.currentMode != 'VIDEO' && this.currentMode != 'SEARCH' && this.currentMode != 'TIMELINE' && !this.isSwipe)
       
   322 	{
       
   323 		return;
       
   324 	}
       
   325 	
       
   326 	console.log('IN SWIPE');
       
   327 		
       
   328 	var _this = this;
       
   329 	
       
   330 	//On spécifie les notifications en div.
       
   331 	var notification_swipe = "<div id='notify_swipe' class='notifications'></div>";
       
   332 	
       
   333 	//On les ajoute à la mosaïque.
       
   334 	$('body').append(notification_swipe);
       
   335 	
       
   336 	//On calcule leurs coordonnées et dimensions.
       
   337 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
   338 	var notify_margin = parseInt($('.notifications').css('margin'));
       
   339 	var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
       
   340 	
       
   341 	// var notifyTop = this.notifyTopVideo, notifyLeft = this.notifyLeftVideo;
       
   342 	var notifyTop = 0, notifyLeft = 0;
       
   343 	
       
   344 	//On les positionne.
       
   345 	$('#notify_swipe').css(
       
   346 	{
       
   347 		top: -notifyTop,
       
   348 		left: -notifyLeft + ($(window).width() - notify_width - notify_margin) / 2,
       
   349 		'background-image': 'url(./pictos/notifications/swipe_' + direction + '.png)'
       
   350 	});
       
   351 	
       
   352 	//On les fait apparaître.
       
   353 	$('.notifications').css(
       
   354 	{
       
   355 		opacity: "0.9"
       
   356 	});
       
   357 }
       
   358 
       
   359 /*
       
   360  * Supprime la notification de dezoom.
       
   361 */
       
   362 mosaic.prototype.removeNotifyUnzoom = function()
       
   363 {
       
   364 	$('#notify_unzoom').remove();
       
   365 }
       
   366 
     6 
   367 /*
     7 /*
   368  * Affiche l'aide.
     8  * Affiche l'aide.
   369 */
     9 */
   370 mosaic.prototype.notifyHelp = function(inMosaic)
    10 mosaic.prototype.notifyHelp = function(inMosaic)
   833 	//On calcule leurs coordonnées et dimensions.
   473 	//On calcule leurs coordonnées et dimensions.
   834 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
   474 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
   835 	var notify_margin = parseInt($('.notifications').css('margin'));
   475 	var notify_margin = parseInt($('.notifications').css('margin'));
   836 	var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
   476 	var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
   837 	
   477 	
       
   478 	// console.log('url("./pictos/big/' + (this.mouseInteractions ? 'MI' : '') + '/' + mode + '/' + gestureName + '.png")');
       
   479 	
   838 	if(_.include(this.gestures, gestureName))
   480 	if(_.include(this.gestures, gestureName))
   839 	{
   481 	{
   840 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + mode + '/' + gestureName + '.png")');
   482 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + (this.mouseInteractions ? 'MI' : '') + '/' + (this.gestureDelRequested ? 'hover' : 'valid') + '/' + gestureName + '.png")');
   841 	}
   483 	}
   842 	else if(mode == 'none')
   484 	else if(mode == 'none')
   843 	{
   485 	{
   844 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
   486 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
   845 	}
   487 	}
   881 	var search_1gesture_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
   523 	var search_1gesture_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
   882 	var selection_left = search_1gesture_left + notify_width + notify_margin;
   524 	var selection_left = search_1gesture_left + notify_width + notify_margin;
   883 	
   525 	
   884 	if(_.include(this.gestures, gestureName))
   526 	if(_.include(this.gestures, gestureName))
   885 	{
   527 	{
   886 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + mode + '/' + gestureName + '.png")');
   528 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + (this.mouseInteractions ? 'MI' : '') + '/' + mode + '/' + gestureName + '.png")');
   887 	}
   529 	}
   888 	else if(mode == 'none')
   530 	else if(mode == 'none')
   889 	{
   531 	{
   890 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
   532 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
   891 	}
   533 	}
   948 		opacity: "0.9"
   590 		opacity: "0.9"
   949 	});
   591 	});
   950 }
   592 }
   951 
   593 
   952 /*
   594 /*
   953  * Affichage de la notification de résultat de move vers un voisin & de dézoom dans une vidéo.
   595  * Affichage de la notification de résultat de move vers un voisin.
   954 */
   596 */
   955 mosaic.prototype.videoMoveAndUnzoom = function(targetId)
   597 mosaic.prototype.videoMove = function(targetId)
   956 {
   598 {
   957 	if(this.currentMode != 'VIDEO')
   599 	if(this.currentMode != 'VIDEO')
   958 	{
   600 	{
   959 		return;
   601 		return;
   960 	}
   602 	}
   961 	
   603 	
   962 	var _this = this;
   604 	var _this = this;
   963 	
   605 	
   964 	//On spécifie les notifications en div.
   606 	//On spécifie les notifications en div.
   965 	var notification_move = "<div id='notify_move' class='notifications'></div>";
   607 	var notification_move = "<div id='notify_move' class='notifications'></div>";
   966 	var notification_unzoom = "<div id='notify_unzoom' class='notifications'></div>";
   608 	
   967 	
   609 	//On les ajoute à la mosaïque.
   968 	//On les ajoute à la mosaïque.
   610 	$('body').append(notification_move);
   969 	$('body').append(notification_move + notification_unzoom);
   611 	
   970 	
   612 	//On calcule leurs coordonnées et dimensions.
   971 	//On calcule leurs coordonnées et dimensions.
   613 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
   972 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
   614 	var notify_margin = parseInt($('.notifications').css('margin'));
   973 	var notify_margin = parseInt($('.notifications').css('margin'));
   615 	var move_left = $(window).width() / 2 - (notify_width) / 2 + notify_margin;
   974 	var move_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
       
   975 	var unzoom_left = move_left + notify_width + notify_margin;
       
   976 	
   616 	
   977 	var side = $.inArray(parseInt(targetId), this.neighboursIds);
   617 	var side = $.inArray(parseInt(targetId), this.neighboursIds);
   978 	// console.log(this.neighboursIds, parseInt(targetId), side);
   618 	// console.log(this.neighboursIds, parseInt(targetId), side);
   979 	if(side == -1)
   619 	if(side == -1)
   980 	{
   620 	{
   981 		return;
   621 		return;
   982 	}
   622 	}
   983 	
   623 	
   984 	var sides = ['left', 'right', 'up', 'down'];
   624 	var sides = ['left', 'right', 'up', 'down'];
   985 	var unzooms = ['horizontal', 'vertical'];
       
   986 	
   625 	
   987 	// var notifyTop = this.notifyTopVideo, notifyLeft = this.notifyLeftVideo;
   626 	// var notifyTop = this.notifyTopVideo, notifyLeft = this.notifyLeftVideo;
   988 	var notifyTop = 0, notifyLeft = 0;
   627 	var notifyTop = 0, notifyLeft = 0;
   989 	
   628 	
   990 	//On les positionne.
   629 	//On les positionne.
   993 		top: -notifyTop,
   632 		top: -notifyTop,
   994 		left: -notifyLeft + move_left,
   633 		left: -notifyLeft + move_left,
   995 		'background-image': 'url(./pictos/notifications/move_' + sides[side] + '.png)'
   634 		'background-image': 'url(./pictos/notifications/move_' + sides[side] + '.png)'
   996 	});
   635 	});
   997 	
   636 	
       
   637 	//On les fait apparaître.
       
   638 	$('.notifications').css(
       
   639 	{
       
   640 		opacity: "0.9"
       
   641 	});
       
   642 }
       
   643 
       
   644 /*
       
   645  * Affichage de la notification de résultat de move vers un voisin & de dézoom dans une vidéo.
       
   646 */
       
   647 mosaic.prototype.videoMoveAndUnzoom = function(targetId)
       
   648 {
       
   649 	if(this.currentMode != 'VIDEO')
       
   650 	{
       
   651 		return;
       
   652 	}
       
   653 	
       
   654 	var _this = this;
       
   655 	
       
   656 	//On spécifie les notifications en div.
       
   657 	var notification_move = "<div id='notify_move' class='notifications'></div>";
       
   658 	var notification_unzoom = "<div id='notify_unzoom' class='notifications'></div>";
       
   659 	
       
   660 	//On les ajoute à la mosaïque.
       
   661 	$('body').append(notification_move + notification_unzoom);
       
   662 	
       
   663 	//On calcule leurs coordonnées et dimensions.
       
   664 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
   665 	var notify_margin = parseInt($('.notifications').css('margin'));
       
   666 	var move_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
       
   667 	var unzoom_left = move_left + notify_width + notify_margin;
       
   668 	
       
   669 	var side = $.inArray(parseInt(targetId), this.neighboursIds);
       
   670 	// console.log(this.neighboursIds, parseInt(targetId), side);
       
   671 	if(side == -1)
       
   672 	{
       
   673 		return;
       
   674 	}
       
   675 	
       
   676 	var sides = ['left', 'right', 'up', 'down'];
       
   677 	var unzooms = ['horizontal', 'vertical'];
       
   678 	
       
   679 	// var notifyTop = this.notifyTopVideo, notifyLeft = this.notifyLeftVideo;
       
   680 	var notifyTop = 0, notifyLeft = 0;
       
   681 	
       
   682 	//On les positionne.
       
   683 	$('#notify_move').css(
       
   684 	{
       
   685 		top: -notifyTop,
       
   686 		left: -notifyLeft + move_left,
       
   687 		'background-image': 'url(./pictos/notifications/move_' + sides[side] + '.png)'
       
   688 	});
       
   689 	
   998 	$('#notify_unzoom').css(
   690 	$('#notify_unzoom').css(
   999 	{
   691 	{
  1000 		top: -notifyTop,
   692 		top: -notifyTop,
  1001 		left: -notifyLeft + unzoom_left,
   693 		left: -notifyLeft + unzoom_left,
  1002 		'background-image': 'url(./pictos/notifications/unzoom_' + unzooms[Math.floor(side / 2)] + '.png)'
   694 		'background-image': 'url(./pictos/notifications/unzoom_' + unzooms[Math.floor(side / 2)] + '.png)'
  1175 	$('#notify_swipe').css(
   867 	$('#notify_swipe').css(
  1176 	{
   868 	{
  1177 		top: -notifyTop,
   869 		top: -notifyTop,
  1178 		left: -notifyLeft + swipe_left,
   870 		left: -notifyLeft + swipe_left,
  1179 		'background-image': 'url(./pictos/notifications/swipe_' + direction + '.png)'
   871 		'background-image': 'url(./pictos/notifications/swipe_' + direction + '.png)'
       
   872 	});
       
   873 	
       
   874 	//On les fait apparaître.
       
   875 	$('.notifications').css(
       
   876 	{
       
   877 		opacity: "0.9"
       
   878 	});
       
   879 }
       
   880 
       
   881 /*
       
   882  * Affichage de la notification de recherche, de move vers un voisin.
       
   883 */
       
   884 mosaic.prototype.searchSearchAndMove = function(targetId)
       
   885 {
       
   886 	if(this.currentMode != 'SEARCH' || this.isCurrentlyInASearchByGesture)
       
   887 	{
       
   888 		return;
       
   889 	}
       
   890 	
       
   891 	//On spécifie les notifications en div.
       
   892 	var notification_search = "<div id='notify_search' class='notifications'></div>";
       
   893 	var notification_move = "<div id='notify_move' class='notifications'></div>";
       
   894 	
       
   895 	//On les ajoute à la mosaïque.
       
   896 	$('body').append(notification_search + notification_move);
       
   897 	
       
   898 	//On calcule leurs coordonnées et dimensions.
       
   899 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
   900 	var notify_margin = parseInt($('.notifications').css('margin'));
       
   901 	var search_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
       
   902 	var move_left = search_left + notify_width + notify_margin;
       
   903 	
       
   904 	var side = $.inArray(parseInt(targetId), this.neighboursIds);
       
   905 	
       
   906 	if(side == -1)
       
   907 	{
       
   908 		return;
       
   909 	}
       
   910 	
       
   911 	var sides = ['left', 'right', 'up', 'down'];
       
   912 	
       
   913 	var notifyTop = 0, notifyLeft = 0;
       
   914 	
       
   915 	//On les positionne.
       
   916 	$('#notify_search').css(
       
   917 	{
       
   918 		top: -notifyTop,
       
   919 		left: -notifyLeft + search_left
       
   920 	});
       
   921 	$('#notify_move').css(
       
   922 	{
       
   923 		top: -notifyTop,
       
   924 		left: -notifyLeft + move_left,
       
   925 		'background-image': 'url(./pictos/notifications/move_' + sides[side] + '.png)'
  1180 	});
   926 	});
  1181 	
   927 	
  1182 	//On les fait apparaître.
   928 	//On les fait apparaître.
  1183 	$('.notifications').css(
   929 	$('.notifications').css(
  1184 	{
   930 	{
  1333 	var notify_margin = parseInt($('.notifications').css('margin'));
  1079 	var notify_margin = parseInt($('.notifications').css('margin'));
  1334 	var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
  1080 	var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
  1335 	
  1081 	
  1336 	if(_.include(this.gestures, gestureName))
  1082 	if(_.include(this.gestures, gestureName))
  1337 	{
  1083 	{
  1338 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + mode + '/' + gestureName + '.png")');
  1084 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + (this.mouseInteractions ? 'MI/' : '') + mode + '/' + gestureName + '.png")');
  1339 	}
  1085 	}
  1340 	else if(mode == 'none')
  1086 	else if(mode == 'none')
  1341 	{
  1087 	{
  1342 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
  1088 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
  1343 	}
  1089 	}
  1383 	var search_1gesture_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
  1129 	var search_1gesture_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
  1384 	var swipe_left = search_1gesture_left + notify_width + notify_margin;
  1130 	var swipe_left = search_1gesture_left + notify_width + notify_margin;
  1385 	
  1131 	
  1386 	if(_.include(this.gestures, gestureName))
  1132 	if(_.include(this.gestures, gestureName))
  1387 	{
  1133 	{
  1388 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + mode + '/' + gestureName + '.png")');
  1134 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + (this.mouseInteractions ? 'MI/' : '') + mode + '/' + gestureName + '.png")');
  1389 	}
  1135 	}
  1390 	else if(mode == 'none')
  1136 	else if(mode == 'none')
  1391 	{
  1137 	{
  1392 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
  1138 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
  1393 	}
  1139 	}
  1399 	});
  1145 	});
  1400 	$('#notify_swipe').css(
  1146 	$('#notify_swipe').css(
  1401 	{
  1147 	{
  1402 		left: swipe_left,
  1148 		left: swipe_left,
  1403 		'background-image': 'url(./pictos/notifications/swipe_' + direction + '.png)'
  1149 		'background-image': 'url(./pictos/notifications/swipe_' + direction + '.png)'
       
  1150 	});
       
  1151 	
       
  1152 	//On les fait apparaître.
       
  1153 	$('.notifications').css(
       
  1154 	{
       
  1155 		opacity: "0.9"
       
  1156 	});
       
  1157 }
       
  1158 
       
  1159 /*
       
  1160  * Affichage de la notification de résultat, de move vers un voisin.
       
  1161 */
       
  1162 mosaic.prototype.searchGestureAndMove = function(gestureName, mode, targetId)
       
  1163 {
       
  1164 	if(this.currentMode != 'SEARCH' || !this.isCurrentlyInASearchByGesture)
       
  1165 	{
       
  1166 		return;
       
  1167 	}
       
  1168 	
       
  1169 	var _this = this;
       
  1170 	
       
  1171 	//On spécifie les notifications en div.
       
  1172 	var notification_search_1gesture = "<div id='notify_search_1gesture' class='notifications'></div>";
       
  1173 	var notification_move = "<div id='notify_move' class='notifications'></div>";
       
  1174 	
       
  1175 	//On les ajoute à la mosaïque.
       
  1176 	$('body').append(notification_search_1gesture + notification_move);
       
  1177 	
       
  1178 	// console.log(this.player.config.gui.zoomTop + " " + this.player.config.gui.zoomLeft);
       
  1179 	
       
  1180 	//On calcule leurs coordonnées et dimensions.
       
  1181 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
  1182 	var notify_margin = parseInt($('.notifications').css('margin'));
       
  1183 	var search_1gesture_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
       
  1184 	var move_left = search_1gesture_left + notify_width + notify_margin;
       
  1185 	
       
  1186 	if(_.include(this.gestures, gestureName))
       
  1187 	{
       
  1188 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + (this.mouseInteractions ? 'MI/' : '') + mode + '/' + gestureName + '.png")');
       
  1189 	}
       
  1190 	else if(mode == 'none')
       
  1191 	{
       
  1192 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
       
  1193 	}
       
  1194 	
       
  1195 	var side = $.inArray(parseInt(targetId), this.neighboursIds);
       
  1196 	
       
  1197 	if(side == -1)
       
  1198 	{
       
  1199 		return;
       
  1200 	}
       
  1201 	
       
  1202 	var sides = ['left', 'right', 'up', 'down'];
       
  1203 	
       
  1204 	//On les positionne.
       
  1205 	$('#notify_search_1gesture').css(
       
  1206 	{
       
  1207 		left: search_1gesture_left
       
  1208 	});
       
  1209 	$('#notify_move').css(
       
  1210 	{
       
  1211 		left: move_left,
       
  1212 		'background-image': 'url(./pictos/notifications/move_' + sides[side] + '.png)'
  1404 	});
  1213 	});
  1405 	
  1214 	
  1406 	//On les fait apparaître.
  1215 	//On les fait apparaître.
  1407 	$('.notifications').css(
  1216 	$('.notifications').css(
  1408 	{
  1217 	{
  1439 	var move_left = search_1gesture_left + notify_width + notify_margin;
  1248 	var move_left = search_1gesture_left + notify_width + notify_margin;
  1440 	var unzoom_left = move_left + notify_width + notify_margin;
  1249 	var unzoom_left = move_left + notify_width + notify_margin;
  1441 	
  1250 	
  1442 	if(_.include(this.gestures, gestureName))
  1251 	if(_.include(this.gestures, gestureName))
  1443 	{
  1252 	{
  1444 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + mode + '/' + gestureName + '.png")');
  1253 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + (this.mouseInteractions ? 'MI/' : '') + mode + '/' + gestureName + '.png")');
  1445 	}
  1254 	}
  1446 	else if(mode == 'none')
  1255 	else if(mode == 'none')
  1447 	{
  1256 	{
  1448 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
  1257 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
  1449 	}
  1258 	}
  1482 }
  1291 }
  1483 
  1292 
  1484 /*
  1293 /*
  1485  * Affichage de la notification de résultat & de dézoom dans une vidéo de recherche.
  1294  * Affichage de la notification de résultat & de dézoom dans une vidéo de recherche.
  1486 */
  1295 */
  1487 mosaic.prototype.searchGestureAndUnzoom = function()
  1296 mosaic.prototype.searchGestureAndUnzoom = function(gestureName, mode, targetId)
  1488 {
  1297 {
  1489 	if(this.currentMode != 'SEARCH' || !this.isCurrentlyInASearchByGesture)
  1298 	if(this.currentMode != 'SEARCH' || !this.isCurrentlyInASearchByGesture)
  1490 	{
  1299 	{
  1491 		return;
  1300 		return;
  1492 	}
  1301 	}
  1508 	var search_1gesture_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
  1317 	var search_1gesture_left = $(window).width() / 2 - (notify_width * 2 + notify_margin * 3) / 2;
  1509 	var unzoom_left = search_1gesture_left + notify_width + notify_margin;
  1318 	var unzoom_left = search_1gesture_left + notify_width + notify_margin;
  1510 	
  1319 	
  1511 	if(_.include(this.gestures, gestureName))
  1320 	if(_.include(this.gestures, gestureName))
  1512 	{
  1321 	{
  1513 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + mode + '/' + gestureName + '.png")');
  1322 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + (this.mouseInteractions ? 'MI/' : '') + mode + '/' + gestureName + '.png")');
  1514 	}
  1323 	}
  1515 	else if(mode == 'none')
  1324 	else if(mode == 'none')
  1516 	{
  1325 	{
  1517 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
  1326 		$('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
  1518 	}
  1327 	}
  1519 	
  1328 	
       
  1329 	var side = $.inArray(parseInt(targetId), this.neighboursIds);
       
  1330 	
       
  1331 	if(side == -1)
       
  1332 	{
       
  1333 		return;
       
  1334 	}
       
  1335 	
       
  1336 	var unzooms = ['horizontal', 'vertical'];
       
  1337 	
  1520 	//On les positionne.
  1338 	//On les positionne.
  1521 	$('#notify_search_1gesture').css(
  1339 	$('#notify_search_1gesture').css(
  1522 	{
  1340 	{
  1523 		left: search_1gesture_left
  1341 		left: search_1gesture_left
  1524 	});
  1342 	});
  1525 	$('#notify_unzoom').css(
  1343 	$('#notify_unzoom').css(
  1526 	{
  1344 	{
  1527 		left: unzoom_left
  1345 		left: unzoom_left,
  1528 	});
  1346 		'background-image': 'url(./pictos/notifications/unzoom_' + unzooms[Math.floor(side / 2)] + '.png)'
  1529 	
  1347 	});
  1530 	//On les fait apparaître.
  1348 	
  1531 	$('.notifications').css(
  1349 	//On les fait apparaître.
  1532 	{
  1350 	$('.notifications').css(
  1533 		opacity: "0.9"
  1351 	{
  1534 	});
  1352 		opacity: "0.9"
  1535 }
  1353 	});
       
  1354 }
       
  1355 
       
  1356 /*
       
  1357  * Affichage des notifications de gestures trouvées dans une recherche par courbes.
       
  1358 */
       
  1359 mosaic.prototype.curvesGestures = function(gestures)
       
  1360 {
       
  1361 	//S'il n'y a pas de gestures à afficher.
       
  1362 	if(gestures.length == 0)
       
  1363 	{
       
  1364 		console.log('NONE');
       
  1365 		//On ajoute une seule notification.
       
  1366 		var notification_curves = "<div class='notifications' id='notify_curves'></div>";
       
  1367 		$('body').append(notification_curves);
       
  1368 		
       
  1369 		//On calcule leurs dimensions et coordonnées.
       
  1370 		var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
  1371 		var notify_margin = parseInt($('.notifications').css('margin'));
       
  1372 		var curves_left = $(window).width() / 2 - (notify_width + notify_margin * 2) / 2;
       
  1373 		
       
  1374 		$('#notify_curves').css(
       
  1375 		{
       
  1376 			left: curves_left,
       
  1377 			'background-image': 'url("./pictos/big/normal/inconnu.png")',
       
  1378 			opacity: '0.9'
       
  1379 		});
       
  1380 		return;
       
  1381 	}
       
  1382 	
       
  1383 	//Sinon, on les met dans un tableau.
       
  1384 	var gestures_tab = gestures.split(';');
       
  1385 	
       
  1386 	var notifications_curves_gestures = '';
       
  1387 	
       
  1388 	//On crée autant de notifications qu'il y a de gestures.
       
  1389 	for(var i = 0 ; i < gestures_tab.length ; i++)
       
  1390 	{
       
  1391 		notifications_curves_gestures += "<div class='notifications' id='notify_curves_" + gestures_tab[i] + "'></div>";
       
  1392 	}
       
  1393 	
       
  1394 	//On les ajoute à la mosaïque.
       
  1395 	$('body').append(notifications_curves_gestures);
       
  1396 	
       
  1397 	//On calcule leurs dimensions.
       
  1398 	var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
       
  1399 	var notify_margin = parseInt($('.notifications').css('margin'));
       
  1400 	var curves_gestures_left = [];
       
  1401 	
       
  1402 	//On calcule leurs dimensions et leur backgrounds.
       
  1403 	curves_gestures_left[0] = $(window).width() / 2 - (notify_width * (gestures_tab.length) + notify_margin * (gestures_tab.length + 2)) / 2;
       
  1404 	
       
  1405 	for(var i = 0 ; i < gestures_tab.length ; i++)
       
  1406 	{
       
  1407 		//On va chercher leurs backgrounds.
       
  1408 		$('#notify_curves_' + gestures_tab[i]).css('background-image', 'url("./pictos/big/' + (this.mouseInteractions ? 'MI/' : '') + 'normal/' + gestures_tab[i] + '.png")');
       
  1409 		// console.log('url("./pictos/big/MI/normal/' + gestures_tab[i] + '.png")');
       
  1410 		
       
  1411 		//On calcule leurs coordonnées.
       
  1412 		if(i+1 < gestures_tab.length)
       
  1413 		{
       
  1414 			curves_gestures_left[i+1] = curves_gestures_left[i] + notify_width + notify_margin * 2;
       
  1415 		}
       
  1416 		
       
  1417 		//On les place.
       
  1418 		$('#notify_curves_' + gestures_tab[i]).css('left', curves_gestures_left[i]);
       
  1419 	}
       
  1420 	
       
  1421 	//On les fait apparaître.
       
  1422 	$('.notifications').css(
       
  1423 	{
       
  1424 		opacity: "0.9"
       
  1425 	});
       
  1426 }