Merge pull request #15278 from KDSBrowne/2.6-disable-hover-slidebg

Disable Background Slide Image Hover Highlight
This commit is contained in:
Ramón Souza 2022-06-29 14:31:30 +01:00 committed by GitHub
commit ffb41cb90f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,9 +231,32 @@ export default function Whiteboard(props) {
// until we handle saving of assets in akka. // until we handle saving of assets in akka.
disableAssets={true} disableAssets={true}
onMount={(app) => { onMount={(app) => {
if (!hasWBAccess && !isPresenter) app.onPan = () => {};
setTLDrawAPI(app); setTLDrawAPI(app);
props.setTldrawAPI(app); props.setTldrawAPI(app);
// disable for non presenter that doesn't have multi user access
if (!hasWBAccess && !isPresenter) {
app.onPan = () => {};
app.setSelectedIds = () => {};
app.setHoveredId = () => {};
} else {
// disable hover highlight for background slide shape
app.setHoveredId = (id) => {
if (id.includes('slide-background')) return null;
app.patchState(
{
document: {
pageStates: {
[app.getPage()?.id]: {
hoveredId: id,
},
},
},
},
`set_hovered_id`
);
};
}
if (curPageId) { if (curPageId) {
app.changePage(curPageId); app.changePage(curPageId);
if (slidePosition.zoom === 0) { if (slidePosition.zoom === 0) {