Skip to content
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

negative sWidth & sHeight optional arguments for 9-argument syntax does not flip image. #37873

Open
Alfradu opened this issue Jan 30, 2025 · 2 comments
Labels
Content:WebAPI Web API docs goal: accuracy (Experimental label) Issues about inaccurate/incorrect content. help wanted If you know something about this topic, we would love your help!

Comments

@Alfradu
Copy link

Alfradu commented Jan 30, 2025

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage

What specific section or headline is this issue about?

#swidth & #sheight

What information was incorrect, unhelpful, or incomplete?

it is stated under both optional arguments sWidth & sHeight that "A negative value will flip the image.". Using firefox, this does not occur and the image is simply displayed in its original size/transform.

What did you expect to see?

I expected the image to flip when given negative values.

Do you have any supporting links, references, or citations?

row 21 in the Js section has a negative width given but image remains the same as without negative values.

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@Alfradu Alfradu added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jan 30, 2025
@github-actions github-actions bot added the Content:WebAPI Web API docs label Jan 30, 2025
@caugner
Copy link
Contributor

caugner commented Jan 31, 2025

I checked the referenced Playground in Chrome, Firefox, and Safari, and indeed the image is not flipped in any browser.

Looking at the HTML Standard, this seems to be misinterpretation in content, as negative values flip the rectangles, not the image (I think it means that the rectangle "grows" in the other direction):

When w is negative, the rounded rectangle is flipped horizontally, which means that the radius values that normally apply to the left corners are used on the right and vice versa. Similarly, when h is negative, the rounded rect is flipped vertically.

@caugner caugner added the goal: accuracy (Experimental label) Issues about inaccurate/incorrect content. label Jan 31, 2025
@Alfradu
Copy link
Author

Alfradu commented Jan 31, 2025 via email

@Josh-Cena Josh-Cena added help wanted If you know something about this topic, we would love your help! and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs goal: accuracy (Experimental label) Issues about inaccurate/incorrect content. help wanted If you know something about this topic, we would love your help!
Projects
None yet
Development

No branches or pull requests

3 participants