Skip to content

Commit 7ceeade

Browse files
committed
refactor(useSnap): simplify snappedDataPoint assignment by removing unnecessary blocks
1 parent 77484d8 commit 7ceeade

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

src/annotations/useSnap.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,15 @@ export function useSnap(
9898
const interactionCoordinate = getRelativeCoordinate(e);
9999
let snappedDataPoint: { x: unknown; y: unknown } | undefined = undefined;
100100
if (snapMode === 'data') {
101-
{
102-
snappedDataPoint = {
103-
x: xInverseDataSnapScale(interactionCoordinate.relativeX),
104-
y: yInverseDataSnapScale(interactionCoordinate.relativeY),
105-
};
106-
}
101+
snappedDataPoint = {
102+
x: xInverseDataSnapScale(interactionCoordinate.relativeX),
103+
y: yInverseDataSnapScale(interactionCoordinate.relativeY),
104+
};
107105
} else if (snapMode === 'tick') {
108-
{
109-
snappedDataPoint = {
110-
x: xInverseTickSnapScale(interactionCoordinate.relativeX),
111-
y: yInverseTickSnapScale(interactionCoordinate.relativeY),
112-
};
113-
}
106+
snappedDataPoint = {
107+
x: xInverseTickSnapScale(interactionCoordinate.relativeX),
108+
y: yInverseTickSnapScale(interactionCoordinate.relativeY),
109+
};
114110
}
115111

116112
if (snappedDataPoint == null) {

0 commit comments

Comments
 (0)