Don't drag-scroll past beginning of track.

This commit is contained in:
Jonathan Moore Liles 2008-02-16 01:59:50 -06:00
parent 894d5d85d0
commit 76d2d70611
2 changed files with 15 additions and 9 deletions

View File

@ -179,13 +179,19 @@ Region::handle ( int m )
if ( Fl::event_x() >= timeline.scroll->x() + timeline.scroll->w() ||
Fl::event_x() <= timeline.scroll->x() )
{
int d;
if ( Fl::event_x() <= timeline.scroll->x() )
d = -100;
else
d = 100;
/* this drag needs to scroll */
timeline.scroll->position( timeline.scroll->xposition() + d, timeline.scroll->yposition() );
long pos = timeline.scroll->xposition();
if ( Fl::event_x() <= timeline.scroll->x() )
pos -= 100;
else
pos += 100;
if ( pos < 0 )
pos = 0;
timeline.scroll->position( pos, timeline.scroll->yposition() );
}
return 1;

6
main.C
View File

@ -110,9 +110,9 @@ main ( int argc, char **argv )
Region *wave2 = new Region( *wave );
wave2->peaks( peaks );
wave2->start( 300 );
wave2->end( len );
/* wave2->peaks( peaks ); */
/* wave2->start( 300 ); */
/* wave2->end( len ); */
track2->add( wave2 );