That will be difficult as you are not notified when the mouse is moved (there is some code that should do that but is was broken). Here is a snippet that will give you the current mouse position. Use it in one of the drawing methods:
view = self.controller().graphicView()
mousePositionInWindowCoordinates = view.window().mouseLocationOutsideOfEventStream()
mousePositionInViewCoordinates = view.convertPoint_fromView_(mousePositionInWindowCoordinates, None)
I tried it, and it doesn’t work unless I drag then. Is there a way to disable the dragging behaviour of the selectTool plugin then? i.e. preventing it from creating the marquee box and disabling the edit features?
1+ for disabling the marquee box (just curious)
And: how can one detect if a modifier key is pressed? E.g. the
I’d like to combine theses 2 things: draw something only when a modifier key is pressed and hiding the marquee box.
The problem is not that the above code is not working but that the view is not notified to redraw itself.
To disable the selection box, overwrite the
drawSelection() method in the select tool. It is not possible to prevent it from within a reporter.
Thanks! And the modifier key question?
I was speaking about the case when you would build a selection tool.
BTW: I found out the modifierFlags
How to make it so that it doesn’t select anything,
def drawSelection(self): pass stops the marquee box from showing up but it still acts as as if something gets selected
selectAtPoint_withModifier_(self, aPoint, modifierFlag)
selectInRect_withModifier_(self, aRect, modifierFlag)
What do you mean with breaks the tool?
The method is called like that because if you what to select something you are very much interested in the modifiers. In your case you overwrite both methods to disable the default behavior.
Sorry it does work now I tried to edit my post but it’s still there
What is the argument to pass into the
mouseDoubleDown_ method on
I’d like to get a notification from a double click.
Usually, you do not call that method yourself. If you have a good reason for it, and know what you are doing, please take a look at Apple’s Event Handling and NSEvent documentation.
Thanks, Rainer. I guess i wont harm anyone with what I try to do. Thanks for the hint.
Is it still not possible to remove the selection marquee from a reporter? Not even with super crazy CG hacking? I want it so hard to not be there in some cases.
Digging this out to see if that’s possible nowadays?
Objective-C, if possible.
I have a Reporter with a dragging operation and while dragging, I need to turn off the selection marquee and the actual selection of GlyphsApp temporarily.
Otherwise when you move the thing around, you also select or even move Layer shapes, which is not desired.
Another problem is, that I want to keep the layer’s selection when dragging my thing.
Way back I even made the entire plugin a tool plugin, just because of that. But it has no tool functionality and should be a reporter. Now that I rewrite it, I stumbled again over this marquee issue.
I’m not sure if a reporter is the right place for this. Could you build a tool instead?
As I said, it was a tool before. But it has no Tool functionality, it just displays information, but you can move that information around with a little grabber.
The tool has the problem, that I when I use that, it doesn’t do what the actually selected tool does. The user still shall be able to use the path tool, or the selection tool, or whatever tool.