svecosystem / paneforge

Resizable pane components for Svelte.
https://paneforge.com
MIT License
370 stars 3 forks source link

Ability to set minimum width or height in pixels? #9

Closed saturnonearth closed 6 months ago

saturnonearth commented 6 months ago

Describe the feature in detail (code, mocks, or screenshots encouraged)

I want to be able to set a a minimum width in pixels so a side panel cannot be made smaller than the minimum. I tried using CSS classes for this which kind of works but has slightly funky behavior.

What type of pull request would this be?

Enhancement

Provide relevant links or additional information.

No response

huntabyte commented 6 months ago

This is unlikely to make it into the project anytime soon. While it seems simple at the surface level, it actually adds an (IMO) unmaintainable level of complexity into the project that I'm not willing to accept at the moment.

It has already been attempted and eventually removed in the well established React Resizable Panels, due to the amount of unexpected edge cases that come into play that make it a nightmare.

huntabyte commented 6 months ago

One thing we could possibly do is expose a callback prop like shouldResize or onResize where you'd get a reference to the pane being resized and could potentially prevent it from being able to shrink of the element is below a certain width/height or above a certain width/height.

saturnonearth commented 6 months ago

One thing we could possibly do is expose a callback prop like shouldResize or onResize where you'd get a reference to the pane being resized and could potentially prevent it from being able to shrink of the element is below a certain width/height or above a certain width/height.

If easy to implement, that would cool! I definitely don't want to add a lot of work onto you.