Merged
Conversation
joshua-dean
commented
Oct 7, 2024
Comment on lines
-705
to
+660
| var images = [document.getElementById(`${this.config["image_id_pfx"]}__0`)]; | ||
| let mappable_images = []; | ||
| for (let i = 0; i < images.length; i++) { | ||
| mappable_images.push(images[i]); | ||
| break; | ||
| } | ||
| let image_promises = mappable_images.map(ULabel.load_image_promise); | ||
| Promise.all(image_promises).then((loaded_imgs) => { | ||
| let first_bg_img = document.getElementById(`${this.config["image_id_pfx"]}__0`); | ||
| first_bg_img.decode().then(() => { | ||
| // Store image dimensions | ||
| that.config["image_height"] = loaded_imgs[0].naturalHeight; | ||
| that.config["image_width"] = loaded_imgs[0].naturalWidth; | ||
| that.config["image_height"] = first_bg_img.naturalHeight; | ||
| that.config["image_width"] = first_bg_img.naturalWidth; |
Collaborator
Author
There was a problem hiding this comment.
This looked like a really complicated way to get the first background image. Wrapping it in an array, looping over the array, immediately breaking the loop, mapping a questionable function that directly attaches .onload to the element...
I have made it significantly easier to follow
Collaborator
Author
|
|
Co-authored-by: Trevor Burgoyne <82477095+TrevorBurgoyne@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull other static functions
Description
This and #200 should be enough to allow #190 to build correctly.
error_logging.tselvl_are now aLogLevelenum - closeselvl_should be enum #179log_messagethat properly uses existingconsolelog levelsalertandthrowfor certain levels is still presentcanvas_utils.tsdynamically_set_n_annos_per_canvasto not need the whole ULabel objectinitialize_annotation_canvasesafter_initto be instance function instead of staticload_image_promiseand use.decodeinsteadPR Checklist
package.jsonhas been bumped since last releasepackage.jsonandsrc/version.jsnpm installandnpm run buildAFTER bumping the version numberapi_spec.md)changelog.mdBreaking API Changes
no