Skip to content

Allow user to scroll while dragging a node #323

@mariosant

Description

@mariosant

I am wondering how to achieve dragging the tree container up or down when the user is dragging a node that's not visible. My container looks like this:

          <Tree
            openByDefault
            height={treeContainer.height ?? 1}
            width={treeContainer.width ?? 1}
            rowHeight={80}
            data={treeNodes as any}
            onMove={handleMove as any}
            renderRow={({ attrs, node, children, innerRef }) => (
              <Box
                ref={innerRef}
                sx={{ pl: `${node.level * 32}px` }}
                {...attrs}
              >
                {children}
              </Box>
            )}
            renderDragPreview={({ isDragging, mouse }) => (
              <Paper
                variant="outlined"
                sx={{...}}
              >
                <DragIndicator />
                <Box
                  sx={{...}}
                />
              </Paper>
            )}
          >
            {TreeNodeComponent}
          </Tree>```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions