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