SOLVED Scale drawings on canvas while zooming

  • Hello,
    I'm working on a little tool that highlights the points of a contour when they are exactly on a metric line.
    It works well only that when you scale the glyph the highlights don't.
    Bildschirmfoto 2019-05-23 um 17.43.01.png
    Bildschirmfoto 2019-05-23 um 17.43.08.png
    Bildschirmfoto 2019-05-23 um 17.43.16.png

    As you can see it only works in a specific zoom level.
    Sadly I can't seem to find out how to do this, so any help would be much appreciated.

    I draw them like that

    def highlightPoints(self, info):
            if not self.w.showPoints.get():
            glyph = info["glyph"]
            asc =
            xhe =
            cap =
            dsc =
            size = 8
            # draw highlight
            if glyph is not None:
                for c in glyph:
                    for s in c:
                        for p in s:
                            if p.y == asc or p.y == xhe or p.y == cap or p.y == dsc or p.y == 0:
                                stroke(1, 0, 0, .6)
                                rect(p.x-size/2, p.y-size/2, size, size

  • Works great!
    Thanks a lot :)

  • hello @daniel,

    you can get the zoom level (drawing scale) from the notification:

    s = info["scale"]

    …and then use it to scale your drawing.