2023-03-10 19:30:46 +08:00
|
|
|
import styled, { createGlobalStyle } from 'styled-components';
|
2023-02-24 07:47:34 +08:00
|
|
|
|
2023-12-06 02:15:25 +08:00
|
|
|
const TldrawV2GlobalStyle = createGlobalStyle`
|
|
|
|
${({ isPresenter, hasWBAccess }) => (!isPresenter && hasWBAccess) && `
|
|
|
|
[data-testid="tools.hand"] {
|
2024-05-22 00:03:01 +08:00
|
|
|
display: none !important;
|
2023-03-10 19:30:46 +08:00
|
|
|
}
|
|
|
|
`}
|
2023-12-06 02:15:25 +08:00
|
|
|
|
|
|
|
${({ isMultiUserActive }) => !isMultiUserActive && `
|
|
|
|
.tl-nametag {
|
|
|
|
display: none;
|
2023-03-10 19:30:46 +08:00
|
|
|
}
|
|
|
|
`}
|
2023-12-06 02:15:25 +08:00
|
|
|
|
2024-02-02 20:16:09 +08:00
|
|
|
${({ isToolbarVisible }) => (!isToolbarVisible) && `
|
2024-02-02 20:58:58 +08:00
|
|
|
.tlui-toolbar,
|
2024-04-05 23:14:08 +08:00
|
|
|
.tlui-style-panel__wrapper {
|
2024-02-02 20:16:09 +08:00
|
|
|
visibility: hidden;
|
|
|
|
}
|
2024-02-05 21:05:19 +08:00
|
|
|
#WhiteboardOptionButton {
|
|
|
|
opacity: 0.2;
|
|
|
|
}
|
2024-02-02 20:16:09 +08:00
|
|
|
`}
|
|
|
|
|
2024-03-14 22:27:27 +08:00
|
|
|
#whiteboard-element {
|
2023-12-06 02:15:25 +08:00
|
|
|
position: relative;
|
|
|
|
height: 100%;
|
2023-03-10 19:30:46 +08:00
|
|
|
}
|
2023-12-06 02:15:25 +08:00
|
|
|
|
2024-03-14 22:27:27 +08:00
|
|
|
#whiteboard-element > * {
|
2023-12-06 02:15:25 +08:00
|
|
|
position: relative;
|
|
|
|
height: 100%;
|
2023-03-10 19:30:46 +08:00
|
|
|
}
|
2023-12-06 02:15:25 +08:00
|
|
|
|
2024-03-14 22:27:27 +08:00
|
|
|
#whiteboard-element .tl-overlays {
|
2023-12-06 02:15:25 +08:00
|
|
|
left: 0px;
|
|
|
|
bottom: 0px;
|
2023-03-10 19:30:46 +08:00
|
|
|
}
|
2023-12-06 02:15:25 +08:00
|
|
|
|
|
|
|
.tlui-navigation-zone,
|
|
|
|
.tlui-help-menu,
|
|
|
|
.tlui-debug-panel {
|
2024-03-11 23:24:06 +08:00
|
|
|
display: none !important;
|
2023-03-10 19:30:46 +08:00
|
|
|
}
|
2023-12-06 02:15:25 +08:00
|
|
|
|
|
|
|
.tlui-style-panel__wrapper {
|
|
|
|
right: 0px;
|
|
|
|
top: -0.35rem;
|
|
|
|
position: relative;
|
2023-03-10 19:30:46 +08:00
|
|
|
}
|
2023-04-19 02:03:22 +08:00
|
|
|
|
2023-12-06 02:15:25 +08:00
|
|
|
// Add the following lines to override height and width attributes for .tl-overlays__item
|
|
|
|
.tl-overlays__item {
|
|
|
|
height: auto !important;
|
|
|
|
width: auto !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
${({ isPresenter, isMultiUserActive }) => !isPresenter && !isMultiUserActive && `
|
|
|
|
.tl-cursor use {
|
|
|
|
transform: scale(0.05)!important;
|
2023-04-19 02:03:22 +08:00
|
|
|
}
|
2023-12-06 02:15:25 +08:00
|
|
|
|
|
|
|
.tl-collaborator__cursor {
|
|
|
|
position: absolute !important;
|
|
|
|
left: -7px !important;
|
|
|
|
top: -6px !important;
|
2023-04-19 02:03:22 +08:00
|
|
|
}
|
|
|
|
`}
|
2023-12-06 02:15:25 +08:00
|
|
|
|
2024-04-05 23:14:08 +08:00
|
|
|
.tlui-toolbar__extras {
|
|
|
|
position: fixed !important;
|
|
|
|
top: -2px !important;
|
|
|
|
left: 40px !important;
|
|
|
|
}
|
|
|
|
|
2024-03-26 08:20:04 +08:00
|
|
|
${({ isRTL }) => (!isRTL) && `
|
|
|
|
.tlui-toolbar__extras {
|
|
|
|
position: fixed !important;
|
|
|
|
top: -2px !important;
|
|
|
|
right: 50px !important;
|
|
|
|
}
|
|
|
|
`}
|
|
|
|
|
2023-12-06 02:15:25 +08:00
|
|
|
[data-testid="main.page-menu"],
|
|
|
|
[data-testid="main.menu"],
|
2024-03-26 23:34:43 +08:00
|
|
|
[data-testid="tools.more.laser"],
|
2023-12-06 02:15:25 +08:00
|
|
|
[data-testid="tools.asset"],
|
2024-04-05 23:14:08 +08:00
|
|
|
[data-testid="page-menu.button"],
|
|
|
|
tlui-menu-zone {
|
2024-03-26 23:34:43 +08:00
|
|
|
display: none !important;
|
2023-12-06 02:15:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.tl-collaborator__cursor {
|
|
|
|
height: auto !important;
|
|
|
|
width: auto !important;
|
|
|
|
}
|
2024-04-24 21:53:56 +08:00
|
|
|
|
|
|
|
.tlui-layout__mobile .tlui-button__tool {
|
|
|
|
height: 30px !important;
|
|
|
|
width: 20px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tlui-toolbar__inner {
|
|
|
|
flex-direction: column-reverse !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tlui-toolbar__tools {
|
|
|
|
flex-direction: column !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tlui-toolbar {
|
|
|
|
align-items: end !important;
|
|
|
|
}
|
2024-05-08 08:50:31 +08:00
|
|
|
|
|
|
|
.tlui-layout__bottom {
|
|
|
|
grid-row: auto / auto !important;
|
|
|
|
position: absolute !important;
|
|
|
|
right: 10px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
[data-side="bottom"][data-align="end"][data-state="open"][role="dialog"] {
|
|
|
|
right: 3.5rem !important;
|
|
|
|
bottom: 9.5rem !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
${({ presentationHeight }) => {
|
|
|
|
const minRange = { height: 345, top: 14 };
|
|
|
|
const maxRange = { height: 1200, top: 384 };
|
|
|
|
|
|
|
|
const interpolateTop = (height) => {
|
|
|
|
if (height <= minRange.height) return `${minRange.top}px`;
|
|
|
|
if (height >= maxRange.height) return `${maxRange.top}px`;
|
|
|
|
|
|
|
|
const slope = (maxRange.top - minRange.top) / (maxRange.height - minRange.height);
|
|
|
|
const interpolatedTop = minRange.top + slope * (height - minRange.height);
|
|
|
|
return `${interpolatedTop}px`;
|
|
|
|
};
|
|
|
|
|
|
|
|
const topValue = interpolateTop(presentationHeight);
|
|
|
|
|
|
|
|
let additionalStyles = '';
|
|
|
|
if (presentationHeight <= 332) {
|
|
|
|
additionalStyles += `
|
|
|
|
.tlui-layout__mobile .tlui-button__tool > .tlui-icon {
|
|
|
|
height: 11px !important;
|
|
|
|
width: 11px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tlui-toolbar__tools {
|
|
|
|
flex-direction: row !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tlui-toolbar__inner {
|
|
|
|
flex-direction: row-reverse !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tlui-layout__bottom {
|
|
|
|
grid-row: auto / auto !important;
|
|
|
|
position: relative !important;
|
|
|
|
top: 2px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
[data-side="top"][role="dialog"] {
|
|
|
|
left: 10rem !important;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return `.tlui-layout__bottom { top: ${topValue} !important; }${additionalStyles}`;
|
|
|
|
}}
|
2023-03-10 19:30:46 +08:00
|
|
|
`;
|
|
|
|
|
|
|
|
const EditableWBWrapper = styled.div`
|
|
|
|
&, & > :first-child {
|
|
|
|
cursor: inherit !important;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-02-24 07:47:34 +08:00
|
|
|
export default {
|
2023-12-06 02:15:25 +08:00
|
|
|
TldrawV2GlobalStyle,
|
2023-03-10 19:30:46 +08:00
|
|
|
EditableWBWrapper,
|
2024-03-26 23:34:43 +08:00
|
|
|
};
|