Skip to content

Positioning starting node in the middle of canvas #44

Closed Answered by siarheihuzarevich
doritones asked this question in Q&A
Discussion options

You must be logged in to vote

@doritones
I added a method to the CanvasComponent called centerGroupOrNode. You can read more on this page FCanvasComponent Documentation.
If you need to set the correct position before the first render, here is the code on how to calculate the required position of the canvas:

canvasPosition = PointExtensions.initialize(
  (flow.width - node.width) / 2 - nodePosition.x * canvasScale,
  (flow.height - node.height) / 2 - nodePosition.y * canvasScale
);

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@siarheihuzarevich
Comment options

@doritones
Comment options

Comment options

You must be logged in to vote
1 reply
@doritones
Comment options

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