react-spaces icon indicating copy to clipboard operation
react-spaces copied to clipboard

Dynamic minimum and maximum size when resizing does not work

Open Gibbo3771 opened this issue 2 years ago • 3 comments

Describe the bug I am trying to use a dynamic resize on a left and right resizable that have a fill wedged in the middle. The issue is that when the space is resizing, the maximun and minimum sizes is captured on resize start. Right now, I have to stop resizing, once I can see it should stop, then drag and it will snap to it's maximum.

To Reproduce This is quite difficult to reproduce, as I have some extra features in my fork that allow access to the space wrapper from the outside.

I am basically measuring the size of a <Viewport />, <LeftResizable />, <RightResizable /> and <Fill />. If <Fill /> width goes below 25px I then take the viewport width and set a left and right maximum by doing the following:

if (fillWrapperDimensions.width > 50) {
            setLeftMaxSize(undefined);
            setRightMaxSize(undefined);
            return;
        };
	setLeftMaxSize(
		wrapperElementDimensions.width - rightWrapperDimensions.width
	);
	setRightMaxSize(
		wrapperElementDimensions.width - leftWrapperDimensions.width
	);

*WrapperDimensions are basically type Dimension = {width: number, height: number}.

Expected behavior I expect the Space to cancel resizing if it's maximum value is reached, even if that value is dynamic

Package versions (please complete the following information):

  • React version: [e.g. 17.0.2]
  • React spaces version: latest

I may be reporting this as a bug, but perhaps it could be an enhancement. If you also have any guidance on how to support this, that would be good. I have tried making a few changes to force the space to update when props.maximumSize changes but I believe there is more to it than this (obviously since it doesn't work!).

Gibbo3771 avatar Sep 02 '21 14:09 Gibbo3771

Hi @Gibbo3771. I'm going to try to get my resize logic refactor over the line in the next release (to support positional spaces) and then will start to focus on overrall minimum/maximum resizing functionality. There seem to be a lot of related requests regarding this (i.e. #87, #72). Hopefully we will be able to reach a consensus on how to move this forward.

aeagle avatar Nov 05 '21 11:11 aeagle

@aeagle Sounds good. Is there a WIP branch for the next release? I would be interested in tracking the progress :).

Gibbo3771 avatar Nov 08 '21 13:11 Gibbo3771

@Gibbo3771 Sure thing. There is a release/v0.3 branch and the main functionally I am preparing for it is on feature/resize-handles

aeagle avatar Nov 09 '21 12:11 aeagle