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

Conversation

fatih-erikli
Copy link
Collaborator

Fixes #1002

@justvanrossum
Copy link
Collaborator

The item spacing is too wide and not consistent:

image

Please make it match the sketch in #1002

@fatih-erikli
Copy link
Collaborator Author

This is a tricky css problem, I will come back to this later.

@fatih-erikli
Copy link
Collaborator Author

If you have a suggestion, I'd be happy to hear.

@justvanrossum
Copy link
Collaborator

The element could have its own css that depends on the number of values.

@fatih-erikli
Copy link
Collaborator Author

Can you elaborate? @justvanrossum

@justvanrossum
Copy link
Collaborator

Something like:

    el = html.div({style: `width: ${some_computed_value_based_on_num_values}em;`);

or:

    el.style = `width: ${some_computed_value_based_on_num_values}em;`;

@fatih-erikli
Copy link
Collaborator Author

max-width: ${this.values.length * 20}px; width: 100%;

This is how the total width calculated currently.

They look ok, however not pixel perfect.

Screenshot 2023-12-17 at 00 42 58

@fatih-erikli
Copy link
Collaborator Author

Not only the tickmarks, the builtin range slider has that gap too.

Screenshot 2023-12-17 at 00 48 08

Maybe thumb-width should be added to the calculation. I tried, it didn't help.

@justvanrossum
Copy link
Collaborator

I don't think you are accounting for the track length bore the first and after the last tickmark. I think the computation should be something like:

this.values.length * 20 + margin * 2

Where margin is the space before the first chckmark.

@fatih-erikli
Copy link
Collaborator Author

Space before the checkmark is half of thumb width. I tried that, it doesn't help.

@fatih-erikli
Copy link
Collaborator Author

Assigning it to @justvanrossum for the remaining gap issue.

@justvanrossum justvanrossum merged commit 06ef874 into main Dec 18, 2023
3 checks passed
@justvanrossum justvanrossum deleted the issue-1002 branch December 18, 2023 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[designspace panel] Discrete value range slider should be shorter
2 participants