static SPDrawAnchor * sp_draw_anchor_test (SPDrawAnchor *anchor, gdouble wx, gdouble wy, gboolean activate) { if (activate && (fabs (wx - anchor->wp.x) <= A_SNAP) && (fabs (wy - anchor->wp.y) <= A_SNAP)) { if (!anchor->active) { sp_canvas_item_set ((GtkObject *) anchor->ctrl, "filled", TRUE, NULL); anchor->active = TRUE; } return anchor; } if (anchor->active) { sp_canvas_item_set ((GtkObject *) anchor->ctrl, "filled", FALSE, NULL); anchor->active = FALSE; } return NULL; }
/** * Test if point is near anchor, if so fill anchor on canvas and return * pointer to it or NULL. */ SPDrawAnchor *sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, gboolean activate) { SPDesktop *dt = SP_EVENT_CONTEXT_DESKTOP(anchor->dc); if ( activate && ( Geom::LInfty( w - dt->d2w(anchor->dp) ) <= A_SNAP ) ) { if (!anchor->active) { sp_canvas_item_set((GtkObject *) anchor->ctrl, "fill_color", FILL_COLOR_MOUSEOVER, NULL); anchor->active = TRUE; } return anchor; } if (anchor->active) { sp_canvas_item_set((GtkObject *) anchor->ctrl, "fill_color", FILL_COLOR_NORMAL, NULL); anchor->active = FALSE; } return NULL; }