Skip to content

Support for header item? #323

@julius-b

Description

@julius-b

As far as I can see, this library does not support this use case:

LazyDragSelectVerticalGrid(...) {
  item(span = { GridItemSpan(maxLineSpan) }) {
    // Header item
  }

  items(key = { it.id }) { item ->
    SelectableItem(item = item) {
        Item(item)
    }
  }
}

because when I long click on any item, the selection actually starts at clicked-item-position + 1. (Removing the header item fixes the problem)
Such an header item is the only way of including text/filters/etc. in the list that should scroll with the list, so it's an important use case.

I'm not sure how to add this feature, one way might be to pass an option to LazyDragSelectVerticalGrid that it should only consider items of a certain contentType for selection (and then pass a different contentType to the header item), but the problem is that itemIndexAtPosition goes by hitboxes and might not be aware of what type of item it has looked at, so the only alternative I can see it pass an offset Integer to LazyDragSelectVerticalGrid that can be subtracted from the determined index.

Or is there a way to exclude this header item from the selection process I'm not seeing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions