Navigation Menu

Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Selected edges do not become bold #2990

Closed
aaronst opened this issue Apr 18, 2017 · 6 comments
Closed

Selected edges do not become bold #2990

aaronst opened this issue Apr 18, 2017 · 6 comments

Comments

@aaronst
Copy link

aaronst commented Apr 18, 2017

When using the dot shape for nodes, selected edges' labels do not become bold. See here for an example: https://jsfiddle.net/vyh3x23n/.

@rasmusblockzero
Copy link

The example is using the chosen function.

I would rephrase the issue as "chosen function doesn't work when set on network.edges but when set on an individual edge".

Or at least that's what my first check reveals.

@eymiha or @mojoaxel this seems to have been introduced (or refactored end of last year becf18e ) Would any of you have any ideas?

@wimrijnders
Copy link
Contributor

wimrijnders commented May 28, 2017

Found it. Unlike the drawing code for node labels, the code from edges labels was missing a conditional recalculation of font attributes due to selection and hover.

In pseudo code, which is perhaps easier to understand:

if select or hover state changed
  redetermine the label font
end
draw the label

Note: This was an issue not just for the dot shape; it was independent of node type.


What will happen now, is that the label will turn bold if:

  • The cursor hovers above it
  • The edge is selected
  • The cursor hovers above one of the nodes connected to the edge
  • A node connected to the edge is selected

This is exactly how the rendering of the edge curve works. If any of these does not hold, the label will return to normal font weight.

I hope this is according to expectations; please advise if it is not.

@aaronst
Copy link
Author

aaronst commented May 30, 2017

@wimrijnders To clarify, the last scenario could be disabled by specifying interaction.selectConnectedEdges = false, correct?

@wimrijnders
Copy link
Contributor

wimrijnders commented May 30, 2017

Good one! Label boldness is not disabled. Will fix it ASAP.

Actually, I'll need to go through all options. Thanks for the tip!

Update: selectConnectedEdges was the only option in interaction which did not work as expected. The fix is forthcoming.

@rasmusblockzero
Copy link

edge.labelHighlightBold would condition this in total I believe
and the edge.chosen option would be specifically juggly as it also can have the sub feature edge.chosen.label
:-)

@wimrijnders
Copy link
Contributor

wimrijnders commented May 31, 2017

@rasmusblockzero Aargh! Need to look at those as well.

Update:

  • I am happy to report that option edge.labelHighlightBold works as intended with the fix
  • Usage of option edge.chosen.label had a small bug, unrelated to the fix in the PR, which I am fixing now.

I think that wraps it up, unless you guys have more curve balls to throw at me 😒.

wimrijnders added a commit to wimrijnders/vis that referenced this issue Jun 2, 2017
Call on issue brought to light by almende#2990.

`ctx` should not be passed as a parameter to the call - not needed and not conform to documentation.
Also cleaned up the calling code to remove the double `fontOptions.chooser()` call.
yotamberk pushed a commit that referenced this issue Jun 3, 2017
Call on issue brought to light by #2990.

`ctx` should not be passed as a parameter to the call - not needed and not conform to documentation.
Also cleaned up the calling code to remove the double `fontOptions.chooser()` call.
primozs pushed a commit to primozs/vis that referenced this issue Jan 3, 2019
Call on issue brought to light by almende#2990.

`ctx` should not be passed as a parameter to the call - not needed and not conform to documentation.
Also cleaned up the calling code to remove the double `fontOptions.chooser()` call.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants