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.
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(): return glyph = info["glyph"] asc = f.info.ascender xhe = f.info.xHeight cap = f.info.capHeight dsc = f.info.descender 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: fill(None) stroke(1, 0, 0, .6) strokeWidth(2) 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.