src/js/model.js
branchplatform-restapi
changeset 976 4b9ec475026a
parent 973 638fe8541a2e
child 980 9ee8c00ae5b7
--- a/src/js/model.js	Fri Oct 26 18:37:55 2012 +0200
+++ b/src/js/model.js	Mon Nov 05 19:02:48 2012 +0100
@@ -356,7 +356,7 @@
     var _hms = this.getHMS(),
         _res = '';
     if (_hms.hours) {
-        _res += pad(_hms.hours) + ':'
+        _res += _hms.hours + ':'
     }
     _res += pad(_hms.minutes) + ':' + pad(_hms.seconds);
     return _res;
@@ -619,11 +619,17 @@
 Model.Annotation.prototype = new Model.Element();
 
 Model.Annotation.prototype.setBegin = function(_beginMs) {
-    this.begin.setMilliseconds(_beginMs);
+    this.begin.setMilliseconds(Math.max(0,_beginMs));
+    this.trigger("change-begin");
 }
 
-Model.Annotation.prototype.setEnd = function(_beginMs) {
-    this.end.setMilliseconds(_beginMs);
+Model.Annotation.prototype.setEnd = function(_endMs) {
+    this.end.setMilliseconds(Math.min(_endMs));
+    this.trigger("change-end");
+}
+
+Model.Annotation.prototype.setDuration = function(_durMs) {
+    this.setEnd(_durMs + this.begin.milliseconds);
 }
 
 Model.Annotation.prototype.setMedia = function(_idRef) {