Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(annotations): Ensure viewports re-render for annotation drawing #1083

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/tools/src/utilities/triggerAnnotationRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,20 @@ class AnnotationRenderingEngine {
// If there is nothing left that is flagged for rendering, stop here
// and allow RAF to be called again
if (this._needsRender.size === 0) {
this._animationFrameSet = false;
this._animationFrameHandle = null;
return;
break;
}
}
}

this._animationFrameSet = false;
this._animationFrameHandle = null;

// Call render again which will use RAF to call this function asynchronously
// if there is any viewport that needs to be rendered because when
// `triggerRender` is called inside the render loop a listener can flag new
// viewports that need to be rendered and some of the viewports that were
// already rendered can be added back to `_needsRender`.
this._render();
};

private _setAllViewportsToBeRenderedNextFrame() {
Expand Down