Handling selection in a Custom Tool
jens last edited by gferreira
Is there a standard way to handle the selection/unselection of points in a custom tool?
I mean something like the
EditingToolbehaves. When I subclass my custom tool from the
EditingTool, the selection behaviour is there, but I don't want the editing/moving of points in my tool.
If I subclass the
BaseEventTool, I know how to find out where clicking/dragging starts and stops, but is there an easy way to find out the affected points to manage the selection myself? Something like
CurrentGlyph.getPointsInsideBox((x0, y0), (x1, y1))perhaps?
there is no standard way to set the point selection
you can use fontTools
from fontTools.misc.arrayTools import pointInRect for contour in CurrentGlyph(): for point in contour.points: print pointInRect((point.x, point.y), (minx, miny, maxx, maxy))
take a look at the PolygonSelectionTool
jens last edited by