xyflow / xyflow

React Flow | Svelte Flow - Powerful open source libraries for building node-based UIs with React (https://reactflow.dev) or Svelte (https://svelteflow.dev). Ready out-of-the-box and infinitely customizable.
https://xyflow.com
MIT License
25.9k stars 1.66k forks source link

Node Resizer: add option to overwrite the resize direction #2986

Open chrtze opened 1 year ago

chrtze commented 1 year ago

Describe the Bug

Currently, the controls of the NodeResizer get their possible resize directions based on their positions. This means that it's not possible to limit a control in the bottom-right corner to resize only horizontally. Maybe we can add an option to overwrite the direction in which a control can resize the node.

Your Example Website or App

https://codesandbox.io/s/zen-wind-w9znpf?file=/ResizableNode.js

Steps to Reproduce the Bug or Issue

Expected behavior

It should be possible to limit the direction for all controls

Screenshots or Videos

No response

Platform

all

Additional context

https://github.com/wbkd/react-flow/discussions/2868

jt6677 commented 11 months ago

shouldResize={(e, params) => params.direction[1] === 0} does not work on diagonal.

peterkogo commented 2 months ago

Good idea. We will add an additional prop to NodeResizeControl so the displayed position can differ from the resize direction.