initDefaultWidht() for various views
This commit is contained in:
parent
0cfd45d8a9
commit
3aa23db306
|
@ -15,7 +15,7 @@ function ButtonView(options) {
|
||||||
|
|
||||||
TextView.call(this, options);
|
TextView.call(this, options);
|
||||||
|
|
||||||
this.dimens.width = this.dimens.width || Math.min(10, this.client.term.termWidth - this.position.col);
|
this.initDefaultWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
util.inherits(ButtonView, TextView);
|
util.inherits(ButtonView, TextView);
|
||||||
|
|
|
@ -19,6 +19,8 @@ function EditTextView(options) {
|
||||||
|
|
||||||
TextView.call(this, options);
|
TextView.call(this, options);
|
||||||
|
|
||||||
|
this.initDefaultWidth();
|
||||||
|
|
||||||
this.cursorPos = { row : 0, col : 0 };
|
this.cursorPos = { row : 0, col : 0 };
|
||||||
|
|
||||||
this.clientBackspace = function() {
|
this.clientBackspace = function() {
|
||||||
|
|
|
@ -35,6 +35,8 @@ function MaskEditTextView(options) {
|
||||||
|
|
||||||
TextView.call(this, options);
|
TextView.call(this, options);
|
||||||
|
|
||||||
|
this.initDefaultWidth();
|
||||||
|
|
||||||
this.cursorPos = { x : 0 };
|
this.cursorPos = { x : 0 };
|
||||||
this.patternArrayPos = 0;
|
this.patternArrayPos = 0;
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,8 @@ function MultiLineEditTextView(options) {
|
||||||
|
|
||||||
View.call(this, options);
|
View.call(this, options);
|
||||||
|
|
||||||
|
this.initDefaultWidth();
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -17,6 +17,8 @@ function SpinnerMenuView(options) {
|
||||||
|
|
||||||
MenuView.call(this, options);
|
MenuView.call(this, options);
|
||||||
|
|
||||||
|
this.initDefaultWidth();
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -14,6 +14,8 @@ function ToggleMenuView (options) {
|
||||||
|
|
||||||
MenuView.call(this, options);
|
MenuView.call(this, options);
|
||||||
|
|
||||||
|
this.initDefaultWidth();
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -20,7 +20,7 @@ function VerticalMenuView(options) {
|
||||||
|
|
||||||
MenuView.call(this, options);
|
MenuView.call(this, options);
|
||||||
|
|
||||||
this.dimens.width = this.dimens.width || Math.min(15, this.client.term.termWidth - this.position.col);
|
this.initDefaultWidth();
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,10 @@ function View(options) {
|
||||||
//this.client.term.write(ansi.setCursorStyle(this.cursorStyle));
|
//this.client.term.write(ansi.setCursorStyle(this.cursorStyle));
|
||||||
this.client.term.rawWrite('show' === this.cursor ? ansi.showCursor() : ansi.hideCursor());
|
this.client.term.rawWrite('show' === this.cursor ? ansi.showCursor() : ansi.hideCursor());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.initDefaultWidth = function(width = 15) {
|
||||||
|
this.dimens.width = this.dimens.width || Math.min(width, this.client.term.termWidth - this.position.col);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
util.inherits(View, events.EventEmitter);
|
util.inherits(View, events.EventEmitter);
|
||||||
|
|
Loading…
Reference in New Issue