diff --git a/packages/react-core/src/components/Drawer/DrawerPanelContent.tsx b/packages/react-core/src/components/Drawer/DrawerPanelContent.tsx index 2933af16965..122fa91fe2e 100644 --- a/packages/react-core/src/components/Drawer/DrawerPanelContent.tsx +++ b/packages/react-core/src/components/Drawer/DrawerPanelContent.tsx @@ -105,12 +105,11 @@ export const DrawerPanelContent: React.FunctionComponent { + const panelRect = panel.current.getBoundingClientRect(); + const initialPanelSize = position === 'bottom' ? panelRect.height : panelRect.width; + + resizeState.current = { + initialPointerPos: controlPosition, + initialPanelSize, + currWidth: initialPanelSize + }; + }; + const handleTouchStart = (e: React.TouchEvent) => { e.stopPropagation(); + setInitialResizeState(position === 'bottom' ? e.touches[0].clientY : e.touches[0].clientX); document.addEventListener('touchmove', callbackTouchMove, { passive: false }); document.addEventListener('touchend', callbackTouchEnd); isResizing = true; @@ -196,11 +207,11 @@ export const DrawerPanelContent: React.FunctionComponent { e.stopPropagation(); e.preventDefault(); + setInitialResizeState(position === 'bottom' ? e.clientY : e.clientX); document.addEventListener('mousemove', callbackMouseMove); document.addEventListener('mouseup', callbackMouseUp); drawerRef.current.classList.add(css(styles.modifiers.resizing)); isResizing = true; - setInitialVals = true; }; const handleMouseMove = (e: MouseEvent) => { @@ -223,33 +234,22 @@ export const DrawerPanelContent: React.FunctionComponent