FileBrowserComponent dragging behavior on iOS

Hi,

I’m having a hard time figuring out what is the best approach to use the FileBrowserComponent on iOS, to provide classic list-browsing and drag’n’dropping from the browser onto other UI components.

If I use the FileBrowserComponent in tree view mode, it clashes between scrolling the list and starting the drag’n’drop gesture. So if there’s more items in the list, the scroll drag works sometimes, but you can see it starting to drag the row temporarily.

Without tree view mode, drag’n’drop is simply not supported by the internal ListBox.

What’s the best approach so far to enable scrolling of the content, and drag’n’dropping ?

Thanks in advance.

E.

Really wish JUCE can support drag&drop for iOS, especially in AUv3, it’s definitely do-able (please see Koala Sampler), and this will open up the possibility of 3rd party file management for users.

JUCE team, please take this under consideration~
@reuk @fr810 @attila

3 Likes

After digging into the depth of FileBrowserComponent, when tree mode view is disabled, it uses a FileListComponent (which inherits from ListBox), the ListBox::RowComponent itself properly detects a scroll gesture on its viewport vs. a drag’n drop gesture.

This can be seen in the code of ListBox::RowComponent:

void mouseDrag (const MouseEvent& e) override
    {
        if (auto* m = owner.getModel())
        {
            if (isEnabled() && e.mouseWasDraggedSinceMouseDown() && ! isDragging)
            {
              [...]

However this method is never called, since FileListComponent implements its own row/item class (FileListComponent::ItemComponent). This ItemComponent class has no support for dragging/drag’n’dropping like the ListBox::RowComponent class.

I believe the bulk of the work would reside in adding all the scroll/drag detection code within FileListComponent.

So far this seems to be the most straightforward method, unless I’m missing something. Happy to hear the JUCE dev team thoughts about this possible improvement.

Thanks,
E.

1 Like

Actually this not solely an iOS issue, FileBrowserComponent just doesn’t support drag’n’drop.

Bumping this… Is suggested fix in the comment above would be the proper way to enable drag’n’drop in FileBrowserComponent ?

Thanks!

E.

I went forward and added the missing viewport scroll VS drag’n’drop gesture logic in FileListComponent::ItemComponent and it works quite nicely.

If the JUCE team is interested I could provide a pull request.

E.

1 Like