SunnyXu / SBMLDiagrams

MIT License
5 stars 1 forks source link

Moving node text is difficult #73

Closed hsauro closed 2 years ago

hsauro commented 2 years ago

I noticed that if I wanted to move some text in a node it is quite tedious to do so. eg

image

If I wanted to move x_5 up, I would first have to get the coordinates of the text then move it from there. It would be better to have a method that could move node text relative to the node. eg

la.moveNodeTextPosition("x_5", [-10, +50])

This would move the text by -10,+50

hsauro commented 2 years ago

Here is a method I made that moves a node text a relative distance. Incorporate something like this into SBMLDiagrams but obviously without the la argument.

def moveNodeTextPosition (la, id, coord): pt = la.getNodePosition (id)[0] pt.x = pt.x + coord.x pt.y = pt.y + coord.y la.setNodeTextPosition("x_5", pt)

hsauro commented 2 years ago

The code above doesn't quite work because it doesn't move the text.

SunnyXu commented 2 years ago

add a new function moveNodeTextPosition (https://sys-bio.github.io/SBMLDiagrams/Node.html#SBMLDiagrams.load.moveNodeTextPosition).