-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Add support for drawing tick marks on the slider #924
Conversation
} | ||
|
||
set tickInterval(v: 'auto' | number) { | ||
if (v == 'auto') { |
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 can safely ignore this if
and straight do this._tickInterval = v
@jelbourn: Addressed comments. |
|
||
// This calculates which step is far enough away from the beginning of the slider to draw a tick | ||
// at. This value will then be used to draw ticks at every tickStep steps. | ||
let tickStep = |
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.
I think this would benefit from some more explanation as to where the calculation came from.
LGTM |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Add tick interval to slider. A tick interval of
auto
will find a tick separation of at least 30px, otherwise the tick separation value is calculated by the number given.The tick interval is based off of the step, meaning a slider with a step of 3 and a tick interval of 4 will draw ticks every 4 steps/every 12 values.
A tick is always drawn at the end of a slider, with the second to last tick being removed if it is too close to the last one.
A repeating linear background is used to draw the ticks because I believe it is more performant/easier than creating multiple divs or using a canvas. This needs to be tested still.
R: @jelbourn @kara
CC: @hansl @robertmesserle