Show Crosshair in 2.3 final

The plugin doesn’t work in the latest update. I always have this amazing plugin turned on. Is it going to be updated to the last version?

Error Message

Show Crosshair plugin:
drawBackgroundForLayer_: 'NSUnknownKeyException - [<GlyphsToolSelect 0x608000ca5fa0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key draggCurrent.'
Show Crosshair plugin:
drawBackgroundForLayer_: ‘NSUnknownKeyException - [<GlyphsToolSelect 0x608000ca5fa0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key draggCurrent.’

Can I trick this into working for the time being before a release

No, I guess I will just have to update it. I was wondering if anyone was still using it.

1 Like

Yes, I miss this feature a lot.

I fixed it.

1 Like

I assume it was a fixed in the program itself opposed to the plugin? So in a sense, I should wait for the next update.

I updated the plugin. Rainer needs to except the pull request.

Awesome. Thanks [smile]

Can the plugin be updated so that the crosshair is shown all the time, in any tool? (Okay, in some tools it doesn’t make sense, but I want it in any tool that involves Bezier curve.) Also I want to see the coordinate of the pointer, maybe at the edge of the view, not at the cursor.

Yes, that is possible now. Put that in the Macro window.

from Foundation import NSColor, NSBezierPath, NSMakeRect

def drawGlyphIntoBackground(layer, info):

	# Due to internal Glyphs.app structure, we need to catch and print exceptions
	# of these callback functions with try/except like so:
	try:
		if Glyphs.font.currentTab.graphicView().window().isKeyWindow():
			# Your drawing code here
			NSColor.redColor().set()
			event = Glyphs.currentEvent()
			Loc = Glyphs.font.currentTab.graphicView().getActiveLocation_(event)
			NSBezierPath.fillRect_(NSMakeRect(Loc.x, Loc.y, 100, 100))
	# Error. Print exception.
	except:
		import traceback
		print traceback.format_exc()
def drawUpdateEditView(notification):
	if Glyphs.font.currentTab.graphicView().window().isKeyWindow():
		Glyphs.redraw()

Glyphs.addCallback(drawGlyphIntoBackground, DRAWBACKGROUND)
selector = objc.selector(drawUpdateEditView, signature="v@:@")
NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(objc.nil, selector, "mouseMoved", objc.nil)

I add that notification the wrapper, so soon, you can replace the last two lines with with this:

Glyphs.addCallback(drawUpdateEditView, MOUSEMOVED)
1 Like