mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
feature(terminal) add Size
This commit is contained in:
parent
08bfe66a26
commit
8c4fe43aeb
1 changed files with 23 additions and 8 deletions
|
|
@ -16,6 +16,11 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal;
|
|||
Images = DOM.Images,
|
||||
Notify = DOM.Notify,
|
||||
|
||||
Size = {
|
||||
cols: 0,
|
||||
rows: 0
|
||||
},
|
||||
|
||||
CHANNEL = CloudFunc.CHANNEL_TERMINAL,
|
||||
CHANNEL_RESIZE = CloudFunc.CHANNEL_TERMINAL_RESIZE,
|
||||
|
||||
|
|
@ -43,7 +48,11 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal;
|
|||
CloudTerm.write = write;
|
||||
|
||||
function show(callback) {
|
||||
var socket = CloudCmd.Socket;
|
||||
var options = {
|
||||
onUpdate: onResize,
|
||||
},
|
||||
|
||||
socket = CloudCmd.Socket;
|
||||
|
||||
if (!Loading) {
|
||||
Images.showLoad({top:true});
|
||||
|
|
@ -91,13 +100,7 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal;
|
|||
Terminal.brokenBold = true;
|
||||
|
||||
Util.exec(callback);
|
||||
}, {
|
||||
onUpdate: function() {
|
||||
var size = getSize();
|
||||
Term.resize(size.cols, size.rows);
|
||||
Term.emit('resize', size);
|
||||
}
|
||||
});
|
||||
}, options);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,6 +145,18 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal;
|
|||
return size;
|
||||
}
|
||||
|
||||
function onResize() {
|
||||
var size = getSize(),
|
||||
cols = size.cols,
|
||||
rows = size.rows;
|
||||
|
||||
if (Size.cols !== cols || Size.rows !== rows) {
|
||||
Size = size;
|
||||
|
||||
Term.resize(size.cols, size.rows);
|
||||
Term.emit('resize', size);
|
||||
}
|
||||
}
|
||||
|
||||
function load(pCallBack) {
|
||||
var dir = CloudCmd.LIBDIRCLIENT + 'terminal/',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue