- holt_widget: left aligned resource labels if too large

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1088 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
paolo 2006-09-10 21:29:22 +00:00
parent ca905257a6
commit 4ff377733a
1 changed files with 6 additions and 2 deletions

View File

@ -127,8 +127,12 @@ void HoltResource::draw(cairo_t *cr)
// draw text
cairo_text_extents_t extents;
cairo_text_extents(cr, _resource->get_name().c_str(), &extents);
double xpos = _pos.real() - extents.width * (1 - x_percent + x_percent / 2);
// left aligned if too large
if(xpos<_pos.real() - _radius)
xpos = _pos.real() - _radius;
cairo_move_to(cr,
_pos.real() - extents.width * (1 - x_percent + x_percent / 2),
xpos,
_pos.imag() + extents.height * ((1 - y_percent) / 2 + 0.5) );
cairo_show_text(cr, _resource->get_name().c_str());