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

File diff suppressed because one or more lines are too long

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:[]
}

View file

@ -313,7 +313,7 @@ a.btn {
}
}
}
span {
> .btn + span {
position: absolute;
right:0rem;
top:0rem;
@ -589,6 +589,28 @@ a {
.submit {
margin-top:30rem;
}
.separator {
line-height: 30rem;
height: 30rem;
margin-bottom: 5rem;
position: relative;
display: flex;
align-items: center;
&:before, &:after {
content:"";
top:14rem;
width: 100%;
height: 1rem;
background: $color-text-fade;
}
span {
font-variant: small-caps;
position: relative;
display: block;
width:100%;
text-align:center;
}
}
}
@ -612,10 +634,10 @@ a {
display:none;
overflow: auto;
position: relative;
padding-top:$gutter;
padding-left:$gutter;
// padding-top:$gutter;
// padding-left:$gutter;
> .widget {
margin-right:$gutter;
// margin-right:$gutter;
}
&.on {
display: block;
@ -629,7 +651,10 @@ a {
// WIDGETS
.widget {
border-bottom:$gutter solid transparent;
// border:$gutter solid transparent;
// &:not(:first-child) {
// margin-left:-$gutter;
// }
display:inline-block;
height:auto;
min-width: 100rem;
@ -692,6 +717,7 @@ a {
right: 5rem;
width:15rem;
height:15rem;
border:2rem solid transparent;
border-right: 2rem solid $color-accent;
border-bottom: 2rem solid $color-accent;
z-index: 100000;
@ -699,6 +725,7 @@ a {
}
.ui-helper {
border: 1rem dashed $color-accent;
background: rgba($color-accent,.25);
min-width:30rem!important;
min-height:30rem!important;
z-index: 99999999999!important;
@ -749,29 +776,29 @@ a {
}
}
&.vertical {
padding-top: 35rem + $gutter;
border-bottom:0;
padding-top: 35rem;// + $gutter;
// border-bottom:0;
.strip {
> .widget {
border-bottom:$gutter solid transparent;
// border-bottom:$gutter solid transparent;
}
}
}
&.horizontal {
padding-top:0;
padding-left: 35rem + $gutter;
padding-left: 35rem;// + $gutter;
width:100%;
height:auto;
display: block;
border-right:0;
// border-right:0;
.strip {
flex-direction: row;
> .widget {
flex-shrink: initial;
width: 100%;
border-bottom:0;
border-right:$gutter solid transparent;
// border-bottom:0;
// border-right:$gutter solid transparent;
}
}
> .label {
@ -799,7 +826,7 @@ a {
.panel-container {
position: absolute;
border:$gutter solid transparent;
// border:$gutter solid transparent;
z-index: 2;
::-webkit-scrollbar-thumb, ::-webkit-scrollbar-track-piece {
@ -809,10 +836,10 @@ a {
height:100%;
overflow: auto;
position: relative;
padding-top:$gutter;
padding-left:$gutter;
// padding-top:$gutter;
// padding-left:$gutter;
> .widget {
margin-right:$gutter;
// margin-right:$gutter;
}
&.stretch {
display:flex;