Skip to content

Commit

Permalink
fix(ui): wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
Molmin committed Jun 10, 2024
1 parent bda2e1e commit 167dcf7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/component/game_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class GameTable {

handleWheelEvent(deltaY: number) {
if (Math.abs(deltaY) < 1) return
this.nowSize += (Math.abs(deltaY) / deltaY) * Math.log(Math.abs(deltaY))
this.nowSize -= (Math.abs(deltaY) / deltaY) * Math.log(Math.abs(deltaY))
this.nowSize = Math.min(Math.max(this.nowSize, 16), 100)
this.updateTableStyle()
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ export class GeneralsGame {
}

handleKeydown(ev: JQuery.KeyDownEvent) {
if (ev.code === 'Digit9') return this.game_table.handleWheelEvent(-20)
if (ev.code === 'Digit0') return this.game_table.handleWheelEvent(20)
if (ev.code === 'Digit9') return this.game_table.handleWheelEvent(20)
if (ev.code === 'Digit0') return this.game_table.handleWheelEvent(-20)
if (ev.code === 'Digit1') return this.game_table.updateSize(35)
if (ev.code === 'Digit2') return this.game_table.updateSize(38)
if (ev.code === 'Digit3') return this.game_table.updateSize(42)
Expand Down

0 comments on commit 167dcf7

Please sign in to comment.