handle active pan state via shortcut
This commit is contained in:
parent
48157ae49b
commit
f1ba37fc2f
@ -4,6 +4,7 @@ import WhiteboardOverlayContainer from '/imports/ui/components/whiteboard/whiteb
|
||||
import WhiteboardContainer from '/imports/ui/components/whiteboard/container';
|
||||
import WhiteboardToolbarContainer from '/imports/ui/components/whiteboard/whiteboard-toolbar/container';
|
||||
import { HUNDRED_PERCENT, MAX_PERCENT } from '/imports/utils/slideCalcUtils';
|
||||
import { SPACE } from '/imports/utils/keyCodes';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import { toast } from 'react-toastify';
|
||||
import { Session } from 'meteor/session';
|
||||
@ -95,6 +96,7 @@ class Presentation extends PureComponent {
|
||||
this.renderPresentationMenu = this.renderPresentationMenu.bind(this);
|
||||
this.setIsZoomed = this.setIsZoomed.bind(this);
|
||||
this.setIsPanning = this.setIsPanning.bind(this);
|
||||
this.handlePanShortcut = this.handlePanShortcut.bind(this);
|
||||
|
||||
this.onResize = () => setTimeout(this.handleResize.bind(this), 0);
|
||||
this.renderCurrentPresentationToast = this.renderCurrentPresentationToast.bind(this);
|
||||
@ -126,8 +128,21 @@ class Presentation extends PureComponent {
|
||||
return stateChange;
|
||||
}
|
||||
|
||||
handlePanShortcut(e) {
|
||||
if (e.keyCode === SPACE) {
|
||||
switch(e.type) {
|
||||
case 'keyup':
|
||||
return this.state.isPanning && this.setIsPanning();
|
||||
case 'keydown':
|
||||
return !this.state.isPanning && this.setIsPanning();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getInitialPresentationSizes();
|
||||
this.refPresentationContainer.addEventListener('keydown', this.handlePanShortcut);
|
||||
this.refPresentationContainer.addEventListener('keyup', this.handlePanShortcut);
|
||||
this.refPresentationContainer
|
||||
.addEventListener(FULLSCREEN_CHANGE_EVENT, this.onFullscreenChange);
|
||||
window.addEventListener('resize', this.onResize, false);
|
||||
@ -284,6 +299,8 @@ class Presentation extends PureComponent {
|
||||
window.removeEventListener('resize', this.onResize, false);
|
||||
this.refPresentationContainer
|
||||
.removeEventListener(FULLSCREEN_CHANGE_EVENT, this.onFullscreenChange);
|
||||
this.refPresentationContainer.removeEventListener('keydown', this.handlePanShortcut);
|
||||
this.refPresentationContainer.removeEventListener('keyup', this.handlePanShortcut);
|
||||
|
||||
if (fullscreenContext) {
|
||||
layoutContextDispatch({
|
||||
|
Loading…
Reference in New Issue
Block a user