question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How should we add fillText properly?

See original GitHub issue

I’m trying to configure some fillText on the canvas, but I’m getting some undesired behavior.

Things I’ve tried thus far:

Initializing my progress ring, and directly after setting the fillText.

$('#ring').circleProgress({ ..... });
$("canvas")[0].getContext("2d").fillText("Test", 50, 50);

This approach results in no text being displayed.

Attaching a listener to circle-inited, and setting the text there.

$("#ring").on("circle-inited", function() {
   $("canvas")[0].getContext("2d").fillText("Test", 50, 50);
});
$('#ring').circleProgress({ ..... });

I also tried attaching to circle-animation-end just to see if that would make a difference, but no dice.

The only thing that seems to work is attaching to circle-animation-progress, but that obviously isn’t the approach I want to take.

I have console outputs to verify that my event listeners are getting called. Is there something else I should be doing to get this working properly?

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kottenatorcommented, Jul 17, 2017

I hope I’ve helped you. I’m closing this ticket, but feel free to reopen.

0reactions
mweissptcommented, Jul 14, 2017

Well I said that because it was working, but drawing multiple strings. Your way provides the proper way to use that route, so it’s certainly viable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML canvas fillText() Method - W3Schools
The fillText() method draws filled text on the canvas. The default color of the text is black. Tip: Use the font property to...
Read more >
CanvasRenderingContext2D.fillText() - Web APIs | MDN
With that in hand, we set the font to 50-pixel-tall "serif" (the user's default serif font), then call fillText() to draw the text...
Read more >
Getting Started with the HTML5 Canvas — Part 5 - Brenda Keller
The fillText() method adds solid-colored text to a drawing. The strokeText() method adds text as an outline with no fill. You can also...
Read more >
how can render html tags in html5 canvas filltext() method?
The fillText() method can only take plain text and doesn't parse any tags within it. If your text is as simple as here...
Read more >
fillText method (Internet Explorer) - Microsoft Learn
This method can return one of these values. Return code, Description. S_OK. The operation completed successfully. W3CException_DOM_SECURITY_ERR.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found