My plugin draws objects below inactiveLayers()

I’m trying to create some special tools for the spacing. I created quite complicated reporter plugin which sometimes draws something similar to measurement line.
To do so I’m using inactiveLayers() with needsExtraMainOutlineDrawingForInactiveLayer_() turned on. I met following issue:

I wanted to draw those red objects above the letters (something like the foreground() but in inactiveLayers() ): not below. Can anyone help me to manage it?

Thanks in advance for your help

EDIT:
Another thing is that even without preview() method in my class, those red objects draws in the preview window. I cope with that by adding preview-method only with “pass” expression in it

Have you tried disabling the main outline and drawing everything yourself?

yes, but inactivelayer() moves a little bit to the upper direction, like 1-2 pixels. I don’t trust this and I’ve jus overridden it, by writing just a little more complicated code in foreground() method.

This is very similar to the measurement line of the text tool. There I draw the whole line in the foreground method. You get to all layers and their position:

layerCount = self.controller.graphicView().cachedLayerCount()
for i in range(layerCount):
	layer = self.controller.graphicView().cachedGlyphAtIndex_(i)
	position = self.controller.graphicView().cachedPositionAtIndex_(i)
1 Like