CodeEdit icon indicating copy to clipboard operation
CodeEdit copied to clipboard

New generic TabView with drag and drop + state fix

Open Wouter01 opened this issue 2 years ago • 1 comments

Description

A new ReorderableTabView, which replaces AreaTabBarAlt.

Why?

  • It's designed to work like a built-in View. No custom protocols, but instead a generic view. Options are provided with modifiers.
  • It fixes multiple state issues. Tab state is now kept when tabs are switched (e.g. scroll position of file tree)
  • Local drag and drop. This was in the previous version too but it's more efficient here.
  • Global drag and drop. This wasn't in the previous version, and allows the item to be dragged outside the view.
  • Drop Target. The view can act like a drop target, and can accept new tabs that are dragged over it. This makes it easy to support multi-pane tabs.
  • All the drag and drop functionality uses the built-in SwiftUI ForEach modifiers, such as onMove, onInsert, and onDelete. This makes it easier to control view state.
  • Additional layout modes. The view makes it possible to place the tab bar at the top, bottom, left or right.

Note that this PR adds the possibility to add all this functionality, but doesn't implement all of it. For example, global drag and drop is possible (and is enabled for the navigator), but isn't used yet as a second navigator tabview isn't present yet. Thanks to this PR, it can be added later on with just a few code changes.

Checklist

  • [x] I read and understood the contributing guide as well as the code of conduct
  • [x] The issues this PR addresses are related to each other
  • [x] My changes generate no new warnings
  • [x] My code builds and runs on my machine
  • [x] My changes are all related to the related issue above
  • [x] I documented my code

Related issues

  • #1301
  • #711

Wouter01 avatar Dec 28 '23 00:12 Wouter01

@CodeEditApp/maintainers What do we want to do with this at this point?

austincondiff avatar Mar 11 '24 17:03 austincondiff

Closing this, I believe we discussed closing this earlier in a meeting.

thecoolwinter avatar Jun 17 '24 18:06 thecoolwinter