mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-25 12:08:21 +02:00
* Add rumorz mod
* ANSI/pipe working properly in VerticalMenuView * Fix bug in renderStringLength() * Make initSequence() part of prototype chain for inheritance * Use proper 'desc' field vs 'status' for menus when setting client/user status * Move pipeToAnsi() to setItems/setFocusItems vs every render * Add %RR random rumor MCI * Predefined MCI's can be init @ startup - RR uses random as a test bed * Add some StatLog functionality for ordering, keep forever, etc. * Fix TextView redraw issue * Better VerticalMenuView drawItem() logic * Add 'key press' emit for View * Enable formats for BBS list - works with MCI * Remove old system_property.js
This commit is contained in:
parent
2b68201f7d
commit
30ba609fb4
13 changed files with 492 additions and 241 deletions
|
@ -15,7 +15,7 @@ exports.VerticalMenuView = VerticalMenuView;
|
|||
function VerticalMenuView(options) {
|
||||
options.cursor = options.cursor || 'hide';
|
||||
options.justify = options.justify || 'right'; // :TODO: default to center
|
||||
|
||||
|
||||
MenuView.call(this, options);
|
||||
|
||||
const self = this;
|
||||
|
@ -48,60 +48,33 @@ function VerticalMenuView(options) {
|
|||
};
|
||||
};
|
||||
|
||||
/*
|
||||
this.drawItem = function(index) {
|
||||
var item = self.items[index];
|
||||
if(!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
var text = strUtil.stylizeString(item.text, item.focused ? self.focusTextStyle : self.textStyle);
|
||||
self.client.term.write(
|
||||
ansi.goto(item.row, self.position.col) +
|
||||
(index === self.focusedItemIndex ? self.getFocusSGR() : self.getSGR()) +
|
||||
strUtil.pad(text, this.dimens.width, this.fillChar, this.justify)
|
||||
);
|
||||
};
|
||||
*/
|
||||
|
||||
this.drawItem = function(index) {
|
||||
const item = self.items[index];
|
||||
|
||||
if(!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
let focusItem;
|
||||
let text;
|
||||
|
||||
if(self.hasFocusItems()) {
|
||||
focusItem = self.focusItems[index];
|
||||
}
|
||||
|
||||
if(focusItem) {
|
||||
if(item.focused) {
|
||||
text = strUtil.stylizeString(focusItem.text, self.focusTextStyle);
|
||||
} else {
|
||||
text = strUtil.stylizeString(item.text, self.textStyle);
|
||||
}
|
||||
|
||||
// :TODO: Need to support pad()
|
||||
// :TODO: shoudl we detect if pipe codes are used?
|
||||
self.client.term.write(
|
||||
ansi.goto(item.row, self.position.col) +
|
||||
colorCodes.pipeToAnsi(text, self.client)
|
||||
);
|
||||
|
||||
let sgr;
|
||||
if(item.focused && self.hasFocusItems()) {
|
||||
const focusItem = self.focusItems[index];
|
||||
text = strUtil.stylizeString(
|
||||
focusItem ? focusItem.text : item.text,
|
||||
self.textStyle
|
||||
);
|
||||
sgr = '';
|
||||
} else {
|
||||
text = strUtil.stylizeString(item.text, item.focused ? self.focusTextStyle : self.textStyle);
|
||||
|
||||
self.client.term.write(
|
||||
ansi.goto(item.row, self.position.col) +
|
||||
(index === self.focusedItemIndex ? self.getFocusSGR() : self.getSGR()) +
|
||||
strUtil.pad(text, this.dimens.width, this.fillChar, this.justify)
|
||||
);
|
||||
text = strUtil.stylizeString(item.text, self.textStyle);
|
||||
sgr = (index === self.focusedItemIndex ? self.getFocusSGR() : self.getSGR());
|
||||
}
|
||||
|
||||
text += self.getSGR();
|
||||
|
||||
self.client.term.write(
|
||||
ansi.goto(item.row, self.position.col) +
|
||||
sgr +
|
||||
strUtil.pad(text, this.dimens.width, this.fillChar, this.justify)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -174,7 +147,7 @@ VerticalMenuView.prototype.setFocusItemIndex = function(index) {
|
|||
this.positionCacheExpired = false; // skip standard behavior
|
||||
this.performAutoScale();
|
||||
}
|
||||
|
||||
|
||||
this.redraw();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue