Skip to content

Commit

Permalink
fix(frontend/presenter): constrain zoom hotkeys to option range
Browse files Browse the repository at this point in the history
  • Loading branch information
Harjot1Singh committed Oct 23, 2020
1 parent 0e104dc commit a2b2431
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/frontend/src/Presenter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
import { GLOBAL_SHORTCUTS } from '../lib/keyMap'
import { SettingsContext } from '../lib/contexts'
import { useCurrentLines } from '../lib/hooks'
import { OPTIONS } from '../lib/options'

import ThemeLoader from '../shared/ThemeLoader'
import Loader from '../shared/Loader'
Expand Down Expand Up @@ -110,9 +111,10 @@ const Presenter = () => {
search: queryString.stringify( { [ STATES.controllerOnly ]: true } ),
} )

const { controllerZoom } = OPTIONS
const setZoom = controllerZoom => controller.setSettings( { layout: { controllerZoom } } )
const zoomInController = () => setZoom( zoom + 0.1 )
const zoomOutController = () => setZoom( zoom - 0.1 )
const zoomInController = () => setZoom( Math.min( controllerZoom.max, zoom + 0.1 ) )
const zoomOutController = () => setZoom( Math.max( controllerZoom.min, zoom - 0.1 ) )
const zoomResetController = () => setZoom( 1 )

/**
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/lib/keyMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const GLOBAL_SHORTCUTS = decorateGroup( {
},
zoomInController: {
name: 'Zoom Controller In',
sequences: [ 'ctrl++' ],
sequences: [ 'ctrl++', 'ctrl+shift+=' ],
required: true,
},
zoomOutController: {
Expand Down

0 comments on commit a2b2431

Please sign in to comment.