front_idill/src/mosaic/js/pointers.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 : pointers.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 d'interaction avec les pointeurs.
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
 * Affiche les pointeurs.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    22
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    23
 * mosaic > fonction loadMosaic.
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    24
*/
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    25
Mosaic.prototype.addPointers = function()
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    26
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    27
    //On n'affiche pas les pointeurs en mode d'interaction souris.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    28
    if(this.config.mouseInteractions)
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
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    33
    //On crée et ajoute les pointeurs.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    34
    var mainPointer = '<div id="mainPointer" class="pointers"></div>';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    35
    var secondPointer = '<div id="secondPointer" class="pointers"></div>';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    36
    $('body').append(mainPointer + secondPointer);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    37
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    38
    //On les place au centre de l'écran.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    39
    $('#secondPointer').css(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    40
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    41
        top: $(window).height() / 2 - $('#secondPointer').height() / 2,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    42
        left: $(window).width() / 4 - $('#secondPointer').width() / 2
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    43
    });
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    44
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    45
    this.secondPointerLastX = $(window).width() / 4 - $('#secondPointer').width() / 2;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    46
    this.secondPointerLastY = $(window).height() / 2 - $('#secondPointer').height() / 2;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    47
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    48
    $('#mainPointer').css(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    49
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    50
        top: $(window).height() / 2 - $('#mainPointer').height() / 2,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    51
        left: $(window).width() * 3 / 4 - $('#mainPointer').width() / 2
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    52
    });
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    53
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    54
    this.mainPointerLastX = $(window).width() * 3 / 4 - $('#mainPointer').width() / 2;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    55
    this.mainPointerLastY = $(window).height() / 2 - $('#mainPointer').height() / 2;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    56
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    57
    //On met à jour les anciennes coordonnées des pointeurs.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    58
    this.mainPointerIdleStartX = this.mainPointerLastX;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    59
    this.mainPointerIdleStartY = this.mainPointerLastY;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    60
    this.secondPointerIdleStartX = this.secondPointerLastX;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    61
    this.secondPointerIdleStartY = this.secondPointerLastY;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    62
}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    63
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    64
/*
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    65
 * Affiche/Masque le pointeur principal.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    66
 * Main est un booléen valant vrai s'il faut afficher le pointeur.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    67
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    68
 * client > fonction processMsg.
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    69
*/
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    70
Mosaic.prototype.mainPointerDisplay = function(main)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
    71
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    72
    var _this = this;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    73
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    74
    //On n'affiche pas les pointeurs dans le mode sans utilisateur ni utilisateur en phase d'approche.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    75
    if(this.currentMode != 'NO-USER' && this.currentMode.indexOf('INCOMING-') == -1)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    76
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    77
        if(main)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    78
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    79
            clearTimeout(this.arrowSpinnerTimeout);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    80
            
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    81
            $('#mainPointer').fadeTo(this.config.timeFilling, '1');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    82
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    83
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    84
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    85
    //Si le booléen est à faux, on masque le pointeur.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    86
    if(!main)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    87
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    88
        $('#spinner').remove();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    89
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    90
        $('#mainPointer').fadeTo(this.config.timeFilling, '0');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    91
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    92
        //Si on a zoomé sur une vidéo.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    93
        if(this.currentMode == 'VIDEO' || this.currentMode == 'SEARCH')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    94
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    95
            //On annule aussi la TL s'il y a lieu.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    96
            if(this.isTLSelected())
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    97
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    98
                this.isTLRequested = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
    99
                clearTimeout(this.selectTLTimeout);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   100
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   101
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   102
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   103
        if(this.isTLSelectedByMainPointer)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   104
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   105
            //On déselectionne la TL.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   106
            this.exitTimeline('');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   107
        }
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
/*
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   111
 * Affiche/Masque le pointeur secondaire.
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   112
 * Main est un booléen valant vrai s'il faut afficher le pointeur.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   113
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   114
 * client > fonction processMsg.
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   115
*/
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   116
Mosaic.prototype.secondPointerDisplay = function(second)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   117
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   118
    //On n'affiche pas les pointeurs dans le mode sans utilisateur ni utilisateur en phase d'approche.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   119
    if(this.currentMode != 'NO-USER' && this.currentMode.indexOf('INCOMING-') == -1)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   120
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   121
        if(second)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   122
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   123
            clearTimeout(this.arrowSpinnerTimeout);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   124
            
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   125
            $('#secondPointer').fadeTo(this.config.timeFilling, '1');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   126
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   127
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   128
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   129
    //Si le booléen est à faux, on masque le pointeur.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   130
    if(!second)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   131
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   132
        $('#spinner').remove();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   133
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   134
        $('#secondPointer').fadeTo(this.config.timeFilling, '0');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   135
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   136
        if(this.isTLSelectedBySecondPointer)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   137
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   138
            //On déselectionne la TL.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   139
            this.exitTimeline('');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   140
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   141
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   142
}
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
 * Assure les interactions des pointeurs avec la mosaique.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   146
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   147
 * pointers > fonction refreshPointers.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   148
*/
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   149
Mosaic.prototype.pointersMosaicInteractions = function(pointerX, pointerY, isMainPointer)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   150
{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   151
	var snapshot = null, isOtherPointerDisplayed, pointer, pointerImg;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   152
	
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   153
	if(isMainPointer)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   154
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   155
		isOtherPointerDisplayed = this.isSecondPointerDisplayed;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   156
		pointer = $('#mainPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   157
		pointerImg = 'url(./img/cursors/pointer.png)';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   158
	}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   159
	else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   160
	{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   161
		isOtherPointerDisplayed = this.isMainPointerDisplayed;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   162
		pointer = $('#secondPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   163
		pointerImg = 'url(./img/cursors/pointer2.png)';
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   164
	}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   165
	
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   166
	//On regarde si on est sur un snapshot.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   167
	snapshot = this.pointerPositionToSN(pointerX, pointerY, true);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   168
	
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   169
	//Si c'est le cas, on récupère son id.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   170
	if(this.previousZoomedSN != null)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   171
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   172
		var id = this.previousZoomedSN.attr('id').replace('snapshotDiv-', '');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   173
	}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   174
	
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   175
	//Sinon, on effectue un preunzoom et on redonne son apparence au pointeur principal.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   176
	if(snapshot == null)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   177
	{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   178
		this.isOnASnapshot = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   179
		this.lastNonNullSN = this.previousZoomedSN;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   180
		this.preUnzoom();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   181
		
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   182
		var image
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   183
		
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   184
		pointer.css('background-image', pointerImg);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   185
	}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   186
	
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   187
	//Si le pointeur secondaire n'est pas affiché et qu'on est sur un snapshot ou que le dernier snapshot sur lequel on est allé n'est pas nul et que les deux pointeurs ne sont pas là en même temps.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   188
	if(!isOtherPointerDisplayed && snapshot != null && (this.previousZoomedSN != null && snapshot.attr('id') !== this.previousZoomedSN.attr('id') || this.lastNonNullSN != null && snapshot.attr('id') === this.lastNonNullSN.attr('id')) && !this.areBothPointersHere)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   189
	{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   190
		//On prézoom sur le snapshot sélectionné et on change l'apparence du pointeur.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   191
		this.isOnASnapshot = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   192
		this.previousZoomedSN = snapshot;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   193
		this.lastNonNullSN = null;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   194
		this.preZoom(snapshot);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   195
		
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   196
		pointer.css('background-image', 'url(./img/cursors/selector_gray.png)');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   197
	}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   198
	
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   199
	//Si on se trouve actuellement dans une recherche par gestures.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   200
	if(this.isMosaicFiltered && !this.isMosaicFiltering)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   201
	{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   202
		//On vérifie si on se trouve sur une notification.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   203
		this.checkIfPointerIsOnSearchNotification(pointerX, pointerY, pointer);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   204
	}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   205
}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   206
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   207
/*
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   208
 * Assure les interactions des pointeurs avec la mosaique.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   209
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   210
 * pointers > fonction refreshPointers.
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   211
*/
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   212
Mosaic.prototype.pointersVideoInteractions = function(pointerX, pointerY, isMainPointer)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   213
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   214
	var _this = this, pointer, thisPointerNeighbourSelectedId, pointerImg, thisPointerExitBorder, otherPointerExitBorder;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   215
	
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   216
	if(isMainPointer)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   217
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   218
		pointer = $('#mainPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   219
		thisPointerNeighbourSelectedId = this.mainPointerNeighbourSelectedId;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   220
		pointerImg = 'url(./img/cursors/pointer.png)';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   221
		thisPointerExitBorder = this.mainPointerExitBorder;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   222
		otherPointerExitBorder = this.secondPointerExitBorder;
45
0e29ae4568a0 Front IDILL:
bastiena
parents: 44
diff changeset
   223
	}
0e29ae4568a0 Front IDILL:
bastiena
parents: 44
diff changeset
   224
	else
0e29ae4568a0 Front IDILL:
bastiena
parents: 44
diff changeset
   225
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   226
		pointer = $('#secondPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   227
		thisPointerNeighbourSelectedId = this.secondPointerNeighbourSelectedId;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   228
		pointerImg = 'url(./img/cursors/pointer2.png)';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   229
		thisPointerExitBorder = this.secondPointerExitBorder;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   230
		otherPointerExitBorder = this.mainPointerExitBorder;
45
0e29ae4568a0 Front IDILL:
bastiena
parents: 44
diff changeset
   231
	}
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   232
	
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   233
	var zoomX = pointerX - this.notifyLeftVideo, zoomY = pointerY - this.notifyTopVideo;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   234
		
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   235
	//On calcule les interactions du pointeur avec la timeline.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   236
	this.pointersTimelineSelection(pointerX, pointerY, isMainPointer);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   237
	
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   238
	//Si on se trouve actuellement dans une recherche par gestures.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   239
	if(this.isCurrentlyInASearchByGesture)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   240
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   241
		this.checkIfPointerIsOnSearchNotification(pointerX, pointerY, pointer);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   242
	}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   243
	
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   244
	//on vérifie si le pointeur est sur un snapshot zoomé.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   245
	snapshot = this.pointerPositionToSN(zoomX, zoomY, true);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   246
	if(snapshot == null)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   247
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   248
		pointer.css('background-image', pointerImg);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   249
		snapshot = this.pointerPositionToAN(pointerX, pointerY);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   250
	}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   251
	
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   252
	var intValueOfId;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   253
	//Si c'est le cas.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   254
	if(snapshot != null && snapshot.length > 0)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   255
	{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   256
		//S'il s'agit d'un voisin additionnel.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   257
		if(snapshot.attr('id').indexOf('borderNeighbour') != -1)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   258
		{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   259
			intValueOfId = parseInt(snapshot.attr('id').replace('borderNeighbour-', ''));
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   260
		}
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   261
		//Sinon si c'est un voisin normal.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   262
		else
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   263
		{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   264
			intValueOfId = parseInt(snapshot.attr('id').replace('snapshotDiv-', ''));
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   265
		}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   266
	}
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   267
	else
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   268
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   269
		intValueOfId = -2;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   270
	}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   271
	
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   272
	//Si c'est un voisin additionnel.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   273
	if(snapshot != null && snapshot.attr('id').indexOf('borderNeighbour') != -1)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   274
	{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   275
		//S'il a été trouvé parmi les voisins du centre.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   276
		if(intValueOfId > -1 && intValueOfId < 5)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   277
		{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   278
			//On le sélectionne.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   279
			this.selectNeighbour(snapshot, pointer);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   280
			if(isMainPointer)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   281
			{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   282
				this.mainPointerExitBorder = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   283
				this.mainPointerNeighbourSelectedId = intValueOfId + this.config.imagesToShow;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   284
			}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   285
			else
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   286
			{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   287
				this.secondPointerExitBorder = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   288
				this.secondPointerNeighbourSelectedId = intValueOfId + this.config.imagesToShow;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   289
			}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   290
		}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   291
		else
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   292
		{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   293
			//Sinon on le déselectionne.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   294
			if(thisPointerNeighbourSelectedId != null && thisPointerNeighbourSelectedId > -1)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   295
			{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   296
				this.deselectNeighbour(thisPointerNeighbourSelectedId);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   297
			}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   298
		}
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   299
	}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   300
	else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   301
	{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   302
		//Si c'est un voisin.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   303
		if(_.include(this.neighboursIds, intValueOfId))
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   304
		{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   305
			//On le sélectionne.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   306
			this.selectNeighbour(snapshot, pointer);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   307
			clearTimeout(this.moveToNeighbourTimeout);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   308
			if(isMainPointer)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   309
			{
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   310
				clearTimeout(this.mainPointerExitBorderTimeout);
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   311
				this.mainPointerExitBorder = true;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   312
				this.mainPointerNeighbourSelectedId = intValueOfId;
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   313
			}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   314
			else
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   315
			{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   316
				clearTimeout(this.secondPointerExitBorderTimeout);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   317
				this.secondPointerExitBorder = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   318
				this.secondPointerNeighbourSelectedId = intValueOfId;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   319
			}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   320
		}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   321
		else
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   322
		{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   323
			//Sinon on déselectionne le snapshot.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   324
			if(thisPointerNeighbourSelectedId != null && thisPointerNeighbourSelectedId > -1)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   325
			{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   326
				this.deselectNeighbour(thisPointerNeighbourSelectedId);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   327
				
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   328
				//Si le pointeur quitte le voisin sans que l'autre pointeur ne fasse de même ailleurs.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   329
				if(thisPointerExitBorder && !otherPointerExitBorder)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   330
				{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   331
					//On va vers le voisin.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   332
					this.correctMoveToNeighbour(thisPointerNeighbourSelectedId, zoomX, zoomY);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   333
				}
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   334
				
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   335
				//Il n'est possible de se déplacer vers un voisin que dans un certain laps de temps lorsqu'on quitte la sélection d'un voisin.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   336
				this.moveToNeighbourTimeout = setTimeout(function()
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   337
				{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   338
					_this.canMoveToNeighbour = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   339
				}, this.config.timeoutMoveToNeighbour);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   340
				
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   341
				if(isMainPointer)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   342
				{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   343
					this.mainPointerExitBorderTimeout = setTimeout(function()
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   344
					{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   345
						_this.mainPointerExitBorder = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   346
					}, this.config.timeoutUnzoom);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   347
				}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   348
				else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   349
				{
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   350
					this.secondPointerExitBorderTimeout = setTimeout(function()
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   351
					{
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   352
						_this.secondPointerExitBorder = false;
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   353
					}, this.config.timeoutUnzoom);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   354
				}
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   355
				
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   356
				//On regarde si on a voulu faire de dézoom.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   357
				this.checkForDezoom();
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   358
			}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   359
		}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   360
	}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   361
}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   362
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   363
/*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   364
 * Assure les interactions des pointeurs avec la timeline.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   365
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   366
 * pointers > fonction pointersVideoInteractions.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   367
*/
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   368
Mosaic.prototype.pointersTimelineSelection = function(pointerX, pointerY, isMainPointer)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   369
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   370
	var _this = this, pointer, isTLSelectedByThisPointer, isTLSelectedByOtherPointer, isOtherPointerDisplayed;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   371
	
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   372
	if(isMainPointer)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   373
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   374
		pointer = $('#mainPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   375
		isTLSelectedByThisPointer = this.isTLSelectedByMainPointer;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   376
		isTLSelectedByOtherPointer = this.isTLSelectedBySecondPointer;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   377
		isOtherPointerDisplayed = this.isSecondPointerDisplayed;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   378
	}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   379
	else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   380
	{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   381
		pointer = $('#secondPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   382
		isTLSelectedByThisPointer = this.isTLSelectedBySecondPointer;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   383
		isTLSelectedByOtherPointer = this.isTLSelectedByMainPointer;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   384
		isOtherPointerDisplayed = this.isMainPointerDisplayed;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   385
	}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   386
	
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   387
	//On vérifie si on veut sélectionner la TL.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   388
	if((this.currentMode != 'TIMELINE' || this.isTLRequested) && this.playerIsReady && !isTLSelectedByOtherPointer && !this.helpDisplayed)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   389
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   390
		//Si la timeline est sélectionnée.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   391
		if(this.isTLSelected(true, true) && !this.isTLRequested)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   392
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   393
			//On a demandé à aller dans la TL.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   394
			this.isTLRequested = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   395
			if(isMainPointer)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   396
			{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   397
				this.isTLSelectedByMainPointer = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   398
				this.isTLSelectedBySecondPointer = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   399
			}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   400
			else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   401
			{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   402
				this.isTLSelectedBySecondPointer = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   403
				this.isTLSelectedByMainPointer = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   404
			}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   405
			this.currentMode = 'TIMELINE';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   406
			this.player.widgets[0].selectTimeline();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   407
			pointer.css('background-image', 'url(./img/cursors/selector_gray.png)');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   408
			
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   409
			//Si on est en mode d'interaction Kinect.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   410
			if(!this.config.mouseInteractions)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   411
			{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   412
				//On met le spinner gif sur le pointeur.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   413
				var spinner = "<img id='spinner'></div>";
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   414
				$('body').append(spinner);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   415
				$('#spinner').css(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   416
				{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   417
					position: 'absolute',
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   418
					top: pointer.position().top,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   419
					left: pointer.position().left,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   420
					width: 85,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   421
					height: 85,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   422
					'z-index': 600
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   423
				});
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   424
				$('#spinner').attr('src', './img/cursors/selector_anim.gif');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   425
			}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   426
			
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   427
			this.selectTLTimeout = setTimeout(function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   428
			{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   429
				//On permet l'interaction après un laps de temps.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   430
				_this.canSlideInTL = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   431
				_this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   432
				_this.timelineTimeline();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   433
			}, this.config.timeoutSlideTL);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   434
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   435
		//Sinon si on était sur la timeline sans qu'elle soit sélectionnée encore et qu'on l'a quitté avant la sélection.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   436
		else if(!this.isTLSelected(true, true) && this.isTLRequested)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   437
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   438
			this.isTLRequested = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   439
			clearTimeout(this.selectTLTimeout);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   440
			//On déselectionne la TL.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   441
			this.exitTimeline('');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   442
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   443
	}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   444
	
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   445
	//Si on a quitté la timeline après une sélection.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   446
	if(isTLSelectedByThisPointer && !this.isTLSelected(false, true))
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   447
	{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   448
		//On déselectionne la TL.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   449
		this.exitTimeline('');
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   450
	}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   451
	
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   452
	//Si on a sélectionné la TL et qu'on a le pointeur droit dessus, on peut modifier la position de lecture.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   453
	if(this.currentMode == 'TIMELINE' && this.playerIsReady && !isOtherPointerDisplayed && this.canSlideInTL)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   454
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   455
		var time, TL = $('.Ldt-Timeline'), P = $('.LdtPlayer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   456
		
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   457
		//Si le pointeur est trop à gauche, on met le curseur de lecture à 0.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   458
		if(pointerX < P.position().left)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   459
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   460
			time = 0;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   461
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   462
		//S'il est trop à droite, on le place à la fin.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   463
		else if(pointerX > (+P.position().left + TL.width()))
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   464
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   465
			time = this.player.widgets[0].source.getDuration().getSeconds();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   466
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   467
		//Sinon, on le met à la position du pointeur.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   468
		else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   469
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   470
			time = this.player.widgets[0].scaleIntervals(P.position().left, (+P.position().left + TL.width()), 0, this.player.widgets[0].source.getDuration().getSeconds(), pointerX);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   471
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   472
		
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   473
		this.player.popcorn.currentTime(time);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   474
	}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   475
}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   476
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   477
/*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   478
 * Raffraîchit la position des pointeurs.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   479
 * Est appelé dans les fichiers :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   480
 * mosaic > fonction loadMosaic.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   481
 * client > fonction processMsg.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   482
*/
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   483
Mosaic.prototype.refreshPointers = function(x, y, isMainPointer)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   484
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   485
    if(this.currentMode == "NO-USER" || this.currentMode.indexOf('INCOMING-') != -1)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   486
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   487
        return;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   488
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   489
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   490
    //Si on est en mode d'interaction Kinect, on effectue un réhaussement de la position.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   491
    if(!this.config.mouseInteractions)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   492
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   493
        x *= 7;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   494
        y *= 7;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   495
        x -= $(window).width() * 3 / 4;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   496
        y -= $(window).height() * 2 / 4;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   497
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   498
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   499
	var pointer;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   500
	
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   501
	//S'il s'agit du pointeur principal.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   502
	if(isMainPointer)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   503
	{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   504
		//On affecte les éléments relatifs au pointeur principal.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   505
		pointer = $('#mainPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   506
		
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   507
		//Si le pointeur quitte la fenêtre en X, on ne le change pas.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   508
		if(x < 0 || x > $(window).width())
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   509
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   510
			x = this.mainPointerLastX;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   511
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   512
		//Sinon, on le met à jour.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   513
		else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   514
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   515
			this.mainPointerLastX = x;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   516
		}
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   517
		
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   518
		//Si le pointeur quitte la fenêtre en Y, on ne le change pas.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   519
		if(y < 0 || y > $(window).height())
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   520
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   521
			y = this.mainPointerLastY;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   522
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   523
		//Sinon, on le met à jour.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   524
		else
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   525
		{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   526
			this.mainPointerLastY = y;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   527
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   528
	}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   529
	//Sinon.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   530
	else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   531
	{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   532
		//On affecte les éléments relatifs au pointeur principal.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   533
		pointer = $('#secondPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   534
		
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   535
		//Si le pointeur quitte la fenêtre en X, on ne le change pas.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   536
		if(x < 0 || x > $(window).width())
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   537
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   538
			x = this.secondPointerLastX;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   539
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   540
		//Sinon, on le met à jour.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   541
		else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   542
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   543
			this.secondPointerLastX = x;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   544
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   545
		
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   546
		//Si le pointeur quitte la fenêtre en Y, on ne le change pas.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   547
		if(y < 0 || y > $(window).height())
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   548
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   549
			y = this.secondPointerLastY;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   550
		}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   551
		//Sinon, on le met à jour.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   552
		else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   553
		{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   554
			this.secondPointerLastY = y;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   555
		}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   556
	}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   557
	
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   558
    var pointerX, pointerY;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   559
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   560
    //Si on est en mode d'interaction souris, on met à jour les coordonnées utilisées dans les fonctions par celles de la souris.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   561
    //Sinon on se base sur les coordonnées des pointeurs.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   562
    if(this.config.mouseInteractions)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   563
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   564
        pointerX = x;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   565
        pointerY = y;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   566
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   567
    else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   568
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   569
        pointerX = x - pointer.width()/2;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   570
        pointerY = y - pointer.height()/2;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   571
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   572
    var _this = this;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   573
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   574
    pointer.css(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   575
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   576
        top: pointerY,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   577
        left: pointerX
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   578
    });
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   579
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   580
    if($('#spinner').length > 0)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   581
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   582
        $('#spinner').css(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   583
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   584
            top: pointerY,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   585
            left: pointerX
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   586
        });
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   587
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   588
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   589
    var snapshot = null;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   590
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   591
    //Si on est dans la mosaique ou en filtrage.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   592
    if(this.currentMode == 'MOSAIC' || this.currentMode == 'FILTER' && this.isMosaicFiltered)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   593
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   594
		this.pointersMosaicInteractions(pointerX, pointerY, isMainPointer);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   595
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   596
    //Si on est dans une vidéo ou dans une recherche ou dans la timeline.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   597
    else if(this.currentMode == 'VIDEO' || this.currentMode == 'SEARCH' || this.currentMode == 'TIMELINE')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   598
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   599
		this.pointersVideoInteractions(pointerX, pointerY, isMainPointer);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   600
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   601
}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   602
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   603
/*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   604
 * Détecte si les deux pointeurs sont dans la zone de recherche et qu'ils ne bougent pas.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   605
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   606
 * client > fonction processMsg.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   607
*/
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   608
Mosaic.prototype.detectIdlePointers = function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   609
{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   610
    var mainPointer = $('#mainPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   611
    var secondPointer = $('#secondPointer');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   612
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   613
    //Si la position des pointeurs au début de l'analyse d'idle change de plus ou moins leur taille par rapport à leur position actuelle.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   614
    if(Math.abs(this.mainPointerIdleStartX - this.mainPointerLastX) > mainPointer.width() || Math.abs(this.mainPointerIdleStartY - this.mainPointerLastY) > mainPointer.height() ||
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   615
    Math.abs(this.secondPointerIdleStartX - this.secondPointerLastX) > secondPointer.width() || Math.abs(this.secondPointerIdleStartY - this.secondPointerLastY) > secondPointer.height())
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   616
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   617
        //On réinitialise les dernières positions connues.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   618
        this.mainPointerIdleStartX = this.mainPointerLastX;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   619
        this.mainPointerIdleStartY = this.mainPointerLastY;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   620
        this.secondPointerIdleStartX = this.secondPointerLastX;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   621
        this.secondPointerIdleStartY = this.secondPointerLastY;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   622
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   623
        this.removeIdlePointers();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   624
        this.pointersIdleNeedLaunch = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   625
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   626
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   627
    //Si l'aide est affichée, on la masque.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   628
    if(this.helpDisplayed)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   629
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   630
        this.removeHelp();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   631
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   632
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   633
    if((this.currentMode == 'SEARCH' || this.currentMode == 'FILTER') && !this.isSearchByCurvesOn)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   634
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   635
        // this.isSearchByCurvesOn = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   636
        // this.startSearch();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   637
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   638
}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   639
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   640
/*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   641
 * Enlève la vérification sur les pointeurs qui ne bougent pas.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   642
 * Est appelé dans les fichiers :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   643
 * pointers > detectIdlePointers.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   644
 * client > fonction processMsg.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   645
*/
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   646
Mosaic.prototype.removeIdlePointers = function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   647
{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   648
    clearTimeout(this.pointersSearchIdleTimeout);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   649
}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   650
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   651
/*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   652
 * Lance une vérification sur les pointeurs qui ne bougent pas.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   653
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   654
 * client > fonction processMsg.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   655
*/
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   656
Mosaic.prototype.launchIdlePointers = function()
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   657
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   658
    var _this = this;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   659
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   660
    //Si on est en mode TL, on ne peut pas effectuer de recherche.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   661
    if(this.currentMode == 'TIMELINE' || (!this.playerIsReady && (this.currentMode == 'VIDEO' || this.currentMode == 'SEARCH')))
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   662
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   663
        return;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   664
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   665
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   666
    if(this.currentMode == 'VIDEO')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   667
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   668
        //On peut le faire que sur la video au dessus de la TL.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   669
        var mainPointer = $('#mainPointer'), secondPointer = $('#secondPointer'), TL = $('.Ldt-Timeline');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   670
        var TLwidth = TL.width(), TLheight = TL.height();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   671
        var Ptop = $('.LdtPlayer').position().top, Pleft = $('.LdtPlayer').position().left;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   672
        var Pheight = $('.LdtPlayer').height();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   673
        var MPx = mainPointer.position().left + mainPointer.width() / 2, MPy = mainPointer.position().top + mainPointer.height() / 2;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   674
        var SPx = secondPointer.position().left + secondPointer.width() / 2, SPy = secondPointer.position().top + secondPointer.height() / 2;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   675
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   676
        //Si les pointeurs ne sont pas sur le player, on part.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   677
        if(MPx < Pleft || MPx > (+Pleft + TLwidth) || MPy < Ptop || MPy > (+Ptop + Pheight - TLheight) ||
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   678
        SPx < Pleft || SPx > (+Pleft + TLwidth) || SPy < Ptop || SPy > (+Ptop + Pheight - TLheight))
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   679
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   680
            return;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   681
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   682
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   683
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   684
    //A la fin du timeout, si rien n'est venu l'interrompre, on entre en recherche/filtrage en fonction du mode dans lequel on se trouve.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   685
    this.pointersSearchIdleTimeout = setTimeout(function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   686
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   687
        //Si les deux pointeurs ne sont pas dans la zone de recherche, on part.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   688
        if(!_this.areBothPointersHere)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   689
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   690
            return;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   691
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   692
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   693
        //Si on est dans la mosaique.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   694
        if(_this.currentMode == "MOSAIC")
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   695
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   696
            //On passe en filtrage.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   697
            _this.currentMode = "FILTER";
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   698
            _this.isMosaicFiltered = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   699
            //On notifie.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   700
            _this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   701
            _this.filterSearch();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   702
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   703
        //Si on est dans la video ou dans la timeline.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   704
        else if(_this.currentMode == "VIDEO" || _this.currentMode == "TIMELINE")
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   705
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   706
            //On entre en recherche.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   707
            _this.currentMode = "SEARCH";
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   708
            //On notifie.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   709
            _this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   710
            _this.searchSearch();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   711
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   712
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   713
        //Si on ne peut pas afficher l'aide.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   714
        if(!_this.canNotifyHelp)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   715
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   716
            //On peut l'afficher après un laps de temps.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   717
            _this.canNotifyHelpTimeout = setTimeout(function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   718
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   719
                _this.canNotifyHelp = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   720
            }, _this.config.timeoutCanNotifyHelp);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   721
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   722
    }, this.config.timeoutPointersIdle);
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   723
}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   724
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   725
/*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   726
 * Vérifie si les deux pointeurs sont dans la zone de recherche.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   727
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   728
 * client > fonction processMsg.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   729
*/
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   730
Mosaic.prototype.checkForBothPointersHere = function()
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   731
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   732
    var _this = this;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   733
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   734
    //Si le timeout de vérification n'a pas été lancé.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   735
    if(!this.areBothPointersTimeoutLaunched)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   736
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   737
        //On le lance.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   738
        this.areBothPointersHereTimeout = setTimeout(function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   739
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   740
            //On considère après un laps de temps qu'au moins une des mains a quitté la zone sauf si on est notifié du contraire.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   741
            _this.areBothPointersHere = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   742
        }, this.config.timeoutAreBothPointersHere);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   743
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   744
        //On spécifie qu'on l'a lancé.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   745
        this.areBothPointersHereTimeoutLaunched = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   746
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   747
}
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   748
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   749
/*
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   750
 * Enlève la vérification de présence des deux pointeurs dans la zone de recherche.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   751
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   752
 * client > fonction processMsg.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   753
*/
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   754
Mosaic.prototype.removeCheckForBothPointersHere = function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   755
{
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   756
    //On désactive le timeout.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   757
    clearTimeout(this.areBothPointersHereTimeout);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   758
    //On indique que la vérification n'est pas lancée.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   759
    this.areBothPointersHereTimeoutLaunched = false;
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   760
}
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   761
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   762
/*
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   763
 * Vérifie si on se trouve sur la notification de recherche par gesture.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   764
 * Est appelé dans le fichier :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   765
 * pointers > fonctions pointersMosaicInteractions et pointersVideoInteractions.
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   766
*/
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   767
Mosaic.prototype.checkIfPointerIsOnSearchNotification = function(x, y, pointer)
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   768
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   769
    var _this = this;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   770
    var notification_search = $('#notify_search_1gesture');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   771
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   772
    //Si la notification de recherche existe (dans le player).
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   773
    if(notification_search.length > 0)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   774
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   775
        //Pictogramme actuel de la notification.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   776
        var currentPicto = notification_search.css('background-image');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   777
        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   778
        //Si le pointeur est sur la notification.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   779
        if(x > notification_search.position().left && x < (+notification_search.position().left + notification_search.width()) && y > notification_search.position().top && y < (+notification_search.position().top + notification_search.height()))
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   780
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   781
            if(!this.alreadyOnNotification && ($('#spinner').length == 0 && !this.config.mouseInteractions || this.config.mouseInteractions))
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   782
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   783
                notification_search.css('background-image', currentPicto.replace('/big/' + (this.config.mouseInteractions ? 'MI/' : '') + 'valid/', '/big/' + (this.config.mouseInteractions ? 'MI/' : '') + 'hover/'));
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   784
                
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   785
                //On émet la requete de suppression de la notification.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   786
                this.gestureDelRequested = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   787
                
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   788
                //Si on est en interaction Kinect.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   789
                if(!this.config.mouseInteractions)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   790
                {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   791
                    //On met le spinner gif sur le pointeur.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   792
                    var spinner = "<img id='spinner'></div>";
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   793
                    $('body').append(spinner);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   794
                    $('#spinner').css(
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   795
                    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   796
                        position: 'absolute',
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   797
                        top: pointer.position().top,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   798
                        left: pointer.position().left,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   799
                        width: 85,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   800
                        height: 85,
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   801
                        'z-index': 600
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   802
                    });
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   803
                    $('#spinner').attr('src', './img/cursors/selector_anim.gif');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   804
                    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   805
                    //Après un laps de temps sur la notification, on supprime la recherche et on revient au mode précédent.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   806
                    this.removeNotificationByGestureTimeout = setTimeout(function()
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   807
                    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   808
                        //Si on est en recherche, on revient en video.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   809
                        if(_this.currentMode == 'SEARCH')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   810
                        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   811
                            _this.player.widgets[0].removeSearchByGesture();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   812
                            _this.currentMode = 'VIDEO';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   813
                        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   814
                        //Si on est en timeline, on revient en timeline.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   815
                        else if(_this.currentMode == 'TIMELINE')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   816
                        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   817
                            _this.player.widgets[0].removeSearchByGesture();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   818
                            _this.currentMode = 'TIMELINE';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   819
                        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   820
                        //Si on est en filtrage, on l'enlève.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   821
                        else if(_this.currentMode == 'FILTER')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   822
                        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   823
                            _this.removeFilter();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   824
                        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   825
                        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   826
                        _this.alreadyOnNotification = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   827
                        _this.isCurrentlyInASearchByGesture = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   828
                        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   829
                        //Si on n'est ni en recherche, ni en filtrage, on enlève la gesture de recherche.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   830
                        if(_this.currentMode != 'MOSAIC' && _this.currentMode != 'FILTER')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   831
                        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   832
                            _this.currentSearchGesture[_this.centerId] = '';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   833
                        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   834
                        
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   835
                        _this.canNotifyHelp = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   836
                    }, this.config.timeoutRemoveNotificationByGesture);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   837
                }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   838
                
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   839
                this.alreadyOnNotification = true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   840
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   841
            //On retourne vrai si on est sur la notification, et faux sinon.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   842
            return true;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   843
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   844
        //S'il n'est pas sur la notification.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   845
        else
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   846
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   847
            //Si on était sur la notification, on remet la notification dans l'état où elle était avant qu'on soit dessus.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   848
            if(this.alreadyOnNotification)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   849
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   850
                notification_search.css('background-image', currentPicto.replace('/big/' + (this.config.mouseInteractions ? 'MI/' : '') + 'hover/', '/big/' + (this.config.mouseInteractions ? 'MI/' : '') + 'valid/'));
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   851
                
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   852
                this.gestureDelRequested = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   853
                
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   854
                clearTimeout(this.removeNotificationByGestureTimeout);
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   855
                this.alreadyOnNotification = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   856
                $('#spinner').remove();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   857
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   858
            
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   859
            return false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   860
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   861
    }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   862
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   863
    return false;
45
0e29ae4568a0 Front IDILL:
bastiena
parents: 44
diff changeset
   864
}
0e29ae4568a0 Front IDILL:
bastiena
parents: 44
diff changeset
   865
0e29ae4568a0 Front IDILL:
bastiena
parents: 44
diff changeset
   866
/*
0e29ae4568a0 Front IDILL:
bastiena
parents: 44
diff changeset
   867
 * Si on se trouve sur la notification de recherche par gesture, on la supprime.
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   868
 * Est appelé dans les fichiers :
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   869
 * mosaic > onMouseDown.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   870
 * zoomInteractions > unzoom.
45
0e29ae4568a0 Front IDILL:
bastiena
parents: 44
diff changeset
   871
*/
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   872
Mosaic.prototype.removeSearchNotificationIfOnIt = function(x, y)
45
0e29ae4568a0 Front IDILL:
bastiena
parents: 44
diff changeset
   873
{
52
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   874
    var _this = this;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   875
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   876
    var notification_search = $('#notify_search_1gesture');
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   877
    
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   878
    //Si la notification de recherche existe (dans le player).
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   879
    if(notification_search.length > 0)
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   880
    {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   881
        if(x > notification_search.position().left && x < (+notification_search.position().left + notification_search.width()) && y > notification_search.position().top && y < (+notification_search.position().top + notification_search.height()))
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   882
        {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   883
            _this.removeNotifications();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   884
            if(_this.currentMode == 'SEARCH')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   885
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   886
                _this.player.widgets[0].removeSearchByGesture();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   887
                _this.currentMode = 'VIDEO';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   888
                _this.currentSearchGesture[_this.centerId] = '';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   889
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   890
            else if(_this.currentMode == 'TIMELINE')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   891
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   892
                _this.player.widgets[0].removeSearchByGesture();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   893
                _this.currentMode = 'TIMELINE';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   894
                _this.currentSearchGesture[_this.centerId] = '';
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   895
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   896
            else if(_this.currentMode == 'FILTER')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   897
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   898
                _this.removeFilter();
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   899
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   900
            
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   901
            _this.alreadyOnNotification = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   902
            _this.isCurrentlyInASearchByGesture = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   903
            _this.curvesGesturesFound = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   904
            _this.canDrawNextCurve = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   905
            _this.isSearchByCurvesOn = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   906
            _this.canNotifyHelp = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   907
            
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   908
            //Si on est dans une vidéo, on laisse cette variable afin de ne pas dézoomer / bouger.
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   909
            if(_this.currentMode != 'VIDEO' && _this.currentMode != 'TIMELINE')
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   910
            {
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   911
                _this.gestureDelRequested = false;
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   912
            }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   913
        }
277c94533395 Front IDILL :
bastiena
parents: 47
diff changeset
   914
    }
44
8393d3473b98 Front IDILL:
bastiena
parents:
diff changeset
   915
}