- color doesn't apply on labels anymore, it has to be handled by widgets

- toggle redesigned
This commit is contained in:
jean-emmanuel 2015-09-14 17:59:23 +02:00 • committed by bordun
parent 6fc7c4a656
commit eee00a7a2c
5 changed files with 104 additions and 899 deletions

View file

@ -23,7 +23,7 @@ $color-accent:#528bff;
$color-border:mix($color-fg,$color-base,65);
$nav-height:50rem;
$bg-button-flat:rgba(white,.05);
$bg-button-flat:mix(white,$color-fg,5);
$bg-button-fade:linear-gradient(mix($color-text,$color-fg,5), mix($color-text,$color-fg,1));
$bg-button:linear-gradient(mix($color-text,$color-fg,8), mix($color-text,$color-fg,5));
@ -422,7 +422,7 @@ a {
.tab {
display:block;
display:block;text-align: justify;
height:0rem;
width: 0rem;
overflow: hidden;
@ -676,59 +676,44 @@ form {
.toggle-container {
width:100rem;
flex-shrink: 0
flex-shrink: 0;
padding:0!important;
.label {
position: relative;
padding:29rem 10rem 26rem;
line-height: 1rem;
background: none!important;
text-align: center;
}
box-shadow: 0 0 0 1px $color-bg inset;
&:hover {
background: $bg-button-hover;
}
background:$bg-button;
// box-shadow: 0 0 0 1px $color-bg inset;
cursor: pointer;
}
.toggle {
padding:10rem 1px 0;
cursor: pointer;
div {
box-shadow: 0 0 0 1px $color-bg inset;
&:hover {
background: $bg-button-hover;
}
width:100%;
text-align: center;
padding-bottom: 50%;
position: relative;
p {
white-space: nowrap;
text-overflow: ellipsis;
z-index: 1;
position: absolute;
top:0;right:0;
bottom:0;left:0;
display: flex;
align-items: center;
justify-content: center;
span {
}
}
background:$bg-button;
// box-shadow: 0 0 0 1px $color-bg inset;
color:$color-text-fade;
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
z-index: 1;
.light {
position: absolute;
left:4rem;
right:4rem;
top:4rem;
height:4rem;
background: $color-border;
border-radius: 3rem;
}
&.on {
p {
color:$color-border;
}
div:after {
content:"";
position: absolute;
top:10rem;
left:10rem;
right:10rem;
bottom:10rem;
background:$color-accent;
z-index:0;
border-radius: 3rem;
opacity: .6;
}
&.on .light {
background: $color-accent;
}
}
@ -1100,7 +1085,7 @@ form {
}
.knob-wrapper {
padding:20rem 20rem 20rem 20rem ;
padding:10rem 20rem 20rem 20rem ;
overflow:hidden;
//height:100%;
width:95rem;
@ -1172,6 +1157,19 @@ form {
border-right-color: $color-accent;
}
span {
position: absolute;
border-top:6rem solid $bg-button-flat;
border-left:5rem solid transparent;
border-right:5rem solid transparent;
margin:9rem 0 0 -9rem;
left:50%;
top:50%;
transform-origin: center -6rem;
transform: rotate(45deg);
}
// no color gauge test
&.dot:after {
content:"";

View file

@ -15,8 +15,9 @@ parsetabs = function(tabs,parent,sub){
}
for (i in tabs) {
var tabData = tabs[i],
id = parent?parent.attr('id')+tabData.id:tabData.id
var tabData = tabs[i];
tabData.id = tabData.id.replace(' ','_')
var id = parent?parent.attr('id')+tabData.id:tabData.id
label= tabData.label||tabData.id
navtabs.append('<li><a data-tab="#'+id+'"><span>'+label+'</span></a></li>');
@ -60,7 +61,7 @@ parsewidgets = function(widgets,parent) {
var widgetContainer = $('\
<div class="widget '+type+'-container" widgetType="'+type+'" widgetId="'+id+'" path="'+path+'">\
<div class="label '+accentclass+'" '+color+'>'+label+'</div>\
<div class="label">'+label+'</div>\
</div>\
');

View file

@ -41,9 +41,10 @@ createWidget.toggle = createWidget.button = function(widgetData) {
var widget = $('\
<div class="toggle">\
<div class="value"><p><span>'+widgetData.off+'</span></p></div>\
<div class="light"></div>\
</div>\
');
'),
led = widget.find('.light')
widget.value = widget.find('span')
@ -62,11 +63,11 @@ createWidget.toggle = createWidget.button = function(widgetData) {
off= widgetData.off
if (v==on) {
widget.addClass('on')
widget.value.text(on)
if (widgetData.color) led.attr('style','background:'+widgetData.color)
if (send) widget.sendValue(v)
} else if (v==off) {
widget.removeClass('on')
widget.value.text(off)
if (widgetData.color) led.attr('style','')
if (send) widget.sendValue(v)
}
@ -416,7 +417,7 @@ createWidget.fader = function(widgetData,container){
for (i in scale) {
var pip = $('<div class="pip"></div>')
if (range[i]!=undefined) {
var piptext = Math.abs(range[i])>1000?range[i]/1000+'k':range[i]
var piptext = Math.abs(range[i])>=1000?range[i]/1000+'k':range[i]
pip.addClass('val').append('<span>'+piptext+'</span>')
}
pips.append(pip)
@ -487,7 +488,7 @@ createWidget.knob = function(widgetData) {
<div class="knob-wrapper-outer">\
<div class="knob-wrapper">\
<div class="knob-mask">\
<div class="knob"></div>\
<div class="knob"><span></span></div>\
</div>\
<div class="pip min"></div>\
<div class="pip max"></div>\
@ -501,8 +502,8 @@ createWidget.knob = function(widgetData) {
unit = widgetData.unit?' '+widgetData.unit.trim(): '';
var pipmin = Math.abs(range.min)>1000?range.min/1000+'k':range.min,
pipmax = Math.abs(range.max)>1000?range.max/1000+'k':range.max;
var pipmin = Math.abs(range.min)>=1000?range.min/1000+'k':range.min,
pipmax = Math.abs(range.max)>=1000?range.max/1000+'k':range.max;
widget.find('.pip.min').text(pipmin)
widget.find('.pip.max').text(pipmax)