-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7daa6f3
commit a1f5af8
Showing
9 changed files
with
121 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Engine } from '../core/models'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class HookService { | ||
constructor(private designer: Engine) {} | ||
|
||
useDesigner() { | ||
return this.designer; | ||
} | ||
|
||
useCursor() { | ||
return this.designer.cursor; | ||
} | ||
|
||
useWorkbench() { | ||
return this.designer.workbench; | ||
} | ||
|
||
useScreen() { | ||
return this.designer.screen; | ||
} | ||
|
||
useWorkspace(workspaceId?: string) { | ||
if (workspaceId) { | ||
return this.designer.workbench.findWorkspaceById(workspaceId); | ||
} else { | ||
return this.designer.workbench.currentWorkspace; | ||
} | ||
} | ||
|
||
useOperation(workspaceId?: string) { | ||
const workspace = this.useWorkspace(workspaceId); | ||
return workspace?.operation; | ||
} | ||
|
||
useSelection(workspaceId?: string) { | ||
const operation = this.useOperation(workspaceId); | ||
return operation?.selection; | ||
} | ||
|
||
useTree(workspaceId?: string) { | ||
const operation = this.useOperation(workspaceId); | ||
return operation?.tree; | ||
} | ||
|
||
useTransformHelper(workspaceId?: string) { | ||
const operation = this.useOperation(workspaceId); | ||
return operation?.transformHelper; | ||
} | ||
|
||
useMoveHelper(workspaceId?: string) { | ||
const operation = this.useOperation(workspaceId); | ||
return operation?.moveHelper; | ||
} | ||
|
||
useViewport(workspaceId?: string) { | ||
const workspace = this.useWorkspace(workspaceId); | ||
return workspace?.viewport; | ||
} | ||
|
||
useOutline(workspaceId?: string) { | ||
const workspace = this.useWorkspace(workspaceId); | ||
return workspace?.outline; | ||
} | ||
} |