front_idill/src/mosaic/js/pointers.js
changeset 100 db42ef1faa7a
parent 89 b6a115568b52
child 112 58ba3ae2d3d9
equal deleted inserted replaced
99:085632de8798 100:db42ef1faa7a
  1110 		return false;
  1110 		return false;
  1111 	}
  1111 	}
  1112 	
  1112 	
  1113 	var margin = parseInt(creditsNotification.css('margin-left'));
  1113 	var margin = parseInt(creditsNotification.css('margin-left'));
  1114 	
  1114 	
  1115 	/*if($('#aa').length <= 0)
       
  1116 	{
       
  1117 		var a = '<div id="aa"></div>';
       
  1118 		$('body').append(a);
       
  1119 		$('#aa').css(
       
  1120 		{
       
  1121 			position: 'absolute',
       
  1122 			'background-color': '#0000FF',
       
  1123 			top: +upArrow.position().top + 2 * margin,
       
  1124 			left: upArrow.position().left + 2 * margin,
       
  1125 			width: upArrow.width(),
       
  1126 			height: upArrow.height()
       
  1127 		});
       
  1128 	}
       
  1129 	
       
  1130 	console.log('---------------UP----------------------');
       
  1131 	console.log(x + ' > ' + (+upArrow.position().left + 2 * margin));
       
  1132 	console.log(x + ' < ' + (+upArrow.position().left + upArrow.width() + 2 * margin));
       
  1133 	console.log(y + ' > ' + (+upArrow.position().top + 2 * margin));
       
  1134 	console.log(y + ' < ' + (+upArrow.position().top + upArrow.height() + 2 * margin));
       
  1135 	console.log('---------------------------------------');*/
       
  1136 	
       
  1137 	//Si la flèche est visible et si la souris est dessus, on retourne true.
  1115 	//Si la flèche est visible et si la souris est dessus, on retourne true.
  1138 	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))
  1116 	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))
  1139 	{
  1117 	{
  1140 		return true;
  1118 		return true;
  1141 	}
  1119 	}
  1157 	
  1135 	
  1158 	//$('#aa').remove();
  1136 	//$('#aa').remove();
  1159 	
  1137 	
  1160 	var margin = parseInt(creditsNotification.css('margin-left'));
  1138 	var margin = parseInt(creditsNotification.css('margin-left'));
  1161 	
  1139 	
  1162 	/*console.log('--------------DOWN---------------------');
       
  1163 	console.log(x + ' > ' + (+downArrow.position().left + margin));
       
  1164 	console.log(x + ' < ' + (+downArrow.position().left + downArrow.width() + margin));
       
  1165 	console.log(y + ' > ' + (+downArrow.position().top + margin));
       
  1166 	console.log(y + ' < ' + (+downArrow.position().top + downArrow.height() + margin));
       
  1167 	console.log('---------------------------------------');*/
       
  1168 	
       
  1169 	//Si la flèche est visible et si la souris est dessus, on retourne true.
  1140 	//Si la flèche est visible et si la souris est dessus, on retourne true.
  1170 	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))
  1141 	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))
  1171 	{
  1142 	{
  1172 		return true;
  1143 		return true;
  1173 	}
  1144 	}
  1284 	{
  1255 	{
  1285 		left: -($('#credits_container').width() * N - parseInt(notify_credits.css('margin-left')))// + this.column_gap)
  1256 		left: -($('#credits_container').width() * N - parseInt(notify_credits.css('margin-left')))// + this.column_gap)
  1286 	});
  1257 	});
  1287 }
  1258 }
  1288 
  1259 
  1289 
  1260 /*
       
  1261  * Retourne vrai si la souris est sur la flèche haute dans le panneau d'aide.
       
  1262 */
       
  1263 Mosaic.prototype.isOnHelpUpArrow = function(x, y)
       
  1264 {
       
  1265 	var helpNotification = $('#notify_help'), upArrow = $('#help_details_upArrow');
       
  1266 	//Si les crédits ne sont pas affichés, on retourne faux.
       
  1267 	if(helpNotification.length <= 0)
       
  1268 	{
       
  1269 		return false;
       
  1270 	}
       
  1271 	
       
  1272 	var margin = parseInt(helpNotification.css('margin-left'));
       
  1273 	
       
  1274 	//Si la flèche est visible et si la souris est dessus, on retourne true.
       
  1275 	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))
       
  1276 	{
       
  1277 		return true;
       
  1278 	}
       
  1279 	
       
  1280 	return false;
       
  1281 }
       
  1282 
       
  1283 /*
       
  1284  * Retourne vrai si la souris est sur la flèche basse dans le panneau d'aide.
       
  1285 */
       
  1286 Mosaic.prototype.isOnHelpDownArrow = function(x, y)
       
  1287 {
       
  1288 	var helpNotification = $('#notify_help'), downArrow = $('#help_details_downArrow');
       
  1289 	//Si les crédits ne sont pas affichés, on retourne faux.
       
  1290 	if(helpNotification.length <= 0)
       
  1291 	{
       
  1292 		return false;
       
  1293 	}
       
  1294 	
       
  1295 	var margin = parseInt(helpNotification.css('margin-left'));
       
  1296 	
       
  1297 	//Si la flèche est visible et si la souris est dessus, on retourne true.
       
  1298 	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))
       
  1299 	{
       
  1300 		return true;
       
  1301 	}
       
  1302 	
       
  1303 	return false;
       
  1304 }
       
  1305 
       
  1306 /*
       
  1307  * Retourne vrai si la souris est sur une des flèches du panneau d'aide.
       
  1308 */
       
  1309 Mosaic.prototype.isOnHelpArrow = function(x, y)
       
  1310 {
       
  1311 	//Si la souris est sur une flèche des crédits, on retourne vrai.
       
  1312 	if(this.isOnHelpUpArrow(x, y) || this.isOnHelpDownArrow(x, y))
       
  1313 	{
       
  1314 		return true;
       
  1315 	}
       
  1316 	
       
  1317 	return false;
       
  1318 }
       
  1319 
       
  1320 /*
       
  1321  * Va a la page d'aide suivante.
       
  1322 */
       
  1323 Mosaic.prototype.goToNextHelpDetailsPage = function()
       
  1324 {
       
  1325 	// console.log(+this.helpDetailsPageNumber + 1  + ' >= ' + this.helpDetailsPageLength);
       
  1326 	//Si on est sur la dernière page, on quitte.
       
  1327 	if(this.helpDetailsPageNumber + 1 >= this.helpDetailsPageLength)
       
  1328 	{
       
  1329 		return;
       
  1330 	}
       
  1331 	
       
  1332 	this.helpDetailsPageNumber++;
       
  1333 	this.goToHelpDetailsPageN(this.helpDetailsPageNumber);
       
  1334 }
       
  1335 
       
  1336 /*
       
  1337  * Va a la page d'aide précédente.
       
  1338 */
       
  1339 Mosaic.prototype.goToPreviousHelpDetailsPage = function()
       
  1340 {
       
  1341 	//Si on est sur la première page, on quitte.
       
  1342 	if(this.helpDetailsPageNumber == 0)
       
  1343 	{
       
  1344 		return;
       
  1345 	}
       
  1346 	
       
  1347 	this.helpDetailsPageNumber--;
       
  1348 	this.goToHelpDetailsPageN(this.helpDetailsPageNumber);
       
  1349 }
       
  1350 
       
  1351 /*
       
  1352  * Va à la page N des crédits.
       
  1353 */
       
  1354 Mosaic.prototype.goToHelpDetailsPageN = function(N)
       
  1355 {
       
  1356 	var notify_help = $('#notify_help'), arrowHeight = $('#help_details_upArrow').height(), margin = parseInt($('#notify_help').css('margin-left')) + parseInt($('#notify_help').css('border-width'));
       
  1357 	
       
  1358 	//Si on est sur la première page, on cache la flèche haut.
       
  1359 	if(this.helpDetailsPageNumber == 0)
       
  1360 	{
       
  1361 		//On affiche la page principale.
       
  1362 		$('#help_search, #help_controls').css('opacity', '1');
       
  1363 		
       
  1364 		$('#help_details_upArrow').css(
       
  1365 		{
       
  1366 			opacity: 0
       
  1367 		});
       
  1368 		$('#help_details_downArrow').css(
       
  1369 		{
       
  1370 			opacity: 1
       
  1371 		});
       
  1372 		$('.help_details_containers').css(
       
  1373 		{
       
  1374 			top: margin,
       
  1375 			// height: notify_help.height() - arrowHeight
       
  1376 		});
       
  1377 	}
       
  1378 	//Si on est sur la dernière page, on cache la flèche bas.
       
  1379 	else if(this.helpDetailsPageNumber + 1 >= this.helpDetailsPageLength)
       
  1380 	{
       
  1381 		//On masque la page principale.
       
  1382 		$('#help_search, #help_controls').css('opacity', '0');
       
  1383 		
       
  1384 		$('#help_details_upArrow').css(
       
  1385 		{
       
  1386 			opacity: 1
       
  1387 		});
       
  1388 		$('#help_details_downArrow').css(
       
  1389 		{
       
  1390 			opacity: 0
       
  1391 		});
       
  1392 		$('.help_details_containers').css(
       
  1393 		{
       
  1394 			top: +arrowHeight + margin,
       
  1395 			// height: notify_help.height() - arrowHeight - margin
       
  1396 		});
       
  1397 	}
       
  1398 	//Si on est dans les autres pages, on affiche les deux flèches.
       
  1399 	else
       
  1400 	{
       
  1401 		//On masque la page principale.
       
  1402 		$('#help_search, #help_controls').css('opacity', '0');
       
  1403 		
       
  1404 		$('#help_details_upArrow').css(
       
  1405 		{
       
  1406 			opacity: 1
       
  1407 		});
       
  1408 		$('#help_details_downArrow').css(
       
  1409 		{
       
  1410 			opacity: 1
       
  1411 		});
       
  1412 		$('.help_details_containers').css(
       
  1413 		{
       
  1414 			top: +arrowHeight + margin,
       
  1415 			// height: notify_help.height() - 2 * arrowHeight - margin
       
  1416 		});
       
  1417 	}
       
  1418 	
       
  1419 	//On déplace le texte des crédits.
       
  1420 	$('.help_details_containers').css(
       
  1421 	{
       
  1422 		// top: -($('.help_details_containers').height() * N - margin)// + this.column_gap)
       
  1423 		top: $('#notify_help').height() - ($('#notify_help').height() * N - margin)// + this.column_gap)
       
  1424 	});
       
  1425 }
  1290 
  1426 
  1291 /*
  1427 /*
  1292  * Retourne vrai si le doigt est sur le bouton de lecture de video dans le mode d'interaction tablettes.
  1428  * Retourne vrai si le doigt est sur le bouton de lecture de video dans le mode d'interaction tablettes.
  1293 */
  1429 */
  1294 Mosaic.prototype.isOnPlayButton = function(x, y)
  1430 Mosaic.prototype.isOnPlayButton = function(x, y)