|
|
@ -54,7 +54,8 @@ const DragBar = (props: IRemixDragBarUi) => { |
|
|
|
const handleResize = () => { |
|
|
|
const handleResize = () => { |
|
|
|
if (!props.refObject.current) return |
|
|
|
if (!props.refObject.current) return |
|
|
|
setOffSet(props.refObject.current.offsetLeft) |
|
|
|
setOffSet(props.refObject.current.offsetLeft) |
|
|
|
setDragBarPosX(props.refObject.current.offsetLeft + props.refObject.current.offsetWidth) |
|
|
|
if (props.layoutPosition === 'left') setDragBarPosX(props.refObject.current.offsetLeft + props.refObject.current.offsetWidth) |
|
|
|
|
|
|
|
else if (props.layoutPosition === 'right') setDragBarPosX(props.refObject.current.offsetLeft) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
@ -66,6 +67,7 @@ const DragBar = (props: IRemixDragBarUi) => { |
|
|
|
|
|
|
|
|
|
|
|
function stopDrag(data: any) { |
|
|
|
function stopDrag(data: any) { |
|
|
|
setDragState(false) |
|
|
|
setDragState(false) |
|
|
|
|
|
|
|
if (props.layoutPosition === 'left') { |
|
|
|
if (data.x < props.minWidth + offset) { |
|
|
|
if (data.x < props.minWidth + offset) { |
|
|
|
setDragBarPosX(offset) |
|
|
|
setDragBarPosX(offset) |
|
|
|
props.setHideStatus(true) |
|
|
|
props.setHideStatus(true) |
|
|
@ -76,6 +78,18 @@ const DragBar = (props: IRemixDragBarUi) => { |
|
|
|
setDragBarPosX(offset + props.refObject.current.offsetWidth) |
|
|
|
setDragBarPosX(offset + props.refObject.current.offsetWidth) |
|
|
|
}, 300) |
|
|
|
}, 300) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if (props.layoutPosition === 'right') { |
|
|
|
|
|
|
|
if (window.innerWidth - data.x < props.minWidth) { |
|
|
|
|
|
|
|
setDragBarPosX(props.refObject.current.offsetLeft) |
|
|
|
|
|
|
|
props.setHideStatus(false) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
props.refObject.current.style.width = (window.innerWidth - data.x) + 'px' |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
props.setHideStatus(false) |
|
|
|
|
|
|
|
setDragBarPosX(props.refObject.current.offsetLeft) |
|
|
|
|
|
|
|
}, 300) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function startDrag() { |
|
|
|
function startDrag() { |
|
|
|