ui: add ref to both nav and panel

This commit is contained in:
Daniel Schmidt 2022-12-22 00:05:34 +01:00
parent c91c03caaf
commit 53da15685b

View File

@ -349,11 +349,14 @@ class Layout extends Component<LayoutProps, LayoutState> {
viewMode: undefined,
};
handleRef: React.RefObject<HTMLDivElement>;
navRef: React.RefObject<HTMLDivElement>;
panelRef: React.RefObject<HTMLDivElement>;
constructor(props: LayoutProps) {
super(props);
this.handleRef = React.createRef();
this.navRef = React.createRef();
this.panelRef = React.createRef();
const { bounds, options } = props;
const { resizerNav, resizerPanel } = persistence.get();
@ -535,9 +538,9 @@ class Layout extends Component<LayoutProps, LayoutState> {
onStart={this.setDragNav}
onDrag={this.resizeNav}
onStop={this.unsetDrag}
nodeRef={this.handleRef}
nodeRef={this.navRef}
>
<Handle ref={this.handleRef} axis="x" isDragging={isDragging === 'nav'} />
<Handle ref={this.navRef} axis="x" isDragging={isDragging === 'nav'} />
</Draggable>
)}
@ -563,8 +566,10 @@ class Layout extends Component<LayoutProps, LayoutState> {
onStart={this.setDragPanel}
onDrag={this.resizePanel}
onStop={this.unsetDrag}
nodeRef={this.panelRef}
>
<Handle
ref={this.panelRef}
isDragging={isDragging === 'panel'}
style={
isPanelBottom