front_idill/src/mosaic/js/zoomInteractions.js
author bastiena
Mon, 23 Jul 2012 16:59:35 +0200
changeset 52 277c94533395
parent 47 4e1ee94d70b1
child 55 afd60399a7b5
permissions -rw-r--r--
Front IDILL : doc updated swipe factorized search bug fixed : when a search is not complete
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
     1
/*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
     2
* This file is part of the TraKERS\Front IDILL package.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
     3
*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
     4
* (c) IRI <http://www.iri.centrepompidou.fr/>
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
     5
*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
     6
* For the full copyright and license information, please view the LICENSE
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
     7
* file that was distributed with this source code.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
     8
*/
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
     9
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    10
/*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    11
 * Projet : TraKERS
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    12
 * Module : Front IDILL
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    13
 * Fichier : zoomInteractions.js
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    14
 * 
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    15
 * Auteur : alexandre.bastien@iri.centrepompidou.fr
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    16
 * 
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    17
 * Fonctionnalités : Définit les fonctions de zoom/dezoom prezoom/preunzoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    18
 */
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    19
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    20
/*
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    21
 * Zoom sur la position d'une image, 1ère partie. Durant le laps de temps de time ms, l'utilisateur a le choix de zoomer sur une autre image.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    22
 * Après ce laps de temps, l'image zoom complétement et il n'est plus possible de sélectionner une autre image par pointage.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    23
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    24
 * pointers > fonction pointersMosaicInteractions.
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    25
 */
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    26
Mosaic.prototype.preZoom = function(snapshot)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    27
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    28
    if(this.currentMode == "NO-USER" || this.currentMode.indexOf("INCOMING") > -1 || snapshot == null || this.helpDisplayed || this.isMosaicFiltering || this.isSearchByCurvesOn || this.gestureDelRequested)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    29
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    30
        return;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    31
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    32
    
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    33
    if(this.fullscreen)
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    34
    {
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    35
        return;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    36
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    37
	this.isPrezooming = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    38
    this.preUnzoom();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    39
    //On enlève les notifications initiales si elles existent.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    40
    this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    41
    
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    42
    //Mosaïque.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    43
    var _this = this;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    44
    //Dimensions de la mosaïque.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    45
    var h = this.height, w = this.width;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    46
    //Longueur en images, nombre d'images et taille de bordure de la mosaïque.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    47
    var len = this.config.length, imgs = this.config.imagesToShow, margin = this.marginWidth;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    48
    //Dimensions et position d'un snapshot dans la mosaïque.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    49
    var snHeight = this.snapshotHeight, snWidth = this.snapshotWidth;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    50
    var sTop = snapshot.position().top, sLeft = snapshot.position().left;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    51
    var prezoomPercentage = this.config.prezoomPercentage;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    52
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    53
    //ID de l'image actuelle.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    54
    var currentId = $('img', snapshot).attr('id');
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    55
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    56
    //Si un zoom est déjà en cours, on ne zoom sur rien d'autre en attendant que ce snapshot ai dézoomé en cas de mouseleave.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    57
    if(this.zoomed)
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    58
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    59
        this.preUnzoom();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    60
    }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    61
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    62
    //On indique qu'on a zoomé et on spécifie le snapshot sur lequel on a zoomé.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    63
    this.zoomed = true;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    64
    this.previousZoomedSN = snapshot;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    65
    this.previousId = currentId;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    66
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    67
    //On récupère les attributs de l'image.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    68
    var fakeImg = $('img', snapshot);
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    69
    //On forme la balise de la fausse image et on passe son url pour les grands snapshots.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    70
    fakeImg = '<img id="fake-' + currentId + '" class="snapshots" src="' + fakeImg.attr('src').replace('-little/', '/') + '" />';
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    71
    //On génère un faux snapshot identique au précédent et qu'on va coller dessus.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    72
    var fakeSnapshot = '<div id="prezoomContainer-' + currentId + '" class="prezoomContainers"><div id="prezoomSnapshot-' + currentId + '" class="snapshotDivs">' + fakeImg + '</div></div>';
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    73
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    74
    //On l'ajoute à la mosaïque.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    75
    $('#mainPanel').append(fakeSnapshot);
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    76
    //On modifie ses attributs.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    77
    // console.log('cid : ' + currentId, $('#fake-' + currentId).length);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    78
    $('#fake-' + currentId).load(function()
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    79
    {
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    80
    // snapshot.fadeTo(400, '0.5').delay(200).fadeTo(400, '1');
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    81
        $('#prezoomContainer-' + currentId).css('top', sTop).css('left', sLeft).css('width', (snWidth + margin)).css('height', (snHeight + margin));
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    82
        $('#prezoomSnapshot-' + currentId).css('width', (snWidth)).css('height', (snHeight));
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    83
        $('#prezoomContainer-' + currentId).css('display', 'block');
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    84
        
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    85
        //Dimensions et coordonnées initiales du div sur lequel on zoom.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    86
        var initialDivWidth = $('#prezoomContainer-' + currentId).width(), initialDivHeight = $('#prezoomContainer-' + currentId).height();
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    87
        var initialDivTop = $('#prezoomContainer-' + currentId).position().top, initialDivLeft = $('#prezoomContainer-' + currentId).position().left;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    88
        //Dimensions et coordonnées finales du div.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    89
        var finalDivWidth = initialDivWidth * (prezoomPercentage+1), diffWidth = finalDivWidth - initialDivWidth, finalDivHeight = initialDivHeight + diffWidth;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    90
        var finalDivTop = (initialDivTop - (finalDivHeight - snHeight)/2), finalDivLeft = (initialDivLeft - (finalDivWidth - snWidth)/2);
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    91
        
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    92
        //CAS PARTICULIER pour la position du snapshot zoomé : les bordures.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    93
        if(finalDivTop < 0)
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    94
        {
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    95
            finalDivTop = -margin;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    96
        }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    97
        if(finalDivTop + finalDivHeight > h)
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    98
        {
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    99
            finalDivTop = h - finalDivHeight;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   100
        }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   101
        if(finalDivLeft < 0)
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   102
        {
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   103
            finalDivLeft = 0;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   104
        }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   105
        if(finalDivLeft + finalDivWidth + margin*2 > w)
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   106
        {
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   107
            finalDivLeft = w - finalDivWidth - margin*2;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   108
        }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   109
        
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   110
        //On prézoom le div en le centrant sur le milieu du snapshot pointé.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   111
        $('#prezoomSnapshot-' + currentId).animate(
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   112
        {
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   113
            width: finalDivWidth + margin,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   114
            height: finalDivHeight - margin*2,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   115
            top: finalDivTop + margin,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   116
            left: finalDivLeft + margin
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   117
        }, _this.config.timePrezoom);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   118
        $('#prezoomContainer-' + currentId).animate(
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   119
        {
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   120
            width: finalDivWidth + margin*2,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   121
            height: finalDivHeight - margin,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   122
            top: finalDivTop + margin,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   123
            left: finalDivLeft
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   124
        }, _this.config.timePrezoom, function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   125
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   126
			//On a fini de prézoomer.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   127
			_this.isPrezooming = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   128
            //Si on est en mode Kinect.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   129
            if(!_this.config.mouseInteractions)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   130
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   131
                //On met le spinner gif sur le pointeur, s'il n'existe pas déjà.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   132
                if($('#spinner').length == 0)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   133
                {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   134
                    //On repère le pointeur ayant provoqué le prezoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   135
                    var prezoomPointer;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   136
                    if(!_this.isMainPointerDisplayed)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   137
                    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   138
                        prezoomPointer = $('#secondPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   139
                    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   140
                    if(!_this.isSecondPointerDisplayed)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   141
                    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   142
                        prezoomPointer = $('#mainPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   143
                    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   144
                    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   145
                    //On crée le spinner qui indique le temps restant avant le zoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   146
                    var spinner = "<img id='spinner'></div>";
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   147
                    $('body').append(spinner);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   148
                    $('#spinner').css(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   149
                    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   150
                        position: 'absolute',
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   151
                        top: prezoomPointer.position().top,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   152
                        left: prezoomPointer.position().left,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   153
                        width: 85,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   154
                        height: 85,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   155
                        'z-index': 600
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   156
                    });
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   157
                    $('#spinner').attr('src', './img/cursors/selector_anim_2.gif');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   158
                }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   159
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   160
            //Si on est en mode d'interaction souris, on indique juste qu'on est en prezoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   161
            else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   162
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   163
                _this.isOnAPrezoomSN = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   164
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   165
            
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   166
            //Si on est en mode mosaic, on indique juste qu'on effectue une selection.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   167
            if(_this.currentMode == 'MOSAIC')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   168
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   169
                _this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   170
                _this.mosaicSelection();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   171
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   172
            //Si on est en filtrage, mais qu'on n'a pas encore de gesture de filtrage, on indique qu'on est en filtrage et en selection.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   173
            else if(_this.currentMode == 'FILTER' && !_this.filterSearchedType && _this.curvesGesturesFound)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   174
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   175
                _this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   176
                _this.filterSearchAndSelection();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   177
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   178
            //Si on est en filtrage avec une gesture de recherche, on indique la gesture et la selection.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   179
            else if(_this.currentMode == 'FILTER' && _this.filterSearchedType)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   180
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   181
                _this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   182
                _this.filterGestureAndSelection(_this.filterSearchedType, 'valid');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   183
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   184
        });
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   185
    });
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   186
    
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   187
    //Si on est en mode Kinect, on zoom après un certain temps.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   188
    if(!this.config.mouseInteractions)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   189
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   190
        this.zoomTimeout = setTimeout(function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   191
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   192
            _this.zoom();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   193
        }, this.config.timeoutZoom);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   194
    }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   195
}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   196
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   197
/*
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   198
 * Dézoome sur la position de l'image. Il est à noter que ce dézoome diffère du dézoom global dans la mesure où celui-ci ne concerne que l'image sur laquelle on a zoomé.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   199
 * Est appelé dans les fichiers :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   200
 * pointers > fonction pointersMosaicInteractions.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   201
 * zoomInteractions > fonctions preZoom et zoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   202
 * mosaic > fonction onMouseMove.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   203
 * client > fonction processMsg.
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   204
 */
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   205
Mosaic.prototype.preUnzoom = function()
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   206
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   207
    $('#spinner').remove();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   208
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   209
    var _this = this;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   210
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   211
    //On indique qu'on n'est plus en prezoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   212
    this.isOnAPrezoomSN = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   213
    clearTimeout(this.zoomTimeout);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   214
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   215
    //Si on est en mode mosaic, on indique qu'on peut pointer ou bien rechercher.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   216
    if(this.currentMode == 'MOSAIC')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   217
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   218
        this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   219
        this.mosaicSelectionAndSearch();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   220
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   221
    //Si on est en filtrage sans gesture, on indique qu'on est juste en filtrage.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   222
    else if(_this.currentMode == 'FILTER' && !this.filterSearchedType && !this.curvesGesturesFound)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   223
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   224
        this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   225
        this.filterSearch();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   226
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   227
    //Si on est en filtrage avec gesture, on indique la gesture de filtrage.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   228
    else if(_this.currentMode == 'FILTER' && this.filterSearchedType && !this.curvesGesturesFound)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   229
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   230
        this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   231
        this.filterGesture(this.filterSearchedType, 'valid');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   232
    }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   233
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   234
    //On spécifie la marge afin de centrer le prédézoom.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   235
    var margin = this.marginWidth;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   236
    //ID du snapshot précédemment pointé.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   237
    var id = this.previousId;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   238
    //On rétrécit le snapshot de prézoom, puis on le supprime en donnant l'illusion qu'il s'agissait du véritable snapshot, alors qu'en fait c'était un clone.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   239
    for(var i = 0 ; i < this.config.imagesToShow ; i++)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   240
    {
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   241
        if($('#prezoomContainer-snapshot-' + i).length > 0)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   242
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   243
            $('#prezoomContainer-snapshot-' + i).animate(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   244
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   245
                width: this.snapshotWidth + margin,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   246
                height: this.snapshotHeight + margin,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   247
                top: $('#snapshotDiv-' + i).position().top,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   248
                left: $('#snapshotDiv-' + i).position().left
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   249
            }, this.config.preUnzoomTime, function(){ $(this).remove(); _this.zoomed = false; });
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   250
            $('#prezoomSnapshot-snapshot-' + i).animate(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   251
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   252
                width: this.snapshotWidth,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   253
                height: this.snapshotHeight,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   254
                top: $('#snapshotDiv-' + i).position().top,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   255
                left: $('#snapshotDiv-' + i).position().left
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   256
            }, this.config.preUnzoomTime);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   257
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   258
    }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   259
}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   260
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   261
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   262
/*
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   263
 * Zoom d'un snapshot en plein écran.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   264
 * Est appelé dans les fichiers :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   265
 * zoomInteractions > fonction preZoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   266
 * mosaic > fonctions onMouseUp et init.
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   267
 */
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   268
Mosaic.prototype.zoom = function()
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   269
{
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   270
    var _this = this;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   271
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   272
    //Si la mosaïque est en pleine écran, pas la peine de zoomer.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   273
    if(this.currentMode == "VIDEO" || this.currentMode == "SEARCH" || this.currentMode.indexOf("INCOMING") > -1 || this.helpDisplayed)
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   274
    {
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   275
        return;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   276
    }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   277
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   278
    //On prend les attributs nécessaires au calculs.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   279
    var margin = this.marginWidth, len = this.config.length, imgs = this.config.imagesToShow, zoomedMargin = this.config.zoomedMargin;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   280
    var zoomPercentage = this.config.zoomPercentage;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   281
    var initMPWidth = this.previousZoomedSN.width() * len + margin*len, initMPHeight = this.previousZoomedSN.height() * (imgs / len) + margin*(imgs / len);
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   282
    var newMPWidth = initMPWidth * len + zoomedMargin * (len), newMPHeight = initMPHeight * (imgs / len) + zoomedMargin * ((imgs / len));
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   283
    var newPreMPWidth = initMPWidth * len * zoomPercentage + zoomedMargin * (len), newPreMPHeight = initMPHeight * (imgs / len) * zoomPercentage + zoomedMargin * ((imgs / len));
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   284
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   285
    //Dimensions et coordonnées initiales du div sur lequel on zoom.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   286
    var initialDivWidth = this.previousZoomedSN.width(), initialDivHeight = this.previousZoomedSN.height();
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   287
    var initialDivTop = this.previousZoomedSN.position().top, initialDivLeft = this.previousZoomedSN.position().left;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   288
    //Dimensions et coordonnées finales du div.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   289
    var finalDivWidth = initialDivWidth * (zoomPercentage+1), finalDivHeight = initialDivHeight * (zoomPercentage+1);
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   290
    var newZoomTop = -this.previousZoomedSN.position().top*(newPreMPHeight/initMPHeight) - zoomedMargin/2 + (initMPHeight - initMPHeight * zoomPercentage)/2, newZoomLeft = -this.previousZoomedSN.position().left*(newPreMPWidth/initMPWidth) - zoomedMargin/2 + (initMPWidth - initMPWidth * zoomPercentage)/2;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   291
    var newSnWidth = initMPWidth * zoomPercentage, newSnHeight = initMPHeight * zoomPercentage;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   292
    
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   293
    this.preUnzoom();
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   294
    /*SINGULARITE*/
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   295
    this.fullscreen = true;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   296
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   297
    //On passe l'image du snapshot pointé en HD.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   298
    var zoomedImg = $('img', this.previousZoomedSN);
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   299
    var src = zoomedImg.attr('src');
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   300
    zoomedImg.attr('src', src.replace('-little/', '/'));
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   301
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   302
    //On récupère son ID.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   303
    var tab, zoomedImgId;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   304
    tab = _this.previousId.split('-');
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   305
    zoomedImgId = tab[1];
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   306
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   307
    //On donne les dimensions des snapshots.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   308
    $('.snapshotDivs').animate(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   309
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   310
        width: newSnWidth,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   311
        height: newSnHeight,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   312
        margin: zoomedMargin/2 + 'px',
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   313
    }, this.config.zoomTime);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   314
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   315
    if(this.currentMode != 'NO-USER')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   316
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   317
        //Les snapshots baissent alors en opacité, donnant l'impression qu'ils sont grisés.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   318
        $('.snapshotDivs').animate(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   319
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   320
            opacity: '0.4'
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   321
        }, this.config.zoomTime);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   322
        //Le snapshot du milieu revient à une opacité optimale, ce qui attire l'attention de l'utilisateur.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   323
        $(this.previousZoomedSN).animate(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   324
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   325
            opacity: '1'
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   326
        }, this.config.zoomTime);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   327
    }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   328
    //On zoome sur la mosaïque.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   329
    $('#mainPanel').animate(
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   330
    {
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   331
        width: newPreMPWidth,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   332
        height: newPreMPHeight,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   333
        top: newZoomTop,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   334
        left: newZoomLeft
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   335
    }, this.config.zoomTime, function()
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   336
    {
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   337
        _this.snTop = (zoomedImg.position().top + newZoomTop + _this.MPTop_margin), _this.snLeft = (zoomedImg.position().left + newZoomLeft);
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   338
        _this.snWidth = newSnWidth + 1, _this.snHeight = newSnHeight + 1;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   339
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   340
        _this.notifyTopVideo = newZoomTop;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   341
        _this.notifyLeftVideo = newZoomLeft;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   342
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   343
        //On charge les interactions avec les voisins.
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   344
        _this.centerId = zoomedImgId;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   345
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   346
        //Si on n'est pas en mode sans utilisateur, on passe en mode video et on regarde les voisins.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   347
        if(_this.currentMode != "NO-USER")
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   348
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   349
            _this.currentMode = 'VIDEO';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   350
            _this.listenToNeighbours();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   351
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   352
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   353
        //Si on a une recherche dans cette video.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   354
        if(_this.currentSearchGesture[_this.centerId] != '')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   355
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   356
            //On passe en recherche en indiquant la gesture de recherche.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   357
            _this.currentMode = 'SEARCH';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   358
            _this.isCurrentlyInASearchByGesture = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   359
            _this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   360
            _this.searchGesture(_this.currentSearchGesture[_this.centerId], 'valid');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   361
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   362
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   363
        //On enlève le spinner et on redonne les apparences par défaut aux pointeurs.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   364
        $('#spinner').remove();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   365
        $('#mainPointer').css('background-image', 'url(./img/cursors/pointer.png)');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   366
        $('#secondPointer').css('background-image', 'url(./img/cursors/pointer2.png)');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   367
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   368
        //On charge le player.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   369
        _this.loadPlayer(_this.snTop, _this.snLeft, _this.snWidth, _this.snHeight, newZoomTop, newZoomLeft, _this.timeToGoAt[_this.centerId]);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   370
    });
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   371
}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   372
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   373
/*
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   374
 * Retour à la taille normale de la mosaïque.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   375
 * Est appelé dans les fichiers :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   376
 * neighbours > fonction checkForDezoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   377
 * zoomInteractions > fonction zoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   378
 * mosaic > fonctions showNImages et onPlayerLoad.
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   379
 */
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   380
Mosaic.prototype.unzoom = function()
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   381
{
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   382
    //Si on n'est pas en plein écran, on quitte.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   383
    if(this.currentMode != "SEARCH" && this.currentMode != "VIDEO" && this.currentMode != "NO-USER" && this.currentMode.indexOf("INCOMING") == -1)
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   384
    {
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   385
        return;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   386
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   387
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   388
    var _this = this;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   389
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   390
    //Il n'est plus possible de swiper.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   391
    this.canSwipe = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   392
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   393
    //Si la TL avait été sélectionnée, on la déselectionne.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   394
    if(this.currentMode == 'TIMELINE')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   395
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   396
        this.exitTimeline('unzoom');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   397
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   398
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   399
    //On indique qu'on est en train de dezoomer.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   400
    this.currentlyUnzooming = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   401
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   402
    //On supprime les voisins additionnels et on déselectionne les voisins.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   403
    this.removeAdditionalNeighbours();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   404
    this.deselectAllNeighbours();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   405
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   406
    this.snTop = 0;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   407
    this.snLeft = 0;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   408
    this.Width = 0;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   409
    this.snHeight = 0;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   410
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   411
    //On charge les attributs nécessaires aux calculs.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   412
    var sWidth = this.snapshotWidth, sHeight = this.snapshotHeight;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   413
    var mpWidth = this.width, mpHeight = this.height;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   414
    var _this = this;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   415
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   416
    //On passe le snapshot sur lequel on a zoomé en SD.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   417
    var zoomedImg = $('img', this.previousZoomedSN);
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   418
    var src = zoomedImg.attr('src');
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   419
    zoomedImg.attr('src', src.replace('snapshots/', 'snapshots-little/'));
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   420
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   421
    //On libère le player.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   422
    if(_this.player.widgets && _this.player.widgets[0])
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   423
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   424
        _this.timeToGoAt[_this.centerId] = Math.floor(_this.player.popcorn.currentTime());
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   425
        _this.player.widgets[0].freePlayer();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   426
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   427
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   428
    //On indique que le player n'est pas prêt et on le supprime.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   429
    _this.playerIsReady = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   430
    $('.LdtPlayer').remove();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   431
    $('body').append('<div class="LdtPlayer" id="LdtPlayer"></div>');
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   432
    
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   433
    //On rend leur opacité aux snapshots. Qui ne sont alors plus grisés.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   434
    $('.snapshotDivs').animate(
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   435
    {
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   436
        width: sWidth,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   437
        height: sHeight,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   438
        margin: this.marginWidth/2 + 'px'
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   439
    }, this.config.unzoomTime, function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   440
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   441
        //Après le dezoom, on indique qu'on a finit de dezoomer.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   442
        _this.neighboursIds.length = 0;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   443
        _this.currentlyUnzooming = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   444
    });
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   445
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   446
    //Si l'utilisateur est là.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   447
    if(this.currentMode != 'NO-USER')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   448
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   449
        //Si l'utilisateur est déjà au moins d'interaction maximal et que la mosaique n'est pas filtrée, on rend visibles tous les snapshots.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   450
        if(this.currentMode.indexOf("INCOMING") == -1 && !this.isMosaicFiltered)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   451
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   452
            $('.snapshotDivs').animate(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   453
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   454
                opacity: '1'
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   455
            }, this.config.unzoomTime);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   456
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   457
        //Si l'utilisateur est déjà au moins d'interaction maximal et que la mosaique est filtrée, on réapplique le filtre sur la mosaique.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   458
        else if(this.currentMode.indexOf("INCOMING") == -1 && this.isMosaicFiltered)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   459
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   460
            for(var i = 0 ; i < this.config.imagesToShow ; i++)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   461
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   462
                $('#snapshotDiv-' + i).animate(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   463
                {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   464
                    opacity: this.opacities[i]
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   465
                }, this.config.unzoomTime);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   466
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   467
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   468
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   469
    //Si on est en mode sans utilisateur.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   470
    else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   471
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   472
        //On sélectionne un autre snapshot pour le jouer dans le player.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   473
        this.previousZoomedSN.fadeTo(this.config.unzoomTime, 0, function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   474
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   475
            _this.init();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   476
        });
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   477
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   478
    
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   479
    //On dézoom sur la mosaïque.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   480
    $('#mainPanel').animate(
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   481
    {
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   482
        width: mpWidth,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   483
        height: mpHeight,
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   484
        top: '0px',
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   485
        left: '0px'
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   486
    }, this.config.unzoomTime, function()
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   487
    {
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   488
        //On n'est plus en plein écran, et on ne peut plus se déplacer vers le prochain voisin.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   489
        _this.fullscreen = false;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   490
        _this.canMoveToNeighbour = false;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   491
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   492
        //Si on est au point d'interaction maximal.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   493
        if(_this.currentMode != 'NO-USER' && _this.currentMode.indexOf('INCOMING-') == -1)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   494
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   495
            //Si la mosaique est filtrée, on revient en mode de filtrage, sinon en mode mosaic.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   496
            if(_this.isMosaicFiltered)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   497
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   498
                _this.currentMode = 'FILTER';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   499
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   500
            else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   501
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   502
                _this.currentMode = 'MOSAIC';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   503
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   504
            
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   505
            //On remet les notifications initiales si on n'est pas dans une recherche par filtrage.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   506
            if(_this.currentMode == 'MOSAIC' && !_this.filterSearchedType)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   507
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   508
                _this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   509
                _this.mosaicSelectionAndSearch();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   510
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   511
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   512
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   513
        //On indique qu'on est plus en dezoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   514
        this.currentlyUnzooming = false;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   515
    });
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   516
}