react-flow-chart icon indicating copy to clipboard operation
react-flow-chart copied to clipboard

CanvasInner shrinking to container width

Open fenech opened this issue 5 years ago • 1 comments

The CanvasInnerDefault component is defined as:

export const CanvasInnerDefault = styled.div<ICanvasInnerDefaultProps>`
  position: relative;
  outline: 1px dashed rgba(0,0,0,0.1);
  width: 10000px;
  height: 10000px;
  cursor: move;
` as any

In previous versions (I jumped from my own branch which was around ~0.0.8), the inner canvas was 10000px wide, so could be dragged horizontally by that distance. It was also possible to define the initial offset as e.g. { x: -5000, y: -5000 } to give the user more space to move in every direction.

In the current version (0.0.13) the CanvasInner component is rendered inside a <TransformComponent> which is display: flex. This means that it flex-shrinks to the width of the container.

A possible way to restore the original behaviour would be just to add flex-shrink: 0 to the CanvasInnerDefault component.

fenech avatar Jun 18 '20 11:06 fenech

Based on your solution, this css worked for me:

.react-transform-element > div {
  flex-shrink: 0;
}

sezanzeb avatar Jun 24 '20 18:06 sezanzeb