Front IDILL:
authorbastiena
Fri, 06 Jul 2012 13:44:25 +0200
changeset 46 9d7a2aa112fb
parent 45 0e29ae4568a0
child 47 4e1ee94d70b1
Front IDILL: curves done
front_idill/src/config.json
front_idill/src/dico.json
front_idill/src/index.html
front_idill/src/lang/en.json
front_idill/src/lang/fr.json
front_idill/src/mosaic/js/mosaic.js
front_idill/src/mosaic/js/notifications.js
front_idill/src/mosaic/js/search.js
front_idill/src/pictos/big/MI/hover/bend.png
front_idill/src/pictos/big/MI/hover/knee-up.png
front_idill/src/pictos/big/MI/normal/bend.png
front_idill/src/pictos/big/MI/normal/knee-up.png
front_idill/src/pictos/big/MI/valid/bend.png
front_idill/src/pictos/big/MI/valid/knee-up.png
front_idill/src/pictos/small/MI/bend.png
front_idill/src/pictos/small/MI/knee-up.png
front_idill/src/player/metadataplayer/Timeline.js
front_idill/src/search/js/curvesDetector.js
front_idill/src/search/js/searchCanvas.js
--- a/front_idill/src/config.json	Thu Jul 05 16:04:33 2012 +0200
+++ b/front_idill/src/config.json	Fri Jul 06 13:44:25 2012 +0200
@@ -35,5 +35,6 @@
 	"host":"127.0.0.1",
 	"port":"8090",
 	"mouseUpDownDeltaTreshold":"15",
-	"dico":"./dico.json"
+	"dico":"./dico.json",
+	"lang":"en"
 }
\ No newline at end of file
--- a/front_idill/src/dico.json	Thu Jul 05 16:04:33 2012 +0200
+++ b/front_idill/src/dico.json	Fri Jul 06 13:44:25 2012 +0200
@@ -25,6 +25,30 @@
 		{
 			"name":"grand-jete",
 			"codes":["D1D0", "D2D0"]
+		},
+		{
+			"name":"wave",
+			"codes":["D0D1D0D1D0D1D0D1", "D0D2D0D2D0D2D0D2"]
+		},
+		{
+			"name":"bend",
+			"codes":["D1D3", "D1D2"]
+		},
+		{
+			"name":"knee-up",
+			"codes":["D3D0D3", "D3D2D3"]
+		},
+		{
+			"name":"no-motion",
+			"codes":["D2D1D0D5D4D3D4"]
+		},
+		{
+			"name":"circle",
+			"codes":["D4D5D0D1D2"]
+		},
+		{
+			"name":"screw",
+			"codes":["D4D5D0D1D2D3D4D1D2", "D4D5D0D1D2D0D1D2"]
 		}
 	]
 }
\ No newline at end of file
--- a/front_idill/src/index.html	Thu Jul 05 16:04:33 2012 +0200
+++ b/front_idill/src/index.html	Fri Jul 06 13:44:25 2012 +0200
@@ -99,6 +99,7 @@
 			default_parameters['port'] = '80';
 			default_parameters['mouseUpDownDeltaTreshold'] = 15;
 			default_parameters['dico'] = './dico.json';
+			default_parameters['lang'] = 'en';
 			
             /*var length = 5, imagesToShow = 20, totalImages = 23;
             //Temps de chargement du prezoom en ms (seront importés des paramètres du Middleware).
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/src/lang/en.json	Fri Jul 06 13:44:25 2012 +0200
@@ -0,0 +1,3 @@
+{
+	"gesturesText":["fall", "jump", "spin", "group spin", "bend", "arm carriage", "knee up", "breakdance", "wave", "no motion", "contact"]
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/src/lang/fr.json	Fri Jul 06 13:44:25 2012 +0200
@@ -0,0 +1,3 @@
+{
+	"gesturesText":["chute", "saut", "rotation", "rotation de groupe", "penché", "port de bras", "levé de genou", "breakdance", "ondulations", "immobilité", "contact"]
+}
\ No newline at end of file
--- a/front_idill/src/mosaic/js/mosaic.js	Thu Jul 05 16:04:33 2012 +0200
+++ b/front_idill/src/mosaic/js/mosaic.js	Fri Jul 06 13:44:25 2012 +0200
@@ -143,6 +143,8 @@
 	this.gestureDelRequested = false;
 	//Code de gesture actuellement calculé par les détecteurs de courbes.
 	this.actualCode = '';
+	//Indique si l'utilisateur est entré dans la zone de recherche.
+	this.isUserInSearchZone = false;
 	
 	//Timeout (attente) pour le zoom après un préZoom.
 	this.zoomTimeout = null;
@@ -368,7 +370,7 @@
 				//Si on gère les interactions à la souris.
 				if(_this.mouseInteractions)
 				{
-					$('body').mousemove(function(e)
+					$(window).mousemove(function(e)
 					{
 						_this.refreshMainPointer(e.pageX, e.pageY, _this);
 						_this.mousePosX = e.pageX;
@@ -407,15 +409,12 @@
 	
 	if(this.mouseInteractions)
 	{
-		//On bind le clic pour supprimer une recherche.
-		$('body').click(function(e)
+		//Si on fait un mouse down sur le body, on vérifie enregistre le déplacement de la souris jusqu'au prochain mouse up.
+		$(window).mousedown(function (e)
 		{
 			_this.removeSearchNotificationIfOnIt(e.pageX, e.pageY);
-		});
-		
-		//Si on fait un mouse down sur le body, on vérifie enregistre le déplacement de la souris jusqu'au prochain mouse up.
-		$(window).mousedown(function ()
-		{
+			
+			_this.isUserInSearchZone = true;
 			if(_this.isSearchByCurvesOn)
 			{
 				_this.searchCanvas.onPointerIn(_this.mousePosX, _this.mousePosY, null, null);
@@ -469,15 +468,15 @@
 						_this.isSearchByCurvesOn = true;
 						_this.startSearch();
 						
-						if(!_this.curvesGesturesFound)
+						/*if(!_this.curvesGesturesFound)
 						{
 							$('.notifications').remove();
 							_this.filterSearch();
-						}
+						}*/
 						
 						_this.searchCanvas.onPointerIn(_this.mousePosX, _this.mousePosY - _this.MPTop_margin, null, null);
 					}
-					else if(_this.currentMode == "FILTER" && !_this.isSearchByCurvesOn)
+					else if(_this.currentMode == "FILTER" && !_this.isSearchByCurvesOn && _this.isUserInSearchZone)
 					{
 						console.log('after search');
 						_this.preUnzoom();
@@ -495,11 +494,11 @@
 						_this.isSearchByCurvesOn = true;
 						_this.startSearch();
 						
-						if(!_this.curvesGesturesFound)
+						/*if(!_this.curvesGesturesFound)
 						{
 							$('.notifications').remove();
 							_this.searchSearch();
-						}
+						}*/
 						
 						_this.searchCanvas.onPointerIn(_this.mousePosX, _this.mousePosY - _this.MPTop_margin, null, null);
 					}
@@ -528,6 +527,8 @@
 				
 				if(_this.isSearchByCurvesOn)
 				{
+					_this.isUserInSearchZone = false;
+					
 					var gesture_match = _this.gestureWithSameCode(_this.actualCode);
 					_this.actualCode = '';
 					
@@ -562,7 +563,7 @@
 				$(window).unbind('mousemove');
 				$(window).unbind('mouseup');
 				//On rebind le mousemove principal du body, car ils ont tous été unbindés.
-				$('body').mousemove(function(e)
+				$(window).mousemove(function(e)
 				{
 					_this.refreshMainPointer(e.pageX, e.pageY, _this);
 					_this.mousePosX = e.pageX;
@@ -682,6 +683,7 @@
 		}
 		
 		_this.getDictionary();
+		_this.getLang();
 	});
 }
 
@@ -803,89 +805,6 @@
 	
 	var gestureReceived = '';
 	
-	//Sinon si on a appuyé sur 'g' ou 'G'.
-	// if(event.which == 103 || event.which == 71)
-	/*if(event == "CURVES")
-	{
-		//Si on est déjà en recherche par courbes.
-		if(this.currentMode == "SEARCH" || this.currentMode == "FILTER")
-		{
-			//On quitte cette recherche.
-			this.leaveSearch();
-			//Si on était en mode recherche.
-			if(this.currentMode == "SEARCH")
-			{
-				//On revient dans la vidéo.
-				this.currentMode = "VIDEO";
-			}
-			else
-			{
-				//Sinon c'est qu'on était dans la mosaïque.
-				this.currentMode = "MOSAIC";
-			}
-		}
-		else
-		{
-			//Si on est en plein écran.
-			if(this.fullscreen)
-			{
-				//On entre en mode recherche.
-				this.currentMode = "SEARCH";
-			}
-			//Sinon.
-			else
-			{
-				//On entre en mode filtrage.
-				this.currentMode = "FILTER";
-			}
-			
-			this.startSearch();
-		}
-	}
-	//Si c'est a ou A.
-	// else if(event.which == 65 || event.which == 97)
-	else if(event == "HELP")
-	{
-		if(!this.helpDisplayed)
-		{
-			this.notifyHelp();
-		}
-		else
-		{
-			this.removeHelp();
-		}
-	}
-	//Si c'est v ou V.
-	// else if(event.which == 86 || event.which == 118)
-	else if(event == "NOTIFY-SEARCH")
-	{
-		this.notifySearchMarkers('run;jump;fall');
-	}
-	//Si c'est b ou B.
-	// else if(event.which == 66 || event.which == 98)
-	else if(event == "REMOVE-SEARCH")
-	{
-		this.removeSearchMarkers();
-	}
-	//Si c'est k ou K.
-	// else if(event.which == 75 || event.which == 107)
-	else if(event == "FILTER")
-	{
-		this.searchFilter('circle');
-	}
-	//Si c'est l ou L.
-	// else if(event.which == 76 || event.which == 108)
-	else if(event == "REMOVE-FILTER")
-	{
-		this.removeFilter();
-	}
-	//Si on a appuié sur la touche 'q' ou 'Q';
-	// else if(event.which == 113 || event.which == 81)
-	else if(event == "UNZOOM")
-	{
-		this.unzoom();
-	}*/
-	// else if(event.which == 111 || event.which == 79)
 	if(event.indexOf("INCOMING-") != -1 && this.prephaseEnabled)
 	{
 		// console.log(this.date() + ' ' + event);
@@ -1187,6 +1106,10 @@
 				if(_this.player.widgets[0])
 				{
 					_this.player.widgets[0].setMouseInteractions(_this.mouseInteractions);
+					if(_this.gesturesText.length > 0)
+					{
+						_this.player.widgets[0].setLang(_this.gesturesText);
+					}
 				}
 				
 				if(_this.currentMode == 'VIDEO' || _this.currentMode == 'SEARCH' || _this.currentMode == 'TIMELINE')
--- a/front_idill/src/mosaic/js/notifications.js	Thu Jul 05 16:04:33 2012 +0200
+++ b/front_idill/src/mosaic/js/notifications.js	Fri Jul 06 13:44:25 2012 +0200
@@ -460,6 +460,8 @@
 		return;
 	}
 	
+	// console.trace();
+	
 	var _this = this;
 	
 	//On spécifie les notifications en div.
--- a/front_idill/src/mosaic/js/search.js	Thu Jul 05 16:04:33 2012 +0200
+++ b/front_idill/src/mosaic/js/search.js	Fri Jul 06 13:44:25 2012 +0200
@@ -51,6 +51,21 @@
 	});
 }
 
+/*
+ * Charge le texte affichable en fonction de la langue.
+*/
+mosaic.prototype.getLang = function(lang)
+{
+	var path = 'lang/' + this.config['lang'] + '.json';
+	
+	var _this = this;
+	
+	$.getJSON(path, function(data)
+	{
+		_this.gesturesText = data.gesturesText;
+	});
+}
+
 mosaic.prototype.listenToPointers = function()
 {
 	if(this.searchCanvas)
Binary file front_idill/src/pictos/big/MI/hover/bend.png has changed
Binary file front_idill/src/pictos/big/MI/hover/knee-up.png has changed
Binary file front_idill/src/pictos/big/MI/normal/bend.png has changed
Binary file front_idill/src/pictos/big/MI/normal/knee-up.png has changed
Binary file front_idill/src/pictos/big/MI/valid/bend.png has changed
Binary file front_idill/src/pictos/big/MI/valid/knee-up.png has changed
Binary file front_idill/src/pictos/small/MI/bend.png has changed
Binary file front_idill/src/pictos/small/MI/knee-up.png has changed
--- a/front_idill/src/player/metadataplayer/Timeline.js	Thu Jul 05 16:04:33 2012 +0200
+++ b/front_idill/src/player/metadataplayer/Timeline.js	Fri Jul 06 13:44:25 2012 +0200
@@ -58,6 +58,14 @@
 	}
 }
 
+/*
+ * Spécifie la langue pour l'affichage des marqueurs.
+*/
+IriSP.Widgets.Timeline.prototype.setLang = function(gesturesText)
+{
+	this.gesturesText = gesturesText;
+}
+
 //Fonction associée à l'événement : les marqueurs sont prêts.
 IriSP.Widgets.Timeline.prototype.onMarkersReady = function() {}
 
--- a/front_idill/src/search/js/curvesDetector.js	Thu Jul 05 16:04:33 2012 +0200
+++ b/front_idill/src/search/js/curvesDetector.js	Fri Jul 06 13:44:25 2012 +0200
@@ -89,7 +89,7 @@
 	this.SPActualAngle = -1;
 	this.actualCode = '';
 	
-	for(var i = 0 ; i < this.joints.length ; i++)
+	/*for(var i = 0 ; i < this.joints.length ; i++)
 	{
 		if(this.joints[i])
 		{
@@ -97,7 +97,7 @@
 		}
 	}
 	
-	this.jInc = 0;
+	this.jInc = 0;*/
 	this.MPActualDist = 0;
 	this.MPTotalDist = 0;
 }
@@ -168,7 +168,7 @@
 		
 		if(MPDist > 0)
 		{
-			MPCurrentA = this.currentAngle(this.MPrepX, this.MPrepY, this.MPx, this.MPy);
+			MPCurrentA = this.currentAngle(this.MPrepX, this.MPrepY, this.MPx, this.MPy, this.divisions);
 			// console.log(MPCurrentA);//, this.MPActualDist);
 		}
 		
@@ -198,6 +198,7 @@
 				{
 					// console.log(this.mosaic.currentMode);
 					this.mosaic.currentSearchGesture = foundGestures;
+					this.mosaic.isUserInSearchZone = false;
 					
 					if(this.mosaic.currentMode == "SEARCH" && this.mosaic.playerIsReady)
 					{
@@ -218,12 +219,14 @@
 						if(this.mosaic.isMosaicFiltered)
 						{
 							console.log('1 curve : ' + foundGestures);
+							this.mosaic.filterSearchedType = foundGestures;
+							this.mosaic.searchFilter(foundGestures);
+							this.mosaic.curvesGesturesFound = false;
+							
 							$('.notifications').remove();
-							this.mosaic.filterSearchedType = foundGestures;
 							this.mosaic.filterGesture(foundGestures, 'valid');
-							this.mosaic.searchFilter(foundGestures);
+							
 							foundGestures = '';
-							this.mosaic.curvesGesturesFound = false;
 							
 							this.mosaic.isSearchByCurvesOn = false;
 							this.mosaic.leaveSearch();
@@ -232,20 +235,20 @@
 				}
 				
 				this.MPActualDist = 0;
-				this.jInc++
+				//this.jInc++
 			}
 			else
 			{
 				this.MPrepX = this.MPpx;
 				this.MPrepY = this.MPpy;
 				
-				if(this.joints[this.jInc])
+				/*if(this.joints[this.jInc])
 				{
 					this.joints[this.jInc].remove();
 				}
 				this.joints[this.jInc] = new paper.Path.Circle(new paper.Point(this.MPrepX, this.MPrepY), 10);
 				this.joints[this.jInc].strokeColor = 'black';
-				this.joints[this.jInc].fillColor = 'green';
+				this.joints[this.jInc].fillColor = 'green';*/
 			}
 			
 			if(this.MPActualAngle == -1)
@@ -324,15 +327,15 @@
 /*
  * Calcule l'angle emprunté par le morceau de segment actuel. On prend A va vers B.
 */
-curvesDetector.prototype.currentAngle = function(xa, ya, xb, yb)
+curvesDetector.prototype.currentAngle = function(xa, ya, xb, yb, divisions)
 {
 	//On calcule l'angle de la droite AB et des abscisses, et on effectue une rotation de 90° vers la gauche.
 	var angleRad = Math.atan2((ya - yb), (xa - xb)) - Math.PI / 2;
 	//On traduit les radians en divisions en passant de [-PI/2 ; PI/2] à [0 ; divisions - 1].
-	var angleDiv = Math.floor((angleRad > 0 ? angleRad : (2*Math.PI + angleRad)) * this.divisions / (2*Math.PI));
+	var angleDiv = Math.floor((angleRad > 0 ? angleRad : (2*Math.PI + angleRad)) * divisions / (2*Math.PI));
 	
 	//L'angle initial est 0.
-	if(angleDiv == this.divisions)
+	if(angleDiv == divisions)
 	{
 		angleDiv = 0;
 	}
--- a/front_idill/src/search/js/searchCanvas.js	Thu Jul 05 16:04:33 2012 +0200
+++ b/front_idill/src/search/js/searchCanvas.js	Fri Jul 06 13:44:25 2012 +0200
@@ -91,6 +91,12 @@
 */
 searchCanvas.prototype.onPointerIn = function(mainPointerX, mainPointerY, secondPointerX, secondPointerY)
 {
+	if(this.mosaic.currentMode != 'MOSAIC' && this.mosaic.currentMode != 'FILTER')
+	{
+		mainPointerX -= 130;
+		mainPointerY -= 60;
+	}
+	
 	//On obtient les coordonnées du pointeur principal en px.
 	mainPointerX = Math.floor(mainPointerX);
 	mainPointerY = Math.floor(mainPointerY);
@@ -109,11 +115,11 @@
 	this.mainPath.strokeCap = 'round';
 	this.mainPath.strokeJoin = 'round';
 	
-	this.direction = new paper.Path();
+	/*this.direction = new paper.Path();
 	this.direction.strokeColor = '#FF0000';
 	this.direction.strokeWidth = 5;
 	this.direction.strokeCap = 'round';
-	this.direction.strokeJoin = 'round';
+	this.direction.strokeJoin = 'round';*/
 	
 	//Si on a un pointeur secondaire
 	if(secondPointerX && secondPointerY)
@@ -150,6 +156,12 @@
 {
 	// console.log('MOVE');
 	
+	if(this.mosaic.currentMode != 'MOSAIC' && this.mosaic.currentMode != 'FILTER')
+	{
+		mainPointerX -= 130;
+		mainPointerY -= 60;
+	}
+	
 	if(!this.mainPointerLastX || !this.mainPointerLastY)
 	{
 		this.mainPointerLastX = mainPointerX;
@@ -173,11 +185,11 @@
 	
 	//this.direction.remove();
 	// console.log(this.mainPointerLastX, this.mainPointerLastY);
-	var directionPoint = new paper.Point(this.mainPointerLastX, this.mainPointerLastY);
+	/*var directionPoint = new paper.Point(this.mainPointerLastX, this.mainPointerLastY);
 	var directionPointEnd = new paper.Point((mainPointerX - this.mainPointerLastX) * 2 + mainPointerX, (mainPointerY - this.mainPointerLastY) * 2 + mainPointerY);
 	this.direction.add(directionPoint);
 	this.direction.add(directionPointEnd);
-	this.direction.smooth();
+	this.direction.smooth();*/
 	
 	//Variables de construction de la courbe secondaire.
 	var secondPoint, secondDelta, secondStep, secondStepStroke, secondTop, secondBottom, secondTopStroke, secondBottomStroke;
@@ -231,7 +243,7 @@
 	this.mainPointerLastX = 0;
 	this.mainPointerLastY = 0;
 	
-	this.direction.remove();
+	// this.direction.remove();
 	
 	this.detector.reinit();