Open sarojregmi200 opened 1 month ago
@sarojregmi200 Could you give the code used to reproduce said issue? What's the width/height you are expecting and what's the real width/height?
I will respond with a Example in a sandbox as soon as possible.
Hey, @Josh-Cena sorry about the delay I completely forgot about it.
I have created a repo with the sample code and here is the live example of the above mentioned issue.
So, let me rephrase the above issue in a more understandable manner. In the documentation for the context api's drawImage method while using
HTMLImageElement
or any otherDOM
media element as it's source. It is not clearly specified that even if the source is aDOMElement
reference the dimensions of the actual media source is taken into account.Due to this missing piece of information I have found myself in 1-2 hrs of debugging state. So, as to save others from suffering the same I believe the documentation should be updated.
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage
What specific section or headline is this issue about?
Parameters section.
What information was incorrect, unhelpful, or incomplete?
The information is incomplete. In the Parameters section of the docs inside the image parameter.
What did you expect to see?
A note saying that the when HTMLImageElement, an SVGImageElement are used the naturalWidth and naturalHeight is taken into account not the height and width set by the browser.
Do you have any supporting links, references, or citations?
No, Need to do some research.
Do you have anything more you want to share?
Steps to reproduce:
What will you observe? You will see that the image appears to be of bigger size that the scaled down one. Which tripped me off, anyways I don't know why that behavior is and would love to research on the topic.
Note: If this issue breaks any rules or is not correct I am open for criticism and would love to know where I fell short.