- 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:
parent
ca905257a6
commit
4ff377733a
|
@ -127,8 +127,12 @@ void HoltResource::draw(cairo_t *cr)
|
||||||
// draw text
|
// draw text
|
||||||
cairo_text_extents_t extents;
|
cairo_text_extents_t extents;
|
||||||
cairo_text_extents(cr, _resource->get_name().c_str(), &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,
|
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) );
|
_pos.imag() + extents.height * ((1 - y_percent) / 2 + 0.5) );
|
||||||
cairo_show_text(cr, _resource->get_name().c_str());
|
cairo_show_text(cr, _resource->get_name().c_str());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue