Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: show page props again
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Sep 10, 2018
1 parent 4cfc89b commit e0754ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/model/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export class Project {

@Mobx.observable private userStore: UserStore;

@Mobx.computed
private get activePage(): Page {
return this.pages.find(p => p.getActive()) || this.pages[0];
}

@Mobx.computed
private get patterns(): Pattern[] {
return this.getPatternLibraries().reduce((ps, lib) => [...ps, ...lib.getPatterns()], []);
Expand Down Expand Up @@ -498,6 +503,12 @@ export class Project {
return this.pages[previousIndex];
}

public getSelectedElement(): Element | undefined {
const selected = this.selectedElements[0];

return selected ? selected : this.activePage.getRoot();
}

public getUserStore(): UserStore {
return this.userStore;
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/view-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ export class ViewStore {
return;
}

return this.project.getElements().find(element => element.getSelected());
return this.project.getSelectedElement();
}

public getSender(): Sender {
Expand Down

0 comments on commit e0754ed

Please sign in to comment.