- css cleaning

- naming (tmp name 'f' changed to 'fader'
- switch sync behaviour fix
This commit is contained in:
jean-emmanuel 2015-09-08 15:54:10 +02:00 • committed by bordun
parent 719b0f8b25
commit ffd7e8bb03
5 changed files with 68 additions and 70 deletions

View file

@ -2,8 +2,8 @@
"presetPath": "/home/bordun/oscwork/oschtmlgui/presets/",
"sessionPath": "/home/bordun/oscwork/oschtmlgui/sessions/",
"recentSessions": [
"/home/bordun/oscwork/oschtmlgui/sessions/demo-full.js",
"/home/bordun/oscwork/oschtmlgui/sessions/demo.js",
"/home/bordun/oscwork/oschtmlgui/sessions/demo-full.js",
"/home/bordun/oscwork/oschtmlgui/sessions/xy.js",
"/home/bordun/oscwork/oschtmlgui/sessions/fadertest.js",
"/home/bordun/oscwork/oschtmlgui/sessions/monitorsjeannot.js",

View file

@ -597,6 +597,12 @@ a {
height:100%;
width:100%;
margin-bottom:2px;
span {
padding:10px;
white-space: normal;
word-break: break-all;
overflow: hidden;
}
&:last-child {
margin-bottom:0;
}
@ -625,7 +631,6 @@ a {
/* STACK (contains any widgets) */
.stack {
@ -635,20 +640,7 @@ a {
border-bottom: 0;
}
.stack-wrapper {
//height:100%;
}
.stack-wrapper .widget {
border-right:0;
border-left:0;
}
.stack-wrapper .widget:nth-child(2n+2) {
}
.stack .widget {
//height:70px;
width:100%;
display:block;
padding:0;
@ -662,17 +654,6 @@ a {
clear:both;
}
}
.stack .button-wrapper {
float:right;
width:70%;
height:70px;
padding: 0 0 0 10px;
position: static;
input {
bottom:0
}
}
.stack .widget .title {
width:30%;
height:35px;
@ -684,17 +665,6 @@ a {
.stack .xy-wrapper {
float:right;
width:70%;
height:300px;
padding-top:0;
padding-left:10px;
}
@ -766,6 +736,9 @@ a {
cursor: -webkit-grab;
&:active {
cursor: -webkit-grabbing;
&:after {
transform: scale(1.5);
}
}
&:after {
content:"";
@ -794,6 +767,15 @@ a {
}
.stack .xy-wrapper {
float:right;
width:70%;
height:300px;
padding-top:0;
padding-left:10px;
}
.rgb-wrapper {
height:510px;
padding-bottom: 120px;
@ -843,6 +825,9 @@ a {
cursor: -webkit-grab;
&:active {
cursor: -webkit-grabbing;
&:after {
transform: scale(1.5);
}
}
&:after {
content:"";
@ -871,7 +856,11 @@ a {
.f-wrapper-outer {
.fader-wrapper-outer {
padding-bottom:30px;
overflow:hidden;
height:100%;
@ -884,17 +873,17 @@ a {
}
}
.f-wrapper {
.fader-wrapper {
padding:20px 15px 20px 20px ;
overflow:hidden;
height:100%;
width:95px;
position: relative;
.f {
.fader {
height:100%;
width:4px;
background:#222;
background:rgba(black,.4);
position: relative;
.handle {
position: absolute;
@ -946,7 +935,7 @@ a {
}
.stack .f-wrapper-outer {
.stack .fader-wrapper-outer {
padding-bottom: 0;
input {
width:30%;
@ -956,7 +945,7 @@ a {
border-top:0;
top:35px;
}
.f {
.fader {
width:100%;
height:4px;
.handle {
@ -964,10 +953,10 @@ a {
width:0;
}
}
.f-wrapper-outer {
.fader-wrapper-outer {
padding:0;
}
.f-wrapper {
.fader-wrapper {
padding:20px 20px;
float:right;
width:70%;

View file

@ -4,7 +4,11 @@ ipc.on('receiveOsc',function(data){
var id = $('[path="'+path+'"]').attr('widgetId');
// update
if (__widgets__[id]!=undefined) __widgets__[id][0].setValue(data.args,false,true)
if (__widgets__[id]!=undefined) {
for (i in __widgets__[id]){
__widgets__[id][i].setValue(data.args,false,false)
}
}
})

View file

@ -88,7 +88,7 @@ createWidget.switch = function(widgetData) {
widget.find('.value').click(function(){
if ($(this).hasClass('on')) return;
var newVal = $(this).data('value')
widget.setValue(newVal,true)
widget.setValue(newVal,true,true)
})
@ -101,7 +101,7 @@ createWidget.switch = function(widgetData) {
widget.find('.on').removeClass('on')
e.addClass('on')
if (send) widget.sendValue(v)
if (send) widget.trigger('sync')
if (sync) widget.trigger('sync')
}
}
@ -140,9 +140,9 @@ createWidget.xy = function(widgetData) {
offX = handle.width()
})
handle.drag(function( ev, dd ){
var h = pad.height()-dd.offsetY,
w = dd.deltaX+offX
handle.css({'height':h+'px','width':w+'px'})
var h = (pad.innerHeight()-dd.offsetY)*100/pad.innerHeight(),
w = (dd.deltaX+offX)*100/pad.innerWidth()
handle.css({'height':h+'%','width':w+'%'})
var v = widget.getValue()
widget.sendValue(v);
@ -162,10 +162,10 @@ createWidget.xy = function(widgetData) {
}
widget.setValue = function(v,send,sync) {
if (v[1]==undefined) var v = [v,v]
var w = mapToScale(v[0],[widgetData.range.x.min,widgetData.range.x.max],[0,pad.innerWidth()])
h = mapToScale(v[1],[widgetData.range.y.min,widgetData.range.y.max],[0,pad.innerHeight()]),
var w = mapToScale(v[0],[widgetData.range.x.min,widgetData.range.x.max],[0,100])
h = mapToScale(v[1],[widgetData.range.y.min,widgetData.range.y.max],[0,100]),
handle.css({'height':h+'px','width':w+'px'})
handle.css({'height':h+'%','width':w+'%'})
widget.showValue(v)
if (sync) widget.trigger('sync')
@ -193,7 +193,7 @@ createWidget.xy = function(widgetData) {
widget.setValue(v,true,true)
})
widget.setValue(widgetData.range.x.min,widgetData.range.y.min)
return widget;
}
@ -299,9 +299,9 @@ createWidget.rgb = function(widgetData) {
rgbOffX = rgbHandle.width()
})
rgbHandle.drag(function( ev, dd ){
var h = pad.height()-dd.offsetY,
w = dd.deltaX+rgbOffX
rgbHandle.css({'height':h+'px','width':w+'px'})
var h = (pad.height()-dd.offsetY)*100/pad.innerHeight(),
w = (dd.deltaX+rgbOffX)*100/pad.innerWidth()
rgbHandle.css({'height':h+'%','width':w+'%'})
var v = widget.getValue()
widget.sendValue(v);
@ -315,8 +315,8 @@ createWidget.rgb = function(widgetData) {
rgbOffX = hueHandle.width()
})
hueHandle.drag(function( ev, dd ){
var w = dd.deltaX+rgbOffX
hueHandle.css({'width':w+'px'})
var w = (dd.deltaX+rgbOffX)*100/pad.innerWidth()
hueHandle.css({'width':w+'%'})
var h = parseFloat(hueHandle.width())/pad.innerWidth()*360,
rgb = hsbToRgb({h:h,s:100,b:100}),
@ -399,6 +399,7 @@ createWidget.rgb = function(widgetData) {
widget.setValue([v[0],v[1],b],true,true)
})
widget.setValue(0)
return widget;
}
@ -407,18 +408,18 @@ createWidget.rgb = function(widgetData) {
createWidget.fader = function(widgetData,parent){
var widget = $('\
<div class="f-wrapper-outer">\
<div class="f-wrapper">\
<div class="f">\
<div class="fader-wrapper-outer">\
<div class="fader-wrapper">\
<div class="fader">\
<div class="handle"></div>\
<div class="pips"></div>\
</div>\
</div>\
<input value="0"></input>\
<input></input>\
</div>\
'),
handle = widget.find('.handle'),
fader = widget.find('.f'),
fader = widget.find('.fader'),
pips = widget.find('.pips'),
input = widget.find('input'),
@ -441,7 +442,8 @@ createWidget.fader = function(widgetData,parent){
handle.drag(function( ev, dd ){
var d = (dimension=='height')?fader.size()-dd.offsetY:dd.deltaX+offX
handle.css(dimension, d+'px')
d = d*100/fader.size()
handle.css(dimension, d+'%')
var v = widget.getValue()
widget.sendValue(v);
@ -529,5 +531,8 @@ createWidget.fader = function(widgetData,parent){
input.change(function(){
widget.setValue(input.val(),true,true)
})
widget.setValue(rangeVals[0])
return widget
}

View file

@ -18,12 +18,12 @@ TABS = {
testingshits: {
widgets:{
switchtest: {
BassesXXX: {
type:'switch',
target:'localhost:6666',
path:'/osc/path/',
color:'#555522',
values:[0,1,2]
values:[-70,-10,0]
},
stacktest: {
type:'stack',
@ -33,9 +33,9 @@ TABS = {
target:'localhost:6666',
path:'/osc/path/',
color:'#555522',
values:[0,1,2]
values:[1,2,3,4,5]
},
Drums: {
BassesXXX: {
title:'BassesXXX',
range:'db',
target:nmPorts['MainMix']+' 127.0.0.1:125',