re-resizable icon indicating copy to clipboard operation
re-resizable copied to clipboard

Dealing with intrinsic width and height for a modeless window

Open CMCDragonkai opened this issue 6 years ago • 2 comments

I have a modeless window that is draggable and resizable.

I used react-draggable for the draggability and this re-resizable for the resizing.

The difference between a modal and modeless window is that the modeless window doesn't block interaction with the background UI.

So I create an component structure like this:

<Draggable>
  <DraggableDiv>
    <Resizable>
      <div>
      </div>
    </Resizable>
  </DraggableDiv>
</Draggable>

The DraggableDiv has this css:

  position: fixed;
  height: max-content;
  width: max-content;
  max-height: 100%;
  max-width: 100%;
  margin: auto;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;

This is intended so the modeless window stays in the middle of the viewport and is also launched in the middle of the viewport. At the same time in order to be modeless, we need its width and height to be based on intrinsic width and height, so that the width/height of the draggable window is actually sized to its contents.

The Resizable component now gets to set the width and height according to javascript.

The problem is that when dragging the Resizable component. Whether left & right or up & down, it doesn't just drag the relevant border. It actually resizes the entire width or height respectively.

resizing problem

Is there a way to ensure that the DraggableDiv retains intrinsic width and height so we get a proper modeless window allowing background UI interaction, while still only getting resizing functionality that doesn't resize the entire height and width at the same time?

CMCDragonkai avatar Aug 02 '19 04:08 CMCDragonkai

@CMCDragonkai Did you come up with any solution for this , Stuck on the same road ?

ashiquemohammed avatar Feb 13 '24 14:02 ashiquemohammed

This is super old and no longer maintained, abandon ship!

CMCDragonkai avatar Feb 15 '24 05:02 CMCDragonkai