Merge pull request #20186 from ramonlsouza/cursor-up
fix: only send cursor updates of users with whiteboard access
This commit is contained in:
commit
bacf1e4fcf
@ -343,7 +343,7 @@ const Whiteboard = React.memo(function Whiteboard(props) {
|
||||
const { updated } = changes;
|
||||
const { "pointer:pointer": pointers } = updated;
|
||||
|
||||
if (pointers) {
|
||||
if ((isPresenter || hasWBAccessRef.current) && pointers) {
|
||||
const [prevPointer, nextPointer] = pointers;
|
||||
updateCursorPosition(nextPointer?.x, nextPointer?.y);
|
||||
}
|
||||
|
@ -1,13 +1,16 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
|
||||
const useCursor = (publishCursorUpdate, whiteboardId) => {
|
||||
const [cursorPosition, setCursorPosition] = useState({ x: -1, y: -1 });
|
||||
const [cursorPosition, setCursorPosition] = useState({ x: '', y: '' });
|
||||
|
||||
const updateCursorPosition = (newX, newY) => {
|
||||
setCursorPosition({ x: newX, y: newY });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!cursorPosition || cursorPosition.x === '' || cursorPosition.y === '') {
|
||||
return;
|
||||
}
|
||||
publishCursorUpdate({
|
||||
whiteboardId,
|
||||
xPercent: cursorPosition?.x,
|
||||
|
Loading…
Reference in New Issue
Block a user