Problems found when making the reporters plug-in

When I make the reporter plug-in and use

-(void)drawBackgroundWithOptions:(NSDictionary *)options{
        [NSColor.orangeColor set];
        NSRectFill([_editViewController.graphicView userVisibleRect]);
}

to fill in the background color, when I open the eyes with the lower right button
image

, the editview will always flash whenever I click the mouse or draw the path with a pen, but when I close the small eyes in the lower right corner, there is no such problem. What is the reason?
Untitled

Why do you try to draw a background yourself? You can set the color in Preferences.

Drawing the background color is more complicated and quit performance intensive. So please don’t do this. If setting the color manually is not an option, you can use the code to overwrite the build in background color:

from AppKit import NSColor
graphicView = Font.currentTab.graphicView()
# set your own color
color = NSColor.redColor()
graphicView.setValue_forKey_(color, "canvasDefaultColor")
# reset it to the default
graphicView.setValue_forKey_(Glyphs.colorDefaults["GSColorCanvas"], "canvasDefaultColor")
graphicView.redraw_(None)

And the same in objectiveC:

graphicView = _editViewController.graphicView;
// set your own color
NSColor *color = NSColor.redColor;
[graphicView setValue: color forKey:@"canvasDefaultColor"];
// reset it to the default
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSColor *color = [defaults colorForKey:@"GSColorCanvas"];
[graphicView setValue: color forKey:@"canvasDefaultColor"];
graphicView.needsDisplay = YES;

There is another key to set the color for dark mode: canvasDefaultColorDark and GSColorCanvasDark

My requirement is to draw another graphic that will not move with the scroll bar in the graphicview, not the whole uservisiblerect. My picture just briefly demonstrates the situation I encounter, because I am not sure whether there is an error in my code or interface.

I see. And I could reproduce the issue. It should only happen if you have more than one document open. I fixed it.

That’s OK,thank you!