-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow direct creation of short annotations in interactive plots #9133
Comments
Annotations can in principle have duration of 0, so I guess there's no reason we couldn't create annotations on single click... I think the original thinking was that annotations that are too short are hard to right-click on if you want to remove them later. @larsoner any opinion here? |
Let's not create short annotations with a single click, but rather stick with click and drag. That way, accidental clicks into the plot won't create annotations, which I'm sure would be very annoying. Clicking and dragging could be modified to support shorter durations though. I guess at the very least we could reduce the current threshold - is it a constant 100ms or does it depend on the currently visible data segment and/or sampling frequency? |
Thanks! To be able to directly delete with a right-click and no draggable edge, minspan=(1/sfreq)*2 works but needs a bit of click spamming in the area before catching it and I have not tested this extensively. Setting minspan to none works for my purpose but I guess the optimal setting here will depend on the most common use case for this tool. Maybe the single click option could be turned on only if self.mne.draggable_annotations. |
Personally I see "single click to create zero-duration annotation" as a valid use case.
That seems like a good enough user experience to me. I think it would require having draggable edges turned on by default; users can turn it off and be warned in the docstring and UI that zero-duration annotating will be disabled while it is off. @agramfort @larsoner any opinions here? |
like this it seems ok. I would need to play myself to see how it flies.
… |
Can we try to make right-click delete work? Then this would be independent of the draggable edges setting. |
We could in principle increase the "hit" tolerance on the zero-duration annotations, so that right-clicking within 3-4 pixels of it would count as a hit. Seems worth trying out. If the zero-duration annotation overlapped another annotation of a different type, the behavior is hard to predict... but nowadays we can dynamically show/hide different annotation types through the UI, so it is possible to avoid such situations. |
Another potential solution might be to replace the right-click delete with a right-button SpanSelector and clear all annotations within the right-button selector. It also has the added benefit of being able to delete multiple annotations at once. I tried it and it seems to work well enough but maybe it comes with some other downside I can't see Added this after _select_annotation_span ~ line 1332
Added the selector in the _create_annotation_fig function:
I also removed the if annotating in the right-click button press in _buttonpress:
|
Let's stick to the existing UX and just increase the click toleration to 3 pixels around it, I feel that right-click and dragging is a very exotic interaction. |
Describe the new feature or enhancement
At the moment, when annotating interactively on a raw.plot(), any annotation created by click and dragging disappears and is not saved on release if it is shorter than ~ 100 ms.
However, once created, annotations can be reduced to a shorter duration.
For some applications (e.g. manually marking peaks, adding events), it could be useful to be able to directly create short or single-sample annotations in one step/single-click.
The text was updated successfully, but these errors were encountered: