Fix cursor chat bubble position. (#3042)
This PR fixes the position of the cursor chat bubble when the canvas is not positioned at the top left. ### Change Type - [x] `internal` ### Test Plan 1. Using CSS, add a margin left to the tldraw component on a multiplayer route. 2. Use cursor chat. ### Release Notes - Fixed a bug where cursor chat bubble position could be wrong when a sidebar was open. --------- Co-authored-by: Lu Wilson <l2wilson94@gmail.com>
This commit is contained in:
parent
3c95ec1013
commit
08a2b59238
1 changed files with 5 additions and 3 deletions
|
@ -58,7 +58,11 @@ function usePositionBubble(ref: RefObject<HTMLInputElement>) {
|
|||
|
||||
// Positioning the chat bubble
|
||||
function positionChatBubble(e: PointerEvent) {
|
||||
ref.current?.style.setProperty('transform', `translate(${e.clientX}px, ${e.clientY}px)`)
|
||||
const { minX, minY } = editor.getViewportScreenBounds()
|
||||
ref.current?.style.setProperty(
|
||||
'transform',
|
||||
`translate(${e.clientX - minX}px, ${e.clientY - minY}px)`
|
||||
)
|
||||
}
|
||||
|
||||
window.addEventListener('pointermove', positionChatBubble)
|
||||
|
@ -185,8 +189,6 @@ const CursorChatInput = track(function CursorChatInput({
|
|||
)
|
||||
|
||||
const handlePaste = useCallback((e: ClipboardEvent) => {
|
||||
// todo: figure out what's an acceptable / sanitized paste
|
||||
preventDefault(e)
|
||||
e.stopPropagation()
|
||||
}, [])
|
||||
|
||||
|
|
Loading…
Reference in a new issue