justhum / HUMSlider

A slider control with auto-appearing ticks and saturating images at each end. Straight from the codebase of Hum.
http://justhum.com/
MIT License
264 stars 31 forks source link

Custom Ticks #9

Closed thejeff77 closed 5 years ago

thejeff77 commented 6 years ago

Added custom ticks to the HUMSlider.

Added various option parameters to enhance the customization potential for the slider.

thejeff77 commented 6 years ago

I've fixed the track width issue we talked about. Currently passing in a Tick with a 0 value will inset the tick from the left enough so that it is in the center of the thumb image, which is about 15px from left by default. I was wondering if I should provide an option to disable inlay of the tick by the radius of the thumb image, and decided to be agile and maybe wait until someone asked for that. This is working fantastically now. It would probably be super easy to modify the previous code to use the new shorter layout methods for odd or evenly spaced ticks. I'll be opening later PRs to add a color to the tick itself so that the default color can be overridden on a tick by tick basis.

designatednerd commented 6 years ago

@thejeff77 Mind if I reopen this? Was planning on getting you more feedback this weekend or next week

thejeff77 commented 6 years ago

No problem, I have a tricky bug to fix, and realized I have quite a bit of cleanup to do. I'm working on this more today, and can re-open as soon as the code looks a little better. I hope that works! I did a major refactor & am making sure all of the old and new functionality works together. I could never have done this without the code there in the first place to use as an example. Thanks :)

designatednerd commented 6 years ago

Awesome! Ping me when it's up and I'll take a look

thejeff77 commented 6 years ago

All done. Much better now. Pretty much re-factored how the consistently spaced tick marks worked - it no longer requires an odd number. It didn't make sense to have two separate implementations in there - one for custom ticks the other for consistently spaced ticks. Also added a feature that hugs the tick to the outside of the slider as it moves by - this is cool when the slider is moving slowly for playback type stuff. Added some public properties for more control over how the slider looks when dragged / not dragged. More specifically - one var to keep them from disappearing when the user isn't touching the slider. Another one to prevent them from being lowered while the slider isn't being dragged. Also removed the copyright, as this causes issues with open source review boards and can be perceived as a conflict with an open source MIT license.

thejeff77 commented 5 years ago

@designatednerd this is ready for a review.