javascript - KineticJS actual text height -
i'm having problem getting actual text height of text object.
var btntext = new kinetic.text({ x: xtracker, y: headery, fill: '#a2b1c3', text: buttontext, width: buttonwidth, fontsize: 40, fontfamily: 'impact', align: 'center' });
all of following methods return same number, 40, not actual height of text.
btntext.getheight(); btntext.gettextheight(); btntext._gettextsize().height;
for debugging purposes, added following rect show text region
var tmp = new kinetic.rect({ x: btntext.getposition().x, y: btntext.getposition().y, fill: 'rgba(0,0,0,0.3)', width: btntext.getwidth(), height: btntext.getheight() });
here result:
you can see gray box (i.e. text region) larger actual text. need actual text size within region.
can use:
var metrics = context.measuretext(label);
Comments
Post a Comment