miroiu / nodify

Highly performant and modular controls for node-based editors designed for data-binding and MVVM.
https://miroiu.github.io/nodify
MIT License
1.3k stars 208 forks source link

[Question] Limit inifinte panning #53

Closed faguetan closed 1 year ago

faguetan commented 1 year ago

Hello! First of all, thank you for your amazing job with Nodify! Wanted to ask what is the best possible way of limiting panning to actual contents of the editor? I am building an application that suggests placing nodes in ordered columns with user having an option to add more columns and further add nodes in these new columns. Therefore from the start user workspace will be limited to visible screen area and zooming is disabled by design for the whole app. It would be great to be able to have horizontal and vertical scrollbars so that user would interact with the working area in the canvas-style way (horizontal and vertical scroll with scrolling stopping when we reach the end of canvas). Canvas can expand when user adds sufficient number of nodes in a column (vertical expansion) or columns (horizontal expansion).

miroiu commented 1 year ago

Hi @faguetan , one way to limit the panning to the actual contents of the editor is to bind to the ItemsExtent and limit the ViewportLocation based on it. For scrollbars, I suggest that you extend the NodifyEditor class and implement IScrollInfo, then wrap the instance in a ScrollViewer. I assume you want to build a Kanban board or something similar, and I don't believe Nodify is a good choice for this. There are a few open source projects and some paid libraries that can do exactly what you want.

faguetan commented 1 year ago

Hi @faguetan , one way to limit the panning to the actual contents of the editor is to bind to the ItemsExtent and limit the ViewportLocation based on it. For scrollbars, I suggest that you extend the NodifyEditor class and implement IScrollInfo, then wrap the instance in a ScrollViewer. I assume you want to build a Kanban board or something similar, and I don't believe Nodify is a good choice for this. There are a few open source projects and some paid libraries that can do exactly what you want.

Dear @miroiu , thank you so much for the tip! I will try this approach. Actually, it is not a Kanban I am building but rather an app that allows to create chains for certain business processes. Therefore Nodify is a 100% hit for this task. I hope to be able to demonstrate it at some point.

miroiu commented 1 year ago

Hi! I hope Nodify was indeed a good choice for your specific requirements. Feel free to reopen this issue if you still need more information.