fix: always correctly position the child vertex of an edge (#307)

The position was incorrect for child using relative geometry.
Introduce a new const to avoid overriding other const with the
same name defined before.
This side effect had been introduced during the migration from mxGraph.
development
jkarkoszka 2024-01-18 07:41:21 +01:00 committed by GitHub
parent 835bfe7ce9
commit a68c94e892
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -897,11 +897,11 @@ export class GraphView extends EventSource {
if (geo.relative && pState) {
if (pState.cell.isEdge()) {
const origin = this.getPoint(pState, geo);
const point = this.getPoint(pState, geo);
if (origin) {
origin.x += origin.x / this.scale - pState.origin.x - this.translate.x;
origin.y += origin.y / this.scale - pState.origin.y - this.translate.y;
if (point) {
origin.x += point.x / this.scale - pState.origin.x - this.translate.x;
origin.y += point.y / this.scale - pState.origin.y - this.translate.y;
}
} else {
origin.x += geo.x * pState.unscaledWidth + offset.x;