keep current state on layout edition
This commit is contained in:
parent
b742583f5c
commit
782c49db8a
3 changed files with 22 additions and 7 deletions
|
|
@ -14,7 +14,7 @@ ipc.on('receiveOsc',function(data){
|
|||
})
|
||||
|
||||
ipc.on('stateLoad',function(preset){
|
||||
stateSet(preset)
|
||||
stateSet(preset,true)
|
||||
stateQuickSave(preset)
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,13 @@ enableEditor = function(){
|
|||
container.addClass('editing')
|
||||
|
||||
var updateWidget = function(){
|
||||
|
||||
var state = stateGet()
|
||||
|
||||
var newContainer = parsewidgets([data],parent)
|
||||
|
||||
stateSet(state,false)
|
||||
|
||||
container.remove()
|
||||
|
||||
if (index == parent.children().length-1) {
|
||||
|
|
@ -54,6 +59,7 @@ enableEditor = function(){
|
|||
|
||||
newContainer.children().first().click()
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (i in data) {
|
||||
|
|
@ -142,18 +148,25 @@ enableEditor = function(){
|
|||
|
||||
var updateTab = function() {
|
||||
|
||||
var state = stateGet()
|
||||
|
||||
container.empty()
|
||||
parsewidgets(data.widgets,container)
|
||||
|
||||
stateSet(state,false)
|
||||
|
||||
enableEditor()
|
||||
sync()
|
||||
|
||||
link.click()
|
||||
|
||||
}
|
||||
|
||||
var updateSession = function(){
|
||||
var state = stateGet()
|
||||
|
||||
init(session,function(){
|
||||
stateSet(state,false)
|
||||
enableEditor()
|
||||
for (i in ontab) {
|
||||
$(`a[data-tab="#${ontab[i]}"]`).click()
|
||||
|
|
@ -185,7 +198,7 @@ enableEditor = function(){
|
|||
|
||||
for (i in data.widgets) {
|
||||
var label = data.widgets[i].label!='auto'&&data.widgets[i].label!=false?data.widgets[i].label:data.widgets[i].id
|
||||
var item = $(`<li data-index="${i}" class="sortables" data-id="${data.widgets[i].id}"><a class="btn small">${label}</a></li>`)
|
||||
var item = $(`<li data-index="${i}" class="sortables"><a class="btn small">${label}</a></li>`)
|
||||
.appendTo(list)
|
||||
.click(function(){
|
||||
container.find('.widget').first().parent().children('.widget').eq($(this).attr('data-index')).click()
|
||||
|
|
@ -281,8 +294,10 @@ enableEditor = function(){
|
|||
|
||||
|
||||
var updateSession = function(){
|
||||
var state = stateGet()
|
||||
|
||||
init(session,function(){
|
||||
stateSet(state,false)
|
||||
enableEditor()
|
||||
for (i in ontab) {
|
||||
$(`a[data-tab="#${ontab[i]}"]`).click()
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ stateQuickSave = function(preset){
|
|||
$('[data-action="stateQuickLoad"]').removeClass('disabled')
|
||||
}
|
||||
stateQuickLoad = function(){
|
||||
stateSet(state)
|
||||
stateSet(state,true)
|
||||
}
|
||||
stateSave = function() {
|
||||
state = stateGet()
|
||||
|
|
@ -45,7 +45,7 @@ stateLoad = function() {
|
|||
var reader = new FileReader();
|
||||
reader.onloadend = function(e) {
|
||||
var preset = e.target.result
|
||||
stateSet(preset)
|
||||
stateSet(preset,true)
|
||||
laststate = preset
|
||||
}
|
||||
reader.readAsText(e.target.files[0],'utf-8');
|
||||
|
|
@ -55,17 +55,17 @@ stateLoad = function() {
|
|||
|
||||
stateSend = function(){
|
||||
var data = stateGet()
|
||||
stateSet(data)
|
||||
stateSet(data,true)
|
||||
|
||||
}
|
||||
stateSet = function(preset){
|
||||
stateSet = function(preset,send){
|
||||
|
||||
$.each(preset.split('\n'),function(i,d) {
|
||||
var data = d.split(' ')
|
||||
|
||||
setTimeout(function(){
|
||||
if (__widgets__[data[0]]!=undefined) {
|
||||
__widgets__[data[0]][0].setValue(data[1].split(','),true,true)
|
||||
__widgets__[data[0]][0].setValue(data[1].split(','),send,true)
|
||||
}
|
||||
},i)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue