Skip to content

Change selected node styles  #385

Open

Description

@nassif7

I have groups of nodes, and i am using shape: icon
i was trying to update the selected node, size, color, shadow and few more things.

i found this example which is really helpful
https://github.com/almende/vis/blob/master/examples/network/other/chosen.html

but in the example, when i am trying to change the node size it doesn't work as long as i am using the shape: icon

color: "#97C2FC"
borderWidth: 20
borderColor: "#2B7CE9"
size: 100
borderDashes: false
borderRadius: 6
shadow: true
shadowColor: "rgba(0,0,0,0.5)"
shadowSize: 50
shadowX: 0
shadowY: 0

the values.size is updated but it doesn't really reflect on the network itself.

I wonder if there is any other way to be able to update a node.
I tried nodes.updateOnly(id, props)
it works well, but this cause the network to be updated whenever i select a node.
and this makes my network to be destroyed and recreated and i don't expect this behaviour

Activity

  1. Thomaash commented on Jan 27, 2020

    @Thomaash
    Member

    Hi @nassif7,

    looking through the code the icon shape ignores the size and uses it's own icon.size. I don't know why this is and it indeed seems really weird. According to blame it has been this way for the past five years so changing this would likely break a lot of projects.

    What if size was used unless icon.size is set and if icon.size is set it would override size. Would it be an acceptable solution?

  2. nassif7 commented on Feb 3, 2020

    @nassif7
    Author

    Hi @Thomaash

    yes, that would work fine, i think for my understanding, the node size should always have the priority here.
    but the solution you proposed looks very acceptable as well.
    in this case i would remove the icon.size and use the size property.
    that would work perfectly for me

    thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions