|
52
|
1 |
/* |
|
|
2 |
* This file is part of the TraKERS\Front IDILL package. |
|
|
3 |
* |
|
|
4 |
* (c) IRI <http://www.iri.centrepompidou.fr/> |
|
|
5 |
* |
|
|
6 |
* For the full copyright and license information, please view the LICENSE |
|
|
7 |
* file that was distributed with this source code. |
|
|
8 |
*/ |
|
|
9 |
|
|
|
10 |
/* |
|
|
11 |
* Projet : TraKERS |
|
|
12 |
* Module : Front IDILL |
|
|
13 |
* Fichier : playerControl.js |
|
|
14 |
* |
|
|
15 |
* Auteur : alexandre.bastien@iri.centrepompidou.fr |
|
|
16 |
* |
|
|
17 |
* Fonctionnalités : Définit les fonctions d'interaction avec le player dans la mosaique. |
|
|
18 |
*/ |
|
|
19 |
|
|
|
20 |
/* |
|
|
21 |
* Passe à une vidéo suivante pour la lire, peut passer d'une vidéo à une autre en cas de filtrage. |
|
|
22 |
* Est appelé : dans le fichier mosaic > fonctions manageControlEvents et onPlayerLoad. |
|
|
23 |
*/ |
|
|
24 |
Mosaic.prototype.playNextVideo = function() |
|
44
|
25 |
{ |
|
52
|
26 |
//Définit l'id du snapshot principal et le suivant à lire. |
|
|
27 |
var videoId = this.centerId, nextId = (+videoId + 1); |
|
|
28 |
|
|
|
29 |
//Si on arrive à la fin de la mosaique on revient au début. |
|
|
30 |
if(videoId >= this.config.imagesToShow - 1) |
|
|
31 |
{ |
|
|
32 |
nextId = 0; |
|
|
33 |
} |
|
|
34 |
|
|
|
35 |
//Si la mosaique est filtrée, on passe directement à la prochaine vidéo non filtrée. |
|
|
36 |
if(this.isMosaicFiltered) |
|
|
37 |
{ |
|
|
38 |
//Tant que la vidéo est masquée par un filtre de recherche, on passe à la vidéo suivante. |
|
|
39 |
while(this.opacities[nextId] == 0 && nextId < this.config.imagesToShow) |
|
|
40 |
{ |
|
|
41 |
nextId++; |
|
|
42 |
} |
|
|
43 |
|
|
|
44 |
//Si on arrive à la fin on revient au début. |
|
|
45 |
if(nextId == this.config.imagesToShow) |
|
|
46 |
{ |
|
|
47 |
nextId = 0; |
|
|
48 |
} |
|
|
49 |
} |
|
|
50 |
|
|
|
51 |
//On se déplace vers la prochaine vidéo à lire. |
|
|
52 |
this.autoMove = true; |
|
|
53 |
this.moveToNeighbour($('#snapshotDiv-' + nextId)); |
|
44
|
54 |
} |
|
|
55 |
|
|
52
|
56 |
/* |
|
|
57 |
* Indique si la timeline est sélectionnée. |
|
|
58 |
* Est appelé : dans le fichier pointers > fonctions mainPointerDisplay et pointersTimelineSelection. |
|
|
59 |
*/ |
|
|
60 |
Mosaic.prototype.isTLSelected = function(entering, mainPointer) |
|
44
|
61 |
{ |
|
52
|
62 |
//Si les deux pointeurs ne sont pas là ou qu'on n'est pas en lecture d'une vidéo. |
|
79
|
63 |
if(this.isMainPointerDisplayed && this.isSecondPointerDisplayed || this.currentMode != 'VIDEO' && this.currentMode != 'SEARCH' && this.currentMode != 'TIMELINE' || !this.playerIsReady || this.isSearchByCurvesOn) |
|
52
|
64 |
{ |
|
|
65 |
return false; |
|
|
66 |
} |
|
|
67 |
|
|
|
68 |
var pointer; |
|
|
69 |
var Px, Py; |
|
|
70 |
|
|
|
71 |
//Si on est en mode d'interaction souris. |
|
|
72 |
if(this.config.mouseInteractions) |
|
|
73 |
{ |
|
|
74 |
//On met à jour la position estimée de la souris. |
|
|
75 |
Px = this.mousePosX; |
|
|
76 |
Py = this.mousePosY; |
|
|
77 |
} |
|
|
78 |
else |
|
|
79 |
{ |
|
|
80 |
//Sinon on se fie à la position des pointeurs. |
|
|
81 |
pointer = (mainPointer ? $('#mainPointer') : $('#secondPointer')); |
|
|
82 |
Px = pointer.position().left + pointer.width() / 2; |
|
|
83 |
Py = pointer.position().top + pointer.height() / 2; |
|
|
84 |
} |
|
|
85 |
|
|
|
86 |
//Si le pointeur se situe sur la timeline, on renvoie vrai, sinon faux. |
|
|
87 |
var TL = $('.Ldt-Timeline'); |
|
|
88 |
var TLwidth = TL.width(), TLheight = TL.height(); |
|
|
89 |
var TLtop = (+$('.LdtPlayer').position().top + $('.LdtPlayer').height() - TLheight), TLleft = $('.LdtPlayer').position().left; |
|
|
90 |
|
|
|
91 |
var correctHorizontalPosition = (entering ? (Px > TLleft && Px < (+TLleft + TLwidth)) : (true)); |
|
|
92 |
|
|
|
93 |
if(correctHorizontalPosition && Py > (TLtop - TLheight / 2) && Py < (+TLtop + TLheight)) |
|
|
94 |
{ |
|
|
95 |
return true; |
|
|
96 |
} |
|
|
97 |
|
|
|
98 |
return false; |
|
44
|
99 |
} |
|
|
100 |
|
|
52
|
101 |
/* |
|
|
102 |
* Sert à déselectionner la timeline. |
|
|
103 |
* Est appelé : dans les fichiers neighbours > fonction moveToNeighbour, pointers > fonctions mainPointerDisplay, secondPointerDisplay et pointersTimelineSelection et zoomInteractions > fonction unzoom. |
|
|
104 |
*/ |
|
|
105 |
Mosaic.prototype.exitTimeline = function(typeOfInteraction) |
|
44
|
106 |
{ |
|
52
|
107 |
//Si on est en mode timeline et que le player est prêt. |
|
|
108 |
if(this.currentMode == 'TIMELINE' && this.playerIsReady) |
|
|
109 |
{ |
|
|
110 |
//On enlève les notifications. |
|
|
111 |
this.removeNotifications(); |
|
|
112 |
|
|
|
113 |
//On remet à zéro les variables concernées. |
|
|
114 |
this.isTLRequested = false; |
|
|
115 |
this.canSlideInTL = false; |
|
|
116 |
//On déselectionne la timeline au niveau du player. |
|
|
117 |
this.player.widgets[0].deselectTimeline(); |
|
|
118 |
|
|
|
119 |
if($('#spinner').length > 0) |
|
|
120 |
{ |
|
|
121 |
$('#spinner').remove(); |
|
|
122 |
} |
|
|
123 |
|
|
|
124 |
//On remet l'apparence des pointeurs. |
|
|
125 |
if(this.isTLSelectedByMainPointer) |
|
|
126 |
{ |
|
|
127 |
$('#mainPointer').css('background-image', 'url(./img/cursors/pointer.png)'); |
|
|
128 |
} |
|
|
129 |
if(this.isTLSelectedBySecondPointer) |
|
|
130 |
{ |
|
|
131 |
$('#secondPointer').css('background-image', 'url(./img/cursors/pointer2.png)'); |
|
|
132 |
} |
|
|
133 |
|
|
|
134 |
this.isTLSelectedByMainPointer = false; |
|
|
135 |
this.isTLSelectedBySecondPointer = false; |
|
|
136 |
|
|
|
137 |
//On revient dans le mode précédent, en fonction de l'action effectuée pour quitter la timeline. |
|
|
138 |
//Si l'action était juste de mettre le pointeur hors de la timeline, on revient en mode video/search en fonction de l'existence d'une gesture de recherche. |
|
|
139 |
if(typeOfInteraction == 'unzoom') |
|
|
140 |
{ |
|
|
141 |
if(this.isMosaicFiltered) |
|
|
142 |
{ |
|
|
143 |
this.currentMode = 'FILTER'; |
|
|
144 |
} |
|
|
145 |
else |
|
|
146 |
{ |
|
|
147 |
this.currentMode = 'MOSAIC'; |
|
|
148 |
} |
|
|
149 |
} |
|
|
150 |
else if(typeOfInteraction == 'move') |
|
|
151 |
{ |
|
|
152 |
this.currentMode = 'VIDEO'; |
|
|
153 |
} |
|
|
154 |
else |
|
|
155 |
{ |
|
|
156 |
if(this.isCurrentlyInASearchByGesture) |
|
|
157 |
{ |
|
|
158 |
this.currentMode = 'SEARCH'; |
|
|
159 |
|
|
|
160 |
this.searchGesture(this.currentSearchGesture[this.centerId], 'valid'); |
|
|
161 |
} |
|
|
162 |
else |
|
|
163 |
{ |
|
|
164 |
this.currentMode = 'VIDEO'; |
|
|
165 |
} |
|
|
166 |
} |
|
|
167 |
} |
|
44
|
168 |
} |