client/annotviz/app/js/doubleroll.js
changeset 95 806739a26858
parent 94 e0e514c5470f
child 98 72d767c5142d
--- a/client/annotviz/app/js/doubleroll.js	Fri Jan 16 20:20:28 2015 +0100
+++ b/client/annotviz/app/js/doubleroll.js	Mon Jan 19 13:31:28 2015 +0100
@@ -20,6 +20,7 @@
 var NTP_EPOCH_DELTA = 2208988800; //c.f. RFC 868
 
 var defaultConfig = {
+    orientation: 'horizontal',
     logger: false,
     sceneWidth: 1920,
     pianorolls : [
@@ -60,6 +61,9 @@
     var _this = this;
     var opts = _(options).defaults(defaultConfig).value();
 
+    var orientation = opts.orientation;
+    var isHorizontal = (orientation !== 'vertical');
+
     this.logger = opts.logger;
     this.lineColor = opts.lineColor;
     this.lineFillColor = opts.lineFillColor;
@@ -111,6 +115,7 @@
 
     var pianorollOptions = {
         parentContainer: uberContainer,
+        orientation: orientation,
         xInit: 0,
         width: sceneWidth,
         noteColors: this.noteColors,
@@ -140,13 +145,20 @@
             var lineGraphics = new PIXI.Graphics()
                 .beginFill(_this.lineFillColor)
                 .lineStyle(1, _this.lineColor)
-                .moveTo(0, yInit)
-                .lineTo(sceneWidth, yInit)
+                .moveTo(Math.floor(sceneWidth*zeroShift), yInit)
+                .lineTo(-sceneWidth - Math.floor(sceneWidth*zeroShift), yInit)
                 .endFill();
-            stage.addChild(lineGraphics);
+            uberContainer.addChild(lineGraphics);
         }
     });
 
+    if(!isHorizontal) {
+        uberContainer.rotation = Math.PI/2;
+        uberContainer.y = sceneHeight;
+        uberContainer.x = sceneWidth;
+    }
+
+
     this.init = function() {
 
         if(typeof(canvasContainer) === 'string') {