From bef63acfad7a793f9bd72cb3985c57b60bf58b77 Mon Sep 17 00:00:00 2001 From: Florrie Date: Wed, 4 Jul 2018 22:51:43 -0300 Subject: focused -> selected --- ui.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'ui.js') 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) } -- cgit 1.3.0-6-gf8a5