hi, @Mark . First of all, you are completely right and I don’t know why I didn’t tag you in this thread. I’m sure there’s stuff that has been discussed here that could have been solved easily with you around.
foregroundInViewCoords , I’m sure it’s quite easy to understand but I’m still having the same sort of problem. The x value is in a fixed place in the screen (no matter the zoom), while the y value is shifting everytime I zoom in or out. I adapted one of your sample scripts for sketch to use the
badge function in order to see whether I’m using x and y correctly. Maybe the following code helps you seeing what I’m doing incorrectly (I was using it in Skedge):
scale = Glyphs.font.currentTab.scale
layer = Glyphs.font.glyphs.layers
tab = Glyphs.font.currentTab
vP = Glyphs.font.currentTab.viewPort
vpOrigin = Glyphs.font.currentTab.viewPort.origin
def badge(x, y, s):
path = NSBezierPath.alloc().init()
rect = NSRect( (x-s/2, y-s/2), (s, s) )
ovalInRect = NSBezierPath.bezierPathWithOvalInRect_( rect )
path.appendBezierPath_( ovalInRect )
NSColor.colorWithCalibratedRed_green_blue_alpha_( 1, .2, 0, .5 ).set()
badge(vpOrigin.x/scale + 100/scale, vpOrigin.y/scale + vP.height/scale , 15 / scale )
Well, thanks again for your help or any hint regarding this issue. I really appreciate it.