Skip to content

Commit

Permalink
slider bubble improvements
Browse files Browse the repository at this point in the history
closes #1570
  • Loading branch information
andyshinn committed Mar 19, 2021
1 parent 9ef88f2 commit 4f9d34d
Show file tree
Hide file tree
Showing 4 changed files with 2,229 additions and 2,214 deletions.
40 changes: 23 additions & 17 deletions wled00/data/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ button {
top: -1px;
z-index: 1;
margin-top: 1px;
width: 272px;
width: auto;
margin: auto;
border-radius: 25px;
}
Expand Down Expand Up @@ -449,20 +449,23 @@ img {
}

.sliderbubble {
width: 36px;
line-height: 24px;
background: var(--c-3);
position: absolute;
transform: translateX(-50%);
border-radius: 12px;
margin-left: 12px;
margin-top: 3px;
padding: 0px;
display: inline;
width: 24px;
position: relative;
display: inline-block;
border-radius: 4px;
background: var(--c-3);
color: white;
padding: 2px 5px;
font-size: 14px;
right: 5px;
transition: visibility 0.25s ease, opacity 0.25s ease;
opacity: 0;
visibility: hidden;
}

.hidden {
display: none;
output.sliderbubbleshow {
visibility: visible;
opacity: 1;
}

input[type=range] {
Expand Down Expand Up @@ -504,10 +507,6 @@ input[type=range]::-moz-range-thumb {
background: var(--c-f);
transform: translateY(7px);
}
input[type=range]:active + .sliderbubble {
display: inline;
transform: translateX(-50%);
}

#wwrap {
display: none;
Expand Down Expand Up @@ -1032,6 +1031,13 @@ input[type="text"].search:not(:placeholder-shown) {
background: var(--c-sbh);
}

@media not all and (hover: none) {
.sliderwrap:hover + output.sliderbubble {
visibility: visible;
opacity: 1;
}
}

@media all and (max-width: 335px) {
.sliderbubble {
display: none;
Expand Down
42 changes: 28 additions & 14 deletions wled00/data/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<input id="sliderBri" onchange="setBri()" oninput="updateTrail(this)" max="255" min="1" type="range" value="128" />
<div class="sliderdisplay"></div>
</div>
<output class="sliderbubble"></output>
</div>
</div>
<iframe id="liveview" src="about:blank"></iframe>
Expand All @@ -46,25 +47,38 @@
<div id="Colors" class="tabcontent">
<div id="picker" class="noslide"></div>
<div id="rgbwrap">
<div class="sliderwrap il">
<input id="sliderR" class="noslide" onchange="fromRgb()" oninput="updateTrail(this,1)" max="255" min="0" type="range" value="128" />
<div class="sliderdisplay"></div>
</div><br>
<div class="sliderwrap il">
<input id="sliderG" class="noslide" onchange="fromRgb()" oninput="updateTrail(this,2)" max="255" min="0" type="range" value="128" />
<div class="sliderdisplay"></div>
</div><br>
<div class="sliderwrap il">
<input id="sliderB" class="noslide" onchange="fromRgb()" oninput="updateTrail(this,3)" max="255" min="0" type="range" value="128" />
<div class="sliderdisplay"></div>
</div><br>
<div id="rwrap" class="il">
<div class="sliderwrap il">
<input id="sliderR" class="noslide" onchange="fromRgb()" oninput="updateTrail(this,1)" max="255" min="0" type="range" value="128" />
<div class="sliderdisplay"></div>
</div>
<output class="sliderbubble"></output>
</div>
<br>
<div id="gwrap" class="il">
<div class="sliderwrap il">
<input id="sliderG" class="noslide" onchange="fromRgb()" oninput="updateTrail(this,2)" max="255" min="0" type="range" value="128" />
<div class="sliderdisplay"></div>
</div>
<output class="sliderbubble"></output>
</div>
<br>
<div id="bwrap" class="il">
<div class="sliderwrap il">
<input id="sliderB" class="noslide" onchange="fromRgb()" oninput="updateTrail(this,3)" max="255" min="0" type="range" value="128" />
<div class="sliderdisplay"></div>
</div>
<output class="sliderbubble"></output>
</div>
<br>
</div>
<div id="wwrap">
<p class="labels">White channel</p>
<div class="sliderwrap il">
<input id="sliderW" class="noslide" onchange="setColor(0)" oninput="updateTrail(this)" max="255" min="0" type="range" value="128" />
<div class="sliderdisplay"></div>
</div>
<output class="sliderbubble"></output>
</div>
<div id="qcs-w">
<div class="qcs" onclick="pC('#ff0000');" title="Red" style="background-color:#ff0000;"></div>
Expand Down Expand Up @@ -124,18 +138,18 @@
<i class="icons slider-icon">&#xe325;</i>
<div class="sliderwrap il">
<input id="sliderSpeed" class="noslide" onchange="setSpeed()" oninput="updateTrail(this)" max="255" min="0" type="range" value="128" />
<output class="sliderbubble hidden"></output>
<div class="sliderdisplay"></div>
</div>
<output class="sliderbubble"></output>
</div>
<p class="labels">Effect intensity</p>
<div class="staytop" id="staytop1">
<i class="icons slider-icon" onclick="tglLabels()">&#xe409;</i>
<div class="sliderwrap il">
<input id="sliderIntensity" class="noslide" onchange="setIntensity()" oninput="updateTrail(this)" max="255" min="0" type="range" value="128" />
<output class="sliderbubble hidden"></output>
<div class="sliderdisplay"></div>
</div>
<output class="sliderbubble"></output>
</div>
<p class="labels">Effect mode</p>
<div id="fxlist" class="list">
Expand Down
15 changes: 4 additions & 11 deletions wled00/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ function onLoad() {
if (localStorage.getItem('pcm') == "true") togglePcMode(true);
var sls = d.querySelectorAll('input[type="range"]');
for (var sl of sls) {
sl.addEventListener('input', updateBubble, true);
sl.addEventListener('touchstart', toggleBubble);
sl.addEventListener('touchend', toggleBubble);
}
Expand Down Expand Up @@ -790,20 +789,14 @@ function updateTrail(e, slidercol)
}
var val = `linear-gradient(90deg, ${scol} ${progress}%, var(--c-4) ${progress}%)`;
e.parentNode.getElementsByClassName('sliderdisplay')[0].style.background = val;
}

function updateBubble(e)
{
var bubble = e.target.parentNode.getElementsByTagName('output')[0];

if (bubble) {
bubble.innerHTML = e.target.value;
}
var bubble = e.parentNode.parentNode.getElementsByTagName('output')[0];
if (bubble) bubble.innerHTML = e.value;
}

function toggleBubble(e)
{
e.target.parentNode.querySelector('output').classList.toggle('hidden');
var bubble = e.target.parentNode.parentNode.getElementsByTagName('output')[0];
bubble.classList.toggle('sliderbubbleshow');
}

function updateLen(s)
Expand Down
Loading

0 comments on commit 4f9d34d

Please sign in to comment.