Closed wheelerlaw closed 5 years ago
@wheelerlaw I agree, the old 1.0 logic of detecting the size, positioning, and text of a label based on the DOM structure was super handy. I don't have the capacity right now to port it over, but ideally the logic would be:
If the data passed to textWrap
is an HTMLELement
or D3Selection
:
width
, height
, x
, and y
properties<text>
element to determine the text
and any inline font stylesThe old logic for parsing the size can be found here, and the old logic for text is here. These are both used here. The old code is in coffeescript 😒
Consider these either notes for my future self, or guidance for someone to make a PR 🍻
Super! If I have some spare cycles, I could take a stab at it. Perhaps this weekend.
duplicate of #6
The API for
textwrap
was far simpler in the previous iteration of d3plus, as it worked with existing elements whose dimensions were already defined. d3plus 2.0 adds unneeded complexity for wrapping text, and it does not seem to work with existing text elements.This was how simple it was to wrap text using d3plus:
Given how already difficult text wrapping in SVG is, the departure from an API that is as simple as that seems like the wrong direction.
I'm requesting that the old but simpler API be ported into d3plus 2.0.