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

Refactor/buffer canvas #133

Merged
merged 22 commits into from
Mar 13, 2024
Merged

Refactor/buffer canvas #133

merged 22 commits into from
Mar 13, 2024

Conversation

TrevorBurgoyne
Copy link
Member

@TrevorBurgoyne TrevorBurgoyne commented Mar 12, 2024

Refactor/buffer canvas

Description

Refactor how spatial annotations are drawn and redrawn.

Previously, spatial annotations were all drawn on the front canvas for the active subtask. When an annotation was modified in any way, the only sure way to render that change was to completely clear the canvas of ALL annotations and then redraw ALL annotations. This inevitably leads to redrawing way more than what was theoretically necessary, and was a cause of considerable lag on annotation jobs with a large number of annotations.

This method of erasing the entire canvas and redrawing everything seems to be the state-of-the-art way to handle changes to the canvas, since erasing only specific annotations is not well supported at all.

This PR works around these quirks of canvases by creating a separate canvas for each spatial annotation. This way, when a given annotation is modified, we only have to erase that annotation's canvas, while leaving all other annotations unchanged. This greatly reduces the time spent redrawing, and provides a smoother experience in the case of many complex annotations.

Non-spatial annotations are left unchanged: they still are all drawn on the front canvas.

Additional minor changes:

  • Improvement to handling resume_from errors that arise from poorly formatted polygons.

PR Checklist

  • Merged latest main
  • Version number in package.json has been bumped since last release
  • Version numbers match between package package.json and src/version.js
  • Ran npm install and npm run build AFTER bumping the version number
  • Updated documentation if necessary (currently just in api_spec.md)
  • Added changes to changelog.md

Breaking API Changes

No

@TrevorBurgoyne TrevorBurgoyne added the refactor The code should be better label Mar 12, 2024
@TrevorBurgoyne TrevorBurgoyne marked this pull request as ready for review March 12, 2024 22:09
Base automatically changed from feature/delete-tool to main March 13, 2024 16:20
@TrevorBurgoyne TrevorBurgoyne merged commit 73aa008 into main Mar 13, 2024
@TrevorBurgoyne TrevorBurgoyne deleted the refactor/buffer-canvas branch March 13, 2024 16:24
@TrevorBurgoyne TrevorBurgoyne mentioned this pull request May 24, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor The code should be better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant