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

Discrete value range slider should be shorter #1026

Merged
merged 3 commits into from
Dec 18, 2023
Merged
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
13 changes: 12 additions & 1 deletion src/fontra/client/web-components/range-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,18 @@ export class RangeSlider extends html.UnlitElement {
]),
]),
html.div(
{ class: "range-container" },
{
class: "range-container",
style: this.isDiscrete()
? // In the discrete case, to keep the spacing between tick marks
// constant, the max-width for the slider is computed like this:
// (the number of values - 1) * (desired distance from left of
// tickmark to left of next tickmark = 20px)
// + one tickmark thickness (1px)
// + the total padding of the tickmarks span (6.5px * 2)
`max-width: ${(this.values.length - 1) * 20 + 1 + 13}px; width: 100%;`
: "",
},
[
(this.rangeInput = html.input({
type: "range",
Expand Down