We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b254afa commit f8487e4Copy full SHA for f8487e4
src/Truncate.js
@@ -156,7 +156,9 @@ export default class Truncate extends Component {
156
}
157
158
measureWidth(text) {
159
- return this.canvas.measureText(text).width;
+ const targetStyles = window.getComputedStyle(this.refs.target);
160
+ const letterSpacing = parseFloat(targetStyles['letter-spacing']) || 0;
161
+ return this.canvas.measureText(text).width + (letterSpacing * text.length);
162
163
164
ellipsisWidth(node) {
0 commit comments