src/js/model.js
changeset 1068 7623f9af9272
parent 1044 d8339b45edc4
child 1072 ac1eacb3aa33
equal deleted inserted replaced
1067:539c9bee5372 1068:7623f9af9272
   760     });
   760     });
   761 };
   761 };
   762 
   762 
   763 extendPrototype(Annotation, BaseElement);
   763 extendPrototype(Annotation, BaseElement);
   764 
   764 
       
   765 /* Set begin and end in one go, to avoid undesired side-effects in
       
   766  * setBegin/setEnd interaction */
       
   767 Annotation.prototype.setBeginEnd = function(_beginMs, _endMs) {
       
   768     _beginMs = Math.max(0,_beginMs);
       
   769     _endMs = Math.max(0,_endMs);
       
   770     if (_endMs < _beginMs)
       
   771         _endMs = _beginMs;
       
   772     this.begin.setMilliseconds(_beginMs);
       
   773     this.end.setMilliseconds(_endMs);
       
   774     this.trigger("change-begin");
       
   775     this.trigger("change-end");
       
   776 };
       
   777 
   765 Annotation.prototype.setBegin = function(_beginMs) {
   778 Annotation.prototype.setBegin = function(_beginMs) {
   766     this.begin.setMilliseconds(Math.max(0,_beginMs));
   779     this.begin.setMilliseconds(Math.max(0,_beginMs));
   767     this.trigger("change-begin");
   780     this.trigger("change-begin");
   768     if (this.end < this.begin) {
   781     if (this.end < this.begin) {
   769         this.setEnd(this.begin);
   782         this.setEnd(this.begin);