Discussed in #510
Originally posted by gswifort May 14, 2026
I observed the following behavior when using Ed.DrawJig. @CEXT-Dan — could you confirm whether these are intended?
Observations:
-
jig.drag() usually returns the same status returned by sampler(), with exceptions:
If the user presses Esc: sampler() runs to completion, but drag() returns kCancel regardless; update() and worldDraw() are not called.
If sampler() returns kNoChange → drag() still returns eOk.
Behavior by sampler() status:
eOk → update() and worldDraw() are called (normal).
kCancel → jig ends immediately.
kNull → jig runs; worldDraw() and update() are called (effectively same as eOk).
kOther → mouse movement does not call update()/worldDraw(); zoom calls update() and worldDraw(); panning calls only worldDraw() (not update()); zoom while panning behaves like panning.
kModeless → behaves like kCancel.
-
After clicking a point or pressing Enter, depending on what we return from sampler() we can distinguish the following end cases for the Jig:
eOk → after sampler() update() is called but not worldDraw(),
kNull → after sampler() neither update() nor worldDraw() is called,
kOther → same as eOk, i.e. after sampler() update() is called but not worldDraw().
-
If update() returns False, then drag() returns kOther (note, update() must be called, so for example, this won't happen when kNull is returned from sampler()); returning False from update() has no effect on Jig's behavior when moving the mouse around the screen.
-
If worldDraw() returns False, then Jig terminates immediately and drag() returns kCancel
Repro code:
def test_jig():
class MyJig(Ed.DrawJig):
def __init__(self):
super().__init__()
self._line = Db.Line()
def sampler(self) -> Ed.DragStatus:
self.setUserInputControls(Ed.UserInputControls.kNullResponseAccepted)
status, point = self.acquirePoint()
self.point = point
print("sampler", status, point)
return status
# return Ed.DragStatus.eOk
# return Ed.DragStatus.kCancel
# return Ed.DragStatus.kNull
# return Ed.DragStatus.kOther
# return Ed.DragStatus.kModeless
# return Ed.DragStatus.kNoChange
def update(self) -> bool:
print("update")
self._line.setEndPoint(self.point)
return True
# return False
def worldDraw(self, wd: Gi.WorldDraw):
print("worldDraw")
geom = wd.geometry()
geom.draw(self._line)
return True
# return False
jig = MyJig()
jig.setDispPrompt("Click a point or press Enter: ")
status = jig.drag()
print("Jig finished with status:", status)
Discussed in #510
Originally posted by gswifort May 14, 2026
I observed the following behavior when using
Ed.DrawJig. @CEXT-Dan — could you confirm whether these are intended?Observations:
jig.drag()usually returns the same status returned bysampler(), with exceptions:If the user presses
Esc:sampler()runs to completion, butdrag()returnskCancelregardless;update()andworldDraw()are not called.If
sampler()returnskNoChange→drag()still returnseOk.Behavior by
sampler()status:eOk→update()andworldDraw()are called (normal).kCancel→ jig ends immediately.kNull→ jig runs;worldDraw()andupdate()are called (effectively same aseOk).kOther→ mouse movement does not callupdate()/worldDraw(); zoom callsupdate()andworldDraw(); panning calls onlyworldDraw()(notupdate()); zoom while panning behaves like panning.kModeless→ behaves likekCancel.After clicking a point or pressing Enter, depending on what we return from
sampler()we can distinguish the following end cases for the Jig:eOk→ aftersampler()update()is called but notworldDraw(),kNull→ aftersampler()neitherupdate()norworldDraw()is called,kOther→ same aseOk, i.e. aftersampler()update()is called but notworldDraw().If
update()returnsFalse, thendrag()returnskOther(note,update()must be called, so for example, this won't happen whenkNullis returned fromsampler()); returningFalsefromupdate()has no effect on Jig's behavior when moving the mouse around the screen.If
worldDraw()returnsFalse, then Jig terminates immediately anddrag()returnskCancelRepro code: