static real textobj_distance_from(Textobj *textobj, Point *point) { if (textobj->text_angle != 0) { Point poly[4]; _textobj_get_poly (textobj, poly); return distance_polygon_point(poly, 4, 0.0, point); } if (textobj->show_background) return distance_rectangle_point(&textobj->object.bounding_box, point); return text_distance_from(textobj->text, point); }
static real flow_distance_from(Flow *flow, Point *point) { Point *endpoints; real linedist; real textdist; endpoints = &flow->connection.endpoints[0]; linedist = distance_line_point(&endpoints[0], &endpoints[1], flow->type == FLOW_MATERIAL ? FLOW_MATERIAL_WIDTH : FLOW_WIDTH, point); textdist = text_distance_from( flow->text, point ) ; return linedist > textdist ? textdist : linedist ; }
static real rendobj_distance_from(RenderObject *rend_obj, Point *point) { Element *elem = &rend_obj->element; Rectangle rect; real dist; real text_dist; /* Todo: Make this better, more changeable by the user. */ rect.left = elem->corner.x; rect.right = elem->corner.x + elem->width; rect.top = elem->corner.y ; rect.bottom = elem->corner.y + elem->height; dist = distance_rectangle_point(&rect, point); if (rend_obj->desc->use_text) { text_dist = text_distance_from(rend_obj->text, point); if (text_dist<dist) dist = text_dist; } return dist; }
static real textobj_distance_from(Textobj *textobj, Point *point) { return text_distance_from(textobj->text, point); }