Skip to content

Commit

Permalink
fixes custom textwrap split logic... again (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Apr 19, 2016
1 parent 6417f75 commit 54d8a61
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions d3plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -19748,7 +19748,7 @@ wrap = function(vars) {
var firstChar;
if (vars.text.phrases.length) {
vars.text.current = vars.text.phrases.shift() + "";
vars.text.words = vars.text.current.match(vars.text["break"]);
vars.text.words = vars.text.current.match(vars.text.split["break"]);
firstChar = vars.text.current.charAt(0);
if (firstChar !== vars.text.words[0].charAt(0)) {
vars.text.words[0] = firstChar + vars.text.words[0];
Expand Down Expand Up @@ -19976,7 +19976,7 @@ module.exports = {
init: function(vars) {
var s;
s = this.split.value;
this["break"] = new RegExp("[^\\s\\" + s.join("\\") + "]+\\" + s.join("?\\") + "?", "g");
this.split["break"] = new RegExp("[^\\s\\" + s.join("\\") + "]+\\" + s.join("?\\") + "?", "g");
return false;
},
split: {
Expand Down Expand Up @@ -26188,7 +26188,7 @@ module.exports = function(params) {
var depth = "depth" in params ? params.depth : dataDepth,
title = params.title || fetchText(vars,d,depth)[0],
icon = uniques(d, vars.icon.value, fetchValue, vars, vars.id.nesting[depth]),
tooltip_data = fetchData(vars,d,length,ex,children,depth)
tooltip_data = params.titleOnly ? [] : fetchData(vars,d,length,ex,children,depth);

if (icon.length === 1 && typeof icon[0] === "string") {
icon = icon[0];
Expand Down Expand Up @@ -27063,6 +27063,7 @@ module.exports = function(vars) {

pattern_enter.append("rect")
.attr("fill",color)
.attr("stroke", "none")
.attr("width",square_size)
.attr("height",square_size);

Expand Down Expand Up @@ -27242,6 +27243,7 @@ module.exports = function(vars) {
"y": y,
"mouseevents": this,
"title": title,
"titleOnly": !vars.legend.data.value,
"offset": square_size*0.4
});

Expand Down Expand Up @@ -29651,6 +29653,10 @@ family = require("../../core/methods/font/family.coffee");
module.exports = {
accepted: [Boolean],
align: "middle",
data: {
accepted: [Boolean],
value: true
},
filters: {
accepted: [Boolean],
value: false
Expand Down
2 changes: 1 addition & 1 deletion src/textwrap/helpers/wrap.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ wrap = (vars) ->
if vars.text.phrases.length

vars.text.current = vars.text.phrases.shift() + ""
vars.text.words = vars.text.current.match vars.text.break
vars.text.words = vars.text.current.match vars.text.split.break

firstChar = vars.text.current.charAt(0)
if firstChar isnt vars.text.words[0].charAt(0)
Expand Down
2 changes: 1 addition & 1 deletion src/textwrap/methods/text.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports =
value: false
init: (vars) ->
s = @split.value
@break = new RegExp "[^\\s\\" + s.join("\\") + "]+\\" + s.join("?\\") + "?", "g"
@split.break = new RegExp "[^\\s\\" + s.join("\\") + "]+\\" + s.join("?\\") + "?", "g"
false
split:
accepted: [Array]
Expand Down

0 comments on commit 54d8a61

Please sign in to comment.