--- a/src/js/model.js Fri Sep 25 14:45:38 2015 +0200
+++ b/src/js/model.js Fri Oct 02 11:27:17 2015 +0200
@@ -762,6 +762,19 @@
extendPrototype(Annotation, BaseElement);
+/* Set begin and end in one go, to avoid undesired side-effects in
+ * setBegin/setEnd interaction */
+Annotation.prototype.setBeginEnd = function(_beginMs, _endMs) {
+ _beginMs = Math.max(0,_beginMs);
+ _endMs = Math.max(0,_endMs);
+ if (_endMs < _beginMs)
+ _endMs = _beginMs;
+ this.begin.setMilliseconds(_beginMs);
+ this.end.setMilliseconds(_endMs);
+ this.trigger("change-begin");
+ this.trigger("change-end");
+};
+
Annotation.prototype.setBegin = function(_beginMs) {
this.begin.setMilliseconds(Math.max(0,_beginMs));
this.trigger("change-begin");