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

Add a VerticalSlider class based on the Slider class #403

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ermarch
Copy link
Contributor

@ermarch ermarch commented May 24, 2019

This adds a vertical slider class inheriting the original horizontal slider class.

@wjakob
Copy link
Owner

wjakob commented May 24, 2019

Hi @ermarch -- I think it would be nicer to make vertical/horizontal an attribute of the Slider class (preferably, with the minimal amount of changes/code duplication) rather than having an entirely new class.

@ermarch
Copy link
Contributor Author

ermarch commented May 24, 2019 via email

@wjakob
Copy link
Owner

wjakob commented May 27, 2019

Hi Erik,

it's generally a good rule to avoid adding extra API as much as possible. When a new class just presents a different way of rendering the same concept, then it's preferable to expose it in this way, using an extra attribute. (Whether that can be used to switch at runtime is another question and not the primary motivator.)

Best,
Wenzel

@ermarch
Copy link
Contributor Author

ermarch commented May 27, 2019 via email

@wjakob
Copy link
Owner

wjakob commented May 27, 2019

For readability, it would be best to minimize the number of if-statements by having a set of variables storing sizes, positions, etc. that are assigned using the ternary operator. You'll want to minimize the amount of redundancy, which requires some planning (instead of replacing every line by an if statement)

@ermarch
Copy link
Contributor Author

ermarch commented May 27, 2019 via email

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.

2 participants