Closed ykevu closed 2 years ago
This is related to undo failing to restore the panOnDrag
state of the canvasMachine
. When switching between tools in editSegmentMachine
on a SET_TOOL
event, the pan
state of the editSegmentMachine
sends a SET_PAN_ON_DRAG
event to canvasMachine
. Brush and threshold require clicking & dragging on the canvas to complete an action, so panning on click & drag should be disabled while using these tools.
This can be reproduced by
Now editSegmentMachine
is set to use the brush, but it never sent a SET_PAN_ON_DRAG
event to make the canvas behave correctly for the brush. The user can fix this by switching in and out of the brush manually (i.e. switch to Select then switch back to Brush) to send the SET_PAN_ON_DRAG
events and properly set the panOnDrag
state in canvasMachine
.
I can think of two possible solutions
panOnDrag
state for the canvasMachine
in its undo/redo history and restore it directly on undo/redoRESTORE
events in the pan
state in editSegmentMachine
and send SET_PAN_ON_DRAG
events as needed@tddough98 There was a much more common failure mode I was able to find for this bug: as long as you change from any other tab (DISPLAY/CELL/DIVISIONS) to the brush tool, the brush will not work and try to pan on drag instead. I've been looking into it but having trouble pinning down the cause, though I imagine it should be the same general issue as with the undo.
Switching from another tab to the brush only breaks the brush when you're already using brush/threshold. If you're using another tool that does pan on dragging (e.g. select), then the SET_TOOL event does trigger a SET_PAN_ON_DRAG. When SET_TOOL does not change the tool (when already using the brush but you're in another tab), then the event does not get set.
You can see in editMachine
, the state for each tab (display
, editDivisions
, etc.) except editSegment
sends SET_PAN_ON_DRAG on entry. For editSegment
, the SET_PAN_ON_DRAG is expected to be sent by the editSegmentMachine
itself, but this is not happening when the tool is already brush or threshold.
A quick fix for this error mode might be to send an event like ENTER_TAB
from editMachine
to editSegmentMachine
when switching into the segment tab and have editSegmentMachine
resend a SET_PAN_ON_DRAG
event for the current tool. This does not fix error mode for undoing.
Describe the bug After performing certain actions, switching back to the brush tool with either the 'b' hotkey or by clicking the brush tool will not allow you to perform brush strokes (mouse just stalls at area you click as if still in select mode).
To Reproduce Unclear exactly what conditions cause this to occur, but in general it seems that if you switch from brush to delete and back, it won't work unless you reselect.