Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

void CNItem::snap ( int  newx = -1,
int  newy = -1 
) [inherited]

Snaps the component to the grid.

Definition at line 357 of file cnitem.cpp.

References CNItem::moveBy().

Referenced by ICNDocument::addItem().

{
      // Ugly looking thing
      // Basically means: Move item to the new position of newx-offsetx and then snap it to the 8-square-side grid
      // This is in one move item call so that any attached connectors are only called once to update their routes.
      moveBy( 4+newx-m_offset.x()-x()-(int)(newx-m_offset.x())%8, 4+newy-m_offset.y()-y()-(int)(newy-m_offset.y())%8 );
}


Generated by  Doxygen 1.6.0   Back to index