Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created February 2, 2021 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/c38c39657a5c7cf50193b47b5ee7e371 to your computer and use it in GitHub Desktop.
Save jasonLaster/c38c39657a5c7cf50193b47b5ee7e371 to your computer and use it in GitHub Desktop.
diff --git a/src/protocol/graphics.ts b/src/protocol/graphics.ts
index de57eb74..a7fbbdc4 100644
--- a/src/protocol/graphics.ts
+++ b/src/protocol/graphics.ts
@@ -115,8 +115,10 @@ function onMouseEvents(events: MouseEvent[], store: UIStore) {
store.dispatch(actions.setEventsForType(gMouseClickEvents, "mousedown"));
}
+let onCanvasUpdate = details => {};
+
export function setupGraphics(store: UIStore) {
- gStore = store;
+ onCanvasUpdate = details => store.dispatch(actions.setCanvas(details));
ThreadFront.sessionWaiter.promise.then((sessionId: string) => {
client.Graphics.findPaints({}, sessionId);
@@ -355,16 +357,14 @@ export function refreshGraphics() {
}
}
- gStore.dispatch(
- actions.setCanvas({
- scale,
- gDevicePixelRatio,
- width: image.width,
- height: image.height,
- left: offsetLeft,
- top: offsetTop,
- })
- );
+ onCanvasUpdate({
+ scale,
+ gDevicePixelRatio,
+ width: image.width,
+ height: image.height,
+ left: offsetLeft,
+ top: offsetTop,
+ });
// Apply the same transforms to any displayed highlighter.
const highlighterContainer = document.querySelector(".highlighter-container") as HTMLElement;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment