SOLVED Disable selection box in EditingTool
-
Hi, I'm working on a tool that subclasses
mojo.events.EditingTool
. I'm implementing my ownmouseDragged
, but is there a way to "disable" the selection box that's drawn onmouseDragged
?This is what I mean:
Thanks!
-
@frederik Ah, yes. I always forget about the
help()
function. Thanks!
-
this helps to find out what methods a class has, as not everything is documented on the site...
from mojo.events import EditingTool help(EditingTool)
-
@frederik Perfect. Thanks much!
-
The selection moves while dragging...
You can overwrite:
def dragSelection(self, point, delta): if myToolHasMySelection: # do you own dragging else: super().dragSelection(point, delta)
-
@frederik both of those work (no more marquee), but both seem to be moving the whole segment when I drag (not pressing any keyboard keys).
Any idea why this is happening?
-
or you can add the following method to your subclass
def canSelectWithMarque(self): return False
see the polygonSelectionTool as example.
(side note: I don't know why this is not is added to the docs, will investigate)
-
In your subclass of the
EditingTool
you can overwrite getMarqueRect. Based on your selection (the line between the offcurves) you can returnNone
or super the inherited class.Something like this should work (pseudo code):
class MyTool(EditingTool): def getMarqueRect(self, offset=None, previousRect=False): if self.myToolSelection: return None return super(self, MyTool).getMarqueRect(offset, previousRect)