aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJonathan Duran2012-03-16 16:23:51 -0700
committerJonathan Duran2012-03-16 16:23:51 -0700
commit319b45ac31acdc50935c3de4da46e14e68395a1b (patch)
treee960e1ec23e4a140253922ea7e8b127bfa39c6ae /js
parent10c58b2ccd93aabb692dbe7e86a88af9446c3c99 (diff)
downloadninja-319b45ac31acdc50935c3de4da46e14e68395a1b.tar.gz
Consolidate conversion functions
Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js53
1 files changed, 19 insertions, 34 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 191228af..21ecdc39 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -538,33 +538,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
538 } 538 }
539 }, 539 },
540 540
541 updateTimeText:{
542 value:function (millisec) {
543 var timeText;
544 var sec = (Math.floor((millisec / 1000))) % 60;
545 var min = (Math.floor((millisec / 1000) / 60)) % 60;
546 var milliSec = String(Math.round(millisec / 10));
547 var returnMillisec = milliSec.slice(milliSec.length - 2, milliSec.length);
548 var returnSec;
549 var returnMin;
550 if (sec < 10) {
551 returnSec = "0" + sec;
552 } else {
553 returnSec = sec;
554 }
555 if (min < 10) {
556 returnMin = "0" + min;
557 } else {
558 returnMin = min;
559 }
560 if (millisec == 0) {
561 returnMillisec = "00";
562 }
563 timeText = returnMin + ":" + returnSec + ":" + returnMillisec;
564 this.timetext.innerHTML = timeText;
565 }
566 },
567
568 deselectTweens:{ 541 deselectTweens:{
569 value:function () { 542 value:function () {
570 for (var i = 0; i < this.selectedTweens.length; i++) { 543 for (var i = 0; i < this.selectedTweens.length; i++) {
@@ -771,12 +744,24 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
771 744
772 calculateTimeMarkerValue:{ 745 calculateTimeMarkerValue:{
773 value:function (currentMarker) { 746 value:function (currentMarker) {
774 var timeToReturn;
775 var currentMilliseconds = currentMarker * this.millisecondsOffset; 747 var currentMilliseconds = currentMarker * this.millisecondsOffset;
776 var sec = (Math.floor((currentMilliseconds / 1000))) % 60; 748 return this.convertMillisecondsToTime(currentMilliseconds);
777 var min = (Math.floor((currentMilliseconds / 1000) / 60)) % 60; 749 }
778 var milliSec = String(Math.round(currentMilliseconds / 10)); 750 },
779 var returnMillisec = milliSec.slice(milliSec.length - 2, milliSec.length); 751
752 updateTimeText:{
753 value:function (millisec) {
754 this.timetext.innerHTML = this.convertMillisecondsToTime(millisec);
755 }
756 },
757
758 convertMillisecondsToTime:{
759 value:function(millisec){
760 var timeToReturn;
761 var sec = (Math.floor((millisec / 1000))) % 60;
762 var min = (Math.floor((millisec / 1000) / 60)) % 60;
763 var milliSeconds = String(Math.round(millisec / 10));
764 var returnMillisec = milliSeconds.slice(milliSeconds.length - 2, milliSeconds.length);
780 var returnSec; 765 var returnSec;
781 var returnMin; 766 var returnMin;
782 if (sec < 10) { 767 if (sec < 10) {
@@ -789,8 +774,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
789 } else { 774 } else {
790 returnMin = min; 775 returnMin = min;
791 } 776 }
792 if (currentMarker == 0) { 777 if (returnMillisec == "0") {
793 returnMillisec = "00"; 778 returnMillisec = "0" + returnMillisec;
794 } 779 }
795 timeToReturn = returnMin + ":" + returnSec + ":" + returnMillisec; 780 timeToReturn = returnMin + ":" + returnSec + ":" + returnMillisec;
796 return timeToReturn; 781 return timeToReturn;