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

Left and right colors for slider rails #1643

Merged
merged 5 commits into from
Apr 12, 2023

Conversation

n1ght-hunter
Copy link
Contributor

@n1ght-hunter n1ght-hunter commented Jan 7, 2023

Bug fixs

the rail color is vertical not horizontal
before:
image
after:
image

features added

added rail height and border radius to style

discussions

you can currently set the slider height but i think the height should be determined off the size of the handle or rail
decided at this point i wont do this may make the changes at a later date. as i can see some advantages to having the height separate.

todo

need to fix vertical slider as well

@n1ght-hunter n1ght-hunter marked this pull request as draft January 8, 2023 06:28
@hecrj
Copy link
Member

hecrj commented Jan 8, 2023

The rail having 2 vertical colors is on purpose! It's meant to allow creating a rail with a subtle shadow.

Having different rail colors for left and right makes complete sense, however.

@n1ght-hunter
Copy link
Contributor Author

oh it was lol. didn't event occur to me haha

@n1ght-hunter n1ght-hunter marked this pull request as ready for review January 13, 2023 03:06
style/src/slider.rs Outdated Show resolved Hide resolved
style/src/slider.rs Outdated Show resolved Hide resolved
@n1ght-hunter n1ght-hunter changed the title Fix slider colors and add rail height Fix slider colors and add rail height and border Feb 10, 2023
@n1ght-hunter n1ght-hunter changed the title Fix slider colors and add rail height and border Fix slider colors and add rail height and border radius Feb 10, 2023
@hecrj hecrj added this to the 0.9.0 milestone Apr 12, 2023
@hecrj hecrj changed the title Fix slider colors and add rail height and border radius Left and right colors for slider rails Apr 12, 2023
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks 🥳

I made some minor changes:

  • Simplified the drawing logic in 45cfce3. We can draw the rail behind the handle. No need to subtract its width everywhere.
  • Removed border_width support in c2cc9a8. I believe it could lead to weird-looking results with thick borders.
  • Changed the rail border_radius for the built-in theme to 2.0 in 6e6804c. It looks nice!
  • Renamed Rail::size to width in 9b39a17. The way I see it, the width of a rail is similar to the width of a stroke.

We can wrap this up and merge! 🚢

@hecrj hecrj enabled auto-merge April 12, 2023 03:34
@hecrj hecrj merged commit 994d612 into iced-rs:master Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants