Skip to content

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