- strip style simplified
- removed semicolons from js files - gitignore config file changes
This commit is contained in:
parent
696ddb262b
commit
72115e2885
11 changed files with 213 additions and 221 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
|||
node_modules/
|
||||
config.json
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
ipc.on('receiveOsc',function(data){
|
||||
// fetch id
|
||||
var path = data.path;
|
||||
var path = data.path
|
||||
var id = __widgetsIds__[path]
|
||||
|
||||
// update
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ init = function(session,callback) {
|
|||
|
||||
$.each(__widgets__,function(i,widget) {
|
||||
if (widget.length>1) {
|
||||
var script ='';
|
||||
var script =''
|
||||
|
||||
var closureSync = function(x) {
|
||||
return function() {
|
||||
|
|
@ -38,11 +38,11 @@ init = function(session,callback) {
|
|||
// Tabs...
|
||||
$('.tablist a').click(function(){
|
||||
|
||||
var id = $(this).data('tab');
|
||||
$(id).siblings('.on').removeClass('on');
|
||||
$(id).addClass('on');
|
||||
$(this).parents('ul').find('.on').removeClass('on');
|
||||
$(this).addClass('on');$(this).parent().addClass('on');
|
||||
var id = $(this).data('tab')
|
||||
$(id).siblings('.on').removeClass('on')
|
||||
$(id).addClass('on')
|
||||
$(this).parents('ul').find('.on').removeClass('on')
|
||||
$(this).addClass('on');$(this).parent().addClass('on')
|
||||
|
||||
})
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ init = function(session,callback) {
|
|||
|
||||
|
||||
// Activate first tabs
|
||||
$('.tablist li:first-child a').click();
|
||||
$('.tablist li:first-child a').click()
|
||||
|
||||
|
||||
|
||||
|
|
@ -76,20 +76,20 @@ init = function(session,callback) {
|
|||
|
||||
} else {
|
||||
var scrollbar = 10
|
||||
var h = $('#container').innerHeight()-scrollbar-$(this).parents('.tab').length*5;
|
||||
var h = $('#container').innerHeight()-scrollbar-$(this).parents('.tab').length*5
|
||||
if ($(this).get(0).scrollHeight+scrollbar == $(this).height()) {
|
||||
var scroll = e.originalEvent.deltaY || e.originalEvent.deltaX
|
||||
$(this).scrollLeft($(this).scrollLeft()+scroll);
|
||||
e.preventDefault();
|
||||
$(this).scrollLeft($(this).scrollLeft()+scroll)
|
||||
e.preventDefault()
|
||||
} else if (e.pageY>=h) {
|
||||
$(this).scrollLeft($(this).scrollLeft()+e.originalEvent.deltaY);
|
||||
$(this).scrollLeft($(this).scrollLeft()+e.originalEvent.deltaY)
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
// sidepanel
|
||||
|
||||
|
|
@ -137,13 +137,13 @@ init = function(session,callback) {
|
|||
|
||||
|
||||
$('#open-toggle').click(function(){
|
||||
$('#open-toggle, #sidepanel, #container').toggleClass('sidepanel-open');
|
||||
$('#open-toggle, #sidepanel, #container').toggleClass('sidepanel-open')
|
||||
})
|
||||
|
||||
$('.widget .label').click(function(){
|
||||
if (!$('#sidepanel').hasClass('sidepanel-open')){return}
|
||||
var data = String(JSON.stringify($(this).data('papers'),null,2)).split('\n').join('<br/> ')
|
||||
$('.inspector .result').html(data);
|
||||
$('.inspector .result').html(data)
|
||||
})
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,15 +15,15 @@ parsetabs = function(tabs,parent,sub){
|
|||
if (!sub) {
|
||||
var nav = $(document.createElement('div')).addClass('main navigation'),
|
||||
navtabs = $(document.createElement('ul')).addClass('tablist'),
|
||||
content = $(document.createElement('div')).addClass('content');
|
||||
content = $(document.createElement('div')).addClass('content')
|
||||
nav.append(navtabs)
|
||||
$('#container').append(nav).append(content);
|
||||
$('#container').append(nav).append(content)
|
||||
} else {
|
||||
var nav = $(document.createElement('div')).addClass('sub navigation'),
|
||||
navtabs = $(document.createElement('ul')).addClass('tablist'),
|
||||
content = $(document.createElement('div')).addClass('content hastabs');
|
||||
nav.append(navtabs);
|
||||
parent.append(nav).append(content);
|
||||
content = $(document.createElement('div')).addClass('content hastabs')
|
||||
nav.append(navtabs)
|
||||
parent.append(nav).append(content)
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -37,19 +37,19 @@ parsetabs = function(tabs,parent,sub){
|
|||
label= tabData.label||tabData.id
|
||||
|
||||
|
||||
navtabs.append('<li><a data-tab="#'+id+'"><span>'+label+'</span></a></li>');
|
||||
navtabs.append('<li><a data-tab="#'+id+'"><span>'+label+'</span></a></li>')
|
||||
|
||||
var tabContent = $('<div></div>').addClass('tab').attr('id',id);
|
||||
var tabContent = $('<div></div>').addClass('tab').attr('id',id)
|
||||
|
||||
if (tabData.stretch) tabContent.addClass('stretch')
|
||||
|
||||
if (tabData.tabs) {
|
||||
parsetabs(tabData.tabs,parent=tabContent,sub=true);
|
||||
parsetabs(tabData.tabs,parent=tabContent,sub=true)
|
||||
} else {
|
||||
parsewidgets(tabData.widgets,tabContent)
|
||||
}
|
||||
|
||||
content.append(tabContent);
|
||||
content.append(tabContent)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ parsewidgets = function(widgets,parent) {
|
|||
<div class="widget '+type+'-container" widgetType="'+type+'" widgetId="'+id+'" path="'+path+'" style="'+style+'">\
|
||||
<div class="label"><span>'+label+'</span></div>\
|
||||
</div>\
|
||||
');
|
||||
')
|
||||
|
||||
|
||||
if (widgetData.label===false) widgetContainer.addClass('nolabel')
|
||||
|
|
@ -85,8 +85,6 @@ parsewidgets = function(widgets,parent) {
|
|||
widgetInner.type = type
|
||||
widgetContainer.find('.label').data('papers',widgetData)
|
||||
|
||||
if (widgetData.class) widgetContainer.addClass(widgetData.class)
|
||||
|
||||
widgetContainer.append(widgetInner)
|
||||
|
||||
// store widget reference for cross widget sync
|
||||
|
|
@ -99,6 +97,6 @@ parsewidgets = function(widgets,parent) {
|
|||
// store path vs widget id for faster cross-app sync
|
||||
__widgetsIds__[widgetData.path ] = id
|
||||
|
||||
parent.append(widgetContainer);
|
||||
parent.append(widgetContainer)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
sendOsc = function(data){
|
||||
// Unpack args for osc sending function
|
||||
if (data[0]) {
|
||||
ipc.send('sendOsc', {target:data[0],path:data[1],args:data[2]});
|
||||
ipc.send('sendOsc', {target:data[0],path:data[1],args:data[2]})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ openSession = function(path){
|
|||
$('#lobby').hide()
|
||||
$('#container').append('<div id="loading"><div class="spinner"></div></div>')
|
||||
setTimeout(function(){
|
||||
init(session,function(){$('#loading').hide()});
|
||||
init(session,function(){$('#loading').hide()})
|
||||
},1)
|
||||
|
||||
} else {
|
||||
|
|
@ -82,9 +82,9 @@ createMenu = function(template) {
|
|||
|
||||
var closureClick = function(item) {
|
||||
return function() {
|
||||
item.click();
|
||||
item.click()
|
||||
return false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
for (i in template) {
|
||||
|
|
@ -149,7 +149,7 @@ createPopup = function(title,content) {
|
|||
|
||||
|
||||
|
||||
var remote = require('remote');
|
||||
var remote = require('remote')
|
||||
configPanel = function(){
|
||||
var readEditableConfig = remote.getGlobal('readEditableConfig')
|
||||
var writeConfig = remote.getGlobal('writeConfig')
|
||||
|
|
@ -175,7 +175,7 @@ configPanel = function(){
|
|||
input.addClass('invalid')
|
||||
} else {
|
||||
input.removeClass('invalid')
|
||||
};
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
|
@ -207,23 +207,23 @@ configPanel = function(){
|
|||
|
||||
writeConfig(newconfig)
|
||||
|
||||
popup.close();
|
||||
popup.close()
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
hsbToRgb = function (hsb) {
|
||||
var rgb = {};
|
||||
var h = hsb.h;
|
||||
var s = hsb.s*255/100;
|
||||
var v = hsb.b*255/100;
|
||||
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;
|
||||
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;
|
||||
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}
|
||||
|
|
@ -232,26 +232,26 @@ hsbToRgb = function (hsb) {
|
|||
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)};
|
||||
};
|
||||
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)}
|
||||
}
|
||||
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;
|
||||
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 = 0;
|
||||
hsb.h *= 60;
|
||||
if (hsb.h < 0) hsb.h += 360;
|
||||
hsb.s *= 100/255;
|
||||
hsb.b *= 100/255;
|
||||
return hsb;
|
||||
};
|
||||
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 = 0
|
||||
hsb.h *= 60
|
||||
if (hsb.h < 0) hsb.h += 360
|
||||
hsb.s *= 100/255
|
||||
hsb.b *= 100/255
|
||||
return hsb
|
||||
}
|
||||
|
||||
|
||||
clip = function(value,range) {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,18 @@
|
|||
createWidget= {}
|
||||
|
||||
|
||||
createWidget.strip = function(widgetData) {
|
||||
createWidget.strip = function(widgetData,container) {
|
||||
var widget = $('\
|
||||
<div class="strip">\
|
||||
</div>\
|
||||
');
|
||||
')
|
||||
if (widgetData.horizontal) {
|
||||
widget.addClass('horizontal')
|
||||
widgetData.class = 'horizontal-container'
|
||||
container.addClass('horizontal')
|
||||
}
|
||||
parsewidgets(widgetData.widgets,widget)
|
||||
widget.getValue = function(){return}
|
||||
widget.setValue = function(){return}
|
||||
return widget;
|
||||
return widget
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -32,7 +31,7 @@ createWidget.led = function(widgetData) {
|
|||
led.css('opacity',mapToScale(v,[range.min,range.max],[0,1]))
|
||||
}
|
||||
widget.getValue = function(){return}
|
||||
return widget;
|
||||
return widget
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -80,10 +79,10 @@ createWidget.toggle = createWidget.button = function(widgetData) {
|
|||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v]);
|
||||
sendOsc([t,p,v])
|
||||
}
|
||||
widget.setValue()
|
||||
return widget;
|
||||
return widget
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -93,7 +92,7 @@ createWidget.switch = function(widgetData) {
|
|||
var widget = $('\
|
||||
<div class="switch">\
|
||||
</div>\
|
||||
');
|
||||
')
|
||||
|
||||
for (v in widgetData.values) {
|
||||
widget.append('<div class="value" data-value="'+widgetData.values[v]+'">'+widgetData.values[v]+'</div>')
|
||||
|
|
@ -101,7 +100,7 @@ createWidget.switch = function(widgetData) {
|
|||
|
||||
|
||||
widget.find('.value').click(function(){
|
||||
if ($(this).hasClass('on')) return;
|
||||
if ($(this).hasClass('on')) return
|
||||
var newVal = $(this).data('value')
|
||||
widget.setValue(newVal,true,true)
|
||||
})
|
||||
|
|
@ -123,9 +122,9 @@ createWidget.switch = function(widgetData) {
|
|||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v]);
|
||||
sendOsc([t,p,v])
|
||||
}
|
||||
return widget;
|
||||
return widget
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -172,8 +171,8 @@ createWidget.xy = function(widgetData) {
|
|||
handle.width = w
|
||||
|
||||
var v = widget.getValue()
|
||||
widget.sendValue(v);
|
||||
widget.showValue(v);
|
||||
widget.sendValue(v)
|
||||
widget.showValue(v)
|
||||
widget.trigger('sync')
|
||||
|
||||
off = {x:handle.width,y:handle.height}
|
||||
|
|
@ -191,11 +190,11 @@ createWidget.xy = function(widgetData) {
|
|||
handle.width = w
|
||||
|
||||
var v = widget.getValue()
|
||||
widget.sendValue(v);
|
||||
widget.showValue(v);
|
||||
widget.sendValue(v)
|
||||
widget.showValue(v)
|
||||
widget.trigger('sync')
|
||||
|
||||
},{ relative:true });
|
||||
},{ relative:true })
|
||||
|
||||
|
||||
|
||||
|
|
@ -216,12 +215,12 @@ createWidget.xy = function(widgetData) {
|
|||
|
||||
widget.showValue(v)
|
||||
if (sync) widget.trigger('sync')
|
||||
if (send) widget.sendValue(v);
|
||||
if (send) widget.sendValue(v)
|
||||
}
|
||||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v]);
|
||||
sendOsc([t,p,v])
|
||||
}
|
||||
|
||||
widget.showValue = function(v) {
|
||||
|
|
@ -230,18 +229,18 @@ createWidget.xy = function(widgetData) {
|
|||
}
|
||||
|
||||
value.x.change(function(){
|
||||
var v = widget.getValue();
|
||||
var v = widget.getValue()
|
||||
v[0] = clip(value.x.val(),[range.x.min,range.x.max])
|
||||
widget.setValue(v,true,true)
|
||||
})
|
||||
value.y.change(function(){
|
||||
var v = widget.getValue();
|
||||
var v = widget.getValue()
|
||||
v[1] = clip(value.y.val(),[range.y.min,range.y.max])
|
||||
widget.setValue(v,true,true)
|
||||
})
|
||||
|
||||
widget.setValue(range.x.min,range.y.min)
|
||||
return widget;
|
||||
return widget
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -296,8 +295,8 @@ createWidget.rgb = function(widgetData) {
|
|||
rgbHandle.width = w
|
||||
|
||||
var v = widget.getValue()
|
||||
widget.sendValue(v);
|
||||
widget.showValue(v);
|
||||
widget.sendValue(v)
|
||||
widget.showValue(v)
|
||||
widget.trigger('sync')
|
||||
|
||||
rgbOff = {x:rgbHandle.width,y:rgbHandle.height}
|
||||
|
|
@ -315,12 +314,12 @@ createWidget.rgb = function(widgetData) {
|
|||
rgbHandle.width = w
|
||||
|
||||
var v = widget.getValue()
|
||||
widget.sendValue(v);
|
||||
widget.showValue(v);
|
||||
widget.sendValue(v)
|
||||
widget.showValue(v)
|
||||
|
||||
widget.trigger('sync')
|
||||
|
||||
},{ relative:true });
|
||||
},{ relative:true })
|
||||
|
||||
|
||||
var hueOff = 0
|
||||
|
|
@ -333,14 +332,14 @@ createWidget.rgb = function(widgetData) {
|
|||
|
||||
var h = clip(hueHandle.width*3.6,[0,360]),
|
||||
rgb = hsbToRgb({h:h,s:100,b:100}),
|
||||
v = widget.getValue();
|
||||
v = widget.getValue()
|
||||
|
||||
pad[0].setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')')
|
||||
|
||||
|
||||
|
||||
widget.sendValue(v);
|
||||
widget.showValue(v);
|
||||
widget.sendValue(v)
|
||||
widget.showValue(v)
|
||||
widget.trigger('sync')
|
||||
|
||||
hueOff = hueHandle.width
|
||||
|
|
@ -359,15 +358,15 @@ createWidget.rgb = function(widgetData) {
|
|||
|
||||
var h = clip(hueHandle.width*3.6,[0,360]),
|
||||
rgb = hsbToRgb({h:h,s:100,b:100}),
|
||||
v = widget.getValue();
|
||||
v = widget.getValue()
|
||||
|
||||
pad[0].setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')')
|
||||
widget.sendValue(v);
|
||||
widget.showValue(v);
|
||||
widget.sendValue(v)
|
||||
widget.showValue(v)
|
||||
|
||||
widget.trigger('sync')
|
||||
|
||||
},{ relative:true });
|
||||
},{ relative:true })
|
||||
|
||||
|
||||
|
||||
|
|
@ -406,17 +405,17 @@ createWidget.rgb = function(widgetData) {
|
|||
var rgb = hsbToRgb({h:hsb.h,s:100,b:100})
|
||||
pad[0].setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')')
|
||||
|
||||
widget.showValue(v);
|
||||
widget.showValue(v)
|
||||
|
||||
|
||||
|
||||
if (sync) widget.trigger('sync');
|
||||
if (send) widget.sendValue(v);
|
||||
if (sync) widget.trigger('sync')
|
||||
if (send) widget.sendValue(v)
|
||||
}
|
||||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v]);
|
||||
sendOsc([t,p,v])
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -444,7 +443,7 @@ createWidget.rgb = function(widgetData) {
|
|||
|
||||
widget.setValue(0)
|
||||
|
||||
return widget;
|
||||
return widget
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -467,8 +466,9 @@ createWidget.fader = function(widgetData,container){
|
|||
input = widget.find('input'),
|
||||
unit = widgetData.unit?' '+widgetData.unit.trim(): '',
|
||||
dimension = widgetData.horizontal?'width':'height',
|
||||
absolute = widgetData.absolute;
|
||||
absolute = widgetData.absolute
|
||||
|
||||
if (widgetData.gauge===false) fader.addClass('nogauge')
|
||||
if (widgetData.horizontal) container.addClass('horizontal')
|
||||
|
||||
handle.size = 0
|
||||
|
|
@ -489,8 +489,8 @@ createWidget.fader = function(widgetData,container){
|
|||
handle.size = d
|
||||
|
||||
var v = widget.getValue()
|
||||
widget.sendValue(v);
|
||||
widget.showValue(v);
|
||||
widget.sendValue(v)
|
||||
widget.showValue(v)
|
||||
|
||||
widget.trigger('sync')
|
||||
|
||||
|
|
@ -511,12 +511,12 @@ createWidget.fader = function(widgetData,container){
|
|||
handle.size = d
|
||||
|
||||
var v = widget.getValue()
|
||||
widget.sendValue(v);
|
||||
widget.showValue(v);
|
||||
widget.sendValue(v)
|
||||
widget.showValue(v)
|
||||
|
||||
widget.trigger('sync')
|
||||
|
||||
},{ relative:true });
|
||||
},{ relative:true })
|
||||
|
||||
widgetData.range = widgetData.range || {'min':0,'max':1}
|
||||
|
||||
|
|
@ -574,17 +574,17 @@ createWidget.fader = function(widgetData,container){
|
|||
handle[0].setAttribute('style',dimension+':'+h+'%')
|
||||
handle.size = h
|
||||
|
||||
widget.showValue(v);
|
||||
widget.showValue(v)
|
||||
|
||||
|
||||
if (sync) widget.trigger('sync');
|
||||
if (send) widget.sendValue(v);
|
||||
if (sync) widget.trigger('sync')
|
||||
if (send) widget.sendValue(v)
|
||||
}
|
||||
|
||||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v]);
|
||||
sendOsc([t,p,v])
|
||||
}
|
||||
|
||||
widget.showValue = function(v) {
|
||||
|
|
@ -624,7 +624,7 @@ createWidget.knob = function(widgetData) {
|
|||
|
||||
|
||||
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;
|
||||
pipmax = Math.abs(range.max)>=1000?range.max/1000+'k':range.max
|
||||
|
||||
widget.find('.pip.min').text(pipmin)
|
||||
widget.find('.pip.max').text(pipmax)
|
||||
|
|
@ -641,7 +641,7 @@ createWidget.knob = function(widgetData) {
|
|||
var rect= knob[0].getBoundingClientRect(),
|
||||
rad = knob.rotation*Math.PI/180,
|
||||
w = dd.target.clientWidth * Math.abs( Math.sin( rad) ) + dd.target.clientWidth * Math.abs( Math.cos( rad ) ),
|
||||
h = dd.target.clientHeight * Math.abs( Math.cos( rad ) ) + dd.target.clientHeight * Math.abs( Math.sin( rad ) );
|
||||
h = dd.target.clientHeight * Math.abs( Math.cos( rad ) ) + dd.target.clientHeight * Math.abs( Math.sin( rad ) )
|
||||
x = dd.startX-rect.left-w/2,
|
||||
y = dd.startY-rect.top-h/2
|
||||
angle = Math.atan2(-y, -x) * 180 / Math.PI +45
|
||||
|
|
@ -658,7 +658,7 @@ createWidget.knob = function(widgetData) {
|
|||
|
||||
var v = mapToScale(r,[0,270],[range.min,range.max])
|
||||
|
||||
widget.sendValue(v);
|
||||
widget.sendValue(v)
|
||||
widget.trigger('sync')
|
||||
widget.showValue(v)
|
||||
|
||||
|
|
@ -676,7 +676,7 @@ createWidget.knob = function(widgetData) {
|
|||
var rect= knob[0].getBoundingClientRect(),
|
||||
rad = knob.rotation*Math.PI/180,
|
||||
w = dd.target.clientWidth * Math.abs( Math.sin( rad) ) + dd.target.clientWidth * Math.abs( Math.cos( rad ) ),
|
||||
h = dd.target.clientHeight * Math.abs( Math.cos( rad ) ) + dd.target.clientHeight * Math.abs( Math.sin( rad ) );
|
||||
h = dd.target.clientHeight * Math.abs( Math.cos( rad ) ) + dd.target.clientHeight * Math.abs( Math.sin( rad ) )
|
||||
x = ev.pageX-rect.left-w/2,
|
||||
y = ev.pageY-rect.top-h/2
|
||||
angle = Math.atan2(-y, -x) * 180 / Math.PI +45
|
||||
|
|
@ -697,11 +697,11 @@ createWidget.knob = function(widgetData) {
|
|||
|
||||
var v = mapToScale(r,[0,270],[range.min,range.max])
|
||||
|
||||
widget.sendValue(v);
|
||||
widget.sendValue(v)
|
||||
widget.trigger('sync')
|
||||
widget.showValue(v)
|
||||
|
||||
},{ relative:true });
|
||||
},{ relative:true })
|
||||
|
||||
|
||||
widget.getValue = function() {
|
||||
|
|
@ -713,7 +713,7 @@ createWidget.knob = function(widgetData) {
|
|||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v]);
|
||||
sendOsc([t,p,v])
|
||||
}
|
||||
widget.setValue = function(v,send,sync) {
|
||||
var r = mapToScale(v,[range.min,range.max],[0,270])
|
||||
|
|
@ -731,10 +731,10 @@ createWidget.knob = function(widgetData) {
|
|||
knob[0].setAttribute('style','transform:rotateZ('+r+'deg)')
|
||||
var v = widget.getValue() || v
|
||||
|
||||
widget.showValue(v);
|
||||
widget.showValue(v)
|
||||
|
||||
if (sync) widget.trigger('sync');
|
||||
if (send) widget.sendValue(v);
|
||||
if (sync) widget.trigger('sync')
|
||||
if (send) widget.sendValue(v)
|
||||
}
|
||||
input.change(function(){
|
||||
widget.setValue(input.val(),true,true)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
// mainProcess & renderProcess communication engine
|
||||
ipc = require('ipc');
|
||||
ipc = require('ipc')
|
||||
|
||||
// filesystem
|
||||
fs = require('fs');
|
||||
fs = require('fs')
|
||||
|
||||
// jquery
|
||||
window.$ = window.jQuery = require( __dirname + "/jquery/jquery.min.js")
|
||||
|
|
@ -17,4 +17,4 @@ require( __dirname + "/jquery/jquery.ba-resize.js")
|
|||
// main js
|
||||
require( __dirname + "/app/app.js")
|
||||
|
||||
ipc.send('ready');
|
||||
ipc.send('ready')
|
||||
|
|
|
|||
|
|
@ -632,30 +632,42 @@ form {
|
|||
background: none;
|
||||
box-shadow:none;
|
||||
> .label {
|
||||
// position: relative;
|
||||
background:$bg-3d;
|
||||
box-shadow: 0 0 0 1px $color-bg inset;
|
||||
}
|
||||
|
||||
&.no-stretch {
|
||||
height:auto;
|
||||
min-height:100%;
|
||||
.strip .widget {
|
||||
height: auto;
|
||||
.strip {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
> .widget {
|
||||
display: block;
|
||||
margin: 0;
|
||||
width:auto;
|
||||
&:not(:last-child) {
|
||||
border-bottom-width:0;
|
||||
}
|
||||
&:first-child {
|
||||
border-top-width:0;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.nolabel .strip:not(.horizontal) > .widget:first-child {
|
||||
border-top:0;
|
||||
}
|
||||
.strip:not(.horizontal) > .widget {
|
||||
width:auto;
|
||||
}
|
||||
&.nolabel .strip.horizontal > .widget {
|
||||
border-top:0;
|
||||
}
|
||||
|
||||
.strip {
|
||||
&.horizontal {
|
||||
&.horizontal {
|
||||
padding-top:0;
|
||||
padding-left: 40rem;
|
||||
width:100%;
|
||||
height:auto;
|
||||
margin:0;
|
||||
border-left-width: 6rem;
|
||||
display: block;
|
||||
&:last-child {
|
||||
margin-bottom:6rem;
|
||||
}
|
||||
&.nolabel {
|
||||
padding-left: 0;
|
||||
}
|
||||
.strip {
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
|
||||
|
|
@ -663,43 +675,12 @@ form {
|
|||
border-bottom-width: 0;
|
||||
border-top-width: 0;
|
||||
border-right-width:6rem;
|
||||
width:auto;
|
||||
flex-shrink: initial;
|
||||
&:last-child {
|
||||
border-right-width: 6rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
> .widget {
|
||||
display: block;
|
||||
margin: 0;
|
||||
// width:100%;
|
||||
&:not(:last-child) {
|
||||
border-bottom-width:0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&.horizontal-container {
|
||||
padding-top:0;
|
||||
padding-left: 40rem;
|
||||
width:100%;
|
||||
height:auto;
|
||||
margin:0;
|
||||
border-left-width: 6rem;
|
||||
|
||||
display: block;
|
||||
&:last-child {
|
||||
margin-bottom:6rem;
|
||||
}
|
||||
&.nolabel {
|
||||
padding-left: 0;
|
||||
}
|
||||
> .label {
|
||||
width:35rem;
|
||||
height:100%;
|
||||
|
|
@ -1011,6 +992,23 @@ form {
|
|||
position: relative;
|
||||
margin:0 auto;
|
||||
left:-25rem;
|
||||
&.nogauge {
|
||||
.handle {
|
||||
background:none;
|
||||
&:before {
|
||||
content:"";
|
||||
position: absolute;
|
||||
top:-6rem;
|
||||
left:-2rem;
|
||||
height:8rem;
|
||||
width:8rem;
|
||||
background:$color-accent;
|
||||
border:none!important;
|
||||
border-radius: 100%!important;
|
||||
box-shadow: 0 0 0 2px mix($color-text,$color-fg,2);
|
||||
}
|
||||
}
|
||||
}
|
||||
.handle {
|
||||
position: absolute;
|
||||
bottom:0!important;
|
||||
|
|
@ -1025,16 +1023,6 @@ form {
|
|||
&:active {
|
||||
cursor: -webkit-grabbing;
|
||||
}
|
||||
// &:before {
|
||||
// content:"";
|
||||
// position: absolute;
|
||||
// top:-6rem;
|
||||
// left:-2rem;
|
||||
// width:8rem;
|
||||
// height:12rem;
|
||||
// border-radius: 2rem;
|
||||
// background:$color-text-fade;
|
||||
// }
|
||||
&:after {
|
||||
content:"";
|
||||
position: absolute;
|
||||
|
|
|
|||
|
|
@ -1 +1,6 @@
|
|||
{}
|
||||
{
|
||||
"sessionPath": "/home/bordun/oscwork/oschtmlgui/sessions/",
|
||||
"recentSessions": [
|
||||
"/home/bordun/oscwork/oschtmlgui/sessions/sebkhachott.js"
|
||||
]
|
||||
}
|
||||
|
|
@ -45,8 +45,8 @@ writeConfig = function(newconfig) {
|
|||
config[i] = newconfig[i]
|
||||
}
|
||||
fs.writeFile(configPath,JSON.stringify(config,null,4), function (err, data) {
|
||||
if (err) throw err;
|
||||
});
|
||||
if (err) throw err
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -66,9 +66,9 @@ readEditableConfig = function(){
|
|||
}
|
||||
|
||||
restartApp = function(){
|
||||
var exec = require('child_process').exec;
|
||||
exec(args.join(' '));
|
||||
app.quit();
|
||||
var exec = require('child_process').exec
|
||||
exec(args.join(' '))
|
||||
app.quit()
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -81,19 +81,19 @@ compileScss = function(){
|
|||
var content = fs.readFileSync(file,'utf8')
|
||||
sass.compile(content,{style: sass.style.compact,linefeed: ''}, function(result) {
|
||||
fs.writeFileSync(__dirname + '/../browser/css/'+filenames[i].replace('.scss','.css'),result.text,'utf8')
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var window = null;
|
||||
var window = null
|
||||
|
||||
app.on('window-all-closed', function() {
|
||||
if (process.platform != 'darwin') {
|
||||
app.quit();
|
||||
app.quit()
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
app.on('ready', function() {
|
||||
|
||||
|
|
@ -105,17 +105,17 @@ app.on('ready', function() {
|
|||
width: 800,
|
||||
height: 600,
|
||||
'auto-hide-menu-bar':true
|
||||
});
|
||||
})
|
||||
|
||||
window.loadUrl('file://' + __dirname + '/../browser/index.html');
|
||||
window.loadUrl('file://' + __dirname + '/../browser/index.html')
|
||||
|
||||
window.on('closed', function() {
|
||||
window = null;
|
||||
});
|
||||
window = null
|
||||
})
|
||||
|
||||
|
||||
var Menu = require('menu');
|
||||
var MenuItem = require('menu-item');
|
||||
var Menu = require('menu')
|
||||
var MenuItem = require('menu-item')
|
||||
|
||||
var template = [
|
||||
{
|
||||
|
|
@ -139,26 +139,26 @@ app.on('ready', function() {
|
|||
]
|
||||
},
|
||||
]
|
||||
menu = Menu.buildFromTemplate(template);
|
||||
Menu.setApplicationMenu(menu);
|
||||
});
|
||||
menu = Menu.buildFromTemplate(template)
|
||||
Menu.setApplicationMenu(menu)
|
||||
})
|
||||
|
||||
|
||||
|
||||
var oscServer = new osc.Server(readConfig('oscInPort'), '127.0.0.1');
|
||||
var oscServer = new osc.Server(readConfig('oscInPort'), '127.0.0.1')
|
||||
|
||||
oscServer.on("message", function (msg, rinfo) {
|
||||
var data = {path:msg.shift(),args:msg}
|
||||
if (data.args.length==1) data.args = data.args[0]
|
||||
renderProcess.send('receiveOsc',data);
|
||||
});
|
||||
renderProcess.send('receiveOsc',data)
|
||||
})
|
||||
|
||||
|
||||
// mainProcess & renderProcess async i/o
|
||||
|
||||
renderProcess = {
|
||||
send : function(name,data) {
|
||||
window.webContents.send(name,data);
|
||||
window.webContents.send(name,data)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ ipc.on('addSessionToHistory',function(event, data){
|
|||
sessionlist.unshift(data)
|
||||
// remove doubles from history
|
||||
sessionlist = sessionlist.filter(function(elem, index, self) {
|
||||
return index == self.indexOf(elem);
|
||||
return index == self.indexOf(elem)
|
||||
})
|
||||
// save history
|
||||
writeConfig({recentSessions:sessionlist})
|
||||
|
|
@ -196,7 +196,7 @@ ipc.on('ready',function(){
|
|||
|
||||
if (args.indexOf('-l')!=-1) {
|
||||
var sessionlist = readConfig('recentSessions')
|
||||
renderProcess.send('openSession',sessionlist[0]);
|
||||
renderProcess.send('openSession',sessionlist[0])
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -207,25 +207,25 @@ ipc.on('ready',function(){
|
|||
ipc.on('sendOsc', function (event,data) {
|
||||
|
||||
var targets = []
|
||||
Array.prototype.push.apply(targets, data.target.split(' '));
|
||||
Array.prototype.push.apply(targets, readConfig('syncTargets').split(' '));
|
||||
Array.prototype.push.apply(targets, data.target.split(' '))
|
||||
Array.prototype.push.apply(targets, readConfig('syncTargets').split(' '))
|
||||
|
||||
for (i in targets) {
|
||||
|
||||
var host = targets[i].split(':')[0],
|
||||
port = targets[i].split(':')[1];
|
||||
port = targets[i].split(':')[1]
|
||||
|
||||
if (port) {
|
||||
var client = new osc.Client(host, port);
|
||||
var client = new osc.Client(host, port)
|
||||
client.send(data.path, data.args, function () {
|
||||
client.kill();
|
||||
});
|
||||
client.kill()
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
ipc.on('save', function(event, data){
|
||||
|
|
@ -236,9 +236,9 @@ ipc.on('save', function(event, data){
|
|||
|
||||
if (file.indexOf('.preset')==-1){file+='.preset'}
|
||||
fs.writeFile(file,data, function (err, data) {
|
||||
if (err) throw err;
|
||||
console.log("The current state was saved in "+file);
|
||||
});
|
||||
if (err) throw err
|
||||
console.log("The current state was saved in "+file)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
|
@ -249,9 +249,9 @@ ipc.on('load', function(event, data){
|
|||
writeConfig({presetPath:file[0].replace(file[0].split('/').pop(),'')})
|
||||
|
||||
fs.readFile(file[0],'utf-8', function read(err, data) {
|
||||
if (err) throw err;
|
||||
renderProcess.send('load',data);
|
||||
});
|
||||
if (err) throw err
|
||||
renderProcess.send('load',data)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue