Merge pull request #15121 from KDSBrowne/2.6-lock-cursor
Restore Viewer Cursors Lock Functionality
This commit is contained in:
commit
bb29cd1d68
@ -858,6 +858,7 @@ class Presentation extends PureComponent {
|
||||
layoutSwapped,
|
||||
podId,
|
||||
intl,
|
||||
isViewersCursorLocked,
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
@ -942,6 +943,7 @@ class Presentation extends PureComponent {
|
||||
svgUri={currentSlide?.svgUri}
|
||||
intl={intl}
|
||||
presentationBounds={presentationBounds}
|
||||
isViewersCursorLocked={isViewersCursorLocked}
|
||||
/>
|
||||
{isFullscreen && <PollingContainer />}
|
||||
{this.renderPresentationToolbar()}
|
||||
@ -975,7 +977,9 @@ class Presentation extends PureComponent {
|
||||
: null}
|
||||
</Styled.SvgContainer>
|
||||
</Styled.Presentation> */}
|
||||
</Styled.PresentationContainer></>
|
||||
</Styled.PresentationContainer>
|
||||
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import {
|
||||
layoutSelectOutput,
|
||||
layoutDispatch,
|
||||
} from '../layout/context';
|
||||
import lockContextContainer from "/imports/ui/components/lock-viewers/context/container";
|
||||
import WhiteboardService from '/imports/ui/components/whiteboard/service';
|
||||
import { DEVICE_TYPE } from '../layout/enums';
|
||||
|
||||
@ -64,9 +65,11 @@ const APP_CONFIG = Meteor.settings.public.app;
|
||||
const PRELOAD_NEXT_SLIDE = APP_CONFIG.preloadNextSlides;
|
||||
const fetchedpresentation = {};
|
||||
|
||||
export default withTracker(({ podId, presentationIsOpen }) => {
|
||||
export default lockContextContainer(
|
||||
withTracker(({ podId, presentationIsOpen, userLocks }) => {
|
||||
const currentSlide = PresentationService.getCurrentSlide(podId);
|
||||
const presentationIsDownloadable = PresentationService.isPresentationDownloadable(podId);
|
||||
const isViewersCursorLocked = userLocks?.hideViewersCursor;
|
||||
|
||||
let slidePosition;
|
||||
if (currentSlide) {
|
||||
@ -134,5 +137,6 @@ export default withTracker(({ podId, presentationIsOpen }) => {
|
||||
addWhiteboardGlobalAccess: WhiteboardService.addGlobalAccess,
|
||||
removeWhiteboardGlobalAccess: WhiteboardService.removeGlobalAccess,
|
||||
multiUserSize: WhiteboardService.getMultiUserSize(currentSlide?.id),
|
||||
isViewersCursorLocked,
|
||||
};
|
||||
})(PresentationContainer);
|
||||
})(PresentationContainer));
|
||||
|
@ -45,7 +45,8 @@ export default function Whiteboard(props) {
|
||||
slidePosition,
|
||||
curPageId,
|
||||
svgUri,
|
||||
presentationBounds
|
||||
presentationBounds,
|
||||
isViewersCursorLocked,
|
||||
} = props;
|
||||
|
||||
const { pages, pageStates } = initDefaultPages(curPres?.pages.length || 1);
|
||||
@ -218,6 +219,7 @@ export default function Whiteboard(props) {
|
||||
tldrawAPI={tldrawAPI}
|
||||
currentUser={currentUser}
|
||||
whiteboardId={whiteboardId}
|
||||
isViewersCursorLocked={isViewersCursorLocked}
|
||||
>
|
||||
<Tldraw
|
||||
key={`wb-${!hasWBAccess && !isPresenter}`}
|
||||
|
@ -118,6 +118,7 @@ export default function Cursors(props) {
|
||||
tldrawAPI,
|
||||
publishCursorUpdate,
|
||||
children,
|
||||
isViewersCursorLocked
|
||||
} = props;
|
||||
React.useEffect(() => {
|
||||
!cursorWrapper.hasOwnProperty("mouseenter") &&
|
||||
@ -127,7 +128,7 @@ export default function Cursors(props) {
|
||||
!cursorWrapper.hasOwnProperty("mouseleave") &&
|
||||
cursorWrapper?.addEventListener("mouseleave", (event) => {
|
||||
publishCursorUpdate({
|
||||
xPercent: null,
|
||||
xPercent: null,
|
||||
yPercent: null,
|
||||
whiteboardId: whiteboardId,
|
||||
});
|
||||
@ -152,6 +153,12 @@ export default function Cursors(props) {
|
||||
</ReactCursorPosition>
|
||||
{otherCursors
|
||||
.filter((c) => c?.xPercent && c?.yPercent)
|
||||
.filter((c) => {
|
||||
if ((isViewersCursorLocked && c?.role !== "VIEWER") || !isViewersCursorLocked || currentUser?.presenter) {
|
||||
return c;
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.map((c) => {
|
||||
return (
|
||||
c &&
|
||||
|
@ -7,11 +7,14 @@ const CursorsContainer = (props) => {
|
||||
return <Cursors {...props}/>
|
||||
};
|
||||
|
||||
export default withTracker(({ currentUser, tldrawAPI, whiteboardId }) => {
|
||||
return {
|
||||
currentUser,
|
||||
publishCursorUpdate: Service.publishCursorUpdate,
|
||||
otherCursors: Service.getCurrentCursors(whiteboardId),
|
||||
tldrawAPI,
|
||||
};
|
||||
})(CursorsContainer);
|
||||
export default
|
||||
withTracker((params) => {
|
||||
return {
|
||||
currentUser: params.currentUser,
|
||||
publishCursorUpdate: Service.publishCursorUpdate,
|
||||
otherCursors: Service.getCurrentCursors(params.whiteboardId),
|
||||
tldrawAPI: params.tldrawAPI,
|
||||
isViewersCursorLocked: params.isViewersCursorLocked,
|
||||
};
|
||||
})(CursorsContainer)
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user