Grid offset is recomputed only when settings are changed.

This commit is contained in:
Maciej Suminski 2014-07-09 11:22:43 +02:00
parent 1f7ce5416c
commit 7645ed8601
2 changed files with 6 additions and 3 deletions

View File

@ -134,9 +134,6 @@ void GAL::DrawGrid()
// Draw the grid // Draw the grid
// For the drawing the start points, end points and increments have // For the drawing the start points, end points and increments have
// to be calculated in world coordinates // to be calculated in world coordinates
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
(long) gridOrigin.y % (long) gridSize.y );
VECTOR2D worldStartPoint = screenWorldMatrix * VECTOR2D( 0.0, 0.0 ); VECTOR2D worldStartPoint = screenWorldMatrix * VECTOR2D( 0.0, 0.0 );
VECTOR2D worldEndPoint = screenWorldMatrix * VECTOR2D( screenSize ); VECTOR2D worldEndPoint = screenWorldMatrix * VECTOR2D( screenSize );

View File

@ -631,6 +631,9 @@ public:
inline void SetGridOrigin( const VECTOR2D& aGridOrigin ) inline void SetGridOrigin( const VECTOR2D& aGridOrigin )
{ {
gridOrigin = aGridOrigin; gridOrigin = aGridOrigin;
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
(long) gridOrigin.y % (long) gridSize.y );
} }
/** /**
@ -661,6 +664,9 @@ public:
inline void SetGridSize( const VECTOR2D& aGridSize ) inline void SetGridSize( const VECTOR2D& aGridSize )
{ {
gridSize = aGridSize; gridSize = aGridSize;
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
(long) gridOrigin.y % (long) gridSize.y );
} }
/** /**