-
Notifications
You must be signed in to change notification settings - Fork 5
Pull other static functions #201
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
Conversation
| 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
|
Co-authored-by: Trevor Burgoyne <82477095+TrevorBurgoyne@users.noreply.github.com>
TrevorBurgoyne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet
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