Describe the bug
Calling WebImage.prototype.setSize(width, height) on a WebImage with the dimensions originalWidth x originalHeight (with width < originalWidth and height < originalHeight) after it loads (such as when using WebImage.prototype.loaded(callback) or setting its size after a second using setTimeout(callback, 1000)) results in the image having the dimensions (width ** 2 / originalWidth) x (height ** 2 / originalHeight) despite the WebImage having the correct dimensions when seen in debug mode. In other words, the image is scaled down twice when it should only be scaled down once.
To Reproduce
Steps to reproduce the behavior:
- Click here: https://codehs.com/sandbox/dashboard/webimageprototypesetsizewidth-height-bug-exhibit
Expected behavior
The WebImage should have the correct size even if its size is set after the image loads.
Desktop:
- OS: Windows 10 Version 22H2 (Build 19045.5487)
- Browser: Google Chrome | 132.0.6834.197 (Official Build) (64-bit) (cohort: Control)
- JavaScript: V8 13.2.152.36