is_item_at
- From: control H <control h gmail com>
- To: goocanvas-list gnome org
- Subject: is_item_at
- Date: Mon, 23 May 2011 12:05:20 +0200
dear list,
I have made a line-item subclass of GOO_TYPE_CANVAS_ITEM_SIMPLE. This
subclass is (so far) only drawing 1 line. I overrule the is_item_at
function:
static gboolean
goo_line_item_is_item_at (GooCanvasItemSimple *simple,
gdouble x,
gdouble y,
cairo_t *cr,
gboolean is_pointer_event)
{
GooLineItem *line=(GooLineItem*)simple;
gboolean r,r2;
GooCanvasPointerEvents pointer_events = GOO_CANVAS_EVENTS_ALL;
gdouble width;
g_object_get (G_OBJECT(line),"line-width", &width,NULL);
cairo_move_to(cr,0,0);
cairo_line_to(cr,line->dx,line->dy);
cairo_set_line_width(cr,width+4.0);
cairo_set_source_rgb(cr,1,0,0);
r2=goo_canvas_item_simple_check_in_path(simple,x,y,cr,pointer_events);
r=cairo_in_stroke (cr, x, y);
printf(", r: %d, r2: %d\n",r,r2);
return r;
}
struct _GooLineItem
{
GooCanvasItemSimple parent_object;
gdouble dx,dy;
gboolean dragging;
};
When I put some goolineitem objects on the canvas, the
goo_line_item_is_item_at() returns only seldom TRUE. Both r and r2 are
FALSE when they should be TRUE. What I am doing wrong?
I use gtk 3.0.2 and goocanvas 2.0.0.
notes:
* I use line-width + 4.0 to make it easier to pick up thin lines.
* I want to use cairo_in_stroke() instead of
goo_canvas_item_simple_check_in_path() so that dashed lines can be
picked up anywhere
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]