Disable selection box in EditingTool
jesentanadi last edited by gferreira
Hi, I'm working on a tool that subclasses
mojo.events.EditingTool. I'm implementing my own
mouseDragged, but is there a way to "disable" the selection box that's drawn on
This is what I mean:
In your subclass of the
EditingToolyou can overwrite getMarqueRect. Based on your selection (the line between the offcurves) you can return
Noneor 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)
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)
@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?
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 Perfect. Thanks much!
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 Ah, yes. I always forget about the