diff options
Diffstat (limited to 'src/edge.c')
-rw-r--r-- | src/edge.c | 32 |
1 files changed, 20 insertions, 12 deletions
@@ -249,21 +249,11 @@ ganv_edge_bounds(GanvItem* item, } } -static void -ganv_edge_update(GanvItem* item, int flags) +void +ganv_edge_get_coords(const GanvEdge* edge, GanvEdgeCoords* coords) { - GanvEdge* edge = GANV_EDGE(item); GanvEdgeImpl* impl = edge->impl; - if (parent_class->update) { - (*parent_class->update)(item, flags); - } - - // Request redraw of old location - ganv_edge_request_redraw(item->canvas, &impl->old_coords); - - // Calculate new coordinates from tail and head - GanvEdgeCoords* coords = &impl->coords; GANV_NODE_GET_CLASS(impl->tail)->tail_vector( impl->tail, impl->head, &coords->x1, &coords->y1, &coords->cx1, &coords->cy1); @@ -273,6 +263,7 @@ ganv_edge_update(GanvItem* item, int flags) const double dx = coords->x2 - coords->x1; const double dy = coords->y2 - coords->y1; + coords->handle_x = coords->x1 + (dx / 2.0); coords->handle_y = coords->y1 + (dy / 2.0); @@ -280,6 +271,23 @@ ganv_edge_update(GanvItem* item, int flags) coords->cy1 = coords->y1 + (coords->cy1 * (ceil(fabs(dy)) / 4.0)); coords->cx2 = coords->x2 + (coords->cx2 * (ceil(fabs(dx)) / 4.0)); coords->cy2 = coords->y2 + (coords->cy2 * (ceil(fabs(dy)) / 4.0)); +} + +static void +ganv_edge_update(GanvItem* item, int flags) +{ + GanvEdge* edge = GANV_EDGE(item); + GanvEdgeImpl* impl = edge->impl; + + if (parent_class->update) { + (*parent_class->update)(item, flags); + } + + // Request redraw of old location + ganv_edge_request_redraw(item->canvas, &impl->old_coords); + + // Calculate new coordinates from tail and head + ganv_edge_get_coords(edge, &impl->coords); // Update old coordinates impl->old_coords = impl->coords; |