mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-15 04:45:06 +01:00
save last used workbench
This commit is contained in:
parent
1c8f420522
commit
835c5f7157
1 changed files with 12 additions and 3 deletions
|
|
@ -57,16 +57,25 @@ export class WorkbenchService {
|
|||
);
|
||||
}
|
||||
|
||||
switchWorkbench(workbenchId: string) {
|
||||
switchWorkbench(workbenchId: string, silent: boolean = false) {
|
||||
const workbenchConfig = this.workbenches$.value[workbenchId];
|
||||
if (!workbenchConfig) {
|
||||
throw 'nonexistent workbench ' + workbenchId;
|
||||
const noWorkbenchMsg = 'nonexistent workbench ' + workbenchId;
|
||||
if (silent) {
|
||||
console.warn(noWorkbenchMsg);
|
||||
} else {
|
||||
throw noWorkbenchMsg;
|
||||
}
|
||||
}
|
||||
this.currentWorkbench$.next(workbenchConfig);
|
||||
}
|
||||
|
||||
switchToDefaultWorkbench() {
|
||||
this.switchWorkbench('modeler');
|
||||
this.switchWorkbench(this.defaultWorkbenchId);
|
||||
}
|
||||
|
||||
get defaultWorkbenchId() {
|
||||
return 'modeler';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue