d3-flame-graph icon indicating copy to clipboard operation
d3-flame-graph copied to clipboard

simplify copying nodes

Open wonder-mice opened this issue 7 years ago • 5 comments

It's very hard to select node's text to copy it in clipboard. Either node is clicked or several nodes are selected. It would be nice to be able to copy-paste interesting nodes to share them via messenger or email.

wonder-mice avatar Sep 20 '18 04:09 wonder-mice

Oh, sorry, didn't see you renamed the title (renamed it back), thought it was me who come up with this title and decided to make it more clear %)

wonder-mice avatar Sep 20 '18 17:09 wonder-mice

Might try to tie this to https://github.com/spiermar/d3-flame-graph/issues/93. Can create a right click handler and default it to copy the node name.

spiermar avatar Sep 20 '18 18:09 spiermar

It's up to you of course, but as a single data point I hate when pages redefine right click in any way.

To through in some possible alternatives:

  • Make it possible to mouse over tooltip and select there (tooltip can have some extra info as well, so making it selectable sounds appealing)?
  • Make it draggable (so I can drag and drop it in mail/text editor)? Not sure how browser will handle so many draggable objects though and how it'll impact performance...
  • I have no idea how click/selection disambiguation works in web browsers, but questions like this imply that it's a common problem and maybe there ways to disambiguate cleanly?
  • Last resort could be that I have a label at the bottom with last clicked item, so I can select it there.

wonder-mice avatar Sep 20 '18 18:09 wonder-mice

The last option is fairly simple to implement right now. The click handler can be changed to zoom and set the text of another element, or copy. The example page right now prints the name to the console. The tooltips are attached to mouseout and mouseover events on each rect. I don't have a better idea right now on how to change this behavior and allow for mouse over the tooltip. Changing the cursor and blocking zoom on select might be possible, I just need to check how browsers will behave with those options in an svg.

spiermar avatar Sep 20 '18 18:09 spiermar

Possibly related to #21 and #94

spiermar avatar Sep 20 '18 20:09 spiermar