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

Configurable knob size #155

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
19 changes: 11 additions & 8 deletions paper-slider.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
`--paper-slider-pin-start-color` | The color of the pin at the far left | `--paper-grey-400`
`--paper-slider-height` | Height of the progress bar | `2px`
`--paper-slider-input` | Mixin applied to the input in editable mode | `{}`
`--paper-slider-knob-size` | Size of the knob | `calc(10px + var(--paper-slider-height))`

@group Paper Elements
@element paper-slider
Expand All @@ -84,6 +85,7 @@
--paper-progress-disabled-active-color: var(--paper-slider-disabled-active-color, --paper-grey-400);
--paper-progress-disabled-secondary-color: var(--paper-slider-disabled-secondary-color, --paper-grey-400);
--calculated-paper-slider-height: var(--paper-slider-height, 2px);
--calculated-paper-slider-knob-size: var(--paper-slider-knob-size, 10px);
}

/* focus shows the ripple */
Expand All @@ -94,9 +96,9 @@
#sliderContainer {
position: relative;
width: 100%;
height: calc(30px + var(--calculated-paper-slider-height));
margin-left: calc(15px + var(--calculated-paper-slider-height)/2);
margin-right: calc(15px + var(--calculated-paper-slider-height)/2);
height: calc(20px + var(--calculated-paper-slider-knob-size) + var(--calculated-paper-slider-height));
margin-left: calc(10px + var(--calculated-paper-slider-knob-size)/2 + var(--calculated-paper-slider-height)/2);
margin-right: calc(10px + var(--calculated-paper-slider-knob-size)/2 + var(--calculated-paper-slider-height)/2);
}

#sliderContainer:focus {
Expand All @@ -118,7 +120,7 @@
}

.ring > .bar-container {
left: calc(5px + var(--calculated-paper-slider-height)/2);
left: calc(var(--calculated-paper-slider-knob-size)/2 + var(--calculated-paper-slider-height));
transition: left 0.18s ease;
}

Expand All @@ -131,7 +133,8 @@
}

#sliderBar {
padding: 15px 0;
padding: 0;
padding-top: calc(var(--calculated-paper-slider-knob-size)/2 + 10px );
width: 100%;
background-color: var(--paper-slider-bar-color, transparent);
--paper-progress-container-color: var(--paper-slider-container-color, --paper-grey-400);
Expand Down Expand Up @@ -167,9 +170,9 @@
position: absolute;
left: 0;
top: 0;
margin-left: calc(-15px - var(--calculated-paper-slider-height)/2);
width: calc(30px + var(--calculated-paper-slider-height));
height: calc(30px + var(--calculated-paper-slider-height));
margin-left: calc(0px - 10px - var(--calculated-paper-slider-knob-size) / 2 - var(--calculated-paper-slider-height));
width: calc(var(--calculated-paper-slider-knob-size) + var(--calculated-paper-slider-height) + 20px);
height: calc(var(--calculated-paper-slider-knob-size) + var(--calculated-paper-slider-height) + 20px);
}

.transiting > .slider-knob {
Expand Down