Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(allowCross): When two handles coincide (i.e pushNum = 0 || pushab… #904

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/hooks/useOffset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,24 @@
nextValues[valueIndex + 1] - pushNum,
);
}

if (valueIndex > 0 && nextValues[valueIndex - 1] === originValue && pushNum === 0) {
nextValues[valueIndex] = Math.max(

Check warning on line 219 in src/hooks/useOffset.ts

View check run for this annotation

Codecov / codecov/patch

src/hooks/useOffset.ts#L219

Added line #L219 was not covered by tests
nextValues[valueIndex],
nextValues[valueIndex - 1] + pushNum,
);
}

if (
valueIndex < nextValues.length - 1 &&
nextValues[valueIndex + 1] === originValue &&
pushNum === 0

Check warning on line 228 in src/hooks/useOffset.ts

View check run for this annotation

Codecov / codecov/patch

src/hooks/useOffset.ts#L228

Added line #L228 was not covered by tests
) {
nextValues[valueIndex] = Math.min(

Check warning on line 230 in src/hooks/useOffset.ts

View check run for this annotation

Codecov / codecov/patch

src/hooks/useOffset.ts#L230

Added line #L230 was not covered by tests
nextValues[valueIndex],
nextValues[valueIndex + 1] + pushNum,
);
}
} else if (typeof pushable === 'number' || pushable === null) {
// >>>>> Pushable
// =============== Push ==================
Expand Down
Loading