--- 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;
}