block the arrow when the user is annotating.
--- a/src/js/widgets/arrowWidget.js Mon Jan 02 15:27:32 2012 +0100
+++ b/src/js/widgets/arrowWidget.js Mon Jan 02 15:46:42 2012 +0100
@@ -2,7 +2,7 @@
IriSP.Widget.call(this, Popcorn, config, Serializer);
this._oldAnnotation = null;
-
+ this._blockArrow = false;
};
@@ -19,9 +19,15 @@
var templ = Mustache.to_html(IriSP.arrowWidget_template, {});
this.selector.append(templ);
this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler));
+ this._Popcorn.listen("IriSP.ArrowWidget.blockArrow", IriSP.wrap(this, this.blockArrow));
+ this._Popcorn.listen("IriSP.ArrowWidget.releaseArrow", IriSP.wrap(this, this.releaseArrow));
+
};
IriSP.ArrowWidget.prototype.timeUpdateHandler = function(percents) {
+ if (this._blockArrow)
+ return;
+
var currentTime = this._Popcorn.currentTime();
var currentAnnotation = this._serializer.currentAnnotations(currentTime)[0]; // FIXME : use the others ?
@@ -66,4 +72,13 @@
this._oldAnnotation = currentAnnotation;
}
-}
+};
+
+/** Block the arrow for instance when the user is annotating */
+IriSP.ArrowWidget.prototype.blockArrow = function() {
+ this._blockArrow = true;
+};
+
+IriSP.ArrowWidget.prototype.releaseArrow = function() {
+ this._blockArrow = false;
+};
--- a/src/js/widgets/createAnnotationWidget.js Mon Jan 02 15:27:32 2012 +0100
+++ b/src/js/widgets/createAnnotationWidget.js Mon Jan 02 15:46:42 2012 +0100
@@ -84,6 +84,9 @@
this.selector.show();
this._hidden = false;
+
+ // block the arrow.
+ this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow");
}
};
@@ -133,5 +136,6 @@
} else {
this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
this.selector.find(".Ldt-createAnnotation-endScreen").show();
+ this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow");
}
};
\ No newline at end of file