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 and drop #18

Closed
gedw99 opened this issue Dec 5, 2024 · 15 comments
Closed

Drag and drop #18

gedw99 opened this issue Dec 5, 2024 · 15 comments

Comments

@gedw99
Copy link
Contributor

gedw99 commented Dec 5, 2024

It would be really awesome if drag and drag worked .

The tree is great and allows you to see all your files .

  1. drag and drop files from the tree across to a layout, so that users can easily compose their layouts from the resources they have on disk .

  2. dag and drop a file ( from the OS) into a folder in the tree across, so that users can easily “ upload files “.

I know this is a ton of work and gio does not seem to have automatic drag and drop .

gioui/gio#111

@gedw99
Copy link
Contributor Author

gedw99 commented Dec 5, 2024

Maybe @mirzakhany also needs something like this .
Mi know I need it for Scientusts being able to markup their stuff ..

@gedw99
Copy link
Contributor Author

gedw99 commented Dec 5, 2024

@oligo thanks for maintaining this

@oligo
Copy link
Owner

oligo commented Dec 5, 2024

Hi, @gedw99, I guess you are referring to the file tree component, right? For in-app DnD, this should be straightforward. I will try to add some event handler and give it a try. For the second part, as you see from the linked issue, framework support is halted, maybe we have to figure out why first.

@gedw99
Copy link
Contributor Author

gedw99 commented Dec 5, 2024

Thanks .

In app , ans you aptly put it, dnd would be highly useful . Os based is not that important t , since the file tree is showing what files are on the OS.

I use xml to represent a document , that is yet to be rendered into its final form ( pdf, email, svg, html.

essentially we are binding data sources to the xml layout.

so when they drop a file they are dropping it onto a gio canvas which has placeholders exposed. We then record the mapping of a placeholder to a file .

later the xml file is processed along with the files to produce a finished document.

the files represent the data . Be it markdown or image or sql query.

This is the xml: https://github.com/ajstarks/deck/tree/master?tab=readme-ov-file#markup

that’s my use case at least .

@oligo
Copy link
Owner

oligo commented Dec 5, 2024

OK, I get your point. So you want to use file entries of file tree as source and make it draggable. The other part is delegated to widgets in your app, right?

@gedw99
Copy link
Contributor Author

gedw99 commented Dec 5, 2024

Yes that’s pretty much it.

if you want to make a basic example of drag and dropping to an xml gio canvas then we know it will work . The deck one already does this . See below..

Once the deck xml slots are mapped to the file paths it can be saved or passed to the deck gio renderer.

This is the deck gio renderer. The widgets in my app as you say .
https://github.com/ajstarks/giocanvas/tree/master/gcdeck

@oligo
Copy link
Owner

oligo commented Dec 6, 2024

Hi @gedw99, I pushed a commit for you to test: d4494bd

There's also an simple example showing the usage in example/basic/file-explorer.go

@oligo
Copy link
Owner

oligo commented Dec 6, 2024

Dropping items to the file tree itself is not yet implemented, I'll finish it some time later.

@gedw99
Copy link
Contributor Author

gedw99 commented Dec 7, 2024

Hi @gedw99, I pushed a commit for you to test: d4494bd

There's also an simple example showing the usage in example/basic/file-explorer.go

Will give it a go today . Thanks @oligo

@gedw99
Copy link
Contributor Author

gedw99 commented Dec 7, 2024

quick test on Mac for drag and drop to square in main pane.

works on Mac.

Screenshot 2024-12-07 at 5 56 07 pm

@gedw99
Copy link
Contributor Author

gedw99 commented Dec 7, 2024

will test on Windows...tomorrow, but should work same since its all in app.

@gedw99 gedw99 closed this as completed Dec 7, 2024
@oligo
Copy link
Owner

oligo commented Dec 12, 2024

Dropping items to the file tree itself is not yet implemented, I'll finish it some time later.

Added to EntryNavItem and test passed.

@gedw99
Copy link
Contributor Author

gedw99 commented Dec 13, 2024

Thanks @oligo

will try it out today

@gedw99
Copy link
Contributor Author

gedw99 commented Dec 13, 2024

I’m planning to add a watcher if some sort so that if the file system changes the gui updates .

Will add an issue for this though as it’s pretty different to this

@gedw99
Copy link
Contributor Author

gedw99 commented Dec 13, 2024

Oh wow I just noticed that the drag and drop on the tree view works. It does not move the file, but you can drag and drop visually.

this means we can hook it into the File Ops in the other issue if we want.

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

No branches or pull requests

2 participants