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
Merged

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

merged 1 commit into from Jul 23, 2021

Conversation

stockiNail
Copy link
Contributor

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
Collaborator

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

@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
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PointStyle as HTMLCanvasElement not documented
4 participants