# HG changeset patch # User cavaliet # Date 1414506715 -3600 # Node ID 1b578edc1578f48528e18b4be16f73c2dc9c357d # Parent 029cdbeebf033b5066b86b0d9daa41b7d41c11d0 factorize code diff -r 029cdbeebf03 -r 1b578edc1578 annot-server/static/js/pianoroll.js --- a/annot-server/static/js/pianoroll.js Tue Oct 28 09:47:11 2014 +0100 +++ b/annot-server/static/js/pianoroll.js Tue Oct 28 15:31:55 2014 +0100 @@ -110,13 +110,18 @@ } i++; } + //console.log("before : ", nbChilds, ", after : ", _this.container.children.length); }; - + + // remove notes each scene width + var removeInterval = window.setInterval(this.removePassedObjets, 1000 * sceneWidth / this.pixelsPerSecond ); + } // Init containers -var container1 = new PianoRoll(uberContainer, 0, 0, prHeight1, true, pixelsPerSecond1, sceneWidth); -var container2 = new PianoRoll(uberContainer, 0, prHeight1, prHeight2, false, pixelsPerSecond2, sceneWidth); +var containerList = []; +containerList.push(new PianoRoll(uberContainer, 0, 0, prHeight1, true, pixelsPerSecond1, sceneWidth)); +containerList.push(new PianoRoll(uberContainer, 0, prHeight1, prHeight2, false, pixelsPerSecond2, sceneWidth)); // Line between two containers var graphics = new PIXI.Graphics(); @@ -131,8 +136,10 @@ function replaceContainers(){ var diff = (Date.now() - timePageLoaded)/1000;// nb of seconds since page loaded //console.log("replace ! diff1 = ", container1.x - Math.floor(-diff*pixelsPerSecond1), ", diff 2 = ", container2.x - Math.floor(-diff*pixelsPerSecond2)); - container1.moveTo(-diff); - container2.moveTo(-diff); + var nb = containerList.length; + for(var i=0;i