Skip to content

Commit

Permalink
fix: scope --color-selection retrieval to given instance (excalidra…
Browse files Browse the repository at this point in the history
…w#6886)

Co-authored-by: dwelle <[email protected]>
  • Loading branch information
zsviczian and dwelle authored Aug 16, 2023
1 parent 991f557 commit 1bd4160
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,7 @@ class App extends React.Component<AppProps, AppState> {
}}
/>
<InteractiveCanvas
containerRef={this.excalidrawContainerRef}
canvas={this.interactiveCanvas}
elements={canvasElements}
visibleElements={visibleElements}
Expand Down
10 changes: 7 additions & 3 deletions src/components/canvases/InteractiveCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type {
import type { NonDeletedExcalidrawElement } from "../../element/types";

type InteractiveCanvasProps = {
containerRef: React.RefObject<HTMLDivElement>;
canvas: HTMLCanvasElement | null;
elements: readonly NonDeletedExcalidrawElement[];
visibleElements: readonly NonDeletedExcalidrawElement[];
Expand Down Expand Up @@ -105,9 +106,12 @@ const InteractiveCanvas = (props: InteractiveCanvasProps) => {
cursorButton[socketId] = user.button;
});

const selectionColor = getComputedStyle(
document.querySelector(".excalidraw")!,
).getPropertyValue("--color-selection");
const selectionColor =
(props.containerRef?.current &&
getComputedStyle(props.containerRef.current).getPropertyValue(
"--color-selection",
)) ||
"#6965db";

renderInteractiveScene(
{
Expand Down

0 comments on commit 1bd4160

Please sign in to comment.