@flourish/pocket-knife
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "@flourish/pocket-knife", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Flourish module with handy tools", | ||
@@ -5,0 +5,0 @@ "main": "pocket-knife.js", |
@@ -0,1 +1,4 @@ | ||
### 1.1.0 | ||
* Fix truncated line-wrapping | ||
### 1.0.0 | ||
@@ -2,0 +5,0 @@ * Add `getTextDirection` |
@@ -80,3 +80,3 @@ import { color } from "d3-color"; | ||
// if everything fits in one line, so leave as a single string | ||
// if everything fits in one line, leave as a single string | ||
var text_width = ctx.measureText(text).width; | ||
@@ -118,5 +118,5 @@ if (text_width <= max_width) { | ||
var remove_counter = 1; | ||
var truncated_string = string; | ||
var truncated_string = word; | ||
do { | ||
truncated_string = string.substring(0, string.length - remove_counter) + "…"; | ||
truncated_string = word.substring(0, string.length - remove_counter) + "…"; | ||
string_width = ctx.measureText(truncated_string).width; | ||
@@ -123,0 +123,0 @@ } |
9316