Skip to content

Commit

Permalink
select parent
Browse files Browse the repository at this point in the history
  • Loading branch information
kleber-swf committed Dec 14, 2021
1 parent 9d866bc commit 348f00e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ export class Actions {
public static readonly TOGGLE_LEFT_PANEL = 'TOGGLE_LEFT_PANEL';
public static readonly TOGGLE_RIGHT_PANEL = 'TOGGLE_RIGHT_PANEL';
public static readonly HELP = 'HELP';
public static readonly SELECT_PARENT = 'SELECT_PARENT';
}
7 changes: 7 additions & 0 deletions src/core/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,13 @@ class EditorClass {
tooltip: 'Help',
icon: 'fa-question',
category: 'general',
},

{
id: Actions.SELECT_PARENT,
tooltip: 'Select parent',
icon: 'fa-level-up-alt',
category: 'object-tree',
}
);

Expand Down
4 changes: 4 additions & 0 deletions src/data/editor-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,9 @@ export class EditorData {
actions.setActionCommand(Actions.PRINT_OBJECT, () => {
if (this._selectedObject) console.info(this._selectedObject);
});

actions.setActionCommand(Actions.SELECT_PARENT, () => {
if (this.selectedObject) this.selectObject(this.selectedObject.parent, DataOrigin.ACTION);
});
}
}
5 changes: 5 additions & 0 deletions src/editor-view/inspector/inspector.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
flex-direction: row;
align-items: center;
justify-content: flex-start;
text-transform: none;

.title {
text-transform: uppercase;
}

.actions {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Actions } from 'core/actions';
import { Editor } from 'core/editor';
import { DataOrigin } from 'data/editor-data';
import { Inspector } from 'editor-view/inspector/inspector';
Expand All @@ -22,6 +23,8 @@ export class ObjectTreeInspector extends Inspector {
el.onClear = this.onFilterClear.bind(this);

Editor.data.onPropertyChanged.add(this.onPropertyChanged, this);

this.addAction(Editor.actions.getAction(Actions.SELECT_PARENT), 'right');
}

public enable(config: PluginConfig) { this.setRoot(config.root); }
Expand Down

0 comments on commit 348f00e

Please sign in to comment.