Don't always clobber the viewport Y when changing canvas grid.
This commit is contained in:
parent
c71283fb85
commit
81f504f88b
20
src/canvas.C
20
src/canvas.C
|
@ -109,7 +109,7 @@ Canvas::grid ( Grid *g )
|
|||
|
||||
resize_grid();
|
||||
|
||||
changed_mapping();
|
||||
update_mapping();
|
||||
|
||||
m.shape = m.grid->draw_shape();
|
||||
|
||||
|
@ -152,16 +152,14 @@ Canvas::_update_row_mapping ( void )
|
|||
m.vp->h = min( m.vp->h, m.maxh );
|
||||
}
|
||||
|
||||
/** change grid mapping */
|
||||
/** update everything about mapping, leaving the viewport alone */
|
||||
void
|
||||
Canvas::changed_mapping ( void )
|
||||
Canvas::update_mapping ( void )
|
||||
{
|
||||
_update_row_mapping();
|
||||
|
||||
m.mapping_drawn = false;
|
||||
|
||||
m.vp->y = (m.maxh / 2) - (m.vp->h / 2);
|
||||
|
||||
resize();
|
||||
|
||||
int old_margin = m.margin_left;
|
||||
|
@ -181,6 +179,18 @@ Canvas::changed_mapping ( void )
|
|||
signal_draw();
|
||||
}
|
||||
|
||||
/** change grid mapping */
|
||||
void
|
||||
Canvas::changed_mapping ( void )
|
||||
{
|
||||
update_mapping();
|
||||
|
||||
m.vp->h = min( m.vp->h, m.maxh );
|
||||
|
||||
if ( m.vp->y + m.vp->h > m.maxh )
|
||||
m.vp->y = (m.maxh / 2) - (m.vp->h / 2);
|
||||
}
|
||||
|
||||
Grid *
|
||||
Canvas::grid ( void )
|
||||
{
|
||||
|
|
|
@ -109,6 +109,8 @@ class Canvas : public trackable
|
|||
bool viewable_x ( int x );
|
||||
void draw_line ( int x, int flags );
|
||||
|
||||
void update_mapping ( void );
|
||||
|
||||
public:
|
||||
|
||||
enum { OFF, ON, TOGGLE };
|
||||
|
|
Loading…
Reference in New Issue