W dniu 24 marca 2010 02:59 użytkownik Krzysztof Kosiński <tweenk.pl@...400...> napisał:
- Every canvas and arena item can receive events. This is useful when
implementing control points, but not for much else, and causes some slowdown when there are many complex paths, because on nearly every motion event the item under the cursor needs to be recalculated. I recall that when I profiled for slowdown in the new node tool, there was a nontrivial amount of time spent in children of pick_item on motion events. While the node tool obviously needs to do this, other tools like the selector don't - they only need to find the item under cursor on clicks. I propose to only pass events to items derived from a specific subclass, that register themselves in a geometric query structure when added to the canvas.
I guess this was too technical... translation to plain English: if we don't pass events to SPItems, we don't need to determine which item is under the cursor on every motion event. Doing this takes up about 20% of the time in the node tool, so we speed up things a bit. Control points (aka knots) would still receive events, because their canvas item would be derived from a special event-receiving class.
Events on SPItems are handled by "item handlers" in event contexts. As far as I know, most of them don't do anything interesting. Equivalent functionality can be obtained by calling sp_event_context_find_item in the event context's root handler.
Regards, Krzysztof