Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text with underline line in Raphael JS

I want to make a simple thinge. Just a text with underline line like tag in html. How can i do it in Raphael JS?

like image 765
Neir0 Avatar asked Dec 28 '22 17:12

Neir0


1 Answers

Here is a function that should do what you're after:

function underlineText(textElement) {
    var textBBox = textElement.getBBox();
var textUnderline = canvas.path("M"+textBBox.x+" "+(textBBox.y+textBBox.height)+"L"+(textBBox.x+textBBox.width)+" "+(textBBox.y+textBBox.height));  
}

var textElement = canvas.text(100,100,"hello world");
underlineText(textElement);
like image 79
Donovan Avatar answered Jan 09 '23 01:01

Donovan