mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-18 21:36:27 +01:00
Fix draggables
This commit is contained in:
parent
1f562d01b1
commit
1378417904
@ -22,6 +22,22 @@ export function DraggableWindow(props: DraggableWindowProps): JSX.Element
|
||||
|
||||
function onMouseDown(event: MouseEvent): void
|
||||
{
|
||||
const index = currentWindows.indexOf(elementRef.current);
|
||||
|
||||
if(index === -1)
|
||||
{
|
||||
currentWindows.push(elementRef.current);
|
||||
}
|
||||
|
||||
else if(index === (currentWindows.length - 1)) return;
|
||||
|
||||
else if(index >= 0)
|
||||
{
|
||||
currentWindows.splice(index, 1);
|
||||
|
||||
currentWindows.push(elementRef.current);
|
||||
}
|
||||
|
||||
bringToTop();
|
||||
}
|
||||
|
||||
@ -43,7 +59,7 @@ export function DraggableWindow(props: DraggableWindowProps): JSX.Element
|
||||
|
||||
return (
|
||||
<Draggable handle={ props.handle } { ...props.draggableOptions }>
|
||||
<div ref={ elementRef } className="position-absolute t-0 l-0" onMouseDown={ onMouseDown }>
|
||||
<div ref={ elementRef } className="position-absolute t-0 l-0" onMouseDownCapture={ onMouseDown }>
|
||||
{ props.children }
|
||||
</div>
|
||||
</Draggable>
|
||||
|
Loading…
Reference in New Issue
Block a user