Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix snapping logic

Abdullah Attad72b502977aa
diff --git a/apps/web/src/components/split-pane/index.tsx b/apps/web/src/components/split-pane/index.tsx
index 6a36281f7..4488c4af6 100644
--- a/apps/web/src/components/split-pane/index.tsx
+++ b/apps/web/src/components/split-pane/index.tsx
@@ -267,10 +267,10 @@ export const SplitPane = React.forwardRef<
);
// snapping logic
- if (currentPaneLimits.snap > 0 && distanceX <= 0) {
- if (nextSizes[i] <= currentPaneLimits.snap / 2)
+ if (currentPaneLimits.snap > 0) {
+ if (distanceX < 0 && nextSizes[i] <= currentPaneLimits.snap / 2) {
nextSizes[i] = currentPaneLimits.min;
- else if (nextSizes[i] < currentPaneLimits.snap) {
+ } else if (nextSizes[i] < currentPaneLimits.snap) {
// reset axis
axis.current[splitAxis] += -distanceX;
return;