Commit 7d592ee7 authored by claes's avatar claes

Align added

parent 77f2b7a9
...@@ -984,6 +984,52 @@ void GrowText::flip( double x0, double y0, glow_eFlipDirection dir) ...@@ -984,6 +984,52 @@ void GrowText::flip( double x0, double y0, glow_eFlipDirection dir)
} }
} }
void GrowText::align( double x, double y, glow_eAlignDirection direction)
{
double dx, dy;
erase();
nav_erase();
switch ( direction)
{
case glow_eAlignDirection_CenterVert:
dx = x - (x_right + x_left) / 2;
dy = 0;
break;
case glow_eAlignDirection_CenterHoriz:
dx = 0;
dy = y - (y_high + y_low) / 2;
break;
case glow_eAlignDirection_CenterCenter:
dx = x - (x_right + x_left) / 2;
dy = y - (y_high + y_low) / 2;
break;
case glow_eAlignDirection_Right:
dx = x - x_right;
dy = 0;
break;
case glow_eAlignDirection_Left:
dx = x - x_left;
dy = 0;
break;
case glow_eAlignDirection_Up:
dx = 0;
dy = y - y_high;
break;
case glow_eAlignDirection_Down:
dx = 0;
dy = y - y_low;
break;
}
trf.move( dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
draw();
}
void GrowText::convert( glow_eConvert version) void GrowText::convert( glow_eConvert version)
{ {
switch ( version) { switch ( version) {
......
...@@ -466,6 +466,14 @@ class GrowText : public GlowText { ...@@ -466,6 +466,14 @@ class GrowText : public GlowText {
*/ */
void flip( double x0, double y0, glow_eFlipDirection dir); void flip( double x0, double y0, glow_eFlipDirection dir);
//! Moves object to alignment line or point.
/*!
\param x x coordinate of alignment point.
\param y y coordinate of alignment point.
\param direction Type of alignment.
*/
void align( double x, double y, glow_eAlignDirection direction);
//! Conversion between different versions of Glow //! Conversion between different versions of Glow
/*! /*!
\param version Version to convert to. \param version Version to convert to.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment