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

drag tab outside should be result into an new window :) #4

Closed
boonkerz opened this issue Aug 12, 2022 · 26 comments · Fixed by #149
Closed

drag tab outside should be result into an new window :) #4

boonkerz opened this issue Aug 12, 2022 · 26 comments · Fixed by #149
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@boonkerz
Copy link

nice to have i think :)

link maybe help:
https://github.com/vivlim/egui-glow-multiwin

@Adanos020
Copy link
Owner

Agree, this feature is going to be crucial to get the library to a usable state

@Jerrody
Copy link
Contributor

Jerrody commented Aug 12, 2022

It can be done with:
https://docs.rs/egui/latest/egui/containers/struct.Window.html

egui::Window::new("My Window").show(ctx, |ui| {
   ui.label("Hello World!");
});

Another part is how to determine that the tab is should be the new window.

@Adanos020
Copy link
Owner

Adanos020 commented Aug 12, 2022

One way of achieving this effect is to imitate Dear Imgui.

image

While the tab is being dragged outside of the tab bar, it is a new window until you drop it while hovering over one of these icons that show up in the middle of the node you're currently hovering over. If it's dropped anywhere else, it stays as a window.

We might consider implementing this for all egui::Windows or creating our custom egui_dock::DockableWindow (or whatever we're gonna call it) instead.

@Jerrody
Copy link
Contributor

Jerrody commented Aug 12, 2022

One way of achieving this effect is to imitate Dear Imgui.

image

While the tab is being dragged outside of the tab bar, it is a new window until you drop it while hovering over one of these icons that show up in the middle of the node you're currently hovering over. If it's dropped anywhere else, it stays as a window.

We might consider implementing this for all egui::Windows or creating our custom egui_dock::DockableWindow (or whatever we're gonna call it) instead.

If we are going to do this it will require big changes.

@Adanos020
Copy link
Owner

Definitely. But I think it's going to be worth it as it would make using the docking UI much easier.

Of course, I'm open to other ideas too, this one's just the first thing that came into my mind.

@Jerrody
Copy link
Contributor

Jerrody commented Aug 12, 2022

Definitely. But I think it's going to be worth it as it would make using the docking UI much easier.

Of course, I'm open to other ideas too, this one's just the first thing that came into my mind.

Or (it is simple and seems pretty elegant) it's just right-clicked on a tab and then this tab becomes an individual window.
Although it may look like a hack :P
But I think that this is not what should be.

@Jerrody
Copy link
Contributor

Jerrody commented Aug 12, 2022

One way of achieving this effect is to imitate Dear Imgui.

image

While the tab is being dragged outside of the tab bar, it is a new window until you drop it while hovering over one of these icons that show up in the middle of the node you're currently hovering over. If it's dropped anywhere else, it stays as a window.

We might consider implementing this for all egui::Windows or creating our custom egui_dock::DockableWindow (or whatever we're gonna call it) instead.

I have an idea. What if to remove this area and replace it with creating a new window?
image

And keep it to have the ability to attach a tab to the node.
image

@Adanos020
Copy link
Owner

Or (it is simple and seems pretty elegant) it's just right-click on a tab and then this tab becomes an individual window.

I have a couple problems with this idea:

  • It's not nearly as intuitive to the user as pulling the tab out of the tab bar
  • How would you dock the window back into a specific node?

@Adanos020
Copy link
Owner

I have an idea. What if to remove this area and replace it with creating a new window? image

Can you elaborate more on the exact behaviour you have in mind? I'm not quite sure what area you mean to remove, among other things.

@Jerrody
Copy link
Contributor

Jerrody commented Aug 12, 2022

Can you elaborate more on the exact behaviour you have in mind? I'm not quite sure what area you mean to remove, among other things.

I mean instead of showing this fully filled selection the user will have an ability to drop a tab and create new window.

@Jerrody
Copy link
Contributor

Jerrody commented Aug 12, 2022

Okay, I determined how to do this.

println!("{:?} {:?}", helper.size(), hover.size());

image

The next thing it's how to create the window and copy content from the tab and dock back the window.

@Jerrody
Copy link
Contributor

Jerrody commented Aug 12, 2022

Sorry, if I explain pretty odd.

@Adanos020
Copy link
Owner

So if I understand correctly: dragging the tab looks like it does right now and dropping it in a certain spot should create a new window out of it, or dock it in a node if it's dropped in another certain spot. Is that right?

I'm not yet sure how it would feel to the user, but it's worth giving it a try!

@Jerrody
Copy link
Contributor

Jerrody commented Aug 13, 2022

So if I understand correctly: dragging the tab looks like it does right now and dropping it in a certain spot should create a new window out of it, or dock it in a node if it's dropped in another certain spot. Is that right?

I'm not yet sure how it would feel to the user, but it's worth giving it a try!

My current state of experiments.
ezgif com-gif-maker

@Jerrody
Copy link
Contributor

Jerrody commented Aug 13, 2022

It works pretty good other thing is how to translate content to the window and how to back this window to the nodes as a tab.

@Jerrody
Copy link
Contributor

Jerrody commented Aug 13, 2022

I think that should be great idea if to create a nightly branch where we can do experiments and others dark things :')

@Adanos020
Copy link
Owner

Good progress so far!

I think that should be great idea if to create a nightly branch where we can do experiments and others dark things :')

That's not a bad idea, I'll create one now. We can also use draft pull requests for tracking all WIP stuff.

@Jerrody
Copy link
Contributor

Jerrody commented Aug 13, 2022

That's not a bad idea, I'll create one now. We can also use draft pull requests for tracking all WIP stuff.

Sounds good.

@Adanos020
Copy link
Owner

Done, you can use the experimental branch :)

@Jerrody Jerrody mentioned this issue Aug 13, 2022
@smallB007
Copy link

Guys, if I may add to that discussion. If anyone wants to know how docking should behave, please look how Visual Studio (not VSCode). They (Visual Studio) simply perfected it.

@Adanos020
Copy link
Owner

Guys, if I may add to that discussion. If anyone wants to know how docking should behave, please look how Visual Studio (not VSCode). They (Visual Studio) simply perfected it.

Yes, this is the approach I would like to go with, that's why I'm suggesting to imitate Dear ImGui.

@Adanos020
Copy link
Owner

I created a discussion for this feature: #29

@Adanos020 Adanos020 added enhancement New feature or request help wanted Extra attention is needed labels Mar 22, 2023
@gre-v-el
Copy link

gre-v-el commented May 17, 2023

nice to have i think :)

link maybe help:
https://github.com/vivlim/egui-glow-multiwin

I know this issue is pretty old, but judging by the linked repo I think the original poster meant the os window, not the egui::Window in their feature request. See the linked YouTube video in the README of the linked repo.

@micfong-z
Copy link
Contributor

micfong-z commented Jun 17, 2023

Upon some tweaking (with breaking changes), I'm able to make it this far (code at https://github.com/micfong-z/egui_dock/tree/main; definitely not ready for a PR), with a Dear ImGui-like overlay:

Screen.Recording.2023-06-17.at.22.16.26.mp4

I'm using a separate Vec<(Tab, Pos2)> in DockArea to store all detached windows (Pos2 used to track init position of window).

However, same as in #27, I have totally no idea how to handle the windows after they are "detached".

Maybe we should make DockArea contain a Vec<Tree<Tab>> so that all detached windows have individual Trees to handle the tabs in it, and the tabs should be able to interact with other Trees on other windows. (AFAIK, imgui gives all detached windows new tab managing areas)

I'm relatively new to Rust, and so its data structures. So there might be better solutions (?)

@Adanos020
Copy link
Owner

@micfong-z Great work, this looks incredible!

I think the issue with detached windows might be that we'd need to make changes to egui itself, so that we could "steal" the contents of any egui::Window, close it, and put them in a tab. Another option is to create our own DockableWindow and capture its instances.

It's not an easy problem to solve and will probably take a few iterations to get this right.

I also think it might be worthwhile to create a new branch just for this feature. You could then open a PR to that branch so that other people would also be able to contribute.

@Adanos020
Copy link
Owner

Closed by #149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants