Merge with f9dd7bfed9976461c79bf521ed01bf4caaf4fbcf
authorrougeronj
Fri, 23 Jan 2015 01:00:00 +0100
changeset 129 7181e1f28eb0
parent 128 9f2334598088 (current diff)
parent 125 f9dd7bfed997 (diff)
child 130 0a2b4991d48c
child 133 12f782a13fa2
Merge with f9dd7bfed9976461c79bf521ed01bf4caaf4fbcf
client/annotviz/app/annotsvizview.html
client/annotviz/app/js/annotstimeline.js
client/annotviz/app/js/annotsvizview.js
client/annotviz/app/js/utils.js
--- a/client/annotviz/app/annotsvizview.html	Fri Jan 23 00:43:54 2015 +0100
+++ b/client/annotviz/app/annotsvizview.html	Fri Jan 23 01:00:00 2015 +0100
@@ -21,9 +21,7 @@
     <script src="/js/libs-annotviz.js"></script>
     <script src="/js/annotviz.js"></script>
     <script>
-
-        var PIXI = require('pixi');
-
+    
 	    var pianorollChannel  = 'PIANOROLL';
 	    var annotationChannel = 'ANNOT';
 	    var eventCode = 'test_1';
@@ -51,8 +49,8 @@
         	stageView: stageView,
         	wsPianoroll: new annotviz.WsWrapper(wsUriPianoroll, logger),
         	wsAnnot: new annotviz.WsWrapper(wsUriAnnotation, logger),
-        	timeBegin: 1421919000000,
-        	timeEnd: 1421951400000,
+        	timeBegin: Date.parse("2015-01-23T09:30:00+01:00"),
+        	timeEnd: Date.parse("2015-01-23T18:30:00+01:00"),
         	eventCode: eventCode,
             channel: annotationChannel
         });
--- a/client/annotviz/app/js/annotsvizview.js	Fri Jan 23 00:43:54 2015 +0100
+++ b/client/annotviz/app/js/annotsvizview.js	Fri Jan 23 01:00:00 2015 +0100
@@ -64,7 +64,7 @@
         annotCategories: this.annotCategories
     });
 	
-    
+    //Archive day 1
     var timeLineDay1 = new AnnotsTimeLine.AnnotsTimeLine({
     	stageView : stageView,
         archive: true,
@@ -72,8 +72,8 @@
         yInit: 0,
         width: 1024 - 200 - 200,
         height: 768-200,
-        timeBegin: this.timeBegin,
-        timeEnd: this.timeEnd,
+        timeBegin: Date.parse("2015-01-22T09:30:00+01:00"),
+        timeEnd: Date.parse("2015-01-22T18:30:00+01:00"),
         circleX: timeLineDay2.circleX,
         circleY: timeLineDay2.circleY,
         intervalWidth: (timeLineDay2.radius*2/3)* timeLineDay2.intervalWidth / timeLineDay2.radius,
@@ -162,15 +162,7 @@
 	};
 
 	this.updateTime = function(){
-    	currentTime = Date.now() + 3600*1000;
-
-        var nbSec = currentTime / 1000;
-        var hours = Math.floor( nbSec / 3600 ) % 24;
-        var minutes = Math.floor( nbSec / 60 ) % 60;
-        var seconds = Math.floor(nbSec % 60);
-        var timeStr = (hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds  < 10 ? '0' + seconds : seconds);
-
-        currentTimeText.setText(timeStr);
+        currentTimeText.setText(Utils.formatTime(Date.now()));
     };
 
     var refreshTimeInterval;
--- a/client/annotviz/app/js/utils.js	Fri Jan 23 00:43:54 2015 +0100
+++ b/client/annotviz/app/js/utils.js	Fri Jan 23 01:00:00 2015 +0100
@@ -9,12 +9,10 @@
 
 var PIXI = require('pixi');
 var _ = require('lodash');
+var moment = require('moment');
 
 function formatTime (ts) {
-	var hours = Math.floor( (ts/1000) / 3600 ) % 24;
-	var minutes = Math.floor( (ts/1000) / 60 ) % 60;
-	var seconds = Math.floor( (ts/1000) % 60);
-	return ((hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds  < 10 ? '0' + seconds : seconds));
+	return moment(ts).format("HH:mm:ss");
 }
 
 function colorToHex(c) {
--- a/client/annotviz/bower.json	Fri Jan 23 00:43:54 2015 +0100
+++ b/client/annotviz/bower.json	Fri Jan 23 01:00:00 2015 +0100
@@ -4,6 +4,7 @@
   "dependencies": {
     "randomColor": "davidmerfield/randomColor#~0.1.1",
     "pixi": "~2.2.3",
-    "lodash": "~2.4.1"
+    "lodash": "~2.4.1",
+    "moment": "~2.9.0"
   }
 }
--- a/client/annotviz/gulp/tasks/browserify.js	Fri Jan 23 00:43:54 2015 +0100
+++ b/client/annotviz/gulp/tasks/browserify.js	Fri Jan 23 01:00:00 2015 +0100
@@ -16,6 +16,7 @@
     .require('./app/lib/pixi/bin/pixi.js', { expose: 'pixi' })
     .require('./app/lib/randomColor/randomColor.js', {expose: 'randomColor'})
     .require('./app/lib/lodash/dist/lodash.js', {expose: 'lodash'})
+    .require('./app/lib/moment/min/moment-with-locales.js', {expose: 'moment'})
     .bundle()
     .pipe(source('libs-'+p.name+'.js'))
     .pipe(gulp.dest(config.dist + '/js/'));
@@ -28,6 +29,7 @@
     .external('pixi')
     .external('randomColor')
     .external('lodash')
+    .external('moment')
     .transform(partialify) // Transform to allow requireing of templates
     .bundle()
     .pipe(source(p.name+'.js'))