diff options
Diffstat (limited to 'src/content/controllers/MarkKeyController.ts')
-rw-r--r-- | src/content/controllers/MarkKeyController.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/content/controllers/MarkKeyController.ts b/src/content/controllers/MarkKeyController.ts new file mode 100644 index 0000000..395dee3 --- /dev/null +++ b/src/content/controllers/MarkKeyController.ts @@ -0,0 +1,31 @@ +import MarkUseCase from '../usecases/MarkUseCase'; +import MarkKeyyUseCase from '../usecases/MarkKeyUseCase'; +import Key from '../domains/Key'; + +export default class MarkKeyController { + private markUseCase: MarkUseCase; + + private markKeyUseCase: MarkKeyyUseCase; + + constructor({ + markUseCase = new MarkUseCase(), + markKeyUseCase = new MarkKeyyUseCase(), + } = {}) { + this.markUseCase = markUseCase; + this.markKeyUseCase = markKeyUseCase; + } + + press(key: Key): boolean { + if (this.markKeyUseCase.isSetMode()) { + this.markUseCase.set(key.key); + this.markKeyUseCase.disableSetMode(); + return true; + } + if (this.markKeyUseCase.isJumpMode()) { + this.markUseCase.jump(key.key); + this.markKeyUseCase.disableJumpMode(); + return true; + } + return false; + } +} |