-
Notifications
You must be signed in to change notification settings - Fork 5
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
Pull other static functions #201
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>
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.ts
elvl_
are now aLogLevel
enum - closeselvl_
should be enum #179log_message
that properly uses existingconsole
log levelsalert
andthrow
for certain levels is still presentcanvas_utils.ts
dynamically_set_n_annos_per_canvas
to not need the whole ULabel objectinitialize_annotation_canvases
after_init
to be instance function instead of staticload_image_promise
and use.decode
insteadPR Checklist
package.json
has been bumped since last releasepackage.json
andsrc/version.js
npm install
andnpm run build
AFTER bumping the version numberapi_spec.md
)changelog.md
Breaking API Changes
no