-
Notifications
You must be signed in to change notification settings - Fork 1
GDPR Chart Zoom (part 2) #80
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
base: master
Are you sure you want to change the base?
Conversation
laptou
commented
Jul 31, 2020
- Modify styles to accommodate zooming
- Connect zoom to mouse wheel event
seunomonije
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
| const {min, max, pow} = Math; | ||
| const scale = pow(10, ev.deltaY / 100); | ||
|
|
||
| const finalZoom = min(max(this.zoom * scale, 0.1), 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add a brief comment explaining why this calculation is necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, you've got several magic numbers and exponents that could use explaining.
| const {min, max, pow} = Math; | ||
| const scale = pow(10, ev.deltaY / 100); | ||
|
|
||
| const finalZoom = min(max(this.zoom * scale, 0.1), 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, you've got several magic numbers and exponents that could use explaining.
| const finalZoom = min(max(this.zoom * scale, 0.1), 3); | ||
| const finalScale = finalZoom / this.zoom; | ||
|
|
||
| // point under user's cursor should not move on scroll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good declarative comment