Skip to content

implement top-left positioning for elements based on x and y values #988

Discussion options

You must be logged in to vote

Ah, I see, the 0; 0 isn't relative to an intermediate parent, but to the graph itself.

The solution in that case is very similar, except you can ignore the parent/compartment/layout issues. The Graph always places its children based on their position.x / y attribute.

So you can simply make sure these nodes derive their position.x/y attributes from your underlying model, when creating them from the GModelFactory.

The resulting graph model should look like this (minimal example):

{
  "id": "root",
  "type": "graph",
  "revision": "1",
  "children": [
    {
      "id": "child-id-b901e4",
      "type": "child-node-type",
      "position": {
        "x": 0,
        "y": 0
      }
    }
  ]
}

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Adem-Kri
Comment options

@CamilleLetavernier
Comment options

@Adem-Kri
Comment options

@CamilleLetavernier
Comment options

Answer selected by Adem-Kri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants