Skip to content

Commit

Permalink
[Update] 适应大小
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuler committed May 24, 2018
1 parent fef9f16 commit af380b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
13 changes: 7 additions & 6 deletions src/app/elements/term/term.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
const elementPaddingHor = elementPadding.right + elementPadding.left;
const availableHeight = activeEle.height() - elementPaddingVer;
const availableWidth = activeEle.width() - elementPaddingHor - (<any>this.term).viewport.scrollBarWidth;
const geometry = (
Math.floor(availableWidth / (<any>this.term).renderer.dimensions.actualCellWidth),
Math.floor(availableHeight / (<any>this.term).renderer.dimensions.actualCellHeight)
);
const geometry = [
Math.floor(availableWidth / (<any>this.term).renderer.dimensions.actualCellWidth) - 1,
Math.floor(availableHeight / (<any>this.term).renderer.dimensions.actualCellHeight) - 1
];
return geometry;

// const cols = Math.floor((activeEle.width() - 15) / markerEle.width() * 6) - 1;
Expand All @@ -69,14 +69,15 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
}

resizeTerm() {
// fit(this.term);
const size = this.getWinSize();
console.log('get SIze', size);
if (isNaN(size[0]) || isNaN(size[1])) {
fit(this.term);
} else {
(<any>this.term).renderer.clear();
this.term.resize(size[0], size[1]);
this.winSizeChangeTrigger.emit([this.term.cols, this.term.rows]);
}
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);
}
Expand Down
8 changes: 5 additions & 3 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,18 @@ app-root {

body ::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.3);
background-color: #676a6c;
background-color: #272323;
border-radius: 6px;
}

body ::-webkit-scrollbar {
width: 8px;
height: 8px;
height:8px;
}

body ::-webkit-scrollbar-thumb {
background-color: #F5F5F5;
background-color: #494141;
border-radius: 6px;
}

.ztree * {
Expand Down

0 comments on commit af380b1

Please sign in to comment.