feat: use notify last action
This commit is contained in:
@@ -72,7 +72,7 @@ const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) =>
|
|||||||
x: coordinates.x,
|
x: coordinates.x,
|
||||||
y: coordinates.y,
|
y: coordinates.y,
|
||||||
});
|
});
|
||||||
setLastAction('move');
|
notifyLastAction('move');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'wheel':
|
case 'wheel':
|
||||||
@@ -82,7 +82,7 @@ const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) =>
|
|||||||
deltaY: Math.round(wheelEvent.deltaY),
|
deltaY: Math.round(wheelEvent.deltaY),
|
||||||
};
|
};
|
||||||
socket.emit('input:wheel', deltas);
|
socket.emit('input:wheel', deltas);
|
||||||
setLastAction('scroll');
|
notifyLastAction('scroll');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('Default mouseEvent registered');
|
console.log('Default mouseEvent registered');
|
||||||
@@ -96,7 +96,7 @@ const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) =>
|
|||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case 'keydown':
|
case 'keydown':
|
||||||
socket.emit('input:keydown', { key: event.key, coordinates: lastMousePosition.current });
|
socket.emit('input:keydown', { key: event.key, coordinates: lastMousePosition.current });
|
||||||
setLastAction(`${event.key} pressed`);
|
notifyLastAction(`${event.key} pressed`);
|
||||||
break;
|
break;
|
||||||
case 'keyup':
|
case 'keyup':
|
||||||
socket.emit('input:keyup', event.key);
|
socket.emit('input:keyup', event.key);
|
||||||
@@ -133,7 +133,7 @@ const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) =>
|
|||||||
height
|
height
|
||||||
);
|
);
|
||||||
socket.emit('input:mousedown', mappedCoordinates);
|
socket.emit('input:mousedown', mappedCoordinates);
|
||||||
setLastAction('click');
|
notifyLastAction('click');
|
||||||
}
|
}
|
||||||
setShowConfirmation(false);
|
setShowConfirmation(false);
|
||||||
setPendingClick(null);
|
setPendingClick(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user