From e75f5f20e74cfa6bd5169ece64705d3a06dde40f Mon Sep 17 00:00:00 2001 From: David Luzar Date: Mon, 25 Jan 2021 10:47:48 +0100 Subject: [PATCH] fix: remote pointers not accounting for offset (#2855) --- src/packages/excalidraw/CHANGELOG.md | 4 ++++ src/renderer/renderScene.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/packages/excalidraw/CHANGELOG.md b/src/packages/excalidraw/CHANGELOG.md index ba90fd51..73bb6655 100644 --- a/src/packages/excalidraw/CHANGELOG.md +++ b/src/packages/excalidraw/CHANGELOG.md @@ -24,6 +24,10 @@ Please add the latest change on the top under the correct section. - Support `Ctrl-Y` shortcut to redo on Windows [#2831](https://github.com/excalidraw/excalidraw/pull/2831). +### Fixes + +- Fix remote pointers not accounting for offset [#2855](https://github.com/excalidraw/excalidraw/pull/2855). + ## 0.2.1 ## Excalidraw API diff --git a/src/renderer/renderScene.ts b/src/renderer/renderScene.ts index 9947300a..5fed9749 100644 --- a/src/renderer/renderScene.ts +++ b/src/renderer/renderScene.ts @@ -418,7 +418,9 @@ export const renderScene = ( // Paint remote pointers for (const clientId in sceneState.remotePointerViewportCoords) { let { x, y } = sceneState.remotePointerViewportCoords[clientId]; - const username = sceneState.remotePointerUsernames[clientId]; + + x -= appState.offsetLeft; + y -= appState.offsetTop; const width = 9; const height = 14; @@ -473,6 +475,8 @@ export const renderScene = ( context.fill(); context.stroke(); + const username = sceneState.remotePointerUsernames[clientId]; + if (!isOutOfBounds && username) { const offsetX = x + width; const offsetY = y + height;