diff --git a/app/config.json b/app/config.json index bc55b4b0..a9b7fb2f 100644 --- a/app/config.json +++ b/app/config.json @@ -3,6 +3,7 @@ "sessionPath": "/home/bordun/oscwork/oschtmlgui/sessions/", "recentSessions": [ "/home/bordun/oscwork/oschtmlgui/sessions/demo.js", + "/home/bordun/oscwork/oschtmlgui/sessions/knob.js", "/home/bordun/oscwork/oschtmlgui/sessions/demo-full.js", "/home/bordun/oscwork/oschtmlgui/sessions/xy.js", "/home/bordun/oscwork/oschtmlgui/sessions/fadertest.js", diff --git a/browser/css/style.scss b/browser/css/style.scss index 9f7e31c4..80e764f2 100644 --- a/browser/css/style.scss +++ b/browser/css/style.scss @@ -863,8 +863,7 @@ a { .fader-wrapper-outer { padding-bottom:30px; overflow:hidden; - height:100%; - width:100%; + // height:100%; position: relative; input { position:absolute; @@ -987,3 +986,61 @@ a { } } + + +.knob-wrapper-outer { + padding-bottom:30px; + overflow:hidden; + width:100%; + position: relative; + input { + position:absolute; + bottom:0; + box-shadow: 0 0 1px 0 $color-border inset; + } +} +.knob-wrapper { + padding:20px 20px 20px 20px ; + overflow:hidden; + //height:100%; + width:120px; + position: relative; + + .knob { + width:100%; + padding-bottom:100%; + border-radius:100%; + position: relative; + background: $color-bg; + box-shadow: 0 0 0 2px $color-border; + &:after { + content:""; + position:absolute; + width:4px; + height:4px; + border-radius:100%; + left:50%; + margin-left:-3px; + bottom:4px; + border:1px solid $color-border; + background:$color-accent + } + } + .pip { + position:absolute; + font-size:11px; + color:#ccc; + &.min { + bottom:10px; + right:50%; + margin-right:35px; + text-align:right; + } + &.max { + bottom:10px; + left:50%; + margin-left:35px; + text-align:left; + } + } +} diff --git a/browser/js/app/widgets.js b/browser/js/app/widgets.js index 08154be8..cb5ce28c 100644 --- a/browser/js/app/widgets.js +++ b/browser/js/app/widgets.js @@ -453,7 +453,7 @@ createWidget.fader = function(widgetData,parent){ },{ relative:true }); - widgetData.range = widgetData.range || {'min':0,'100%':1} + widgetData.range = widgetData.range || {'min':0,'max':1} widgetData.range = (widgetData.range=='db')?{'min': -70,'20%': -40,'45%': -20,'60%': -10,'71%':-6,'78%':-3,'85%':0,'92%':3,'max': 6}:widgetData.range; @@ -536,3 +536,85 @@ createWidget.fader = function(widgetData,parent){ return widget } + +// get rotation plugin (@Ivo Renkema) + +$.fn.getRotation = function () { + var matrix = this.css("transform") + if(typeof matrix === 'string' && matrix !== 'none') { + var values = matrix.split('(')[1].split(')')[0].split(','); + var a = values[0]; + var b = values[1]; + var angle = Math.round(Math.atan2(b, a) * (180/Math.PI)); + } else { var angle = 0; } + if (angle<0) angle = 360+angle + return angle; +}; + + +createWidget.knob = function(widgetData,parent) { + var widget = $('\ +