-
Notifications
You must be signed in to change notification settings - Fork 597
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
fix: setViewport can cause a crash if voi or scale are not provided #493
fix: setViewport can cause a crash if voi or scale are not provided #493
Conversation
@@ -35,12 +35,12 @@ export default function (element, viewport) { | |||
// Prevent window width from being too small (note that values close to zero are valid and can occur with | |||
// PET images in particular) | |||
if (enabledElement.viewport.voi.windowWidth) { | |||
enabledElement.viewport.voi.windowWidth = Math.max(viewport.voi.windowWidth, MIN_WINDOW_WIDTH); | |||
enabledElement.viewport.voi.windowWidth = Math.max(enabledElement.viewport.voi.windowWidth, MIN_WINDOW_WIDTH); |
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.
viewport.voi.windowWidth
and enabledElement.viewport.voi.windowWidth
should be equal given the merge on lines 26-32.
} | ||
|
||
// Prevent scale from getting too small | ||
if (enabledElement.viewport.scale) { | ||
enabledElement.viewport.scale = Math.max(viewport.scale, MIN_VIEWPORT_SCALE); | ||
enabledElement.viewport.scale = Math.max(enabledElement.viewport.scale, MIN_VIEWPORT_SCALE); |
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.
Same goes for viewport.scale
and enabledElement.viewport.scale
.
🎉 This PR is included in version 2.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR fixes an issue where
setViewport
can cause a crash if not providedvoi
orscale
.