diff --git a/README b/README index 9c3d4a2c..65b44391 100644 --- a/README +++ b/README @@ -1,3 +1,4 @@ node_modules/osc/node_modules -> serialport remplacé par serialport-electron@1.7.4-temp pour compatibilité avec electron +-> node_modules/osc/src/platforms/osc-node.js replace require() --> revenir à la version d'origine pour pouvoir lancer le server avec node diff --git a/aa.preset b/aa.preset index 95346663..0acda064 100644 --- a/aa.preset +++ b/aa.preset @@ -1,5 +1,6 @@ -fader:xBasses:-30.38 -fader:xGuitars:-30.77 +fader:xBasses:0.00 +fader:xGuitars:0.00 +button:button1: fader:Bassess:0.00 fader:Drums:0.00 fader:Basses:0.00 @@ -54,5 +55,4 @@ fader:FX_Vx_Dag_1:0.00 fader:FX_Vx_Dag_2:0.00 fader:FX_Vx_Dag:0.00 fader:Scape_Vx_Dag:0.00 -fader:Vx_Jeannot:0.00 -button:button1:1 \ No newline at end of file +fader:Vx_Jeannot:0.00 \ No newline at end of file diff --git a/index.js b/index.js index 1b009d04..59d3c291 100644 --- a/index.js +++ b/index.js @@ -97,7 +97,7 @@ ipc.on('init',function(event, data){ ipc.on('sendOsc', function (event,data) { - for (i in data.target.split(' ').length) { + for (i in data.target.split(' ')) { var host = data.target.split(' ')[i].split(':')[0], port = data.target.split(' ')[i].split(':')[1]; diff --git a/lib-dev/css/jquery.nouislider.scss b/lib-dev/css/jquery.nouislider.scss index 3b7ff551..a9d957e3 100644 --- a/lib-dev/css/jquery.nouislider.scss +++ b/lib-dev/css/jquery.nouislider.scss @@ -65,7 +65,7 @@ } .noUi-handle { border-radius:100%!important; - background:#528bff!important; + background:$color-accent!important; box-shadow:0 0 10px 0px #aaa inset,0 0 1px 1px rgba(0,0,0,.5),0 0 0 3px rgba(255,255,255,.2)!important } .noUi-horizontal .noUi-handle { @@ -278,7 +278,7 @@ } .noUi-connect { - background:#528bff; + background:$color-accent; border:0; border-radius:0; } diff --git a/lib-dev/css/style.scss b/lib-dev/css/style.scss index a9008e29..c9594ce4 100644 --- a/lib-dev/css/style.scss +++ b/lib-dev/css/style.scss @@ -31,7 +31,9 @@ $nav-height:50px; * ::selection{ background:rgba(0,0,0,0); } - +.inspector *::selection{ + background:$color-accent!important; +} input:focus::selection{ background:$color-accent; } @@ -88,33 +90,32 @@ $sidepanel-size:300px; .open-toggle { position:absolute; top:7px; - left:-47px; + left:-53px; width:47px; height:40px; - background:$color-fg; - padding:10px 10px; - border:1px solid $color-border; - border-right:0; + padding:11px 9px; + border:1px solid transparent; + border-bottom:0; //box-shadow: 0 0 10px 0 $color-border; - border-radius:3px 0 0 3px; + border-radius:3px 3px 0 0; .bars { display:block; position: relative; width:100%; - height:3px; - background: $color-border; + height:2px; + background: $color-text; &:after, &:before { content:""; position: absolute; width: 100%; height:100%; - top:8px; + top:7px; left:0; - background: $color-border; + background: $color-text; } &::after { - top:16px; + top:14px; } &, &:after, &:before { //transition:all .3s; @@ -139,20 +140,34 @@ $sidepanel-size:300px; } #options { position:absolute; - left:0;top:3px; + left:0;top:2px; right:0;bottom:0; padding:5px; list-style:none; background:$color-fg; li { display:block; - margin-bottom:5px; + margin-bottom:15px; background:$color-title; border:1px solid $color-border; - div { + > div { padding:10px; } } + + .inspector { + .result { + background: $color-border; + border-radius: 3px; + margin-top: 10px; + padding:10px; + color:$color-text-fade; + white-space: pre; + word-wrap: break-word; + width:100%; + + } + } } } @@ -185,32 +200,55 @@ a { text-transform: uppercase; } &.sub { - padding-top:2px + padding-top:2px; + ul { + padding:0; + } + li { + border-image: linear-gradient($color-fg, $color-border 20px) 0 0 0 1 stretch; + } } - .main { - top:0; - position:fixed; - z-index:3; - white-space:nowrap; - border-bottom:0; - overflow:hidden + + + + &.main { + right:80px; } ul { list-style:none; + display: flex; + padding-left:5px; + li.on + li {border:0;} li { - display:inline-block; - margin:0 5px; + display:block; + max-width:250px; + flex: 1; + + border-width:0 0 0 1px; + border-image: linear-gradient($color-bg, $color-border 20px) 0 0 0 1 stretch; + &:first-child, &.on { + border:0; + } + + a { display:block; padding: 5px 10px; line-height: ($nav-height - 22px); border-radius:3px 3px 0 0; overflow:hidden; + text-align:center; + border:1px solid transparent; + position:relative; + span { + display:block; + width:100%; + -webkit-mask: linear-gradient(to left, rgba(0, 0, 0, 0), #000000 10px) no-repeat; + } &.on { background:#282c34; border:1px solid $color-border; border-bottom-color:$color-fg; - position:relative; &:after { content:""; @@ -239,6 +277,7 @@ a { bottom:0; padding:5px; border-top:1px solid $color-border; + .tab { height:100%; font-size:0; @@ -270,10 +309,11 @@ a { height:100%; position:relative; font-size:13px; - border:1px solid $color-border; - padding:35px 0; - width:100px; +// box-shadow: 0 0 0 1px $color-border; + padding-top:35px; vertical-align:top; + overflow: hidden; + margin-right: 10px; .title { border-bottom:1px solid $color-border; border-left:0; @@ -287,26 +327,18 @@ a { text-overflow:ellipsis; overflow:hidden; height:35px; + border-radius:2px 2px 0 0 ; } input { width:100%; height:35px; border:0; - border-left:0; - border-right:0; background:$color-bg; color:inherit; - border-top: 1px solid $color-border; display:block; - margin:0 auto; padding:10px; - position:absolute; - bottom:0; - left:0; - right:0; - border-top &:focus { - box-shadow: 0 0 0 1px $color-accent inset; + box-shadow:0 0 0 1px $color-accent inset!important; } &[disabled] { color:$color-text-fade; @@ -334,6 +366,10 @@ $button-size:20px; width:100%; height:100%; position:relative; + outline:1px solid $color-bg; + outline-offset: -10px; + background: $color-title; + border: 10px solid $color-fg; &:after{ content:""; position:absolute; @@ -350,6 +386,10 @@ $button-size:20px; box-shadow:0 0 0 4px rgba(255,255,255,0.1); } } + input { + position:absolute; + bottom:0; + } } @@ -357,7 +397,7 @@ $button-size:20px; /* STACK (contains any widgets) */ .stack { - width:400px; +width:400px; height:auto; padding-bottom:0; border-bottom: 0; @@ -381,10 +421,16 @@ $button-size:20px; display:block; padding:0; border-top:0; + border-right:0; + border-left:0; + margin-top: 10px; } .stack .fader { width:100%; } +.stack .fader-wrapper-outer { + padding:0; +} .stack .fader-wrapper { padding:20px 20px; float:right; @@ -397,7 +443,7 @@ $button-size:20px; .stack .widget .title { width:30%; height:50%; - border-right:1px solid $color-border; + //border-right:1px solid $color-border; } .stack .widget input { width:30%; @@ -405,16 +451,179 @@ $button-size:20px; left:0; right:auto; border-top:0; - border-right:1px solid $color-border; + //border-right:1px solid $color-border; } /* STRIP (vertical fader) */ +.fader-wrapper-outer { + padding-bottom:30px; + overflow:hidden; + height:100%; + width:100%; + position: relative; + input { + position:absolute; + bottom:0; + } +} .fader-wrapper { padding:20px 15px; overflow:hidden; height:100%; + width:95px; + position: relative; } .fader{ height:100%; } + + +/* XY */ + +.xy-wrapper { + width:400px; + padding: 10px; + height:100%; + overflow: hidden; +} +.xy { + position:relative; + width:100%; + height: 400px; + border:1px solid $color-border; + background: $color-bg; + overflow: hidden; + .handle { + position:absolute; + height:0; + width:0; + z-index:2; + &:after { + content:""; + position:absolute; + top:-.5px; + left:-1px; + box-shadow:0 0 10px 0px #aaa inset,0 0 1px 1px rgba(0,0,0,.5),0 0 0 3px rgba(255,255,255,.2)!important; + border-radius:100%!important; + background:$color-accent!important; + width: 11px; + height: 11px; + margin:-5px 0 0 -5px; + } + + span { + position:absolute; + top:-.5px; + left:-1px; + width:2000px; + height:2000px; + margin:-1000px 0 0 -1000px; + opacity:.5; + &:after { + content:""; + position: absolute; + width:100%; + height:1px; + top:50%; + background: $color-accent + } + &:before { + content:""; + position: absolute; + height:100%; + width:1px; + top:0; + left:50%; + background: $color-accent + } + } + } +} + + + +.rgb-wrapper { + .value { + margin-top:30px; + width:100%; + } + input { + width:33.33%; + float:left; + padding-left: 20px; + position: relative; + left:0px; + right:0px; + &.r:after { + content:"Rzd"; + display:block; + position: absolute;; + left:0; + } + } +} + +.rgb { + background-color: red; + &:before, &:after { + content:""; + position: absolute; + left:0; + top:0; + width: 100%; + height: 100%; + } + &:before { + background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); + } + &:after { + background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* W3C */ + } +} +.hue { + width:100%; + height:30px; + border:1px solid $color-border; + margin-top:10px; + background:transparent linear-gradient(to left, #F00, #FF0080, #F0F, #8000FF, #00F, #0080FF, #0FF, #00FF80, #0F0, #80FF00, #FF0, #FF8000, #F00) repeat scroll 0% 0%; + + .handle { + position:absolute; + height:100%; + width:1px; + z-index:2; + &:after { + content:""; + position:absolute; + top:100%; + left:-1px; + box-shadow:0 0 10px 0px #aaa inset,0 0 1px 1px rgba(0,0,0,.5),0 0 0 3px rgba(255,255,255,.2)!important; + border-radius:100%!important; + background:$color-accent!important; + width: 11px; + height: 11px; + margin:4px 0 0 -5px; + } + &:before { + content:""; + position:absolute; + top:0; + bottom:0; + left:0; + width:1px; + background:$color-accent; + } + span { + position:absolute; + top:0; + left:0; + width:2000px; + height:100%; + margin-left:-1000px; + opacity:.5; + + } + } + +} diff --git a/lib-dev/index.html b/lib-dev/index.html index 4c456513..de713048 100644 --- a/lib-dev/index.html +++ b/lib-dev/index.html @@ -50,6 +50,7 @@ for (i in styles) { // third-party js libraries require( __dirname + "/js/jquery.nicescroll.min.js") require( __dirname + "/js/jquery.nouislider.all.js") +require( __dirname + "/js/jquery-ui.draggable.min.js") // main js require( __dirname + "/js/oschtmlgui.js") @@ -76,6 +77,12 @@ ipc.send('init');
  • Load
  • Send ALL
  • Fullscreen
  • +
  • +
    + Inspector +
    Click on a widget's title to inspect
    +
    +
  • diff --git a/lib-dev/js/demo.js b/lib-dev/js/demo.js index a37ee71a..d1bf4740 100644 --- a/lib-dev/js/demo.js +++ b/lib-dev/js/demo.js @@ -26,7 +26,7 @@ TABS = { title:'BassesXXX', range:'db', target:nmPorts['MainMix']+' 127.0.0.1:125', - path:'/strip/Basses/Gain/Gain%20(dB)/unscaled', + path:'/test2', }, xGuitars: { @@ -40,19 +40,23 @@ TABS = { target:'localhost:6666', path:'/osc/path/', color:'#555522' - }, + } } }, - sep: { - type:'sep' - }, - Bassess: { - title:'Bassess', - range:'db', + xypad_test: { + title:'XY Pad', + type:'rgb', target:nmPorts['MainMix'], - path:'/SHIT' + path:'/pad' + }, + xypad_test2: { + title:'XY Pad', + type:'xy', + target:nmPorts['MainMix'], + path:'/SHIT', + range:{x:{min:-10,max:10},y:{min:2,max:-4}} }, } }, diff --git a/lib-dev/js/oschtmlgui.js b/lib-dev/js/oschtmlgui.js index 0b34dc0c..144dbd78 100644 --- a/lib-dev/js/oschtmlgui.js +++ b/lib-dev/js/oschtmlgui.js @@ -3,10 +3,6 @@ defaultTarget = 'localhost:9999' -// Predeclare python callbacks (before document's ready event!) -loadPreset = function(){}; -oscReceive = function(){}; -init = function(){}; // jQuery loaded $(document).ready(function(){ @@ -15,10 +11,10 @@ $(document).ready(function(){ init = function() { -__faders__ = {}; -__buttons__ = {}; +createWidget={} +__widgets__ = {} + -parsetabs(TABS,false,false) function parsetabs(TABS,parent,sub){ @@ -43,7 +39,7 @@ function parsetabs(TABS,parent,sub){ var title = tabData.title||tabId var id = parent?parent.attr('id')+tabId:tabId - $navtabs.append('
  • '+title+'
  • '); + $navtabs.append('
  • '+title+'
  • '); var $tabContent = $(document.createElement('div')).addClass('tab').attr('id',id); @@ -63,7 +59,6 @@ function parsetabs(TABS,parent,sub){ } - function parsewidgets(widgets,parent) { $.each(widgets,function(widgetId,widgetData){// parse widgets @@ -71,183 +66,411 @@ function parsewidgets(widgets,parent) { var color = widgetData.color?'style="background-color:'+widgetData.color+'"':''; var title = widgetData.title || widgetId; - switch(widgetData.type) { + widgetData.path = widgetData.path || '/' + widgetId - case 'sep': - case 'separator': - var $widget = $('\ -
    \ -
    \ - '); + var $widget = $('\ +
    \ +
    '+title+'
    \ +
    \ + '); - break - case 'stack': - var $widget = $('\ -
    \ -
    '+title+'
    \ -
    \ -
    \ -
    \ - '); + var type = widgetData.type || 'fader' + var widgetInner = createWidget[type](widgetData,parent) + widgetInner.type = widgetData.type || 'fader' - parsewidgets(widgetData.widgets,$widget.find('.stack-wrapper')) - - break - - case 'button': - - var dv = widgetData.args?widgetData.args.off:0; - var $widget = $('\ -
    \ -
    '+title+'
    \ -
    \ -
    \ -
    \ - \ -
    \ - '); - - $widget.input = $widget.find('input') - $widget.button = $widget.find('.button') - - $widget.button - .on('on',function(e,send){ - $(this).addClass('on'); - var t = widgetData.target?widgetData.target:defaultTarget, - p = widgetData.path, - v = widgetData.on?widgetData.on:1; - if (send) sendOsc([t,p,parseFloat(v)]); - $widget.input.val(v) - }) - .on('off',function(e,send){ - $(this).removeClass('on'); - var t = widgetData.target?widgetData.target:defaultTarget, - p = widgetData.path, - v = widgetData.off?widgetData.off:0; - if (send) sendOsc([t,p,parseFloat(v)]); - $widget.input.val(v) - }) - .click(function(){ - var x = $widget.button.val()?'off':'on' - $(this).trigger(x,true) - }); - - $widget.button.val = function(v,send) { - var send = send==undefined?true:false; - if (v== undefined) {return $(this).hasClass('on')?1:0;} - else { - if (widgetData.args!=undefined) { - if (v==widgetData.args.on) {$widget.button.trigger('on',send)} - if (v==widgetData.args.off) {$widget.button.trigger('off',send)} - } else { - if (v==1) {$widget.button.trigger('on',send)} - if (v==0) {$widget.button.trigger('off',send)} - } - } - } - - __buttons__[widgetId] = $widget.button - - break + $widget.append(widgetInner) + __widgets__[widgetId] = widgetInner - - case 'fader': - default: - - var $widget = $('\ -
    \ -
    '+title+'
    \ -
    \ -
    \ -
    \ - \ -
    \ - '); - - $widget.fader = $widget.find('.fader') - - var range = (widgetData.range=='db'||!widgetData.range)?{'min': -70,'20%': -40,'45%': -20,'60%': -10,'max': 6}:widgetData.range; - - - var pips = function() { - if (widgetData.range=='db'||!widgetData.range) { - return [-70,-60,-50,-40,-30,-20,-10,-6,-3,0,3,6]; - } else { - var autopips = []; - var i=0; - for (key in range) { - //alert(range.key) - autopips[i]=range[key]; - i=i+1; - } - if (range.min<0 && 0\ + \ + '); + parsewidgets(widgetData.widgets,$widget) + $widget.getValue = function(){return} + $widget.setValue = function(){return} + return $widget; +} + +createWidget.button = function(widgetData) { + var $widget = $('\ +
    \ +
    \ + \ +
    \ + '); + + $widget.input = $widget.find('input') + $widget.button = $widget.find('.button') + + widgetData.args = widgetData.args || {off:0,on:1} + + $widget.button.click(function(){ + var newVal = $widget.button.hasClass('on')?widgetData.args.off||0:widgetData.args.on||1 + $widget.setValue(newVal,true) + }) + + + $widget.getValue = function() { + return $widget.button.hasClass('on')?widgetData.args.on||1:widgetData.args.off||0 + } + $widget.setValue = function(v,send) { + var on = widgetData.args.on||1, + off= widgetData.args.off||0 + if (v==on) { + $widget.button.addClass('on') + if (send) $widget.sendValue(v) + } else if (v==off) { + $widget.button.removeClass('on') + if (send) $widget.sendValue(v) + } + $widget.input.val($widget.getValue()) + + } + $widget.sendValue = function(v) { + var t = widgetData.target?widgetData.target:defaultTarget, + p = widgetData.path + sendOsc([t,p,v]); + } + $widget.setValue() + return $widget; +} + + +createWidget.xy = function(widgetData) { + var $widget = $('\ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ + '); + $widget.xy = $widget.find('.xy') + $widget.xy.handle = $widget.find('.handle') + $widget.xy.handle.css({top:0,left:0}).draggable({ + addClasses: false, + containment:'parent' + }); + + + $widget.xy.on('drag',function(e, data){ + var v = $widget.getValue(); + $widget.sendValue(v); + $widget.find('.val').text(v) + }) + widgetData.range = widgetData.range || {x:{min:0,max:1},y:{min:0,max:1}} + + $widget.getValue = function() { + var x = parseFloat($widget.xy.handle.css('left'))/$widget.xy.innerWidth(), + x = widgetData.range.x.min + x *(widgetData.range.x.max - widgetData.range.x.min), + y = 1 - (parseFloat($widget.xy.handle.css('top'))/$widget.xy.innerHeight()), + y = widgetData.range.y.min + y *(widgetData.range.y.max - widgetData.range.y.min) + return [x,y] + } + $widget.setValue = function(v,send) { + if (v[1]==undefined) var v = [v,v] + var x = (v[0]-widgetData.range.x.min)/(widgetData.range.x.max-widgetData.range.x.min)*$widget.xy.innerWidth(), + y = $widget.xy.innerHeight()-(v[1]-widgetData.range.y.min)/(widgetData.range.y.max-widgetData.range.y.min)*$widget.xy.innerHeight() + $widget.xy.handle.css({'top':y+'px','left':x+'px'}) + $widget.find('.val').text($widget.getValue()) + + if (send) $widget.xy.sendValue(v); + } + $widget.sendValue = function(v) { + var t = widgetData.target?widgetData.target:defaultTarget, + p = widgetData.path || widgetData.path + sendOsc([t,p,v]); + } + + + return $widget; +} + + + +var hsbToRgb = function (hsb) { + var rgb = {}; + var h = hsb.h; + var s = hsb.s*255/100; + var v = hsb.b*255/100; + if(s == 0) { + rgb.r = rgb.g = rgb.b = v; + } else { + var t1 = v; + var t2 = (255-s)*v/255; + var t3 = (t1-t2)*(h%60)/60; + if(h==360) h = 0; + if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3} + else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3} + else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3} + else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3} + else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3} + else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3} + else {rgb.r=0; rgb.g=0; rgb.b=0} + } + return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)}; +}; +var rgbToHsb = function (rgb) { + var hsb = {h: 0, s: 0, b: 0}; + var min = Math.min(rgb.r, rgb.g, rgb.b); + var max = Math.max(rgb.r, rgb.g, rgb.b); + var delta = max - min; + hsb.b = max; + hsb.s = max != 0 ? 255 * delta / max : 0; + if (hsb.s != 0) { + if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta; + else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta; + else hsb.h = 4 + (rgb.r - rgb.g) / delta; + } else hsb.h = -1; + hsb.h *= 60; + if (hsb.h < 0) hsb.h += 360; + hsb.s *= 100/255; + hsb.b *= 100/255; + return hsb; +}; +createWidget.rgb = function(widgetData) { + var $widget = $('\ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ + \ + \ +
    \ +
    \ + '); + $widget.xy = $widget.find('.xy') + $widget.xy.saturation = $widget.find('.rgb .handle') + $widget.xy.hue = $widget.find('.hue .handle') + $widget.xy.saturation.css({top:0,left:0}).draggable({ + addClasses: false, + containment:'parent' + }); + $widget.xy.hue.css({left:0}).draggable({ + addClasses: false, + containment:'parent' + }); + + $widget.xy.value = {r:$widget.find('input.r'),g:$widget.find('input.g'),b:$widget.find('input.b')} + + + $widget.xy.hue.on('drag',function(e, data){ + var h = parseFloat($widget.xy.hue.css('left'))/$widget.xy.innerWidth()*360, + rgb = hsbToRgb({h:h,s:100,b:100}), + v = $widget.getValue(); + console.log(h) + $widget.xy.css('background-color','rgb('+rgb.r+','+rgb.g+','+rgb.b+')') + $widget.sendValue(v); + $widget.showValue(v); + }) + + $widget.xy.saturation.on('drag',function(e, data){ + var v = $widget.getValue(); + $widget.sendValue(v); + $widget.showValue(v); + }) + + + widgetData.range = {x:{min:0,max:100},y:{min:0,max:100}} + + + + $widget.getValue = function() { + var s = parseFloat($widget.xy.saturation.css('left'))/$widget.xy.innerWidth(), + s = widgetData.range.x.min + s *(widgetData.range.x.max - widgetData.range.x.min), + l = 1 - (parseFloat($widget.xy.saturation.css('top'))/$widget.xy.innerHeight()), + l = widgetData.range.y.min + l *(widgetData.range.y.max - widgetData.range.y.min), + h = parseFloat($widget.xy.hue.css('left'))/$widget.xy.innerWidth()*360, + rgb = hsbToRgb({h:h,s:s,b:l}) + + return [rgb.r,rgb.g,rgb.b] + } + $widget.setValue = function(v,send) { + if (v[1]==undefined && v[2]==undefined) var v = [v,v,v] + if (v[2]==undefined) var v = [v[0],v[1],v[1]] + + for (i in [0,1,2]) { + if (!0<=v[i]<=255) {v[i]=Math.min(255,Math.max(0,v[i]))} + } + + + var hsb = rgbToHsb({r:v[0],g:v[1],b:v[2]}) + + var s = (hsb.s-widgetData.range.x.min)/(widgetData.range.x.max-widgetData.range.x.min)*$widget.xy.innerWidth(), + l = $widget.xy.innerHeight()-(hsb.b-widgetData.range.y.min)/(widgetData.range.y.max-widgetData.range.y.min)*$widget.xy.innerHeight() + h = hsb.h/360*$widget.xy.innerWidth() + + $widget.xy.saturation.css({'top':l+'px','left':s+'px'}) + $widget.xy.hue.css({'left':h+'px'}) + + var rgb = hsbToRgb({h:h,s:100,b:100}) + $widget.xy.css('background-color','rgb('+rgb.r+','+rgb.g+','+rgb.b+')') + + $widget.showValue(v); + + if (send) $widget.sendValue(v); + } + $widget.sendValue = function(v) { + var t = widgetData.target?widgetData.target:defaultTarget, + p = widgetData.path || widgetData.path + sendOsc([t,p,v]); + } + + + + $widget.showValue = function(v) { + $widget.xy.value.r.val(v[0]) + $widget.xy.value.g.val(v[1]) + $widget.xy.value.b.val(v[2]) + } + $widget.xy.value.r.change(function(){ + if (!0<=$(this).val()<=255) {$(this).val(Math.min(255,Math.max(0,$(this).val())))} + var v = $widget.getValue() + $widget.setValue([$(this).val(),v[1],v[2]],true) + }) + $widget.xy.value.g.change(function(){ + if (!0<=$(this).val()<=255) {$(this).val(Math.min(255,Math.max(0,$(this).val())))} + var v = $widget.getValue() + $widget.setValue([v[0],$(this).val(),v[2]],true) + }) + $widget.xy.value.b.change(function(){ + if (!0<=$(this).val()<=255) {$(this).val(Math.min(255,Math.max(0,$(this).val())))} + var v = $widget.getValue() + $widget.setValue([v[0],v[1],$(this).val()],true) + }) + + + return $widget; +} + + + + + + +createWidget.fader = function(widgetData,parent) { + var $widget = $('\ +
    \ +
    \ +
    \ +
    \ + \ +
    \ + '); + + $widget.fader = $widget.find('.fader') + $widget.lock = false + var range = (widgetData.range=='db'||!widgetData.range)?{'min': -70,'20%': -40,'45%': -20,'60%': -10,'max': 6}:widgetData.range; + + + var pips = function() { + if (widgetData.range=='db'||!widgetData.range) { + return [-70,-60,-50,-40,-30,-20,-10,-6,-3,0,3,6]; + } else { + var autopips = []; + var i=0; + for (key in range) { + autopips[i]=range[key]; + i=i+1; + } + if (range.min<0 && 0' + String(JSON.stringify(findNode(id,TABS),null,2)).split('\n').join('
      ') + $('.inspector .result').html(data); +}) // CALLBACKS @@ -410,15 +643,9 @@ ipc.on('receiveOsc',function(data){ var path = data.address; var id = $('[path="'+path+'"]').attr('widgetId'); - // lock - $('[path="'+path+'"]').addClass('locked'); - // update - if (__faders__[id]!=undefined) __faders__[id].val(data.args) - if (__buttons__[id]!=undefined) __buttons__[id].val(data.args,false) + if (__widgets__[id]!=undefined) __widgets__[id].setValue(data.args,false) - //unlock - $('[path="'+path+'"]').removeClass('locked'); }) ipc.on('load',function(preset){ diff --git a/lib-dev/logo_big.png b/lib-dev/logo_big.png deleted file mode 100644 index 086cf7af..00000000 Binary files a/lib-dev/logo_big.png and /dev/null differ diff --git a/package.json b/package.json index eb8ce852..04bb199d 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,7 @@ "dependencies": { "osc": "1.2.1", "express": "4.x", - "socket.io": "1.x", - "jquery" : "2.x" - }, + "socket.io": "1.x" }, "keywords": [ "osc" ],