Repository navigation
Allow reordering project folders via drag and drop - #525
Conversation
|
+1 this would be great, specially with a lot of folders not alphabetically ordered |
|
I've updated this to work with the drag and drop changes in master. The semantics are that project folder dragging will occur if the drop occurs over the top half of a project folder entry, or over a file entry. The placeholder will appear if and only if project folder movement will occur, otherwise, selection will appear. Alternate semantics that I've thought about are that file movement should only occur if the user is holding down the shift key, similar to many file managers. |
|
+1 |
There was a problem hiding this comment.
It's from this PR: #565 ; I accidentally merged it in at some point. I can rebase it out if needed.
|
Can you please rebase on top of master so that only the changes specific to this PR get displayed in the diff? It gets confusing reviewing when there's changes from other, unrelated PRs. |
6c2d06e to
957287d
Compare
|
@50Wliu Rebased. The other PR isn't 100% unrelated, but the fix is disjoint. 😉 |
|
+1 |
Now, instead of the top 50% being used for sorting project folders and the bottom 50% for moving the actual files, the middle 40% is used for moving the actual files, and the top & bottom 30% is used for sorting project folders.
957287d to
7fcbb6c
Compare
|
Rebased and updated. Tests all work. @50Wliu ping! |
|
/cc @atom/feedback |
|
Is there a particular reason this wasn't merged yet? I'd love to have this feature. |
|
Please make this behavior optional (toggled by a setting). Too many times I had accidentally dragged an entry instead of clicking on it. |
|
@mxstbr I guess someone with the proper authorization needs to review and approve the code (there's a "needs-review" label attached). |
|
Sorry about the delay. I linked this locally to test and found this issue right away: if you open the editor with a single project, and drag that project and drop it onto one of its own subfolders, an error is displayed. We need to not only do nothing on drop in this case, we shouldn't be highlighting / selecting tree view entries as the project is dragged over them. |
|
any progress on this? missing it badly ;) |
|
@forivall @Ben3eeE This seems to be because we're calling diff --git a/lib/root-drag-and-drop.coffee b/lib/root-drag-and-drop.coffee
index af68e01..829fd15 100644
--- a/lib/root-drag-and-drop.coffee
+++ b/lib/root-drag-and-drop.coffee
@@ -24,6 +24,7 @@ class RootDragAndDropHandler
@treeView.on 'drop', '.tree-view', @onDrop
onDragStart: (e) =>
+ @lastDropTargetIndex = null
e.originalEvent.dataTransfer.setData 'atom-event', 'true'
projectRoot = $(e.target).closest('.project-root')
directory = projectRoot[0].directory
@@ -75,6 +76,8 @@ class RootDragAndDropHandler
newDropTargetIndex = @getDropTargetIndex(e)
return unless newDropTargetIndex?
+ return if @lastDropTargetIndex is newDropTargetIndex
+ @lastDropTargetIndex = newDropTargetIndex
@removeDropTargetClasses()This resolves the jank on my machine. Finally, I wonder if it makes more sense to put the placeholder above the hovered project if you're on the upper half of the entire entry, not just the header. In that case, we'd additionally need diff --git a/lib/root-drag-and-drop.coffee b/lib/root-drag-and-drop.coffee
index 829fd15..62edee5 100644
--- a/lib/root-drag-and-drop.coffee
+++ b/lib/root-drag-and-drop.coffee
@@ -157,9 +158,7 @@ class RootDragAndDropHandler
return 0 unless projectRoot.length
- element = projectRoot.find('.project-root-header')
-
- elementCenter = element.offset().top + element.height() / 2
+ elementCenter = projectRoot.offset().top + projectRoot.height() / 2
if e.originalEvent.pageY < elementCenter
projectRoots.index(projectRoot)
|
|
@BinaryMuse Hmm, I didn't think that reinserting the same element would cause the issue, and I wasn't seeing jank on my machines (OSX or Linux, stable atom). But cool, that's a simpler solution than what I briefly tried over my lunch break (debouncing). Also, I originally did have the placeholder position based on the center of the entire entry, but switched it to the header during the phase where on-disk dragging was allowed. 👍 to reverting back to that placeholder positioning. |
|
@BinaryMuse Nice 👍 I will test this again later tonight to verify functionality and responsiveness on my machine. |
|
@BinaryMuse I also added the change for
in edf9e5b. Try it out! |
|
@forivall This looks awesome, great work! I'm going to look into the spec failures (which have nothing to do with your PR) and once that's resolved I'll merge this. 🎉 [Edit] I lied, gonna worry about the Windows stuff later. To the Merge Button! |
|
@forivall THANK YOU SO MUCH!!!!! 🎉🎉 |
|
How can I use this feature? |
|
If you want it right now, you'll have to build Atom from source. If you can wait, this will be available in the next beta release. |
|
@peterschmidler you can also clone this repository and |
|
Or just |
|
Keep in mind that installing the package from a local source via |
|
What about |
|
@KSXGitHub I guess to be more specific, any mechanism by which you place a package with the same name as a core, bundled package in your |
|
I highly advise people to not install core packages directly — it only leads to tears. Core packages should only be symlinked in dev mode when you are actively working on the package. Since this issue has gone completely off-topic, and needlessly notifying 21+ people is unnecessary, I'm locking this thread. If someone wants to discuss this further, do it on the Slack channel or on Discuss 🙇 |





Fixes #691
This uses the same logic that moving tabs uses to reposition project folders within the tree view.
Future additions:
Bugfixes