don't move the arrow widget when there's no annotation at the time. popcorn-port
authorhamidouk
Tue, 31 Jan 2012 16:01:41 +0100
branchpopcorn-port
changeset 754 b119a956b647
parent 753 72eecd7250e5
child 755 d60401f66984
child 758 7fdb2d92da58
don't move the arrow widget when there's no annotation at the time.
src/js/widgets/arrowWidget.js
--- a/src/js/widgets/arrowWidget.js	Tue Jan 31 15:34:48 2012 +0100
+++ b/src/js/widgets/arrowWidget.js	Tue Jan 31 16:01:41 2012 +0100
@@ -30,9 +30,14 @@
   
   var currentTime = this._Popcorn.currentTime();
   var currentAnnotation = this._serializer.currentChapitre(currentTime);
-  if (IriSP.null_or_undefined(currentAnnotation))
-    var currentAnnotation = this._serializer.currentAnnotation(currentTime)[0]; // FIXME : use the others ?
-
+  if (IriSP.null_or_undefined(currentAnnotation)) {
+    var c_annots = this._serializer.currentAnnotation(currentTime)
+    if (c_annots.length != 0)
+      var currentAnnotation = c_annots[0]; // FIXME : use the others ?
+    else
+      return;
+  }
+  
   /* move the arrow only if the current annotation changes */
   if (currentAnnotation != this._oldAnnotation) {
     var begin = (+ currentAnnotation.begin) / 1000;