Skip to content
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

fix: Drag into sidebar always docks into an empty zone #499

Merged
merged 4 commits into from
Nov 20, 2024

Conversation

gwhitney
Copy link
Collaborator

@gwhitney gwhitney commented Nov 17, 2024

By submitting this PR, I am indicating to the Numberscope maintainers that I have read and understood the contributing guidelines and that this PR follows those guidelines to the best of my knowledge. I have also read the pull request checklist and followed the instructions therein.


Prior to this PR, dragging a tab on top of a docked one would leave
it floating over the docked tab. Moreover, if the empty zone in the
sidebar was less than half the size of the tab being dragged, it would
be impossible to dock the dragged tab at all.

Now any drag into a sidebar with at least one empty zone results in
a docking to the targeted zone if it is empty, or the first empty zone
if not.

Resolves #431.

Note that this PR does not at the moment implement any resizing.
There is resizing described in issue #431. However, now that this is
working smoothly, it is making perfect visual sense to me that the
dragged tab fits itself into the remaining empty space, leaving the
already-docked tab alone, and in fact, this behavior seems to me
preferable to what's described in #431. But if there remains a clear
desire for the resizing as described in the issue, that can be
implemented. Just let me know.

OK, this has been rebased and is ready for its own review. There are two spurious commits with changes to Formula.ts, a637a7f and 46d1ac9. These are an artifact of how I originally submitted this on top of #498. But the latter one precisely undoes the other, and so they will "squash commit" to nothing: the only commit that matters at this point is a53d7ea, and as you can see at the top, GitHub realizes that only Scope.vue has changed. Sorry about the confusion, I should have just done this as an independent PR like I did with the last two, but I didn't set Git up quite right this time. But now all should be well for this to be reviewed normally and once it is ready, squash-merged like normal.

@gwhitney gwhitney force-pushed the tab_drag branch 2 times, most recently from 0b8cd74 to 38230ec Compare November 17, 2024 22:43
  Prior to this PR, dragging a tab on top of a docked one would leave
  it floating over the docked tab. Moreover, if the empty zone in the
  sidebar was less than half the size of the tab being dragged, it would
  be impossible to dock the dragged tab at all.

  Now any drag into a sidebar with at least one empty zone results in
  a docking to the targeted zone if it is empty, or the first empty zone
  if not.

  Resolves numberscope#431.

  Note that this PR does not at the moment implement any resizing.
  There is resizing described in issue numberscope#431. However, now that this is
  working smoothly, it is making perfect visual sense to me that the
  dragged tab fits itself into the remaining empty space, leaving the
  already-docked tab alone, and in fact, this behavior seems to me
  preferable to what's described in numberscope#431. But if there remains a clear
  desire for the resizing as described in the issue, that can be
  implemented. Just let me know.
@gwhitney gwhitney marked this pull request as draft November 19, 2024 23:40
@gwhitney
Copy link
Collaborator Author

Aaron found a bug: pull out bottom tab, drag top tab down, try to drag that tab back up, it won't go, and then try to drag the old bottom tab back into the gap at the top, it just lands over the sidebar, it doesn't dock.
(Maybe the top zone did not get updated to empty when the tab dragged down.)

@gwhitney
Copy link
Collaborator Author

Aaron is fine with only the dragged tab resizing, so unless Kate disagrees we will just go with the current behavior (once the bug is fixed).

@gwhitney
Copy link
Collaborator Author

Another bug: Drag tab into left, resize it in left, drag it out so nothing is in left. When you put something in left, it now uses previous divider position.

   Also fixes bug that sometimes prevented docking in an apparently empty
   spot (the `empty` class was not being properly maintained).
@gwhitney gwhitney marked this pull request as ready for review November 20, 2024 08:37
@gwhitney
Copy link
Collaborator Author

OK, I believe that commit fixes all of the issues we observed at today's meeting. Ready for further review.

@katestange
Copy link
Member

Ok, I can't get it to do anything that seems like a bug. I'm going to merge.

@katestange katestange merged commit 64cef6a into numberscope:ui2 Nov 20, 2024
2 checks passed
@gwhitney gwhitney deleted the tab_drag branch November 20, 2024 19:51
gwhitney added a commit that referenced this pull request Jan 20, 2025
* fix: Make sure warnings are shown every time Formula changes

* fix: Drag into sidebar always docks into an empty zone

  Prior to this PR, dragging a tab on top of a docked one would leave
  it floating over the docked tab. Moreover, if the empty zone in the
  sidebar was less than half the size of the tab being dragged, it would
  be impossible to dock the dragged tab at all.

  Now any drag into a sidebar with at least one empty zone results in
  a docking to the targeted zone if it is empty, or the first empty zone
  if not.

  Resolves #431.

  Note that this PR does not at the moment implement any resizing.
  There is resizing described in issue #431. However, now that this is
  working smoothly, it is making perfect visual sense to me that the
  dragged tab fits itself into the remaining empty space, leaving the
  already-docked tab alone, and in fact, this behavior seems to me
  preferable to what's described in #431. But if there remains a clear
  desire for the resizing as described in the issue, that can be
  implemented. Just let me know.

* chore: revert change to Formula.ts left over from Git manipulations

* fix: tab drags and docking/undocking preserve size whenever possible

   Also fixes bug that sometimes prevented docking in an apparently empty
   spot (the `empty` class was not being properly maintained).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants