Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
luna
Commits
c8b8a4b3
Commit
c8b8a4b3
authored
May 23, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复窗口大小的
parent
6d8c33da
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
term.component.ts
src/app/elements/term/term.component.ts
+18
-3
control.component.html
src/app/pages/control/control/control.component.html
+1
-1
index.html
src/index.html
+1
-1
No files found.
src/app/elements/term/term.component.ts
View file @
c8b8a4b3
...
...
@@ -3,7 +3,8 @@ import {ElementRef} from '@angular/core';
import
{
Terminal
}
from
'xterm'
;
import
{
fit
}
from
'xterm/lib/addons/fit/fit'
;
import
{
Observable
}
from
'rxjs/Rx'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
import
*
as
$
from
'jquery/dist/jquery.min.js'
;
import
'rxjs/Observable'
;
import
'rxjs/add/operator/debounceTime'
;
import
'rxjs/add/operator/distinctUntilChanged'
;
...
...
@@ -43,9 +44,23 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
this
.
resizeTerm
();
}
getWinSize
()
{
const
activeEle
=
$
(
'#winContainer'
);
const
markerEle
=
$
(
'#marker'
);
const
cols
=
parseInt
(
activeEle
.
width
()
/
markerEle
.
width
()
*
6
,
10
)
-
6
;
const
rows
=
parseInt
(
activeEle
.
height
()
/
markerEle
.
height
(),
10
)
-
1
;
return
[
cols
,
rows
];
}
resizeTerm
()
{
fit
(
this
.
term
);
this
.
winSizeChangeTrigger
.
emit
([
this
.
term
.
cols
,
this
.
term
.
rows
]);
// fit(this.term);
const
size
=
this
.
getWinSize
();
if
(
isNaN
(
size
[
0
]))
{
fit
(
this
.
term
);
}
else
{
this
.
term
.
resize
(
size
[
0
],
size
[
1
]);
this
.
winSizeChangeTrigger
.
emit
([
this
.
term
.
cols
,
this
.
term
.
rows
]);
}
this
.
_cookie
.
set
(
'cols'
,
this
.
term
.
cols
.
toString
(),
0
,
'/'
,
document
.
domain
);
this
.
_cookie
.
set
(
'rows'
,
this
.
term
.
rows
.
toString
(),
0
,
'/'
,
document
.
domain
);
}
...
...
src/app/pages/control/control/control.component.html
View file @
c8b8a4b3
...
...
@@ -2,7 +2,7 @@
<div
fxFlex=
"0 0 30px"
class=
"search"
>
<pages-control-nav></pages-control-nav>
</div>
<div
fxFlex=
"0 0 calc(100%-35px)"
>
<div
fxFlex=
"0 0 calc(100%-35px)"
id=
"winContainer"
>
<div
class=
"window"
*
ngFor=
"let m of NavList.List;let i=index"
[
ngClass
]="{'
active
'
:i=
=NavList.Active}"
style=
"height: 100%"
>
<elements-ssh-term
[
index
]="
i
"
...
...
src/index.html
View file @
c8b8a4b3
...
...
@@ -10,7 +10,7 @@
</head>
<body>
<app-root></app-root>
<span
id=
"marker"
style=
"display: none"
>
marker
</span>
<span
id=
"marker"
style=
"display: none
;font-size: 14px
"
>
marker
</span>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment