1
0
mirror of https://github.com/excalidraw/excalidraw.git synced 2024-11-10 11:35:52 +01:00

fix: show user state only when passed from host (#3050)

This commit is contained in:
Aakansha Doshi 2021-02-16 15:08:27 +05:30 committed by GitHub
parent 6cafb6bb90
commit 9c0f832a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 17 deletions

@ -20,6 +20,10 @@ Please add the latest change on the top under the correct section.
- Export [`restore`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L182), [`restoreAppState`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L144) and [`restoreElements`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L128) to host - Export [`restore`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L182), [`restoreAppState`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L144) and [`restoreElements`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L128) to host
### Fixes
- Show user state only when [userState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L35) is passed on remote pointers during collaboration [#3050](https://github.com/excalidraw/excalidraw/pull/3050)
## 0.3.1 ## 0.3.1
## Excalidraw API ## Excalidraw API

@ -483,25 +483,20 @@ export const renderScene = (
context.stroke(); context.stroke();
const username = sceneState.remotePointerUsernames[clientId]; const username = sceneState.remotePointerUsernames[clientId];
let usernameAndIdleState;
if (hasEmojiSupport) { let idleState = "";
usernameAndIdleState = `${username ? `${username} ` : ""}${ if (userState === UserIdleState.AWAY) {
userState === UserIdleState.AWAY idleState = hasEmojiSupport ? "⚫️" : ` (${UserIdleState.AWAY})`;
? "⚫️" } else if (userState === UserIdleState.IDLE) {
: userState === UserIdleState.IDLE idleState = hasEmojiSupport ? "💤" : ` (${UserIdleState.IDLE})`;
? "💤" } else if (userState === UserIdleState.ACTIVE) {
: "🟢" idleState = hasEmojiSupport ? "🟢" : "";
}`;
} else {
usernameAndIdleState = `${username ? `${username}` : ""}${
userState === UserIdleState.AWAY
? ` (${UserIdleState.AWAY})`
: userState === UserIdleState.IDLE
? ` (${UserIdleState.IDLE})`
: ""
}`;
} }
const usernameAndIdleState = `${
username ? `${username} ` : ""
}${idleState}`;
if (!isOutOfBounds && usernameAndIdleState) { if (!isOutOfBounds && usernameAndIdleState) {
const offsetX = x + width; const offsetX = x + width;
const offsetY = y + height; const offsetY = y + height;