Closed vadimshvetsov closed 2 years ago
yarn run pretty
At NodeModel and PortModel method setPosition currently doesn't work properly if we pass only Point as a first argument.
NodeModel
PortModel
setPosition
Because NodeModel.setPosition for instance sets position to it's ports with this code:
NodeModel.setPosition
https://github.com/projectstorm/react-diagrams/blob/dd68d1fe671925ba81d8e9e80ae6b3467e2d5c30/packages/react-diagrams-core/src/entities/node/NodeModel.ts#L42-L52
x can be PointModel and y we could never have, that's why ports never get correct position
x
y
We should use this.position.x and this.position.y for getting correct position for ports and points.
this.position.x
this.position.y
Checklist
yarn run pretty
What?
At
NodeModel
andPortModel
methodsetPosition
currently doesn't work properly if we pass only Point as a first argument.Why?
Because
NodeModel.setPosition
for instance sets position to it's ports with this code:https://github.com/projectstorm/react-diagrams/blob/dd68d1fe671925ba81d8e9e80ae6b3467e2d5c30/packages/react-diagrams-core/src/entities/node/NodeModel.ts#L42-L52
x
can be PointModel andy
we could never have, that's why ports never get correct positionHow?
We should use
this.position.x
andthis.position.y
for getting correct position for ports and points.Feel good image: