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

fix the wrong type of setTransform #2322

Merged
merged 2 commits into from
Dec 7, 2023
Merged

fix the wrong type of setTransform #2322

merged 2 commits into from
Dec 7, 2023

Conversation

huankong233
Copy link
Contributor

@huankong233 huankong233 commented Dec 6, 2023

Thanks for contributing!

  • Have you updated CHANGELOG.md?

fix the wrong type of setTransform

@chearon
Copy link
Collaborator

chearon commented Dec 7, 2023

Our implementation doesn't take the raw coordinates yet:

if (info.Length() == 1 && info[0].ToObject().UnwrapTo(&mat)) {

@huankong233
Copy link
Contributor Author

Our implementation doesn't take the raw coordinates yet:

if (info.Length() == 1 && info[0].ToObject().UnwrapTo(&mat)) {

but my code works well with this type 😕
code ↓

    const canvas = createCanvas(800, 250)
    const ctx = canvas.getContext('2d')
    ctx.setTransform(1, 0, -0.4, 1, 0, 0)
    ctx.font = '80px sans-serif'
    ctx.fillStyle = 'red'
    ctx.fillText('testText', 250, 200)
    ctx.resetTransform()
    return canvas.toBuffer('image/png')

image

there is a test file,I thought someone is forget this ?

ctx.setTransform(mat3.a, mat3.b, mat3.c, mat3.d, mat3.e, mat3.f)

Copy link
Collaborator

@chearon chearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aw, you're right. I misread the else path.

@chearon chearon merged commit 2c4d2a7 into Automattic:master Dec 7, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants