fix keydown event listener not handling arrow press

This commit is contained in:
KDSBrowne 2024-05-16 17:20:20 +00:00
parent d02aeaed9e
commit efea396020

View File

@ -632,7 +632,7 @@ const Whiteboard = React.memo(function Whiteboard(props) {
const handleArrowPress = (event) => { const handleArrowPress = (event) => {
const currPageNum = parseInt(curPageIdRef.current); const currPageNum = parseInt(curPageIdRef.current);
const shapeSelected = tlEditorRef.current.selectedShapes.length > 0; const shapeSelected = tlEditorRef.current.getSelectedShapes()?.length > 0;
const changeSlide = (direction) => { const changeSlide = (direction) => {
if (!currentPresentationPage) return; if (!currentPresentationPage) return;
let newSlideNum = currPageNum + direction; let newSlideNum = currPageNum + direction;
@ -671,7 +671,7 @@ const Whiteboard = React.memo(function Whiteboard(props) {
if ( if (
(undoCondition || redoCondition) && (undoCondition || redoCondition) &&
(isPresenter || hasWBAccessRef.current) (isPresenterRef.current || hasWBAccessRef.current)
) { ) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
@ -687,7 +687,7 @@ const Whiteboard = React.memo(function Whiteboard(props) {
if ( if (
(event.keyCode === KEY_CODES.ARROW_RIGHT || (event.keyCode === KEY_CODES.ARROW_RIGHT ||
event.keyCode === KEY_CODES.ARROW_LEFT) && event.keyCode === KEY_CODES.ARROW_LEFT) &&
isPresenter isPresenterRef.current
) { ) {
handleArrowPress(event); handleArrowPress(event);
} }