From: riccardo Date: Sat, 29 Jan 2011 12:52:26 +0000 (+0100) Subject: fixed bugs in marker move which reset also textarea changes. Now text is saved from... X-Git-Tag: 1.1~474^2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=157223a4808f23b199ee8cd6922ce45c9efb572f;p=telemeta.git fixed bugs in marker move which reset also textarea changes. Now text is saved from textarea into marker description BEFORE markers add/move --- diff --git a/telemeta/htdocs/timeside/src/controller.js b/telemeta/htdocs/timeside/src/controller.js index 7de3a121..3f871595 100644 --- a/telemeta/htdocs/timeside/src/controller.js +++ b/telemeta/htdocs/timeside/src/controller.js @@ -48,7 +48,53 @@ TimeSide(function($N) { this.cfg.soundProvider.seek(data.offset); }, + formatMarkerOffset: function(markerOffset){ + //marker offset is in float format second.decimalPart + var hours = parseInt(markerOffset/(60*24)); + markerOffset-=hours*(60*24); + var minutes = parseInt(markerOffset/(60)); + markerOffset-=minutes*(60); + var seconds = parseInt(markerOffset); + markerOffset-=seconds; + var msec = Math.round(markerOffset*100); //show only centiseconds + //(use 1000* to show milliseconds) + var format = (hours<10 ? "0"+hours : hours )+":"+ + (minutes<10 ? "0"+minutes : minutes )+":"+ + (seconds<10 ? "0"+seconds : seconds )+"."+ + msec; + return format; + }, + _onMarkerMove: function(e, data) { + if (this.cfg.map) { + this.refreshMarkersText(this.cfg.map); + this.cfg.map.move(this.cfg.map.byId(data.id), data.offset); + this.updateMarkersDiv(this.cfg.map, data.offset); + } + }, + _onMarkerAdd: function(e, data) { + if (this.cfg.map) { + this.refreshMarkersText(this.cfg.map); + this.cfg.map.add(data.offset, ''); + this.updateMarkersDiv(this.cfg.map, data.offset); + } + }, + + refreshMarkersText: function(nonNullMarkersMap){ + var div = this.cfg.markersDiv; + var m = nonNullMarkersMap.markers; + var l = m.length; + if(div){ + var divChildren = div.childNodes; + for(var i=0; i