Tk Source Code

Ticket Change Details
Login
Overview

Artifact ID: cef984a679d3ef1675974d77258433026e2ef53b
Ticket: e9a842a3c584d6e709398529863fb8f798c83e3c
TkCanvas events search for all objects , even they are not displayed
User & Date: arjenmarkus 2013-11-10 15:16:42
Changes

  1. icomment:
    I have had a closer look at the patch and I realised that it can be implemented in a different way that is perhaps a bit less efficient, but requires no extra fields.
    
    A simple test program with a list of 1 million items shows that there is a small overhead of iterating over the entire list if the number of items to be considered is small (1%), but it is still 30 times faster than considering all items, where "considering" meant printing a number of the item. That seems quite acceptable.
    
    The idea is to keep track of the visibility of the items. We can simply iterate over the whole list and check if the item is visible. If not, there is no need to consider it any further. This can also be used to add an extra attribute, -hidden, to the set of properties of a canvas item, so that you can control at the scripting level if an item is visible or not.
    
    Also, there is an issue of compatibility to consider: the patch would suppress displaying rectangles and ovals that are smaller than two pixels, but that effectively means that applications that use small rectangles will give different results.
    
    So I suggest turning this feature on by an extra option to the canvas: -hidesmallitems.
    
    Also: the visibility of all items should be managed, not just rectangles and ovals.
    
  2. login: "arjenmarkus"
  3. mimetype: "text/plain"