Skip to content

Fix initial call to isZoomedOrPanned #630

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

Merged
merged 1 commit into from
Mar 23, 2022

Conversation

joshkel
Copy link
Contributor

@joshkel joshkel commented Mar 10, 2022

isZoomedOrPanned incorrectly returns true if it's called before any zoom or pan operations are done.

I believe that the !== undefined check should be valid; storeOriginalScaleLimits always sets the min/max value to chart.scales[scaleId]'s min/max, which TypeScript says are always defined. However, I could be missing something.

Fixes #629

isZoomedOrPanned incorrectly returns true if it's called before any zoom or pan operations are done.

I believe that the `!== undefined` check should be valid; storeOriginalScaleLimits always sets the min/max value to chart.scales[scaleId]'s min/max, which TypeScript says are always defined. However, I could be missing something.

Fixes chartjs#629
@joshkel
Copy link
Contributor Author

joshkel commented Mar 23, 2022

I see that the build failed due to excessive cognitive complexity. Do you want me to fix this? I noticed that CodeClimate's cognitive complexity limit of 5 seems stricter than the configured ESLint cyclomatic complexity limit of 10. I don't see obvious unnecessary complexity, but I'm happy to break apart the function to reduce the complexity score if that's what's desired.

@kurkle
Copy link
Member

kurkle commented Mar 23, 2022

No, I don't think that needs to be changed (approved it)

@kurkle kurkle merged commit ffec8c3 into chartjs:master Mar 23, 2022
@kurkle kurkle added this to the 1.2.1 milestone Mar 23, 2022
@kurkle kurkle added the bug label Mar 23, 2022
@joshkel joshkel deleted the initial-isZoomedOrPanned branch May 19, 2022 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

isZoomedOrPanned incorrectly returns true on initial render
2 participants