lobby: make it smooth too
This commit is contained in:
parent
0322092504
commit
bddf5f8fa7
2 changed files with 22 additions and 9 deletions
|
|
@ -60,14 +60,16 @@ module.exports = {
|
|||
|
||||
sessionList: function(event,data){
|
||||
var data = data || event
|
||||
$('#lobby').append(`
|
||||
var lobby = $(`
|
||||
<div class="main">
|
||||
<div class="header">
|
||||
Open Stage Control
|
||||
</div>
|
||||
<div class="list"></div>
|
||||
<div class="footer"></div>
|
||||
</div>`)
|
||||
</div>`),
|
||||
list = lobby.find('.list'),
|
||||
footer = lobby.find('.footer')
|
||||
|
||||
for (i in data) {
|
||||
var max = 50
|
||||
|
|
@ -79,27 +81,31 @@ module.exports = {
|
|||
path = path.substr(0,Math.floor((path.length)/2)-(length-max)/2) + '...' + path.substr(Math.ceil((path.length)/2)+(length-max)/2, path.length)
|
||||
}
|
||||
|
||||
$('#lobby .list').append('<a class="btn load" data-session="'+data[i]+'">'+file+' <em style="opacity:0.45">('+path+')</em><span>'+icon('remove')+'</span></a>')
|
||||
list.append('<a class="btn load" data-session="'+data[i]+'">'+file+' <em style="opacity:0.45">('+path+')</em><span>'+icon('remove')+'</span></a>')
|
||||
}
|
||||
$('#lobby .footer').append('<a class="btn browse">'+icon('folder-open')+' Browse</a>')
|
||||
$('#lobby .footer').append('<a class="btn new">'+icon('file-o')+' New</a>')
|
||||
$('#lobby .load').click(function(e){
|
||||
footer.append('<a class="btn browse">'+icon('folder-open')+' Browse</a>')
|
||||
footer.append('<a class="btn new">'+icon('file-o')+' New</a>')
|
||||
lobby.find('.load').click(function(e){
|
||||
e.stopPropagation()
|
||||
IPC.send('sessionOpen',{path:$(this).data('session')})
|
||||
})
|
||||
$('#lobby a span').click(function(e){
|
||||
lobby.find('a span').click(function(e){
|
||||
e.stopPropagation()
|
||||
IPC.send('sessionRemoveFromHistory',$(this).parent().data('session'))
|
||||
$(this).parents('a').remove()
|
||||
})
|
||||
$('#lobby .browse').click(function(e){
|
||||
lobby.find('.browse').click(function(e){
|
||||
e.stopPropagation()
|
||||
actions.sessionBrowse()
|
||||
})
|
||||
$('#lobby .new').click(function(e){
|
||||
lobby.find('.new').click(function(e){
|
||||
e.stopPropagation()
|
||||
init([{}],function(){$('#open-toggle, .enable-editor').click();$('.editor-root').trigger('mousedown.editor')})
|
||||
})
|
||||
$('#lobby').append(lobby)
|
||||
setTimeout(()=>{
|
||||
lobby.addClass('loaded')
|
||||
})
|
||||
},
|
||||
|
||||
sessionOpen: function(event,data){
|
||||
|
|
|
|||
|
|
@ -103,12 +103,19 @@ i {
|
|||
justify-content: center;
|
||||
overflow-y: auto;
|
||||
padding:20rem;
|
||||
|
||||
.main {
|
||||
width:600rem;
|
||||
max-width: 100%;
|
||||
max-height:100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
opacity: 0;
|
||||
transition: opacity .25s;
|
||||
&.loaded {
|
||||
opacity: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
.list {
|
||||
flex:1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue