front_idill/src/mosaic/js/neighbours.js
changeset 55 afd60399a7b5
parent 52 277c94533395
child 58 a28488078053
--- a/front_idill/src/mosaic/js/neighbours.js	Tue Jul 24 16:35:10 2012 +0200
+++ b/front_idill/src/mosaic/js/neighbours.js	Thu Jul 26 14:34:02 2012 +0200
@@ -46,18 +46,18 @@
     //On ne peut actuellement pas se déplacer vers un voisin.
     this.canMoveToNeighbour = false;
     //On calcule la ligne et colonne du snapshot du milieu.
-    var currentLine = Math.floor(this.centerId / this.config.length), currentColumn = this.centerId % this.config.length;
+    var currentLine = Math.floor(this.centerId / this.config.imagesByLine), currentColumn = this.centerId % this.config.imagesByLine;
     var zoomedImg = $('img', this.previousZoomedSN);
     
     //On cherche l'ID des voisins.
     //Si le voisin de gauche est sur la même ligne, on n'est pas sur la bordure de gauche.
     this.neighboursIds[0] = (currentColumn > 0) ? (this.centerId - 1) : -1;
     //Si le voisin de droite est sur la même ligne, on n'est pas sur la bordure de droite.
-    this.neighboursIds[1] = (currentColumn < this.config.length - 1) ? (+this.centerId + 1) : -1;
+    this.neighboursIds[1] = (currentColumn < this.config.imagesByLine - 1) ? (+this.centerId + 1) : -1;
     //Si le voisin du haut est sur la même colonne, on n'est pas sur la bordure du haut.
-    this.neighboursIds[2] = (currentLine > 0) ? (this.centerId - this.config.length) : -1;
+    this.neighboursIds[2] = (currentLine > 0) ? (this.centerId - this.config.imagesByLine) : -1;
     //Si le voisin du bas est sur la même colonne, on n'est pas sur la bordure du bas.
-    this.neighboursIds[3] = (currentLine < (this.config.imagesToShow / this.config.length)) ? (+this.centerId + this.config.length) : -1;
+    this.neighboursIds[3] = (currentLine < (this.config.imagesToShow / this.config.imagesByLine)) ? (+this.centerId + this.config.imagesByLine) : -1;
     
     //ID du cadre voisin.
     var preId;
@@ -90,7 +90,7 @@
     {
         return;
     }
-    
+	
     //Pour tous les voisins.
     var additionalNeighbours = '';
     for(var i = 0 ; i < this.neighboursIds.length ; i++)
@@ -459,7 +459,7 @@
     var startId = this.previousZoomedSN.attr('id').replace('snapshotDiv-', '');
     
     //On charge les attributs nécessaires aux calculs.
-    var length = _this.config.length;
+    var length = _this.config.imagesByLine;
     var MPCurrentTop = $('#mainPanel').position().top, MPCurrentLeft = $('#mainPanel').position().left;
     var divideCoeffTop = Math.floor(destinationId / length) == 0 ? 1 : Math.floor(destinationId / length);
     var divideCoeffLeft = destinationId % length == 0 ? 1 : destinationId % length;
@@ -587,7 +587,7 @@
     //Espace de centrage vertical de la mosaïque.
     var top_margin = parseInt(this.MPTop_margin);
     //Dimensions de la mosaïque en nombre de snapshots.
-    var mosW = this.config.length, mosH = this.config.imagesToShow / mosW;
+    var mosW = this.config.imagesByLine, mosH = this.config.imagesToShow / mosW;
     
     //Si le pointeur se trouve au niveau de la mosaïque.
     if(x < W * mosW && y >= top_margin && y < H * mosH + top_margin)