-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Clean up cell selection behavior #3414
Conversation
TDD baby! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
packages/notebook/src/widget.ts
Outdated
if (index === this.activeCellIndex) { | ||
// Already collapsed selection, nothing more to do. | ||
return; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else after a return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
packages/notebook/src/widget.ts
Outdated
Private.selectedProperty.set(this.widgets[head], false); | ||
} | ||
|
||
// Toggle everything strictly between head and index except anchor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverse order in comment for clarity? between index and head
?
test/src/notebook/widget.spec.ts
Outdated
expect(selected(widget)).to.eql([]); | ||
widget.select(widget.activeCell); | ||
expect(selected(widget)).to.eql([widget.activeCellIndex]); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon (from the lint report)
Tested locally, fixed one bug where |
@jasongrout, is this ready for testing/review?
…On Thu, Dec 21, 2017 at 2:16 AM, Steven Silvester ***@***.***> wrote:
Tested locally, fixed one bug where shift+click would immediately
deselect on mouseup. This LGTM, thanks!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3414 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABr0E8yjaprnRNewZS4vNQMJk1iYnQHks5tCjANgaJpZM4RGTXw>
.
--
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com
|
84ce15d
to
b2bc05f
Compare
I think I accidentally overwrote your fix with a force-push (since this was still a WIP PR), but I think I fixed the same thing. |
@ellisonbg - there still are some questions about the interaction of selection and dragging, but I think the selection by itself is ready for comment. One problem I did notice with the current PR is that selecting a different notebook resets the active cell for the notebook you are leaving to 0. |
@ellisonbg - I think this is ready for taking a spin. I haven't written tests for commits past fa914e3. I can work on writing those tests, or I can work on something more pressing for the release. |
Hmm, this builds but lab is pretty broken. Like the themes are not loading. @jasongrout have you rebased today? Could you? A lot has changed and I want to test it with everything else in place. |
Sure, I could try to rebase. I'm still not quite happy with how selection and dragging interplays, so I'm tackling that again. |
@ellisonbg - I'm much happier with how this works now. There still is a bug where it highlights too much when dragging a selection in the same document. I'll rebase this tomorrow, but probably will not be able to do it in the morning. |
Note to self: some of the tests are out of date, and lots of new tests need to be written to clarify the behavior. Let's see how many we can get done before a release deadline :). |
(Of note, just like in a text editor, now shift and dragging the mouse changes the selection) |
The bug that I'm still tracking down is if I highlight a bunch of cells and drag to move them in the same document, the active cell after the move seems to be randomly set - sometimes it's at the top of the selected/moved cells, sometimes at the bottom, and sometimes in the middle (!). I think it's a race condition with the cell widgets catching up to the model moves. I'll investigate more when I'm back online in a few hours. |
…ected querying just the selected state.
…own. There are still some subtle issues with starting a drag/drop we need to work through.
We need to use currentTarget, not target.
1. Prevent text selection right off. 2. If we don’t have a contiguous selection, deselect everything and write an error to the console.
2e0ae01
to
0920d53
Compare
I rebased on master. |
We were not considering the case when a cell moves from before to behind the active cell, or vice versa.
0920d53
to
5d67859
Compare
LGTM, no longer WIP? |
No longer WIP. Hopefully the tests pass (they do on my computer). |
Travis passes! |
Great work, thank you! |
This PR:
isSelectedOrActive
that is the equivalent of the previousisSelected
, and nowisSelected
and friends only refer to the selected property of a cell.head
of the selection is the active cell, and theanchor
is the other end of the selection. Comprehensive tests are included for this framework.Fixes #3373.
Another PR should create comprehensive tests for the UX around selection, particularly with keyboard handling and mouse events.