Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reset zoom to 1 with "r" shortcut #53

Merged
merged 3 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ After running for the first time you can access the app settings through the tra
<td>o</td>
<td>Toggle rounded camera (window must be focused)</td>
</tr>
<tr>
<td>r</td>
<td>Reset zoom (window must be focused)</td>
</tr>
<tr>
<td>Arrow Up / Down / Left / Right</td>
<td>Adjust video offset (window must be focused)</td>
Expand Down Expand Up @@ -106,9 +110,9 @@ After running for the first time you can access the app settings through the tra

👤 **Mayk Brito**

* Twitter: [@maykbrito](https://twitter.com/maykbrito)
* Github: [@maykbrito](https://github.com/maykbrito)
* LinkedIn: [@maykbrito](https://linkedin.com/in/maykbrito)
- Twitter: [@maykbrito](https://twitter.com/maykbrito)
- Github: [@maykbrito](https://github.com/maykbrito)
- LinkedIn: [@maykbrito](https://linkedin.com/in/maykbrito)

## Show your support

Expand Down
6 changes: 5 additions & 1 deletion src/cam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export class CameraController {
this.position.x += 1
break
}

this.render()
}

Expand All @@ -65,6 +64,11 @@ export class CameraController {
this.render()
}

public reset() {
this.position.z = 1
this.render()
}

public round() {
this.isRounded = !this.isRounded

Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ const controls = {
ArrowRight: () => cameraController.adjustOffset('right'),
ArrowUp: () => cameraController.adjustOffset('up'),
ArrowDown: () => cameraController.adjustOffset('down'),
o: () => cameraController.round(),
r: () => cameraController.reset(),
'=': () => cameraController.zoom('in'),
'-': () => cameraController.zoom('out'),
'/': () => cameraController.flipHorizontal(),
o: () => cameraController.round(),
}

function isValidControlKey(key: string): key is keyof typeof controls {
Expand Down