Re: gnome-canvas, large items, and MOTION_NOTIFY handling question



On Wed, Feb 28, 2001 at 01:04:05PM +0200, Lauris Kaplinski wrote:
> If you do not need events, then you should just modify canvas item, to
> return some very large distance for ::point() method. You didn't
> specify, whether you use stock items, or created customs ones - you
> cannot do that with stock items unfortunately. But you can just very
> simple subclass, that overrides ::point method.  Also, if you need
> events, you can probably still speed your code up by modifying
> ::point(). In current canvas ::point() is supposed to return distance
> from point to object - there is little need for exact distance - for
> most cases it is sufficent to determine, whether point lies on item,
> or outside it. Just check, whether point is inside (using
> art_svp_wind or something) and return either 0 or 1000000...
> depending on result.

Thanks!  That's sounds like good idea.  Right now I work around the
problem by splitting the items (they are just lines, but with a lot of
points) into many smaller items.  Since canvas uses bounding boxes, this
speeds up mouse tracking significantly as long as there isn't a large
number of overlaping items. 

> On 22 Feb 2001 14:10:16 -0500, Jan Hlavacek wrote:
> > I hope this is the right place to ask.  I am writing a little
> > application that uses AA gnome canvas with rulers to track mouse
> > position.  It works fine as long as I don't use too complicated
> > items.  However, in my application I need to use lines with several
> > hundreds control points.  Every time mouse cursor enters the
> > bounding rectangle of such item, the rulers start seriously laging
> > behind the actual mouse cursor.  If I move the cursor several times
> > accross the bounding rectangle, I can see the marks on the rulers
> > slowly move around several seconds after the mouse cursor stoped. 
> > 
> > From what I could figure out, I believe that this is caused by the
> > fact
> > that gnome canvas is trying to figure out whether a mouse cursor is
> > over the line or not,  which is slow for complicated lines.  What I
> > would like to know is this:  Is there any way to stop canvas from
> > trying to send mouse events to its items?  Or is there some other
> > way how to speed the canvas mouse tracking?  

-- 
Jan Hlavacek                                            (219) 434-7566
Department of Mathematics                             Jhlavacek sf edu
University of Saint Francis               http://www.sf.edu/jhlavacek/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]