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

Adds HTMLCanvasElement as possible value for pointStyle option in the documentation #9458

Merged
merged 1 commit into from Jul 23, 2021

Conversation

@stockiNail
Copy link
Contributor

@stockiNail stockiNail commented Jul 22, 2021

Fixes #9457

@stockiNail stockiNail changed the title Adds HTMLCanvasElement as possible value for pointStyle option Adds HTMLCanvasElement as possible value for pointStyle option in the documentation Jul 22, 2021
@LeeLenaleee
Copy link
Contributor

@LeeLenaleee LeeLenaleee commented Jul 22, 2021

Maby instead of specifying the htmlcanvaselement it might be better to place a reference to all the kind attributes the drawImage method accepts since it also accepts videoElements and offscreenCanvasElements for example
Screenshot_20210722-132135.jpg

@stockiNail
Copy link
Contributor Author

@stockiNail stockiNail commented Jul 22, 2021

@LeeLenaleee good point! But please forgive my poor knowledge of javascript.

In helper.canvas.js there is a check about the object type which is passed:

if (style && typeof style === 'object') {
type = style.toString();
if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {
ctx.save();
ctx.translate(x, y);
ctx.rotate(rad);
ctx.drawImage(style, -style.width / 2, -style.height / 2, style.width, style.height);
ctx.restore();
return;
}
}

and I think only HTMLCanvasElement and HTMLImageElement are allowed.

Am I wrong?

@LeeLenaleee
Copy link
Contributor

@LeeLenaleee LeeLenaleee commented Jul 22, 2021

No seems like it's my bad, should have looked up code first, somehow I just thought it would get passed along and just accept anything the drawImage accepts

@kurkle
kurkle approved these changes Jul 23, 2021
@kurkle kurkle merged commit 3311377 into chartjs:master Jul 23, 2021
5 checks passed
5 checks passed
@github-actions
build (ubuntu-latest)
Details
@github-actions
build
Details
@github-actions
build (windows-latest)
Details
@github-actions
finish
Details
codeclimate All good!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants