Skip to content

Commit

Permalink
1544: Reset dragHandler position after column resize
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben van Leeuwen committed Dec 2, 2024
1 parent 4d1579d commit 250f554
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ export const WfoDragHandler: FC<WfoDragHandlerProps> = ({
fieldName,
onUpdateColumWidth,
}) => {
// const [position, setPosition] = useState({ x: 0, y: 200 });
const [position, setPosition] = useState({ x: 0, y: 0 });

// const onDrag: DraggableEventHandler = (_, data) => {
// setPosition({ x: data.x, y: data.y });
// };
const onDrag: DraggableEventHandler = (_, data) => {
setPosition({ x: data.x, y: data.y });
};

// const resetPosition = () => {
// setPosition({ x: 0, y: 0 });
// };
const resetPosition = () => {
setPosition({ x: 0, y: 0 });
};

const { dragAndDropStyle } = useWithOrchestratorTheme(getWfoTableStyles);
let startWidth: number;
Expand All @@ -36,8 +36,8 @@ export const WfoDragHandler: FC<WfoDragHandlerProps> = ({
<div>
<Draggable
axis="x"
// position={position}
// onDrag={onDrag}
position={position}
onDrag={onDrag}
bounds="thead"
onStop={(_, data) => {
if (headerRowRef.current) {
Expand All @@ -51,7 +51,7 @@ export const WfoDragHandler: FC<WfoDragHandlerProps> = ({
fieldName,
newWidth > 50 ? newWidth : 50,
);
// resetPosition();
resetPosition();
}
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export const WfoTableHeaderRow = <T extends object>({
const dataSortingConfiguration = dataSorting.find(
(dataSorting) => dataSorting.field === fieldName,
);
let startDragPosition = 0;
let startWidth = 0;

if (columnConfig.columnType === ColumnType.DATA) {
return (
Expand Down

0 comments on commit 250f554

Please sign in to comment.