front_idill/src/mosaic/js/neighbours.js
changeset 77 205409da0f32
parent 58 a28488078053
child 79 9eff85166868
--- a/front_idill/src/mosaic/js/neighbours.js	Thu Aug 02 11:54:08 2012 +0200
+++ b/front_idill/src/mosaic/js/neighbours.js	Wed Aug 08 18:40:40 2012 +0200
@@ -73,7 +73,7 @@
     
     //Si on est sur une bordure.
     //On crée des voisins supplémentaires.
-    if(_.include(this.neighboursIds, -1))
+    if(_.include(this.neighboursIds, -1) && !this.isTablet)
     {
         this.createAdditionalNeighbours();
     }
@@ -394,9 +394,12 @@
 {
     var _this = this;
     
+	var id = parseInt(id);
+	
     if(this.neighboursIds != null && this.neighboursIds.length > 0 && this.canMoveToNeighbour)
     {
-        var idx = $.inArray(id, this.neighboursIds);
+        var idx = this.neighboursIds.indexOf(id);
+		
         //Si l'id du snapshot qu'on vient de quitter fait partie des voisins.
         if(idx > -1)
         {
@@ -409,7 +412,6 @@
             //On cherche le symétrique de l'id du voisin quitté.
             //Astuce : S'il est pair, cela signifie qu'on doit faire +1, sinon c'est -1.
             //var sym = (idx % 2 == 0) ? (+idx + 1) : (idx - 1);
-            
             //S'il est > -1 alors forcément il existe.
             //Si on peut se déplacer vers un voisin, on le fait.
             if(this.neighboursIds[idx] > -1)
@@ -419,10 +421,20 @@
                 //Si l'id du tableau est pair, alors forcément le pointeur doit être plus à droite/plus en bas que le milieu de l'écran pour se déplacer vers le voisin.
                 //Sinon c'est l'inverse.
                 //(sym et idx on été échangés).
-                if(idx == 0 && x > centerWidth || idx == 2 && y > centerHeight || idx == 1 && x < centerWidth || idx == 3 && y < centerHeight)
-                {
-                    this.moveToNeighbour($('#snapshotDiv-' + this.neighboursIds[idx]));
-                }
+				if(this.isTablet)
+				{
+					if(idx > -1 && idx < 4)
+					{
+						this.moveToNeighbour($('#snapshotDiv-' + this.neighboursIds[idx]));
+					}
+				}
+				else
+				{
+					if(idx == 0 && x > centerWidth || idx == 2 && y > centerHeight || idx == 1 && x < centerWidth || idx == 3 && y < centerHeight)
+					{
+						this.moveToNeighbour($('#snapshotDiv-' + this.neighboursIds[idx]));
+					}
+				}
             }
         }
         else if(id >= this.config.imagesToShow)
@@ -443,7 +455,7 @@
     var _this = this;
     
     //Si on ne peut pas se déplacer vers les voisins, on quitte.
-    if((!this.canMoveToNeighbour || neighbour.length <= 0 || this.currentlyMoving) && !this.autoMove)
+    if((!this.canMoveToNeighbour || neighbour.length <= 0 || this.currentlyMoving || this.currentlyUnzooming) && !this.autoMove)
     {
         return;
     }
@@ -514,7 +526,7 @@
         _this.player.widgets[0].freePlayer();
         _this.playerIsReady = false;
         $('.LdtPlayer').remove();
-        $('body').append('<div class="LdtPlayer" id="LdtPlayer"></div>');
+        
     }
     
     //On obtient l'ID du div de coloration du snapshot vers lequel on se déplace afin de le supprimer.
@@ -532,6 +544,7 @@
         left: MPCurrentLeft
     }, _this.config.timeMovingToNeighbour, function()
     {
+		$('body').append('<div class="LdtPlayer" id="LdtPlayer"></div>');
         //On passe en mode recherche et on recherche dans la vidéo en fonction de la gesture de recherche enregistrée dans la nouvelle vidéo.
         if(_this.currentSearchGesture[_this.centerId] != '')
         {