diff options
author | Florrie <towerofnix@gmail.com> | 2018-07-04 22:51:43 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-07-04 22:51:43 -0300 |
commit | bef63acfad7a793f9bd72cb3985c57b60bf58b77 (patch) | |
tree | 1fe1a0625f696025dc847d48ffe5be601691cc6d /ui.js | |
parent | cff36a8b518ab04e8c516ec7002d4d541742a16c (diff) |
focused -> selected
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/ui.js b/ui.js index 8d912a2..4ad09e9 100644 --- a/ui.js +++ b/ui.js @@ -109,6 +109,10 @@ class AppElement extends FocusElement { this.setupDialog(this.alertDialog) } + selected() { + this.root.select(this.form) + } + async handlePlaylistSource(source) { this.openPlaylistDialog.close() this.alertDialog.showMessage('Opening playlist...', false) @@ -547,7 +551,7 @@ class GrouplikeListingElement extends FocusElement { this.pathElement.w = this.contentW } - focused() { + selected() { this.root.select(this.form) } @@ -555,10 +559,6 @@ class GrouplikeListingElement extends FocusElement { return this.form.selectable } - get isSelected() { - return this.form.isSelected - } - keyPressed(keyBuf) { if (telc.isBackspace(keyBuf)) { this.loadParentGrouplike() @@ -669,11 +669,8 @@ class GrouplikeListingForm extends ListScrollForm { return Math.min(this.inputs.length, 1) } - get isSelected() { - return this.root.selected && this.root.selected.directAncestors.includes(this) - } - selectAndShow(item) { + // TODO: Make sure this is still working. const index = this.inputs.findIndex(inp => inp.item === item) if (index >= 0) { this.curIndex = index @@ -699,7 +696,7 @@ class GrouplikeItemElement extends Button { } drawTo(writable) { - if (this.isFocused) { + if (this.isSelected) { writable.write(ansi.invert()) } @@ -809,7 +806,7 @@ class PathItemElement extends FocusElement { this.addChild(this.arrowLabel) } - focused() { + selected() { this.root.select(this.button) } @@ -957,7 +954,7 @@ class OpenPlaylistDialog extends Dialog { this.button.y = 1 } - focused() { + selected() { this.root.select(this.form) } } @@ -978,7 +975,7 @@ class AlertDialog extends Dialog { this.pane.addChild(this.button) } - focused() { + selected() { this.root.select(this.button) } |