KateRaman / simile-widgets

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

TIMELINE Very long events don't stay in their track over time #304

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Go to example page at
http://www.nickrabinowitz.com/projects/temp/timeline_track_bug.html

2. Scroll to 5000 BC. Notice that Urgarit (the red band) has jumped up one
track.

3. Scroll to 1000 BC. Notice that Ur (the green band) has jumped down one
track.

This bug is in Timeline v.2.2.0 - v.2.3.1. With very long events, the event
will jump from track to track over time. The problem is in the
OriginalDurationPainter, in the paint() function
(http://code.google.com/p/simile-widgets/source/browse/timeline/tags/2.3.1/src/w
ebapp/api/scripts/original-painter.js#127).
Because the paint function, presumably to save processing time until
necessary, only paints a portion of the timeline at a time, the tracks get
reset when you scroll out of the band's allotted time slot (between
band.minDate and band.maxDate). When the tracks are reset, events are
likely to change tracks, giving a "jumping" effect.

The fix is to paint all events at once:

Change line 165
(http://code.google.com/p/simile-widgets/source/browse/timeline/tags/2.3.1/src/w
ebapp/api/scripts/original-painter.js#165):

// iterate over all events
var iterator = eventSource.getAllEventIterator();

Note that this will cause problems, because the iterator currently used is
a reverse iterator (not sure why). The solution is either to write a new
AllReverseIterator (should be pretty simple), or to switch a couple of
lines in painting events, e.g. line 350
(http://code.google.com/p/simile-widgets/source/browse/timeline/tags/2.3.1/src/w
ebapp/api/scripts/original-painter.js#350)
should change to:

var leftEdge = Math.max(labelLeft, startPixel);
var track = this._findFreeTrack(evt, leftEdge);

and line 375 should change to:

this._tracks[track] = endPixel;

Finally, if you go this route, the _findFreeTrack() function needs to get
reversed as well, line 446:

if (t < rightEdge) { //... less than rather than greater than

Hope this is helpful. The fix means you have to paint the entire timeline,
but this might be worthwhile...

Original issue reported on code.google.com by nick.rab...@gmail.com on 27 Jul 2009 at 5:15

GoogleCodeExporter commented 9 years ago
this doesn't seem to fix the issue. am using 2.3.0

the long events still jump tracks. i've confirmed that all events are 
PreciseDurationEvents

Original comment by lv.shankar on 12 Jul 2010 at 10:10

GoogleCodeExporter commented 9 years ago

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