-
Notifications
You must be signed in to change notification settings - Fork 429
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
[imagetool] Scale down large images before passing to ImageTool #567
Conversation
ac824ca
to
a6c7f05
Compare
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
|
||
export default class ImageLoader extends React.Component { |
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.
Incorrect class name
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.
Good catch, thanks!
children: PropTypes.func.isRequired | ||
} | ||
|
||
getCanvas() { |
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.
Won't this leak a new canvas into the document for every Resize
instance?
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.
Whoops, I had implemented a cWU that removed it, but it got missing in action obviously. Added it back now. Thanks!
* [imagetool] Scale down large images before passing to ImageTool * [imagetool] Remove canvas element on cWU * [imagetool] Fix incorrect class name
This will scale down large images before passing on to the ImageTool component. It's a defensive fix to ensure the imagetool works even if you give it a huge image.
This is just an internal refactoring, the public API stays the same.
It is also a good idea to scale down the images before fetching from the CDN, but that's a separate task.