Aykuty / simile-widgets

Automatically exported from code.google.com/p/simile-widgets
0 stars 0 forks source link

[Enhancement] Scroll to next event method #390

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Timeline.DefaultEventSource.prototype.getEventByIndex = function(i) {
    return this._events._events.elementAt(i);
};

Timeline._Band.prototype.scrollToNextEvent = function(event) {
    var date = this.getCenterVisibleDate();
    var date2 = null;
    var ev = this.getEventSource();
    for(var i = ev.getCount() - 1; i >= 0; i--){
        if(date2 < date && date2 != null) break;
        date2 = ev.getEventByIndex(i).getStart();
    }
    this.scrollToCenter(date2);
};

var tl = Timeline.create(element, bandInfos, Timeline.HORIZONTAL);
tl.loadXML('examples.xml', function(xml, url) { 
   eventSource.loadXML(xml, url);

   tl.getBand(index).scrollToNextEvent();

}));

greetings André

Original issue reported on code.google.com by a.fied...@oe-konzept.de on 1 Sep 2010 at 8:43

GoogleCodeExporter commented 8 years ago

Original comment by ryan...@csail.mit.edu on 23 Jun 2011 at 9:45