Some phat update :

- Layout gutters removed
- widgets options separators in editor
- css style option for all widgets
- dragging helper for widget positionning
- restored 'unit' option for fader/knob
- pretty indentation for session exports
This commit is contained in:
jean-emmanuel 2016-02-15 10:49:12 +01:00
parent 991b2fef2f
commit 6fe2df4091
7 changed files with 159 additions and 36 deletions

View file

@ -75,15 +75,24 @@ enableEditor = function(){
$(this).draggable({
stop: function( event, ui ) {
data.top = ui.helper.position().top// - $(this).parent().position().top
data.left = ui.helper.position().left// - $(this).parent().position().left
event.preventDefault()
data.top = ui.helper.position().top + $(this).parent().scrollTop()
data.left = ui.helper.position().left + $(this).parent().scrollLeft()
ui.helper.remove()
updateWidget()
},
handle:'.ui-draggable-handle',
containment:'parent'
snap:'.widget, .tab',
snapTolerance:5,
helper:function(){return $('<div class="ui-helper"></div>').css({height:$(this).outerHeight(),width:$(this).outerWidth()})}
// containment:'parent'
}).append('<div class="ui-draggable-handle"></div>')
for (i in data) {
for (i in widgetOptions[data.type]) {
if (i.indexOf('separator')!=-1) {
$(`<div class="separator"><span>${widgetOptions[data.type][i]}</span></div>`).appendTo(form)
continue
}
if (i!='widgets' && i!='tabs') {
var type = typeof data[i],
d = type == 'object'?JSON.stringify(data[i]):data[i],
@ -168,7 +177,7 @@ enableEditor = function(){
}
if (!data.widgets || data.widgets.length==0) {
if (data.tabs && (!data.widgets || data.widgets.length==0)) {
//tabs
var list = $('<ul class="input"></ul>')

View file

@ -84,6 +84,11 @@ init = function(session,callback) {
$(`<a id="open-toggle">${icon('navicon')}</a>`).appendTo('#container').click(function(){
$('#open-toggle, #sidepanel, #container').toggleClass('sidepanel-open')
})
// in case where are hot loading a session
if ($('#sidepanel').hasClass('sidepanel-open')) {
$('#open-toggle, #container').addClass('sidepanel-open')
}
}
sidepanel()

View file

@ -81,7 +81,7 @@ parsewidgets = function(widgets,parent) {
var tmpWidgetOptions = JSON.parse(JSON.stringify(widgetOptions))
for (i in tmpWidgetOptions[widgetData.type]) {
if (widgetData[i]===undefined) widgetData[i] = tmpWidgetOptions[widgetData.type][i]
if (i.indexOf('separator')==-1 && widgetData[i]===undefined) widgetData[i] = tmpWidgetOptions[widgetData.type][i]
}
widgetData.id = widgetData.id=='auto'?widgetData.type+'_'+getIterator(widgetData.type):widgetData.id.replace(' ','_')
@ -96,11 +96,8 @@ parsewidgets = function(widgets,parent) {
// Sort widgets' properties and turn string-numbers to numbers
for (k in widgetOptions[widgetData.type]) {
var tmp = widgetData[k]
if (parseFloat(tmp)==tmp) tmp=parseFloat(tmp)
if (parseInt(tmp)==tmp) tmp=parseInt(tmp)
delete widgetData[k]
widgetData[k] = tmp
if (parseFloat(widgetOptions[widgetData.type])==widgetOptions[widgetData.type]) widgetOptions[widgetData.type]=parseFloat(widgetOptions[widgetData.type])
if (parseInt(widgetOptions[widgetData.type])==widgetOptions[widgetData.type]) widgetOptions[widgetData.type]=parseInt(widgetOptions[widgetData.type])
}
@ -121,7 +118,7 @@ parsewidgets = function(widgets,parent) {
var widgetContainer = $(`
<div class="widget ${widgetData.type}-container ${styleL.length || styleT.length?'absolute-position':''}" style="${styleW + styleH + styleL + styleT}">
<div class="widget ${widgetData.type}-container ${styleL.length || styleT.length?'absolute-position':''}" style="${styleW + styleH + styleL + styleT + widgetData.css}">
<div class="label"><span>${widgetData.label}</span></div>
</div>
`)

View file

@ -104,7 +104,7 @@ sessionBrowse = function(){
}
sessionSave = function() {
var sessionfile = JSON.stringify(session)
var sessionfile = JSON.stringify(session,null,' ')
if (webFrame) {
ipc.send('sessionSave',sessionfile)
} else {

View file

@ -3,46 +3,74 @@ widgetOptions = {
strip: {
type:'strip',
id:'auto',
separator1:'style',
label:'auto',
horizontal:false,
left:'auto',
top:'auto',
width:'auto',
height:'auto',
horizontal:false,
css:'',
separator2:'children',
widgets:[]
},
panel: {
type:'panel',
id:'auto',
separator1:'style',
label:'auto',
left:'0',
top:'0',
width:'auto',
height:'auto',
stretch:false,
css:'',
separator2:'chilren',
widgets:[],
tabs:[]
},
led: {
type:'led',
id:'auto',
separator1:'style',
label:'auto',
color:'green',
left:'auto',
top:'auto',
width:'auto',
height:'auto',
color:'green',
css:'',
separator2:'osc',
range:{min:0,max:1},
path:'auto'
},
toggle: {
type:'toggle',
id:'auto',
separator1:'style',
label:'auto',
left:'auto',
top:'auto',
width:'auto',
height:'auto',
css:'',
separator2:'osc',
off:0,
on:1,
path:'auto',
@ -51,11 +79,18 @@ widgetOptions = {
push: {
type:'push',
id:'auto',
separator1:'style',
label:'auto',
left:'auto',
top:'auto',
width:'auto',
height:'auto',
css:'',
separator2:'osc',
off:0,
on:1,
path:'auto',
@ -64,12 +99,19 @@ widgetOptions = {
switch: {
type:'switch',
id:'auto',
separator1:'style',
label:'auto',
left:'auto',
top:'auto',
width:'auto',
height:'auto',
horizontal:false,
css:'',
separator2:'osc',
values:[0,1],
path:'auto',
target:[]
@ -77,56 +119,99 @@ widgetOptions = {
xy: {
type:'xy',
id:'auto',
separator1:'style',
label:'auto',
left:'auto',
top:'auto',
width:'auto',
height:'auto',
css:'',
separator2:'behaviour',
absolute:false,
separator3:'osc',
split:false,
rangeX:{min:0,max:1},
rangeY:{min:0,max:1},
absolute:false,
path:'auto',
target:[]
},
rgb: {
type:'rgb',
id:'auto',
separator1:'style',
label:'auto',
left:'auto',
top:'auto',
width:'auto',
height:'auto',
split:false,
css:'',
separator2:'behaviour',
absolute:false,
separator3:'osc',
split:false,
path:'auto',
target:[]
},
fader: {
type:'fader',
id:'auto',
separator1:'style',
label:'auto',
unit:'',
left:'auto',
top:'auto',
width:'auto',
height:'auto',
horizontal:false,
range:{min:0,max:1},
css:'',
separator2:'behaviour',
absolute:false,
separator3:'osc',
range:{min:0,max:1},
path:'auto',
target:[]
},
knob: {
type:'knob',
id:'auto',
separator1:'style',
label:'auto',
unit:'',
left:'auto',
top:'auto',
width:'auto',
height:'auto',
range:{min:0,max:1},
css:'',
separator2:'behaviour',
absolute:false,
pan:false,
separator3:'osc',
range:{min:0,max:1},
path:'auto',
target:[]
}