Try to clean up region dragging.
This commit is contained in:
parent
0f402d0851
commit
c8bb330e8e
|
@ -420,7 +420,7 @@ Region::handle ( int m )
|
||||||
|
|
||||||
if ( ! _drag )
|
if ( ! _drag )
|
||||||
{
|
{
|
||||||
begin_drag( Drag( x() - X, y() - Y ) );
|
begin_drag( Drag( x() - X, y() - Y, x_to_offset( X ) ) );
|
||||||
_log.hold();
|
_log.hold();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,29 +180,29 @@ Sequence_Widget::handle ( int m )
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
case FL_DRAG:
|
case FL_DRAG:
|
||||||
case FL_DND_DRAG:
|
|
||||||
{
|
{
|
||||||
if ( ! _drag )
|
if ( ! _drag )
|
||||||
{
|
{
|
||||||
begin_drag ( Drag( x() - X, y() - Y ) );
|
begin_drag ( Drag( x() - X, y() - Y, x_to_offset( X ) ) );
|
||||||
_log.hold();
|
_log.hold();
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_cursor( FL_CURSOR_MOVE );
|
fl_cursor( FL_CURSOR_MOVE );
|
||||||
|
|
||||||
const int ox = _drag->x;
|
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
if ( timeline->ts_to_x( timeline->xoffset ) + ox + X > _track->x() )
|
|
||||||
{
|
{
|
||||||
int nx = (ox + X) - _track->x();
|
const nframes_t of = timeline->x_to_offset( X );
|
||||||
|
|
||||||
// _r->offset = timeline->x_to_ts( nx ) + timeline->xoffset;
|
if ( of >= _drag->offset )
|
||||||
offset( timeline->x_to_ts( nx ) + timeline->xoffset );
|
{
|
||||||
|
_r->offset = of - _drag->offset;
|
||||||
|
|
||||||
if ( Sequence_Widget::_current == this )
|
if ( Sequence_Widget::_current == this )
|
||||||
_track->snap( this );
|
_track->snap( this );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_r->offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( X >= _track->x() + _track->w() ||
|
if ( X >= _track->x() + _track->w() ||
|
||||||
|
|
|
@ -35,9 +35,9 @@ struct Drag
|
||||||
int y;
|
int y;
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
Sequence_Widget *original;
|
nframes_t offset;
|
||||||
|
|
||||||
Drag( int X, int Y ) : x( X ), y( Y ) { state = 0; }
|
Drag( int X, int Y, nframes_t offset=0 ) : x( X ), y( Y ), offset( offset ) { state = 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Range
|
struct Range
|
||||||
|
|
|
@ -562,6 +562,9 @@ Timeline::resize ( int X, int Y, int W, int H )
|
||||||
void
|
void
|
||||||
Timeline::draw ( void )
|
Timeline::draw ( void )
|
||||||
{
|
{
|
||||||
|
if ( ! visible_r() )
|
||||||
|
return;
|
||||||
|
|
||||||
int X, Y, W, H;
|
int X, Y, W, H;
|
||||||
|
|
||||||
int bdx = 0;
|
int bdx = 0;
|
||||||
|
|
Loading…
Reference in New Issue