Don't drag-scroll past beginning of track.
This commit is contained in:
parent
894d5d85d0
commit
76d2d70611
18
Region.C
18
Region.C
|
@ -179,13 +179,19 @@ Region::handle ( int m )
|
||||||
if ( Fl::event_x() >= timeline.scroll->x() + timeline.scroll->w() ||
|
if ( Fl::event_x() >= timeline.scroll->x() + timeline.scroll->w() ||
|
||||||
Fl::event_x() <= timeline.scroll->x() )
|
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 */
|
/* 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;
|
return 1;
|
||||||
|
|
6
main.C
6
main.C
|
@ -110,9 +110,9 @@ main ( int argc, char **argv )
|
||||||
|
|
||||||
Region *wave2 = new Region( *wave );
|
Region *wave2 = new Region( *wave );
|
||||||
|
|
||||||
wave2->peaks( peaks );
|
/* wave2->peaks( peaks ); */
|
||||||
wave2->start( 300 );
|
/* wave2->start( 300 ); */
|
||||||
wave2->end( len );
|
/* wave2->end( len ); */
|
||||||
|
|
||||||
track2->add( wave2 );
|
track2->add( wave2 );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue