Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JirkaDellOro committed Sep 11, 2024
2 parents a9f3fd4 + 82db7da commit 80010d4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
23 changes: 12 additions & 11 deletions Distribution/FudgeUserInterface.js

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions Source/UserInterface/CustomElement/CustomTree/CustomTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ namespace FudgeUserInterface {
* Removes the branch of children from this item
*/
private removeBranch(): void {
let content: CustomTreeList<T> = this.getBranch();
if (!content)
let branch: CustomTreeList<T> = this.getBranch();
if (!branch)
return;
this.removeChild(content);
this.removeChild(branch);
}

private create(): void {
Expand Down Expand Up @@ -180,21 +180,23 @@ namespace FudgeUserInterface {

private hndKey = (_event: KeyboardEvent): void => {
_event.stopPropagation();
if (!this.#content.disabled)
return;

let content: CustomTreeList<T> = <CustomTreeList<T>>this.querySelector("ul");
if (!this.#content.disabled) {
if (_event.code == ƒ.KEYBOARD_CODE.ESC || _event.code == ƒ.KEYBOARD_CODE.ENTER)
this.focus();

return;
}

switch (_event.code) {
// TODO: repair arrow key navigation
case ƒ.KEYBOARD_CODE.ARROW_RIGHT:
if (this.hasChildren && !content)
if (this.hasChildren && !this.expanded)
this.expand(true);
else
this.dispatchEvent(new KeyboardEvent(EVENT.FOCUS_NEXT, { bubbles: true, shiftKey: _event.shiftKey, ctrlKey: _event.ctrlKey }));
break;
case ƒ.KEYBOARD_CODE.ARROW_LEFT:
if (content)
if (this.expanded)
this.expand(false);
else
this.dispatchEvent(new KeyboardEvent(EVENT.FOCUS_PREVIOUS, { bubbles: true, shiftKey: _event.shiftKey, ctrlKey: _event.ctrlKey }));
Expand All @@ -211,7 +213,7 @@ namespace FudgeUserInterface {
break;

this.#content.disabled = false;
element?.focus();
element.focus();
break;
case ƒ.KEYBOARD_CODE.SPACE:
this.select(_event.ctrlKey, _event.shiftKey);
Expand Down Expand Up @@ -284,7 +286,7 @@ namespace FudgeUserInterface {
this.controller.dragDrop.sources = this.controller.selection;
else
this.controller.dragDrop.sources = [this.data];
_event.dataTransfer.effectAllowed = "move";
_event.dataTransfer.effectAllowed = "all";
_event.dataTransfer.setDragImage(document.createElement("img"), 0, 0);
this.controller.dragDrop.target = null;

Expand Down

0 comments on commit 80010d4

Please sign in to comment.