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