--- a/front_idill/src/player/metadataplayer/Timeline.js Mon May 14 17:20:35 2012 +0200
+++ b/front_idill/src/player/metadataplayer/Timeline.js Thu May 24 10:30:05 2012 +0200
@@ -19,9 +19,10 @@
this.paused = false
this.top_epsilon = 0;
this.imgDir = "player/img/";
- this.markersDir = "player/markers/";
+ this.markersDir = "pictos/small/";
+ this.player = player;
- this.gestures = ["swipe-down", "jump", "circle", "screw", "bend", "join-hands", "arc", "pendulum", "knee-up", "right-angle", "wave", "slow", "hello", "beat", "cross", "wheel", "contact", "run"];
+ this.gestures = ["fall", "jump", "circle", "screw", "bend", "arc", "pendulum", "knee-up", "right-angle", "wave", "slow", "hello", "no-motion", "wheel", "contact", "run"];
this.annotations = this.annotationsFilter(this.source.getAnnotations(), this.gestures, this.isGesture);
@@ -199,6 +200,8 @@
var key = this.whichKey(e.which);
var time = 0;
+ console.log($(this));
+
if(key > -1 && key < 11)
{
time = this.source.getDuration().getSeconds()/10*key;
@@ -236,18 +239,34 @@
if(key == 13)
{
- this.currentMode = "SEARCH";
- this.hideMarkersSearch("screw");
- /*this.currentMode = "SEARCH";
- this.showMarkersSearchByType("screw");*/
- }
-
- if(key == 14)
- {
- this.currentMode = "SEARCH";
- this.hideMarkersSearch("contact");
- /*this.currentMode = "SEARCH";
- this.showMarkersSearchByType("contact");*/
+ var gesturesStr = '';
+ for(var i = 0 ; i < this.gestures.length ; i++)
+ {
+ gesturesStr += this.gestures[i] + ", ";
+ }
+ gesturesStr = gesturesStr.substr(0, gesturesStr.length - 2);
+
+ /*if(IriSP.jQuery('#notify_search_1gesture').length > 0)
+ {
+ this.removeSearch1Gesture();
+ }*/
+
+ var typeName = prompt("Please enter a type name among (" + gesturesStr + ").", "");
+
+ this.notifySearch1Gesture(typeName, "valid");
+
+ if(typeName != '' || typeName != undefined)
+ {
+ if(_.include(this.gestures, typeName))
+ {
+ this.currentMode = "SEARCH";
+ this.hideMarkersSearch(typeName);
+ }
+ else
+ {
+ alert("Unknown gesture type. Operation aborted.");
+ }
+ }
}
if(key == 21)
@@ -284,8 +303,8 @@
return 11;
}
- //q ou Q pour quitter une recherche.
- if(code == 113 || code == 81)
+ //m ou M pour quitter une recherche.
+ if(code == 109 || code == 77)
{
return 12;
}
@@ -296,16 +315,11 @@
return 21;
}
- //a ou A pour une recherche de type screw.
- if(code == 97 || code == 65)
+ //n ou N pour une recherche par type.
+ if(code == 110 || code == 78)
{
return 13;
}
- //z ou Z pour une recherche de type contact.
- if(code == 122 || code == 90)
- {
- return 14;
- }
switch(code)
{
@@ -651,8 +665,6 @@
return;
}
- console.log('in');
-
var _this = this;
//On récupère les annotations.
@@ -727,6 +739,7 @@
IriSP.jQuery(".search_Marker").fadeOut(this.markerShowTime, function()
{
IriSP.jQuery("div").remove(".search_Marker");
+ _this.removeSearch1Gesture();
if(type == undefined)
{
@@ -736,13 +749,101 @@
{
// console.log(_this.currentMode);
_this.showMarkersSearchByType(type);
+ _this.notifySearch1Gesture(type, "valid");
return;
}
});
if(IriSP.jQuery(".search_Marker").length == 0 && type != undefined)
{
+ if(type == undefined || !_.include(this.gestures, type))
+ {
+ this.notifySearch1Gesture(type, "none");
+ }
// console.log(this.currentMode);
this.showMarkersSearchByType(type);
}
+}
+
+IriSP.Widgets.Timeline.prototype.freePlayer = function()
+{
+ IriSP.jQuery('body').unbind();
+ IriSP.jQuery('.notifications').remove();
+}
+
+/*
+ * Affiche la notification de validation/survol de gesture de recherche.
+ * Mode prend pour valeurs : "valid" ou "hover".
+*/
+IriSP.Widgets.Timeline.prototype.notifySearch1Gesture = function(gestureName, mode)
+{
+ console.log('C');
+ if(IriSP.jQuery('#notify_search_1gesture').length > 0)
+ {
+ return;
+ }
+
+ var _this = this;
+
+ //On spécifie les notifications en div.
+ var notification_search_1gesture = "<div id='notify_search_1gesture' class='notifications'></div>";
+
+ //On les ajoute à la mosaïque.
+ $('#mainPanel').append(notification_search_1gesture);
+
+ console.log(this.player.config.gui.zoomTop + " " + this.player.config.gui.zoomLeft);
+
+ //On calcule leurs coordonnées et dimensions.
+ var notify_width = $('.notifications').width(), notify_height = $('.notifications').height();
+ var notify_margin = parseInt($('.notifications').css('margin'));
+ var point_left = $(window).width() / 2 - (notify_width) / 2 - notify_margin;
+
+ if(_.include(this.gestures, gestureName))
+ {
+ IriSP.jQuery('#notify_search_1gesture').css('background-image', 'url("./pictos/big/' + mode + '/' + gestureName.replace('-', '_') + '.png")');
+ }
+ else if(mode == 'none')
+ {
+ IriSP.jQuery('#notify_search_1gesture').css('background-image', 'url("./pictos/big/normal/inconnu.png")');
+ }
+
+ if(mode != 'none')
+ {
+ IriSP.jQuery('#notify_search_1gesture').mouseover(function()
+ {
+ IriSP.jQuery(this).css('background-image', 'url("./pictos/big/hover/' + gestureName + '.png")');
+ }).mouseout(function()
+ {
+ IriSP.jQuery(this).css('background-image', 'url("./pictos/big/valid/' + gestureName + '.png")');
+ }).click(function()
+ {
+ _this.removeSearch1Gesture();
+ _this.hideMarkersSearch();
+ });
+ }
+
+ var notifyTop = this.player.config.gui.zoomTop, notifyLeft = this.player.config.gui.zoomLeft;
+
+ //On les positionne.
+ $('#notify_search_1gesture').css(
+ {
+ top: -notifyTop,
+ left: -notifyLeft + (IriSP.jQuery(window).width() - notify_width) / 2
+ });
+
+ //On les fait apparaître.
+ $('.notifications').css(
+ {
+ opacity: "0.9"
+ });
+}
+
+/*
+ * Supprime la notification de recherche de gesture.
+*/
+IriSP.Widgets.Timeline.prototype.removeSearch1Gesture = function()
+{
+ console.log('R');
+ console.trace();
+ IriSP.jQuery('#notify_search_1gesture').remove();
}
\ No newline at end of file